flake--
This commit is contained in:
parent
8d36967a2c
commit
c4e6f6f4b9
1 changed files with 5 additions and 4 deletions
|
@ -25,6 +25,7 @@ class MetadataDetails:
|
||||||
value: Any
|
value: Any
|
||||||
description: str = ''
|
description: str = ''
|
||||||
|
|
||||||
|
|
||||||
def get_byteorder(reader: gguf.GGUFReader) -> gguf.GGUFEndian:
|
def get_byteorder(reader: gguf.GGUFReader) -> gguf.GGUFEndian:
|
||||||
if np.uint32(1) == np.uint32(1).newbyteorder("<"):
|
if np.uint32(1) == np.uint32(1).newbyteorder("<"):
|
||||||
# Host is little endian
|
# Host is little endian
|
||||||
|
@ -67,12 +68,12 @@ def get_field_data(reader: gguf.GGUFReader, key: str) -> Any:
|
||||||
|
|
||||||
|
|
||||||
def find_token(token_list: Sequence[int], token: str) -> Sequence[int]:
|
def find_token(token_list: Sequence[int], token: str) -> Sequence[int]:
|
||||||
token_ids = [index for index, value in enumerate(token_list) if value == token]
|
token_ids = [index for index, value in enumerate(token_list) if value == token]
|
||||||
|
|
||||||
if len(token_ids) == 0:
|
if len(token_ids) == 0:
|
||||||
raise LookupError(f'Unable to find "{token}" in token list!')
|
raise LookupError(f'Unable to find "{token}" in token list!')
|
||||||
|
|
||||||
return token_ids
|
return token_ids
|
||||||
|
|
||||||
|
|
||||||
def copy_with_new_metadata(reader: gguf.GGUFReader, writer: gguf.GGUFWriter, new_metadata: Mapping[str, MetadataDetails], remove_metadata: Sequence[str]) -> None:
|
def copy_with_new_metadata(reader: gguf.GGUFReader, writer: gguf.GGUFWriter, new_metadata: Mapping[str, MetadataDetails], remove_metadata: Sequence[str]) -> None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue