I finetuned TinyLlama, I pushed my project in the hub, but it does not contains pytorch_model.bin, config.json and some files. Is there a way to after finetune the model and upload all, config files and the model after run ‘peft_model.merge_and_unload()’?, I want to share my model after merge it with all the configurations to load it.
I am using Google Colab. Thanks.
Code:
from peft import PeftModel
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained(
model_id,
load_in_8bit=False,
torch_dtype=torch.float16,
device_map='auto',
trust_remote_code=True
)
model_path = '/content/TinyLlama-1.1B-Chat-v1.0-Colorist/checkpoint-250'
peft_model = PeftModel.from_pretrained(
model,
model_path,
from_transformers=True,
device_map='auto'
)
tokenizer = AutoTokenizer.from_pretrained(model_id)
tokenizer.pad_token = tokenizer.eos_token
model.push_to_hub = True
tokenizer.push_to_hub = True
model.config.save_pretrained(model_id)
tokenizer.save_pretrained(model_id)
model.save_pretrained(model_id)
model = peft_model.merge_and_unload()