Bugfix: WandbCallback uploads initial model checkpoint (#30897)

* fix wandb always uploading initial model

* Update comment.

* Optionally log initial model

* Revert "Optionally log initial model"

This reverts commit 9602cc1fad3feaf218f82a7339a194d3d2fbb946.
This commit is contained in:
Matthias Gerstgrasser 2024-05-23 12:29:00 -07:00 committed by GitHub
parent 6d3d5b1039
commit 6657fb5fed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -797,7 +797,7 @@ class WandbCallback(TrainerCallback):
except AttributeError:
logger.info("Could not log the number of model parameters in Weights & Biases.")
# log the initial model and architecture to an artifact
# log the initial model architecture to an artifact
with tempfile.TemporaryDirectory() as temp_dir:
model_name = (
f"model-{self._wandb.run.id}"
@ -813,7 +813,6 @@ class WandbCallback(TrainerCallback):
"initial_model": True,
},
)
model.save_pretrained(temp_dir)
# add the architecture to a separate text file
save_model_architecture_to_file(model, temp_dir)