Instructions to use tokyotech-llm/Swallow-7b-instruct-hf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tokyotech-llm/Swallow-7b-instruct-hf with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tokyotech-llm/Swallow-7b-instruct-hf")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tokyotech-llm/Swallow-7b-instruct-hf") model = AutoModelForCausalLM.from_pretrained("tokyotech-llm/Swallow-7b-instruct-hf", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tokyotech-llm/Swallow-7b-instruct-hf with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tokyotech-llm/Swallow-7b-instruct-hf" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tokyotech-llm/Swallow-7b-instruct-hf", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/tokyotech-llm/Swallow-7b-instruct-hf
- SGLang
How to use tokyotech-llm/Swallow-7b-instruct-hf 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 "tokyotech-llm/Swallow-7b-instruct-hf" \ --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": "tokyotech-llm/Swallow-7b-instruct-hf", "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 "tokyotech-llm/Swallow-7b-instruct-hf" \ --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": "tokyotech-llm/Swallow-7b-instruct-hf", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use tokyotech-llm/Swallow-7b-instruct-hf with Docker Model Runner:
docker model run hf.co/tokyotech-llm/Swallow-7b-instruct-hf
Commit History
Upload README.md 63dbf5f verified
Upload README.md 8b747a8 verified
Upload README.md 6f7f524 verified
Upload README.md cd11173 verified
Upload README.md 8063407 verified
Upload README.md 8aa132a verified
Upload README.md 61f7414 verified
Upload README.md 624b378 verified
Upload README.md 93d99cf verified
Upload README.md 00d6595 verified
Upload README.md f178cbc verified
Upload README.md eab84ac verified
Upload README.md 3d0cc53 verified
Upload requirements.txt 112b5fd
Upload logo.png 04991d5
Upload README.md 3635c32
Upload tokenizer_config.json 759fb3c
Upload LICENSE.txt 68c5973
Upload generation_config.json 9bb5336
Upload special_tokens_map.json 4ba626b
Update config.json 78b4905
Upload config.json 602cf4f
Upload generation_config.json 961de93
Upload model-00002-of-00003.safetensors 6bca509
Upload model.safetensors.index.json 45d5b15
Upload tokenizer.model 75a9e83
Upload model-00003-of-00003.safetensors 742a588
Upload model-00001-of-00003.safetensors c27f804
initial commit d19b7af
Kazuki Fujii commited on