Instructions to use cjerzak/political-speeches-gpt2-finetune with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cjerzak/political-speeches-gpt2-finetune with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cjerzak/political-speeches-gpt2-finetune")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("cjerzak/political-speeches-gpt2-finetune") model = AutoModelForCausalLM.from_pretrained("cjerzak/political-speeches-gpt2-finetune") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use cjerzak/political-speeches-gpt2-finetune with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cjerzak/political-speeches-gpt2-finetune" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cjerzak/political-speeches-gpt2-finetune", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/cjerzak/political-speeches-gpt2-finetune
- SGLang
How to use cjerzak/political-speeches-gpt2-finetune 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 "cjerzak/political-speeches-gpt2-finetune" \ --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": "cjerzak/political-speeches-gpt2-finetune", "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 "cjerzak/political-speeches-gpt2-finetune" \ --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": "cjerzak/political-speeches-gpt2-finetune", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use cjerzak/political-speeches-gpt2-finetune with Docker Model Runner:
docker model run hf.co/cjerzak/political-speeches-gpt2-finetune
Model Card for cjerzak/trump-speeches-gpt2-finetune
This is a fine-tuned version of the GPT-2 language model on a collection of 10 Donald Trump speeches. The original speeches are available at ryanmcdermott/trump-speeches. This model is intended for experimentation with text generation and for demonstration/educational purposes.
Model Details
Model Description
- Developed by: Fine-tuning OpenAI's original GPT-2.
- Model type: Causal Language Model (GPT-2).
- Language(s) (NLP): English.
- License: GPT-2’s license (MIT-based). The fine-tuning code is also available and may be under a different open-source license; consult the repository for details.
- Finetuned from model:
gpt2. - Shared by: cjerzak on Hugging Face.
Because it was fine-tuned on a small set of speeches, the model has learned stylistic patterns, phrases, and vocabulary frequently used in Donald Trump’s rhetoric. Note: This model is primarily for demonstration and to illustrate the use of GPT-2 fine-tuning. It should not be considered a comprehensive or robust representation of all of Donald Trump’s speeches.
Model Sources
- Repository: cjerzak/trump-speeches-gpt2-finetune on Hugging Face
- Training Data Source: ryanmcdermott/trump-speeches
Uses
Direct Use
- Text Generation / Experimentation: You can use this model to generate text in a style that somewhat mimics Donald Trump's speeches. It is well-suited as a teaching or demonstration model for fine-tuning GPT-2.
Downstream Use
- Creative Projects / Educational Examples: If you want to incorporate a “Trump-like” text generation style in creative applications or show how GPT-2 behaves when fine-tuned on a small, domain-specific dataset.
Bias, Risks, and Limitations
Because the training data consists of Donald Trump's speeches, the model may exhibit:
- Stylistic Bias: The model might produce text with repetitive rhetorical patterns or phrases.
- Political Bias / Offensiveness: The original speeches may contain language or statements that some users find offensive or controversial.
- Limited Generalization: With only 10 speeches, the model’s language patterns are narrowly focused. It may produce text with limited variety or slightly nonsensical completions outside of the style/subject matter present in the training data.
Recommendations
- Content Filtering: If deploying publicly, consider adding filters or moderation layers to avoid offensive content.
- Awareness: Users should be aware of potential biases in the generated text. Given the small dataset, it can amplify certain topics or phrasings.
- Educational Use: Primarily recommended for demonstration or educational projects, not as a production-level model.
How to Get Started with the Model
Install the necessary packages:
pip install transformers accelerate torch
- Downloads last month
- 4