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
File size: 1,020 Bytes
759d613 d1c8f85 759d613 d1c8f85 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | from transformers import PretrainedConfig
class SpinConfig(PretrainedConfig):
model_type = "spin"
attribute_map = {
"hidden_size": "d_model",
"num_hidden_layers": "n_layers",
"num_attention_heads": "n_heads",
}
def __init__(
self,
vocab_size: int = 512,
max_seq_len: int = 256,
d_model: int = 48,
n_layers: int = 2,
n_heads: int = 4,
d_ff: int = 128,
norm_eps: float = 1e-5,
tie_word_embeddings: bool = True,
**kwargs,
):
self.vocab_size = vocab_size
self.max_seq_len = max_seq_len
self.d_model = d_model
self.n_layers = n_layers
self.n_heads = n_heads
self.d_ff = d_ff
self.norm_eps = norm_eps
self.hidden_size = d_model
self.num_hidden_layers = n_layers
self.num_attention_heads = n_heads
super().__init__(tie_word_embeddings=tie_word_embeddings, **kwargs) |