Instructions to use pszemraj/gpt-peter-2.7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use pszemraj/gpt-peter-2.7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="pszemraj/gpt-peter-2.7B")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("pszemraj/gpt-peter-2.7B") model = AutoModelForCausalLM.from_pretrained("pszemraj/gpt-peter-2.7B") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use pszemraj/gpt-peter-2.7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "pszemraj/gpt-peter-2.7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pszemraj/gpt-peter-2.7B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/pszemraj/gpt-peter-2.7B
- SGLang
How to use pszemraj/gpt-peter-2.7B 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 "pszemraj/gpt-peter-2.7B" \ --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": "pszemraj/gpt-peter-2.7B", "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 "pszemraj/gpt-peter-2.7B" \ --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": "pszemraj/gpt-peter-2.7B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use pszemraj/gpt-peter-2.7B with Docker Model Runner:
docker model run hf.co/pszemraj/gpt-peter-2.7B
pszemraj/gpt-peter-2.7B
- This model is a fine-tuned version of EleutherAI/gpt-neo-2.7B on about 80k WhatsApp and iMessage texts.
- The model is too large to use the inference API. linked here is a notebook for testing in Colab.
- alternatively, you can message a bot on telegram where I test LLMs for dialogue generation
- the telegram bot code and the model training code can be found in this repository
Usage in python
Install the transformers library if you don't have it:
pip install -U transformers
load the model into a pipeline object:
from transformers import pipeline
import torch
my_chatbot = pipeline('text-generation',
'pszemraj/gpt-peter-2.7B',
device=0 if torch.cuda.is_available() else -1,
)
generate text!
my_chatbot('Did you ever hear the tragedy of Darth Plagueis The Wise?')
(example above for simplicity, but adding generation parameters such as no_repeat_ngram_size are recommended to get better generations)
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 6e-05
- train_batch_size: 2
- eval_batch_size: 2
- seed: 42
- distributed_type: multi-GPU
- gradient_accumulation_steps: 32
- total_train_batch_size: 64
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: cosine
- lr_scheduler_warmup_ratio: 0.05
- num_epochs: 1
Framework versions
- Transformers 4.17.0
- Pytorch 1.10.0+cu113
- Datasets 2.0.0
- Tokenizers 0.11.6
- Downloads last month
- 11
Model tree for pszemraj/gpt-peter-2.7B
Base model
EleutherAI/gpt-neo-2.7B