Text Generation
Transformers
Safetensors
English
llama
gpt-u
tiny-lm
pretrained-from-scratch
text-generation-inference
Instructions to use DedeProGames/GPT-U-20M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DedeProGames/GPT-U-20M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="DedeProGames/GPT-U-20M")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("DedeProGames/GPT-U-20M") model = AutoModelForCausalLM.from_pretrained("DedeProGames/GPT-U-20M", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use DedeProGames/GPT-U-20M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "DedeProGames/GPT-U-20M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "DedeProGames/GPT-U-20M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/DedeProGames/GPT-U-20M
- SGLang
How to use DedeProGames/GPT-U-20M 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 "DedeProGames/GPT-U-20M" \ --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": "DedeProGames/GPT-U-20M", "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 "DedeProGames/GPT-U-20M" \ --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": "DedeProGames/GPT-U-20M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use DedeProGames/GPT-U-20M with Docker Model Runner:
docker model run hf.co/DedeProGames/GPT-U-20M
Download scripts/run_train.sh from DedeProGames/GPT-U-20M: direct link, hf CLI and curl.
- Browser
- Download file 1 kB
-
https://huggingface.co/DedeProGames/GPT-U-20M/resolve/main/scripts/run_train.sh
- Command line
-
hf download hf://DedeProGames/GPT-U-20M/scripts/run_train.sh
-
curl -L -o run_train.sh https://huggingface.co/DedeProGames/GPT-U-20M/resolve/main/scripts/run_train.sh
1 kB
| # Start GPT-U-20M training in a detached tmux session with a persistent log. Re-running resumes automatically. | |
| # scripts/run_train.sh -> session "gptu", full run, log logs/gptu.out | |
| # SESSION=smoke scripts/run_train.sh --smoke | |
| set -euo pipefail | |
| cd "$(dirname "$0")/.." | |
| SESSION=${SESSION:-gptu} | |
| VENV=${VENV:-$HOME/venvs/gpt-u} | |
| CACHE=${CACHE:-/mnt/c/Users/andre/gpt-u-20m-data/cache} # compiler caches off the exFAT-hosted WSL disk | |
| ENVS="NCCL_P2P_DISABLE=1 NCCL_IB_DISABLE=1 CUDA_DEVICE_ORDER=PCI_BUS_ID PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True OMP_NUM_THREADS=2 TORCHINDUCTOR_CACHE_DIR=$CACHE/inductor TRITON_CACHE_DIR=$CACHE/triton" | |
| # The env goes inside the command: a running tmux server would not inherit this shell's exports. | |
| tmux new-session -d -s "$SESSION" \ | |
| "cd $PWD && env $ENVS $VENV/bin/torchrun --standalone --nproc_per_node=2 scripts/train.py $* 2>&1 | tee -a logs/$SESSION.out" | |
| echo "tmux session '$SESSION' started, log: logs/$SESSION.out" | |