Instructions to use Maryam033/gpt2-text-generation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Maryam033/gpt2-text-generation with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Maryam033/gpt2-text-generation")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Maryam033/gpt2-text-generation") model = AutoModelForCausalLM.from_pretrained("Maryam033/gpt2-text-generation", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Maryam033/gpt2-text-generation with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Maryam033/gpt2-text-generation" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Maryam033/gpt2-text-generation", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Maryam033/gpt2-text-generation
- SGLang
How to use Maryam033/gpt2-text-generation 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 "Maryam033/gpt2-text-generation" \ --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": "Maryam033/gpt2-text-generation", "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 "Maryam033/gpt2-text-generation" \ --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": "Maryam033/gpt2-text-generation", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Maryam033/gpt2-text-generation with Docker Model Runner:
docker model run hf.co/Maryam033/gpt2-text-generation
GPT-2 Text Generation Model
Model Description
This project uses the GPT-2 Transformer architecture for natural language text generation.
The model generates meaningful text based on a given input prompt.
Model Details
- Model Name: GPT-2 Text Generation
- Developed by: Maryam033
- Model Architecture: GPT-2
- Model Type: Transformer-based Language Model
- Task: Text Generation
- Language: English
- Framework: Hugging Face Transformers
Intended Use
This model is designed for:
- Automatic text generation
- Text completion
- Natural language processing experiments
- Educational and research purposes
Model Architecture
GPT-2 is a decoder-only Transformer model that uses self-attention mechanisms to predict the next token in a sequence.
How to Use
from transformers import pipeline
generator = pipeline(
"text-generation",
model="Maryam033/gpt2-text-generation"
)
result = generator(
"Artificial Intelligence is",
max_length=50,
num_return_sequences=1
)
print(result)
Training Information
- Base Model: GPT-2
- Training Framework: Hugging Face Transformers
- Training Method: Fine-tuning
Limitations
- Generated text may sometimes contain incorrect information.
- Output quality depends on training data.
- The model may generate repetitive text.
Author
Maryam Zubair Ahmed
Hugging Face: https://huggingface.co/Maryam033
- Downloads last month
- 221