cross platform from_pretrained#20538
Merged
ArthurZucker merged 10 commits intohuggingface:mainfrom Dec 5, 2022
Merged
Conversation
Collaborator
Author
|
Works great for sharded from transformers import TFT5ForConditionalGeneration
MODEL_NAME = "google/flan-t5-xl"
m = TFT5ForConditionalGeneration.from_pretrained(MODEL_NAME, from_pt=True) |
|
The documentation is not available anymore as the PR was closed or merged. |
sgugger
reviewed
Dec 1, 2022
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
…transformers into tf-from-sharded-pt
Collaborator
Author
|
Just need to remove the |
sgugger
reviewed
Dec 5, 2022
Comment on lines
-2573
to
-2578
| elif os.path.isfile(pretrained_model_name_or_path): | ||
| archive_file = pretrained_model_name_or_path | ||
| is_local = True | ||
| elif os.path.isfile(pretrained_model_name_or_path + ".index"): | ||
| archive_file = pretrained_model_name_or_path + ".index" | ||
| is_local = True |
Collaborator
There was a problem hiding this comment.
This code shouldn't be removed, to preserve compatibility with PreTrainedModel.from_pretrained(path_to_a_model_path, config = config)
mpierrau
pushed a commit
to mpierrau/transformers
that referenced
this pull request
Dec 15, 2022
* add support for `from_pt` * add tf_flax utility file * Update src/transformers/modeling_tf_flax_utils.py Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com> * remove flax related modifications * add test * remove FLAX related commits * fixup * remove safetensor todos * revert deletion Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Allows loading sharded checkpoints in TF models. Should fix #19965
from_pt=Truefrom_flax=Truecc @sgugger just FYI