roneneldan/TinyStories
Viewer โข Updated โข 2.14M โข 322k โข 1.34k
Run omaralshareef/Fine-tuning-Gpt-2 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Use HF Jobs to fine-tune https://huggingface.co/omaralshareef/Fine-tuning-Gpt-2. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Use HF Jobs to run batch inference with https://huggingface.co/omaralshareef/Fine-tuning-Gpt-2 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Use HF Jobs to evaluate https://huggingface.co/omaralshareef/Fine-tuning-Gpt-2. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Use HF Jobs to create a 4-bit version of https://huggingface.co/omaralshareef/Fine-tuning-Gpt-2. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
How to use omaralshareef/Fine-tuning-Gpt-2 with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("openai-community/gpt2")
model = PeftModel.from_pretrained(base_model, "omaralshareef/Fine-tuning-Gpt-2")LoRA adapter for openai-community/gpt2, fine-tuned with TRL SFT on TinyStories.
The base GPT-2 weights are unchanged. This repo contains the adapter only.
train[:8000], sequence length 256c_attn, c_proj, c_fcTrained locally on an Apple M3 Pro.
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_id = "openai-community/gpt2"
adapter_id = "omaralshareef/Fine-tuning-Gpt-2"
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
model = AutoModelForCausalLM.from_pretrained(base_id)
model = PeftModel.from_pretrained(model, adapter_id)
prompt = "Once upon a time there was a little girl named Lucy."
inputs = tokenizer(prompt, return_tensors="pt")
output = model.generate(**inputs, max_new_tokens=80, do_sample=True, temperature=0.8, top_p=0.95)
print(tokenizer.decode(output[0], skip_special_tokens=True))
Base model
openai-community/gpt2