Instructions to use raghavbali/gpt2-finetuned-headliner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use raghavbali/gpt2-finetuned-headliner with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="raghavbali/gpt2-finetuned-headliner")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("raghavbali/gpt2-finetuned-headliner") model = AutoModelForCausalLM.from_pretrained("raghavbali/gpt2-finetuned-headliner") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use raghavbali/gpt2-finetuned-headliner with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "raghavbali/gpt2-finetuned-headliner" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "raghavbali/gpt2-finetuned-headliner", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/raghavbali/gpt2-finetuned-headliner
- SGLang
How to use raghavbali/gpt2-finetuned-headliner 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 "raghavbali/gpt2-finetuned-headliner" \ --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": "raghavbali/gpt2-finetuned-headliner", "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 "raghavbali/gpt2-finetuned-headliner" \ --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": "raghavbali/gpt2-finetuned-headliner", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use raghavbali/gpt2-finetuned-headliner with Docker Model Runner:
docker model run hf.co/raghavbali/gpt2-finetuned-headliner
GPT2 Fine Tuned Headline Generator
- This model is trained on the harvard/abcnews-dataset to generate news headlines
- This model is a fine-tuned version of openai-community/gpt2-medium on an unknown dataset.
Model description
The model is fine-tuned for 2 epochs and 4k training samples from the abcnews dataset. This enables the model to generate news headline like text given a simple prompt
Intended uses & limitations
This model is only for learning purposes only. The model easily hallucinates people names, locations and other artifacts & incidents.
Training and evaluation data
The model leverages 2k test samples for evaluation
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 5e-05
- train_batch_size: 64
- eval_batch_size: 64
- seed: 42
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- lr_scheduler_warmup_steps: 4
- num_epochs: 2
Training results
The final output after 2 epochs is as follows: TrainOutput(global_step=130, training_loss=5.044873604407678, metrics={'train_runtime': 140.587, 'train_samples_per_second': 59.166, 'train_steps_per_second': 0.925, 'total_flos': 248723096358912.0, 'train_loss': 5.044873604407678, 'epoch': 2.0})
Framework versions
- Transformers 4.44.2
- Pytorch 2.3.1
- Datasets 2.21.0
- Tokenizers 0.19.1
- Downloads last month
- 75