transformers icon indicating copy to clipboard operation
transformers copied to clipboard

Adding variant as a keyword to config.save_pretrained

Open sachinruk opened this issue 9 months ago • 1 comments

What does this PR do?

When saving a model of type PreTrainedModel via save_pretrained you can add a variant argument so that the final model name can be model.vision.safetensors or model.text.safetensors. However, this capability is not extended to configuration files. This is a PR to add this capability

Fixes # (issue) If in a file you do the following, you only get one configuration file with the last config

vision_model.save_pretrained(save_directory, variant="vision")
text_model.save_pretrained(save_directory, variant="text")

Note: Tests are failing. Will fix those issues if this PR is useful in the first place. Please let me know if this PR will be accepted if I fix the rest of the tests.

Before submitting

  • [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • [x] Did you read the contributor guideline, Pull Request section?
  • [x] Was this discussed/approved via a Github issue or the forum? Please add a link to it if that's the case.
  • [ ] Did you make sure to update the documentation with your changes? Here are the documentation guidelines, and here are tips on formatting docstrings.
  • [x] Did you write any new necessary tests?

cc @fxmarty

sachinruk avatar May 04 '24 01:05 sachinruk

Hey @sachinruk, can you walk me through what use case that would enable?

LysandreJik avatar May 06 '24 13:05 LysandreJik

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

github-actions[bot] avatar Jun 03 '24 08:06 github-actions[bot]