Instructions to use starvector/starvector-8b-im2svg with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use starvector/starvector-8b-im2svg with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="starvector/starvector-8b-im2svg", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("starvector/starvector-8b-im2svg", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use starvector/starvector-8b-im2svg with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "starvector/starvector-8b-im2svg" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "starvector/starvector-8b-im2svg", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/starvector/starvector-8b-im2svg
- SGLang
How to use starvector/starvector-8b-im2svg 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 "starvector/starvector-8b-im2svg" \ --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": "starvector/starvector-8b-im2svg", "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 "starvector/starvector-8b-im2svg" \ --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": "starvector/starvector-8b-im2svg", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use starvector/starvector-8b-im2svg with Docker Model Runner:
docker model run hf.co/starvector/starvector-8b-im2svg
Update starvector architecture file
Browse files- starvector_arch.py +5 -4
starvector_arch.py
CHANGED
|
@@ -2,7 +2,7 @@ from transformers import (
|
|
| 2 |
PretrainedConfig,
|
| 3 |
PreTrainedModel
|
| 4 |
)
|
| 5 |
-
|
| 6 |
class StarVectorConfig(PretrainedConfig):
|
| 7 |
model_type = "starvector"
|
| 8 |
|
|
@@ -18,9 +18,10 @@ class StarVectorConfig(PretrainedConfig):
|
|
| 18 |
use_cache: bool = True,
|
| 19 |
num_attention_heads: int = 16,
|
| 20 |
num_hidden_layers: int = 24,
|
| 21 |
-
vocab_size: int =
|
| 22 |
-
hidden_size: int =
|
| 23 |
num_kv_heads: int = 4,
|
|
|
|
| 24 |
**kwargs,
|
| 25 |
):
|
| 26 |
self.starcoder_model_name = starcoder_model_name
|
|
@@ -36,7 +37,7 @@ class StarVectorConfig(PretrainedConfig):
|
|
| 36 |
self.vocab_size = vocab_size
|
| 37 |
self.hidden_size = hidden_size
|
| 38 |
self.num_kv_heads = num_kv_heads
|
| 39 |
-
|
| 40 |
super().__init__(**kwargs)
|
| 41 |
|
| 42 |
class StarVectorForCausalLM(PreTrainedModel):
|
|
|
|
| 2 |
PretrainedConfig,
|
| 3 |
PreTrainedModel
|
| 4 |
)
|
| 5 |
+
import torch
|
| 6 |
class StarVectorConfig(PretrainedConfig):
|
| 7 |
model_type = "starvector"
|
| 8 |
|
|
|
|
| 18 |
use_cache: bool = True,
|
| 19 |
num_attention_heads: int = 16,
|
| 20 |
num_hidden_layers: int = 24,
|
| 21 |
+
vocab_size: int = 49152,
|
| 22 |
+
hidden_size: int = 2048,
|
| 23 |
num_kv_heads: int = 4,
|
| 24 |
+
torch_dtype: str = "bfloat16",
|
| 25 |
**kwargs,
|
| 26 |
):
|
| 27 |
self.starcoder_model_name = starcoder_model_name
|
|
|
|
| 37 |
self.vocab_size = vocab_size
|
| 38 |
self.hidden_size = hidden_size
|
| 39 |
self.num_kv_heads = num_kv_heads
|
| 40 |
+
self.torch_dtype = torch_dtype
|
| 41 |
super().__init__(**kwargs)
|
| 42 |
|
| 43 |
class StarVectorForCausalLM(PreTrainedModel):
|