mlabonne/FineTome-100k
Viewer • Updated • 100k • 20k • 268
How to use x0root/Llama-3.1-8B-Orca-Structured-LoRA with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit")
model = PeftModel.from_pretrained(base_model, "x0root/Llama-3.1-8B-Orca-Structured-LoRA")How to use x0root/Llama-3.1-8B-Orca-Structured-LoRA with Unsloth Studio:
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for x0root/Llama-3.1-8B-Orca-Structured-LoRA to start chatting
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for x0root/Llama-3.1-8B-Orca-Structured-LoRA to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for x0root/Llama-3.1-8B-Orca-Structured-LoRA to start chatting
pip install unsloth
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="x0root/Llama-3.1-8B-Orca-Structured-LoRA",
max_seq_length=2048,
)This is a custom-trained LoRA adapter for Meta-Llama-3.1-8B-Instruct. It has been fine-tuned to excel at step-by-step mathematical reasoning and to respond with a polite, highly structured, and logically organized tone.
The model combines two carefully curated datasets. A balanced subset of 16,000 examples was used:
Run this model easily with the unsloth library. It automatically downloads the base model and applies this LoRA adapter.
pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
pip install --no-deps xformers trl peft accelerate bitsandbytes
from unsloth import FastLanguageModel
# Load model and tokenizer
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = "x0root/Llama-3.1-8B-Orca-Structured-LoRA",
max_seq_length = 1024,
dtype = None,
load_in_4bit = True,
)
FastLanguageModel.for_inference(model)
# Create prompt
messages = [
{"role": "system", "content": "You are a highly intelligent, polite AI assistant. Always think step-by-step and structure your answers beautifully."},
{"role": "user", "content": "A store sells apples for $1.20 each and bananas for $0.50 each. If I buy 4 apples and 6 bananas, and I pay with a $20 bill, how much change should I receive? Please explain your reasoning clearly."}
]
inputs = tokenizer.apply_chat_template(
messages,
tokenize = True,
add_generation_prompt = True,
return_tensors = "pt",
).to("cuda")
# Generate response
outputs = model.generate(
input_ids = inputs,
max_new_tokens = 512,
use_cache = True,
temperature = 0.3,
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response.split("assistant\n")[-1])
Fine-tuned using Supervised Fine-Tuning (SFT) with the following configuration:
Base model
meta-llama/Llama-3.1-8B