Text Generation
Transformers
Safetensors
English
spin
tiny-models
custom-architecture
story-generation
experimental
custom_code
Instructions to use Quantech/spin-80k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Quantech/spin-80k with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Quantech/spin-80k", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Quantech/spin-80k", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Quantech/spin-80k with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Quantech/spin-80k" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Quantech/spin-80k", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Quantech/spin-80k
- SGLang
How to use Quantech/spin-80k 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 "Quantech/spin-80k" \ --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": "Quantech/spin-80k", "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 "Quantech/spin-80k" \ --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": "Quantech/spin-80k", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Quantech/spin-80k with Docker Model Runner:
docker model run hf.co/Quantech/spin-80k
config changes attribute names
Browse files- configuration_spin.py +13 -2
configuration_spin.py
CHANGED
|
@@ -3,6 +3,11 @@ from transformers import PretrainedConfig
|
|
| 3 |
|
| 4 |
class SpinConfig(PretrainedConfig):
|
| 5 |
model_type = "spin"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
def __init__(
|
| 8 |
self,
|
|
@@ -16,11 +21,17 @@ class SpinConfig(PretrainedConfig):
|
|
| 16 |
tie_word_embeddings: bool = True,
|
| 17 |
**kwargs,
|
| 18 |
):
|
| 19 |
-
super().__init__(tie_word_embeddings=tie_word_embeddings, **kwargs)
|
| 20 |
self.vocab_size = vocab_size
|
| 21 |
self.max_seq_len = max_seq_len
|
| 22 |
self.d_model = d_model
|
| 23 |
self.n_layers = n_layers
|
| 24 |
self.n_heads = n_heads
|
| 25 |
self.d_ff = d_ff
|
| 26 |
-
self.norm_eps = norm_eps
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
class SpinConfig(PretrainedConfig):
|
| 5 |
model_type = "spin"
|
| 6 |
+
attribute_map = {
|
| 7 |
+
"hidden_size": "d_model",
|
| 8 |
+
"num_hidden_layers": "n_layers",
|
| 9 |
+
"num_attention_heads": "n_heads",
|
| 10 |
+
}
|
| 11 |
|
| 12 |
def __init__(
|
| 13 |
self,
|
|
|
|
| 21 |
tie_word_embeddings: bool = True,
|
| 22 |
**kwargs,
|
| 23 |
):
|
|
|
|
| 24 |
self.vocab_size = vocab_size
|
| 25 |
self.max_seq_len = max_seq_len
|
| 26 |
self.d_model = d_model
|
| 27 |
self.n_layers = n_layers
|
| 28 |
self.n_heads = n_heads
|
| 29 |
self.d_ff = d_ff
|
| 30 |
+
self.norm_eps = norm_eps
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
self.hidden_size = d_model
|
| 34 |
+
self.num_hidden_layers = n_layers
|
| 35 |
+
self.num_attention_heads = n_heads
|
| 36 |
+
|
| 37 |
+
super().__init__(tie_word_embeddings=tie_word_embeddings, **kwargs)
|