Instructions to use riva-labs/gpt2-xl-sentiment-analysis-riva with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use riva-labs/gpt2-xl-sentiment-analysis-riva with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("openai-community/gpt2-xl") model = PeftModel.from_pretrained(base_model, "riva-labs/gpt2-xl-sentiment-analysis-riva") - Notebooks
- Google Colab
- Kaggle
ancient-eagle
This is a Riva-generated LoRA fine-tune of openai-community/gpt2-xl for classification, trained on lakshmi25npathi_imdb-dataset-of-50k-movie-reviews_review_sentiment_train.jsonl with 4,102 examples. Its final classification_f1 score was 0.8882.
Use Cases
- Task-specific text generation, classification, extraction, or rewriting workflows.
- Prototyping a model behavior before investing in larger training runs.
- Continuing the same training setup with your own data in Riva.
Continue Training in Riva
This model was trained with Riva.
Start from this checkpoint, choose your own dataset, and create your own version in minutes:
https://app.riva.run/import?hf=HassanJbr/gpt2-xl-classification-lora-riva
Training Summary
| Field | Value |
|---|---|
| Base model | openai-community/gpt2-xl |
| Method | LoRA |
| Checkpoint type | lora |
| Publish version | v2 |
| GPU | T4 |
| Max steps | 50 |
| Learning rate | 0.0001 |
| Seed | 42 |
| Dataset | lakshmi25npathi_imdb-dataset-of-50k-movie-reviews_review_sentiment_train.jsonl |
| Training examples | 4102 |
| Dataset artifact | 8c9516bb7750aaf508b195fc0c6df51599df0d9014508d0db75219b830157343 |
| Config artifact | 374b9cfd62da458a7dd3765373775d5ed1b569666658b2e0bb081ae2f44466c3 |
The full Riva configuration is included in riva_config.yaml, and the run provenance is included in riva_provenance.json.
Evaluation
| Phase | Metric | Value | Correct / Total | Step |
|---|---|---|---|---|
| baseline | classification_f1 | 0.0000 | 0 / 50 | 0 |
| step | classification_f1 | 0.0303 | 1 / 50 | 10 |
| step | classification_f1 | 0.8496 | 39 / 50 | 20 |
| step | classification_f1 | 0.8730 | 40 / 50 | 30 |
| step | classification_f1 | 0.8882 | 41 / 50 | 40 |
| step | classification_f1 | 0.8882 | 41 / 50 | 50 |
| final | classification_f1 | 0.8882 | 41 / 50 | 50 |
| test | classification_f1 | 0.8738 | 405 / 500 | 50 |
Inference
from peft import AutoPeftModelForCausalLM
from transformers import AutoTokenizer
repo_id = "HassanJbr/gpt2-xl-classification-lora-riva"
tokenizer = AutoTokenizer.from_pretrained(repo_id)
model = AutoPeftModelForCausalLM.from_pretrained(repo_id, device_map="auto")
prompt = "Write your prompt here"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=128)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Limitations
- This model is an example checkpoint. Evaluate it on your own data and requirements before production use.
- Behavior depends on the base model, the training dataset, and the task template used for this run.
- Model and adapter use may be subject to the license and use restrictions of the base model and training data.
Riva
Train your own version: https://app.riva.run/import?hf=HassanJbr/gpt2-xl-classification-lora-riva
- Downloads last month
- 5
Model tree for riva-labs/gpt2-xl-sentiment-analysis-riva
Base model
openai-community/gpt2-xl