Instructions to use NumbersStation/nsql-2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NumbersStation/nsql-2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="NumbersStation/nsql-2B")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("NumbersStation/nsql-2B") model = AutoModelForCausalLM.from_pretrained("NumbersStation/nsql-2B") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use NumbersStation/nsql-2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "NumbersStation/nsql-2B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NumbersStation/nsql-2B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/NumbersStation/nsql-2B
- SGLang
How to use NumbersStation/nsql-2B 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 "NumbersStation/nsql-2B" \ --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": "NumbersStation/nsql-2B", "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 "NumbersStation/nsql-2B" \ --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": "NumbersStation/nsql-2B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use NumbersStation/nsql-2B with Docker Model Runner:
docker model run hf.co/NumbersStation/nsql-2B
Does it run on a CPU instance in sagemaker (ml.m5.2xlarge)?
#2
by arviii - opened
Hey, I am trying to deploy a model on a CPU instance(ml.m5.2xlarge) on sagemaker, but it overflows the storage and best way to resolve this might be to mount a storage volume (EBS I suppose)
To do so, ideally should pass volume_size=80 in huggingface_model.deploy parameters. But it doesn't seem to work in my case and it still throws same error about storage running out.
Model: https://huggingface.co/NumbersStation/nsql-llama-2-7B
Instance: ml.m5.2xlarge (it works perfectly fine on ml.g5.2xlarge)
error: "Error: Download
Error safetensors_rust.SafetensorError: Error while serializing: IoError(Os { code: 28, kind: StorageFull, message: ""No space left on device"" })"
code: predictor = huggingface_model.deploy(
initial_instance_count=1,
# instance_type="ml.g5.2xlarge",
instance_type="ml.m5.2xlarge",
container_startup_health_check_timeout=300,
volume_size=80,
)
rest code is just fine as it gets deployed successfully on ml.g5.2xlarge
Thank you for sharing this information! It will be helpful for others who are interested in deploying on Sagemaker.