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

Not able to push the whole model to hugging face after training : help urgent , Hackathon submission EOD #898

Open
Data-Scientist-Sahil opened this issue Aug 10, 2024 · 6 comments

Comments

@Data-Scientist-Sahil
Copy link

Data-Scientist-Sahil commented Aug 10, 2024

SO after training the model and pushing the adaptors to HF

model.push_to_hub("your_name/lora_model", token = "...") # Online saving
tokenizer.push_to_hub("your_name/lora_model", token = "...") # Online saving

this code flawlessly , but after trying to push the model in shards to HF , there was an error about model card
code -

if False: model.save_pretrained_merged("model", tokenizer, save_method = "merged_16bit",)
if False: model.push_to_hub_merged("hf/model", tokenizer, save_method = "merged_16bit", token = "")

error -

`TypeError                                 Traceback (most recent call last)
<ipython-input-14-848fa230afad> in <cell line: 2>()
      1 if True: model.save_pretrained_merged("model", tokenizer, save_method = "merged_16bit",)
----> 2 if True: model.push_to_hub_merged("rishika0704/javelin", tokenizer, save_method = "merged_16bit", token = os.getenv("hf_token"))

4 frames
/usr/local/lib/python3.10/dist-packages/transformers/utils/hub.py in create_and_tag_model_card(repo_id, tags, token, ignore_metadata_errors)
   1181     if tags is not None:
   1182         for model_tag in tags:
-> 1183             if model_tag not in model_card.data.tags:
   1184                 model_card.data.tags.append(model_tag)
   1185 

TypeError: argument of type 'NoneType' is not iterable`

Guys if anyone could help , please help me asap , this is regarding a submission in Hackathon

@codelion
Copy link

@Data-Scientist-Sahil There is some issue if the repo is not already created. See my comment here - https://discord.com/channels/1179035537009545276/1179035537529643040/1271746355093831793 see if you are on latest transformers.

@Data-Scientist-Sahil
Copy link
Author

delete later
am unable to access the comment on that discord ...
would you please share again ...

@codelion
Copy link

Just join the unsloth discord, you may get better support there.

This was my comment -

The simplest thing may be to just do it in 2 steps. Finish the original fine-tune upload your lora then delete and clear the runtime. Then load the adapter from HF with 

    from unsloth import FastLanguageModel
    model, tokenizer = FastLanguageModel.from_pretrained(
        model_name = "your_model", # YOUR MODEL YOU USED FOR TRAINING
        max_seq_length = max_seq_length,
        dtype = dtype,
        load_in_4bit = load_in_4bit,
    )

and then push gguf  with 
model.push_to_hub_gguf("your_model", tokenizer, quantization_method = "q4_k_m", token = "")

The thing to be aware is that model.push_to_hub_gguf doesn't seem to create the repo if it doesn't exist. You can just create the model from the web and then push.

@Data-Scientist-Sahil
Copy link
Author

how do i upload the Lora adapters after i clear the runtime and disconnected the GPU on google colab , so i tried to download all the files in model folder and then reupload it ... but ig that doesnt seem to work
i will join the discord channel

@codelion
Copy link

Start a new session, just load the model from folder and push to hub.

@rishiraj
Copy link

rishiraj commented Sep 5, 2024

this should fix the issue huggingface/transformers#33315

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

No branches or pull requests

3 participants