[Misc] Streamline unique id generation (#29375)

Signed-off-by: Nick Hill <nhill@redhat.com>
This commit is contained in:
Nick Hill
2025-11-25 00:30:11 -08:00
committed by GitHub
parent 67fc16cd8c
commit db2906108a
3 changed files with 16 additions and 13 deletions

View File

@@ -52,9 +52,11 @@ STR_FLASHINFER_ATTN_VAL: str = "FLASHINFER"
STR_FLASH_ATTN_VAL: str = "FLASH_ATTN"
STR_INVALID_VAL: str = "INVALID"
MASK_64_BITS = (1 << 64) - 1
def random_uuid() -> str:
return str(uuid.uuid4().hex)
return f"{uuid.uuid4().int & MASK_64_BITS:016x}" # 16 hex chars
def length_from_prompt_token_ids_or_embeds(