Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions gguf-py/gguf/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ class SafetensorRemote:
"""

BASE_DOMAIN = "https://huggingface.co"
ALIGNMENT = 8 # bytes

@classmethod
def get_list_tensors_hf_model(cls, model_id: str) -> dict[str, RemoteTensor]:
Expand Down Expand Up @@ -204,9 +203,6 @@ def get_metadata(cls, url: str) -> tuple[dict, int]:

# Calculate the data start offset
data_start_offset = 8 + metadata_length
alignment = SafetensorRemote.ALIGNMENT
if data_start_offset % alignment != 0:
data_start_offset += alignment - (data_start_offset % alignment)

# Check if we have enough data to read the metadata
if len(raw_data) < 8 + metadata_length:
Expand Down Expand Up @@ -298,7 +294,6 @@ class SafetensorsLocal:
Custom parsing gives a bit more control over the memory usage.
The official safetensors library doesn't expose file ranges.
"""
ALIGNMENT = 8 # bytes

tensors: dict[str, LocalTensor]

Expand All @@ -316,9 +311,6 @@ def __init__(self, filename: Path):
raise ValueError(f"Failed to parse safetensors metadata as JSON: {e}")

data_start_offset = f.tell()
alignment = self.ALIGNMENT
if data_start_offset % alignment != 0:
data_start_offset += alignment - (data_start_offset % alignment)

tensors: dict[str, LocalTensor] = {}
for name, meta in metadata.items():
Expand Down