Prepare
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
from huggingface_hub import login
login(token="{your_write_token}")
Merge Model
model_id = "yanolja/EEVE-Korean-10.8B-v1.0"
base_model = AutoModelForCausalLM.from_pretrained(
model_id,
return_dict=True,
torch_dtype=torch.float16
)
tokenizer = AutoTokenizer.from_pretrained(model_id)
upload_model = PeftModel.from_pretrained(base_model, "{peft save path}")
upload_model = upload_model.merge_and_unload()
Upload
upload_model.push_to_hub("j5ng/{model-name}", use_temp_dir=True)
tokenizer.push_to_hub("j5ng/{model-name}", use_temp_dir=True)