-
Notifications
You must be signed in to change notification settings - Fork 71
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
Do not upload NeuronModelForCausalLM weights when they can be reconstructed from the hub #413
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
When serializing a model, the checkpoint files (i.e. the original weights formatted for neuron) and the compiled artifacts are stored under two folder in the model directory. This modifies the NeuronForCausalLM.push_to_hub method to exclude the folder containing the checkpoint files if they can be instead reconstructed from a model on the hub. Note that it is still possible to upload checkpoint files by using the huggingface_cli directly on the saved model folder instead of push_to_hub. To allow optimum-neuron to fetch and reconstruct the checkpoint when fetchin a neuron model from the hub, the original repository that was used to export the model and its revision are stored in the neuron config.
298c840
to
87c7341
Compare
87c7341
to
f07d0b1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
"model_id, revision", | ||
[ | ||
["dacorvo/tiny-random-gpt2-neuronx", "1b3456cf877cc42c053ee8464f1067021eccde4b"], | ||
["dacorvo/tiny-random-gpt2-neuronx-no-checkpoint", "78eb2313ab7e149bbc22ff32257db93ba09e3033"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the test with no checkpoint, shall we check there is no checkpoint after push to hub?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a download here: the check is done in the other test.
When serializing a model, the checkpoint files (i.e. the original
weights formatted for neuron) and the compiled artifacts are stored
under two folders in the model directory.
This modifies the
NeuronForCausalLM.push_to_hub
method to excludethe folder containing the checkpoint files if they can be instead
reconstructed from a model on the hub.
Note that it is still possible to upload checkpoint files by using the
huggingface_cli
directly on the saved model folder instead ofpush_to_hub.
To allow
optimum-neuron
to fetch and reconstruct the checkpoint whenfetchin a neuron model from the hub, the original repository that was
used to export the model and its revision are stored in the neuron config.
Example model here:
https://huggingface.co/dacorvo/llama-2-7b-chat-hf-neuronx-bs1-seq2048-no-checkpoint/tree/main