Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: SLAM.from_pretrained classmethod #9

Merged
merged 3 commits into from
Mar 22, 2024

Conversation

Thytu
Copy link
Owner

@Thytu Thytu commented Mar 22, 2024

This PR adds two things:

SMITTrainer

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.

Closes #3

@Thytu Thytu self-assigned this Mar 22, 2024
@Thytu Thytu merged commit 0022c38 into main Mar 22, 2024
@Thytu Thytu deleted the feat/from-pretrained-classmethod branch March 22, 2024 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a classmethod to load a trained model
1 participant