Instructions to use bowang0911/Nano-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bowang0911/Nano-1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="bowang0911/Nano-1B", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("bowang0911/Nano-1B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use bowang0911/Nano-1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bowang0911/Nano-1B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bowang0911/Nano-1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/bowang0911/Nano-1B
- SGLang
How to use bowang0911/Nano-1B 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 "bowang0911/Nano-1B" \ --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": "bowang0911/Nano-1B", "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 "bowang0911/Nano-1B" \ --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": "bowang0911/Nano-1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use bowang0911/Nano-1B with Docker Model Runner:
docker model run hf.co/bowang0911/Nano-1B
Use dedicated PAD token to preserve EOS training labels
DataCollatorForLanguageModeling(mlm=False) masks every label equal to pad_token_id. The current tokenizer uses EOS ID 1 as PAD, so real document-ending EOS tokens lose supervision in padded batches.
Use the existing dedicated <|▁pad▁|> token (ID 2) consistently in the tokenizer, model configuration/defaults, and generation configuration. EOS stays at ID 1. The vocabulary, tokenizer.json, raw unpadded encoding, and 24-layer vanilla architecture are unchanged. Update tokenizer provenance and the padding instructions.
For documents [42, 43, EOS] and [42, EOS], the standard collator now produces:
input_ids: [[42, 43, 1], [42, 1, 2]]
labels: [[42, 43, 1], [42, 1, -100]]
Validation: 13 tests passed — the 11 existing dense-model behavioral tests plus regressions for standard-collator EOS preservation/backward and PAD/EOS serialization/raw-encoding parity. The dedicated embedding padding row has no gradient; EOS supervision is retained. Full-size meta parameter count remains 1,076,700,672.
The previous 100-step experiments used padding-free custom batches, kept EOS labels, and did not use the standard collator. Their exact training slices and evaluation panels contain no ID 2; their reported metrics are unaffected by this issue. Those trials were not rerun for this fix.
This PR is independent of the recurrent architecture candidate in PR #1. No loop fields or model execution changes are included. No tests, datasets, credentials, or weights are uploaded to the model repository.