-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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
Discrepancy in Model Inference: Local vs. Hugging Face Model Hub #25362
Comments
Hey! Seems like you have a lot of custom code, I would recommend you to open an issue on the forum. This is not a bug per se in |
Totally agree with @ArthurZucker But have a quick look model_params = [frozen_base_model, unfrozen_base_model]
for model_param in model_params: and if model_param == frozen_base_model:
model_name = "model_name"
elif model_param == unfrozen_base_model:
model_name = "model_name" I feel your uploading is messed up with the 2 models you trained. (I am not sure though!) As @ArthurZucker 's comment said, further question is better on the forum, and the code snippet is better to have some rework to make it easier and clear. |
Thanks for the responses! @ArthurZucker I will post on the forum. I am pretty sure it's not a mistake in my code but of course I could be wrong. @ydshieh I actually modified the code so that the path names would be generic, it should be more like
But this is almost certainly not the issue, as I only ever get to training the frozen_base_model. I believe something funky may be happening when I set the
And then
Doesn't push all the weights or something. |
Solved the issue. The problem was indeed with setting the model.roberta = to the frozen base mosel. This caused the model params to double in size, and when pushing, I guess only part of the model was being pushed, not the entire thing. |
Glad you find the cause! As you pointed, it's due to When you do As your model definition has no |
Exactly! Results look great now :) 🎉. I love HuggingFace and the transformers library |
System Info
transformers
version: 4.31.0Who can help?
@ArthurZucker @youne
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
PROBLEM: #2 and #3 have completely different values, even though the input sequence is exactly the same. Note: #3 (using the local weights without downloading, gives a result that is closely aligned with the training run outputs, which is good. The downloaded model gives poor predictions.)
Expected behavior
I would expect when running inference on the downloaded model weights, that the result would be the same or similar as when running inference on the initially trained model locally. I do a test to make sure that the uploaded model weights are the same as the local model weights by redownloading it. What could possibly be the issue? I've spent hours racking my brain about this!
Thanks!
The text was updated successfully, but these errors were encountered: