A new trainer replace the default one. SMITTrainer overrides Trainer.save_model (while still relying on it) to add the model's config to safetensors' metadata.
Thanks to that change, safetensors will act as a single input file containing everything needed to load a trained file.
SLAM.from_pretrained
SLAM now provides the SLAM.from_pretrained classmethod to load a trained file. It can be used either by directly taking a safetensors generated by SMITTrainer as input, or safetensors plus a cfg as Dict (i.e in case the safetensors doesn't contain the cfg as metadata.
This PR adds two things:
SMITTrainer
A new trainer replace the default one.
SMITTrainer
overridesTrainer.save_model
(while still relying on it) to add the model's config tosafetensors
' metadata.Thanks to that change,
safetensors
will act as a single input file containing everything needed to load a trained file.SLAM.from_pretrained
SLAM
now provides theSLAM.from_pretrained
classmethod to load a trained file. It can be used either by directly taking asafetensors
generated bySMITTrainer
as input, orsafetensors
plus a cfg asDict
(i.e in case thesafetensors
doesn't contain the cfg as metadata.Closes #3