Downloads · 30 days
10
13% of all-time downloads
CrystalRaindropsFall/phi2-gsm8k-curriculum-complexity
phi2-gsm8k-curriculum-complexity is a machine learning model from CrystalRaindropsFall. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as apache-2.0.
This is a LoRA adapter for microsoft/phi-2 fine-tuned on the GSM8K dataset for mathematical reasoning.
Downloads · 30 days
10
13% of all-time downloads
All-time downloads
76
Public
Repo size
31.5 MB
Likes
0
Public
Click a slice to open those files.
.safetensors31.5 MB · 87%
From the Hugging Face model README
This is a LoRA adapter for microsoft/phi-2 fine-tuned on the GSM8K dataset for mathematical reasoning.
LoRA adapter for PHI-2 trained with curriculum learning (complexity score method)
This model was trained using curriculum learning, where the model is exposed to progressively harder problems:
The curriculum was determined based on problem complexity (number of solution steps × operation complexity).
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
"microsoft/phi-2",
device_map="auto",
torch_dtype="auto"
)
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-2")
# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "CrystalRaindropsFall/phi2-gsm8k-curriculum-complexity")
# Inference
prompt = "Question: Janet's ducks lay 16 eggs per day. She eats three for breakfast every morning and bakes muffins for her friends every day with four. She sells the remainder at the farmers' market daily for $2 per fresh duck egg. How much in dollars does she make every day at the farmers' market?\nAnswer:"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
from transformers import pipeline
from peft import PeftModel, AutoPeftModelForCausalLM
# Load model with adapter
model = AutoPeftModelForCausalLM.from_pretrained(
"YOUR_USERNAME/REPO_NAME",
device_map="auto"
)
# Create pipeline
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
# Generate
result = pipe("Question: A robe takes 2 bolts of blue fiber and half that much white fiber. How many bolts in total does it take?\nAnswer:")
print(result[0]['generated_text'])
Evaluated on GSM8K test set (512 samples):
| Metric | Score |
|---|---|
| Exact Match | 62.50% |
| Format Correct | 100% |
Apache 2.0 (following base model license)