Finetuned from model : inceptionai/jais-adapted-7b-chat
Dataset: CopyleftCultivars/Natural-Farming-Real-QandA-Conversations-Q1-2024-Update (Real world Natural Farming advise, from over 12 countries and a multitude of real-world farm operations, using semi-synthetic data curated by domain experts)
V4 (best training loss curve of unsloth configs tested) of LORA adapter trained, merged into this full merged model: Solshine/jais-adapted-7b-chat-Natural-Farmer-lora-only-V4
import os
import torch
from huggingface_hub import login
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
from google.colab import userdata
Hugging Face credentials
HF_TOKEN = userdata.get('HF_TOKEN')
if HF_TOKEN is None:
raise ValueError("HF_TOKEN not found in Colab secrets. Please set it up.")
print("Downloading and loading the LORA adapter...")
lora_model = PeftModel.from_pretrained(base_model, LORA_MODEL_NAME, device_map=device_map)
Merge the base model with the LORA adapter
print("Merging the base model with the LORA adapter...")
merged_model = lora_model.merge_and_unload()
Save the merged model locally
print("Saving the merged model locally...")
merged_model.save_pretrained("./merged_model", safe_serialization=True)
tokenizer.save_pretrained("./merged_model")
Push the merged model to Hugging Face Hub
print("Pushing the merged model to Hugging Face Hub...")
merged_model.push_to_hub(MERGED_MODEL_NAME, use_auth_token=HF_TOKEN)
tokenizer.push_to_hub(MERGED_MODEL_NAME, use_auth_token=HF_TOKEN)