Instructions to use Nexusflow/Starling-LM-7B-beta with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Nexusflow/Starling-LM-7B-beta with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Nexusflow/Starling-LM-7B-beta") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Nexusflow/Starling-LM-7B-beta") model = AutoModelForCausalLM.from_pretrained("Nexusflow/Starling-LM-7B-beta") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Nexusflow/Starling-LM-7B-beta with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Nexusflow/Starling-LM-7B-beta" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Nexusflow/Starling-LM-7B-beta", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Nexusflow/Starling-LM-7B-beta
- SGLang
How to use Nexusflow/Starling-LM-7B-beta 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 "Nexusflow/Starling-LM-7B-beta" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Nexusflow/Starling-LM-7B-beta", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "Nexusflow/Starling-LM-7B-beta" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Nexusflow/Starling-LM-7B-beta", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Nexusflow/Starling-LM-7B-beta with Docker Model Runner:
docker model run hf.co/Nexusflow/Starling-LM-7B-beta
SafetensorError: Error while deserializing header: MetadataIncompleteBuffer
What could be the reason for this? It was working fine until a while ago.
```
SafetensorError Traceback (most recent call last)
/tmp/ipykernel_2268/3485156104.py in <cell line: 1>()
----> 1 model = AutoModelForCausalLM.from_pretrained("Nexusflow/Starling-LM-7B-beta")
~/conda/pytorch21_p39_gpu_v1/lib/python3.9/site-packages/transformers/models/auto/auto_factory.py in from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
564 elif type(config) in cls._model_mapping.keys():
565 model_class = _get_model_class(config, cls._model_mapping)
--> 566 return model_class.from_pretrained(
567 pretrained_model_name_or_path, *model_args, config=config, **hub_kwargs, **kwargs
568 )
~/conda/pytorch21_p39_gpu_v1/lib/python3.9/site-packages/transformers/modeling_utils.py in from_pretrained(cls, pretrained_model_name_or_path, config, cache_dir, ignore_mismatched_sizes, force_download, local_files_only, token, revision, use_safetensors, *model_args, **kwargs)
3848 offload_index,
3849 error_msgs,
-> 3850 ) = cls._load_pretrained_model(
3851 model,
3852 state_dict,
~/conda/pytorch21_p39_gpu_v1/lib/python3.9/site-packages/transformers/modeling_utils.py in _load_pretrained_model(cls, model, state_dict, loaded_keys, resolved_archive_file, pretrained_model_name_or_path, ignore_mismatched_sizes, sharded_metadata, _fast_init, low_cpu_mem_usage, device_map, offload_folder, offload_state_dict, dtype, is_quantized, keep_in_fp32_modules)
4257 if shard_file in disk_only_shard_files:
4258 continue
-> 4259 state_dict = load_state_dict(shard_file)
4260
4261 # Mistmatched keys contains tuples key/shape1/shape2 of weights in the checkpoint that have a shape not
~/conda/pytorch21_p39_gpu_v1/lib/python3.9/site-packages/transformers/modeling_utils.py in load_state_dict(checkpoint_file)
504 if checkpoint_file.endswith(".safetensors") and is_safetensors_available():
505 # Check format of the archive
--> 506 with safe_open(checkpoint_file, framework="pt") as f:
507 metadata = f.metadata()
508 if metadata.get("format") not in ["pt", "tf", "flax"]:
SafetensorError: Error while deserializing header: MetadataIncompleteBuffer
```