Run this model with HF Jobs
Run Vedant3907/Llama-3.2-1B-PersonaClassifier 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:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/Vedant3907/Llama-3.2-1B-PersonaClassifier. 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.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Vedant3907/Llama-3.2-1B-PersonaClassifier 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.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/Vedant3907/Llama-3.2-1B-PersonaClassifier. 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.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/Vedant3907/Llama-3.2-1B-PersonaClassifier. 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.
Instructions to use Vedant3907/Llama-3.2-1B-PersonaClassifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Vedant3907/Llama-3.2-1B-PersonaClassifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Vedant3907/Llama-3.2-1B-PersonaClassifier")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Vedant3907/Llama-3.2-1B-PersonaClassifier") model = AutoModelForCausalLM.from_pretrained("Vedant3907/Llama-3.2-1B-PersonaClassifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Vedant3907/Llama-3.2-1B-PersonaClassifier with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Vedant3907/Llama-3.2-1B-PersonaClassifier" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Vedant3907/Llama-3.2-1B-PersonaClassifier", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Vedant3907/Llama-3.2-1B-PersonaClassifier
- SGLang
How to use Vedant3907/Llama-3.2-1B-PersonaClassifier with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Vedant3907/Llama-3.2-1B-PersonaClassifier" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Vedant3907/Llama-3.2-1B-PersonaClassifier", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Vedant3907/Llama-3.2-1B-PersonaClassifier" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Vedant3907/Llama-3.2-1B-PersonaClassifier", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Vedant3907/Llama-3.2-1B-PersonaClassifier with Docker Model Runner:
docker model run hf.co/Vedant3907/Llama-3.2-1B-PersonaClassifier
Model Description
This model is a fine-tuned version of meta-llama/Llama-3.2-1B optimized for Persona Classifier tasks when given a Detailed Persona. The training was done on argilla/FinePersonas-v0.1 dataset with the 10k records.
- Developed by: Vedant Rajpurohit
- Model type: Causal Language Model
- Language(s): English
- Fine-tuned from model:
meta-llama/Llama-3.2-1B
Direct Use
from transformers import pipeline
model_id_new = "Vedant3907/Llama-3.2-1B-PersonaClassifier"
tokenzier = AutoTokenizer.from_pretrained(model_id_new)
model_pretrained = AutoModelForCausalLM.from_pretrained(
model_id_new,
device_map="auto",
torch_dtype="float16")
prompt = """Given the persona give the associated labels:
### Persona:
A social justice activist and blogger focused on anti-colonialism, anti-racism, and media representation, particularly within the context of intersectional people of color experiences.
### Labels:
"""
pipe = pipeline(task="text-generation",
model=model_pretrained,
tokenizer=tokenizer,
max_new_tokens=50,
temperature=0.1,
pad_token_id = tokenizer.eos_token_id)
result = pipe(prompt)
print(extract_labels(result[0]['generated_text']))
#The extract_labels function is to print just the lsit of persona generated by model if sometime it generates random things.
'''
import re
def extract_labels(output_text):
"""
Extracts the list of labels from the generated text.
Args:
output_text (str): The raw output text from the model.
Returns:
list: A list of labels if found, otherwise an empty list.
"""
try:
# Find the content after "Labels:" and extract the list
match = re.search(r"### Labels:\s*(\[.*?\])", output_text)
if match:
labels = eval(match.group(1)) # Convert string representation of list to Python list
if isinstance(labels, list):
return labels
except Exception as e:
print(f"Error extracting labels: {e}")
# Return an empty list if extraction fails
return []
'''
Training Details
Training Procedure
The model was fine-tuned using with LoRA adapters, enabling efficient training. Below are the hyperparameters used:
training_arguments = TrainingArguments(
output_dir=output_dir,
num_train_epochs=3,
per_device_train_batch_size=1,
gradient_accumulation_steps=8,
optim="paged_adamw_32bit",
logging_steps=10,
learning_rate=2e-4,
fp16=True,
bf16=False,
max_grad_norm=0.3,
# max_steps=-1,
warmup_steps=7,
group_by_length=False,
lr_scheduler_type="cosine",
report_to="wandb",
eval_strategy="steps",
eval_steps = 0.2
)
Hardware
- Trained on google colab with its T4 GPU
- Downloads last month
- 16
Model tree for Vedant3907/Llama-3.2-1B-PersonaClassifier
Base model
meta-llama/Llama-3.2-1B