Text Generation
Transformers
Safetensors
English
deepseek-v3
multi-head-latent-attention
mixture-of-experts
Mixture of Experts
tinystories
tiny-model
validation
debug-model
Instructions to use shibatch/tinydeepseekv3-3m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use shibatch/tinydeepseekv3-3m with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="shibatch/tinydeepseekv3-3m")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("shibatch/tinydeepseekv3-3m", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use shibatch/tinydeepseekv3-3m with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "shibatch/tinydeepseekv3-3m" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shibatch/tinydeepseekv3-3m", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/shibatch/tinydeepseekv3-3m
- SGLang
How to use shibatch/tinydeepseekv3-3m 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 "shibatch/tinydeepseekv3-3m" \ --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": "shibatch/tinydeepseekv3-3m", "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 "shibatch/tinydeepseekv3-3m" \ --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": "shibatch/tinydeepseekv3-3m", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use shibatch/tinydeepseekv3-3m with Docker Model Runner:
docker model run hf.co/shibatch/tinydeepseekv3-3m
File size: 1,340 Bytes
6036082 | 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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | from pathlib import Path
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
MODEL_PATH = "."
MODEL_SUBFOLDER = "hf"
PROMPT = "Once upon"
SEED = 0
def main() -> None:
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model_dir = Path(MODEL_PATH) / MODEL_SUBFOLDER
tokenizer = AutoTokenizer.from_pretrained(model_dir)
model = AutoModelForCausalLM.from_pretrained(
model_dir,
dtype=torch.float32,
).to(device)
model.eval()
input_ids = torch.tensor(
[
[tokenizer.bos_token_id]
+ tokenizer.encode(PROMPT, add_special_tokens=False)
],
dtype=torch.long,
device=device,
)
torch.manual_seed(SEED)
if device.type == "cuda":
torch.cuda.manual_seed_all(SEED)
with torch.inference_mode():
output = model.generate(
input_ids=input_ids,
max_new_tokens=100,
do_sample=True,
temperature=0.8,
top_p=0.95,
top_k=40,
repetition_penalty=1.1,
use_cache=True,
pad_token_id=tokenizer.pad_token_id,
eos_token_id=tokenizer.eos_token_id,
)
print(tokenizer.decode(output[0].tolist(), skip_special_tokens=True))
if __name__ == "__main__":
main()
|