Made mypy compatible

This commit is contained in:
paramthakkar123
2025-04-04 07:34:43 +05:30
parent c52cc748f8
commit d7cab9d5f5
4 changed files with 13 additions and 9 deletions

View File

@@ -7,7 +7,7 @@ import glob
import json
import shutil
from pathlib import Path
from typing import Dict
import mlx.core as mx
import mlx.nn as nn
import torch
@@ -149,7 +149,8 @@ def quantize(weights, config, args):
def make_shards(weights: dict, max_file_size_gibibyte: int = 15):
max_file_size_bytes = max_file_size_gibibyte << 30
shards = []
shard, shard_size = {}, 0
shard : Dict[str, mx.array] = {}
shard_size = 0
for k, v in weights.items():
if shard_size + v.nbytes > max_file_size_bytes:
shards.append(shard)