[Core] Modulize prepare input and attention metadata builder (#6596)

This commit is contained in:
Cody Yu
2024-07-23 00:45:24 +00:00
committed by GitHub
parent bdf5fd1386
commit e0c15758b8
6 changed files with 409 additions and 298 deletions
+5
View File
@@ -719,6 +719,11 @@ def merge_dicts(dict1: Dict[K, List[T]],
return dict(merged_dict)
def flatten_2d_lists(lists: List[List[T]]) -> List[T]:
"""Flatten a list of lists to a single list."""
return [item for sublist in lists for item in sublist]
def init_cached_hf_modules() -> None:
"""
Lazy initialization of the Hugging Face modules.