Unverified Commit 321c31c9 authored by sandy's avatar sandy Committed by GitHub
Browse files

[Fix]prevent ZeroDivisionError when chunk_size is 0 (#367)

parent d9795972
...@@ -567,7 +567,7 @@ def convert_weights(args): ...@@ -567,7 +567,7 @@ def convert_weights(args):
current_chunk = {} current_chunk = {}
for idx, (k, v) in tqdm(enumerate(converted_weights.items()), desc="Saving chunks"): for idx, (k, v) in tqdm(enumerate(converted_weights.items()), desc="Saving chunks"):
current_chunk[k] = v current_chunk[k] = v
if (idx + 1) % args.chunk_size == 0 and args.chunk_size > 0: if args.chunk_size > 0 and (idx + 1) % args.chunk_size == 0:
output_filename = f"{args.output_name}_part{chunk_idx}.safetensors" output_filename = f"{args.output_name}_part{chunk_idx}.safetensors"
output_path = os.path.join(args.output, output_filename) output_path = os.path.join(args.output, output_filename)
logger.info(f"Saving chunk to: {output_path}") logger.info(f"Saving chunk to: {output_path}")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment