Instructions to use harpertoken/harpertokenGPT2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use harpertoken/harpertokenGPT2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="harpertoken/harpertokenGPT2")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("harpertoken/harpertokenGPT2") model = AutoModelForCausalLM.from_pretrained("harpertoken/harpertokenGPT2") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use harpertoken/harpertokenGPT2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "harpertoken/harpertokenGPT2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "harpertoken/harpertokenGPT2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/harpertoken/harpertokenGPT2
- SGLang
How to use harpertoken/harpertokenGPT2 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 "harpertoken/harpertokenGPT2" \ --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": "harpertoken/harpertokenGPT2", "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 "harpertoken/harpertokenGPT2" \ --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": "harpertoken/harpertokenGPT2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use harpertoken/harpertokenGPT2 with Docker Model Runner:
docker model run hf.co/harpertoken/harpertokenGPT2
Model Card for harpertoken/harpertokenGPT2
GPT-2 small model trained from scratch on WikiText-2-raw-v1 dataset for text generation.
Model Details
Model Description
This is a GPT-2 small model (117M parameters) trained from random initialization on the WikiText-2-raw-v1 dataset. It can generate coherent text continuations.
- Developed by: Niladri Das
- Model type: GPT-2
- Language(s) (NLP): English
- License: Apache-2.0
Model Sources
- Repository: https://github.com/bniladridas/models
Uses
Direct Use
Use for text generation tasks, such as completing sentences or generating stories.
Out-of-Scope Use
Not suitable for tasks requiring factual accuracy, safety-critical applications, or languages other than English.
Bias, Risks, and Limitations
Trained on WikiText, which may contain biases from the source data. Model may generate inappropriate or biased content.
Recommendations
Use with caution; implement content filters for production use.
How to Get Started with the Model
from transformers import pipeline
generator = pipeline('text-generation', model='harpertoken/harpertokenGPT2')
print(generator("The quick brown fox"))
Training Details
Training Data
WikiText-2-raw-v1 dataset, a collection of Wikipedia articles.
Training Procedure
Trained from scratch using PyTorch and Transformers.
Training Hyperparameters
- Epochs: 3
- Batch size: 1
- Learning rate: 5e-5
- Max length: 512
Evaluation
Basic evaluation via text generation coherence.
Results
Generates plausible text continuations.
Environmental Impact
- Hardware Type: CPU/MPS
- Hours used: ~10 minutes
- Carbon Emitted: Minimal (local training)
Technical Specifications
Model Architecture and Objective
GPT-2 decoder-only transformer for causal language modeling.
Compute Infrastructure
- Hardware: Mac with MPS
- Software: PyTorch, Transformers
- Downloads last month
- 1