Instructions to use HuggingFaceH4/starchat-alpha with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HuggingFaceH4/starchat-alpha with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="HuggingFaceH4/starchat-alpha")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("HuggingFaceH4/starchat-alpha") model = AutoModelForCausalLM.from_pretrained("HuggingFaceH4/starchat-alpha") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use HuggingFaceH4/starchat-alpha with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "HuggingFaceH4/starchat-alpha" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HuggingFaceH4/starchat-alpha", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/HuggingFaceH4/starchat-alpha
- SGLang
How to use HuggingFaceH4/starchat-alpha 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 "HuggingFaceH4/starchat-alpha" \ --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": "HuggingFaceH4/starchat-alpha", "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 "HuggingFaceH4/starchat-alpha" \ --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": "HuggingFaceH4/starchat-alpha", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use HuggingFaceH4/starchat-alpha with Docker Model Runner:
docker model run hf.co/HuggingFaceH4/starchat-alpha
General tips around inference speed?
Maybe I just haven't run this large of a model before but I'm blown away by the difference in speed for this 16b model versus a 12b parameter model like pythia. Are there any speed-up tips? Things I'm doing so far:
- On pytorch 2.0
- Confirmed it's running on CUDA (device=0 and VRAM is soaked)
- torch_dtype=torch.bfloat16
- even tried loading as 8 bit to no noticeable speed-up (but I guess that last one is more to alleviate memory than speed things up).
Any other ideas?
Did pytorch 2.0 gave you noticable improvement?
I actually didn't try Pytorch 1.x so I don't know! The one last thing I was going to try was deepspeed inference (per this https://www.deepspeed.ai/tutorials/inference-tutorial/) but I don't know how much improvement I'm going to see on a single GPU machine.
Try editing the config.json file to say use_cache: true. That will help.
Try editing the config.json file to say
use_cache: true. That will help.
thanks.
I've noticed 40% faster inference by using use_cache: true
Edit: I'm peeling this out into it's own thread.
https://huggingface.co/HuggingFaceH4/starchat-alpha/discussions/6
