Skip to content

Commit

Permalink
delete comments black formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
isanvicente committed Oct 29, 2024
1 parent 55ccd81 commit 4dab32f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions eole/bin/model/average_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ def average_models(model_paths, fp32=False):
for i, model_path in enumerate(model_paths):
m = model_saver.load_checkpoint(model_path)
model_weights = load_file(os.path.join(model_path, "model.00.safetensors"))

if fp32:
for k, v in model_weights.items():
model_weights[k] = v.float()

if i == 0:
vocab, config, optim = m["vocab"], m["config"], m["optim"]
avg_model = model_weights
else:
for k, v in avg_model.items():
avg_model[k].mul_(i).add_(model_weights[k]).div_(i + 1)

final = {
"vocab": vocab,
"config": config,
Expand Down

0 comments on commit 4dab32f

Please sign in to comment.