Text Generation
Transformers
Safetensors
English
matriochka
matryoshka
nested-models
speculative-decoding
model-suite
distillation
custom_code
Instructions to use nthngdy/matryoshka-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nthngdy/matryoshka-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nthngdy/matryoshka-3B", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("nthngdy/matryoshka-3B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nthngdy/matryoshka-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nthngdy/matryoshka-3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nthngdy/matryoshka-3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/nthngdy/matryoshka-3B
- SGLang
How to use nthngdy/matryoshka-3B 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 "nthngdy/matryoshka-3B" \ --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": "nthngdy/matryoshka-3B", "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 "nthngdy/matryoshka-3B" \ --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": "nthngdy/matryoshka-3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use nthngdy/matryoshka-3B with Docker Model Runner:
docker model run hf.co/nthngdy/matryoshka-3B
| { | |
| "architectures": [ | |
| "MatriochkaForCausalLM" | |
| ], | |
| "auto_map": { | |
| "AutoConfig": "modeling_matriochka.MatriochkaConfig", | |
| "AutoModelForCausalLM": "modeling_matriochka.MatriochkaForCausalLM" | |
| }, | |
| "bos_token_id": 0, | |
| "dtype": "float32", | |
| "eos_token_id": 0, | |
| "junction_type": "norm", | |
| "model_type": "matriochka", | |
| "sub_model_configs": [ | |
| { | |
| "head_dim": 64, | |
| "hidden_size": 1024, | |
| "intermediate_size": 4096, | |
| "max_position_embeddings": 8192, | |
| "num_attention_heads": 16, | |
| "num_hidden_layers": 24, | |
| "num_key_value_heads": 16, | |
| "rms_norm_eps": 1e-05, | |
| "rope_theta": 100000.0, | |
| "tie_word_embeddings": false, | |
| "vocab_size": 49152 | |
| }, | |
| { | |
| "head_dim": 96, | |
| "hidden_size": 2304, | |
| "intermediate_size": 9216, | |
| "max_position_embeddings": 8192, | |
| "num_attention_heads": 24, | |
| "num_hidden_layers": 10, | |
| "num_key_value_heads": 24, | |
| "rms_norm_eps": 1e-05, | |
| "rope_theta": 100000.0, | |
| "tie_word_embeddings": false, | |
| "vocab_size": 49152 | |
| }, | |
| { | |
| "head_dim": 128, | |
| "hidden_size": 4352, | |
| "intermediate_size": 17408, | |
| "max_position_embeddings": 8192, | |
| "num_attention_heads": 34, | |
| "num_hidden_layers": 5, | |
| "num_key_value_heads": 34, | |
| "rms_norm_eps": 1e-05, | |
| "rope_theta": 100000.0, | |
| "tie_word_embeddings": false, | |
| "vocab_size": 49152 | |
| } | |
| ], | |
| "sub_model_tags": [ | |
| "500M_42B", | |
| "1-5B_42B", | |
| "3B_42B" | |
| ], | |
| "transformers_version": "5.6.2", | |
| "vocab_size": 49152 | |
| } | |