Text Generation
Transformers
Safetensors
English
llama
micro
nano
small
supra
cpu
cpu-only
microsupra
text-generation-inference
Instructions to use SupraLabs/MicroSupra-10k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SupraLabs/MicroSupra-10k with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SupraLabs/MicroSupra-10k")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("SupraLabs/MicroSupra-10k") model = AutoModelForCausalLM.from_pretrained("SupraLabs/MicroSupra-10k", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use SupraLabs/MicroSupra-10k with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SupraLabs/MicroSupra-10k" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SupraLabs/MicroSupra-10k", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/SupraLabs/MicroSupra-10k
- SGLang
How to use SupraLabs/MicroSupra-10k 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 "SupraLabs/MicroSupra-10k" \ --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": "SupraLabs/MicroSupra-10k", "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 "SupraLabs/MicroSupra-10k" \ --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": "SupraLabs/MicroSupra-10k", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use SupraLabs/MicroSupra-10k with Docker Model Runner:
docker model run hf.co/SupraLabs/MicroSupra-10k
Download scripts/inference.py from SupraLabs/MicroSupra-10k: direct link, hf CLI and curl.
- Browser
- Download file 1.42 kB
-
https://huggingface.co/SupraLabs/MicroSupra-10k/resolve/main/scripts/inference.py
- Command line
-
hf download hf://SupraLabs/MicroSupra-10k/scripts/inference.py
-
curl -L -o inference.py https://huggingface.co/SupraLabs/MicroSupra-10k/resolve/main/scripts/inference.py
1.42 kB
| """MicroSupra-10k — inferência de demonstração (mesmos prompts do card original).""" | |
| import os | |
| from huggingface_hub import hf_hub_download | |
| from transformers import LlamaForCausalLM, PreTrainedTokenizerFast | |
| import torch | |
| BASE = os.path.dirname(os.path.abspath(__file__)) | |
| OUT = f"{BASE}/out" | |
| tok_path = hf_hub_download("SupraLabs/MicroSupra-1k", "tokenizer.json") | |
| tokenizer = PreTrainedTokenizerFast( | |
| tokenizer_file=tok_path, | |
| bos_token="<s>", eos_token="</s>", pad_token="<pad>", unk_token="<unk>", | |
| ) | |
| model = LlamaForCausalLM.from_pretrained(OUT) | |
| model.eval() | |
| print(f"[*] Parâmetros: {sum(p.numel() for p in model.parameters()):,}", flush=True) | |
| prompts = [ | |
| "My name is ", | |
| "The main concept of physics is ", | |
| "Question: What is the capital of France?\nAnswer: ", | |
| ] | |
| for prompt in prompts: | |
| inputs = tokenizer(prompt, return_tensors="pt") | |
| with torch.no_grad(): | |
| out = model.generate( | |
| input_ids=inputs["input_ids"], | |
| attention_mask=inputs["attention_mask"], | |
| max_new_tokens=120, | |
| do_sample=True, | |
| temperature=0.35, | |
| top_p=0.85, | |
| repetition_penalty=1.2, | |
| pad_token_id=tokenizer.pad_token_id, | |
| eos_token_id=tokenizer.eos_token_id, | |
| ) | |
| print(f"\nPROMPT: {prompt!r}\nOUTPUT: {tokenizer.decode(out[0], skip_special_tokens=True)!r}", flush=True) | |
| print("\n[*] DONE", flush=True) |