MCPcopy
hub / github.com/city96/ComfyUI-GGUF / get_list_field

Function get_list_field

loader.py:40–49  ·  view source on GitHub ↗
(reader, field_name, field_type)

Source from the content-addressed store, hash-verified

38 raise TypeError(f"Unknown field type {field_type}")
39
40def get_list_field(reader, field_name, field_type):
41 field = reader.get_field(field_name)
42 if field is None:
43 return None
44 elif field_type == str:
45 return tuple(str(field.parts[part_idx], encoding="utf-8") for part_idx in field.data)
46 elif field_type in [int, float, bool]:
47 return tuple(field_type(field.parts[part_idx][0]) for part_idx in field.data)
48 else:
49 raise TypeError(f"Unknown field type {field_type}")
50
51def get_gguf_metadata(reader):
52 """Extract all simple metadata fields like safetensors"""

Callers 3

gguf_tokenizer_loaderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected