Instructions to use AIDC-AI/Marco-Mini-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AIDC-AI/Marco-Mini-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AIDC-AI/Marco-Mini-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("AIDC-AI/Marco-Mini-Instruct") model = AutoModelForCausalLM.from_pretrained("AIDC-AI/Marco-Mini-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use AIDC-AI/Marco-Mini-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AIDC-AI/Marco-Mini-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AIDC-AI/Marco-Mini-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AIDC-AI/Marco-Mini-Instruct
- SGLang
How to use AIDC-AI/Marco-Mini-Instruct 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 "AIDC-AI/Marco-Mini-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AIDC-AI/Marco-Mini-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "AIDC-AI/Marco-Mini-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AIDC-AI/Marco-Mini-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use AIDC-AI/Marco-Mini-Instruct with Docker Model Runner:
docker model run hf.co/AIDC-AI/Marco-Mini-Instruct
How to prevent repetitions?
On llama.cpp (current build)
I tried q4_K_M
llama-server -m ./Marco-Mini-Instruct.Q4_K_M.gguf --no-webui --ctx-checkpoints 4 -b 512 -ub 1024 --ctx-size 16834 --cache-type-k q8_0 --cache-type-v q8_0 -t 4 --parallel 1 --spec-type ngram-mod --spec-ngram-mod-n-match 40 --spec-ngram-mod-n-min 0 --spec-ngram-mod-n-max 16 -fa on --no-mmproj --fit on --no-warmup
and q6_K
/usr/local/bin/llama-server -m /media/sda3/Models/Marco-Nano-Instruct.i1-Q6_K.gguf --no-webui --ctx-checkpoints 4 -b 512 -ub 1024 --ctx-size 16834 --cache-type-k q8_0 --cache-type-v q8_0 -t 4 --parallel 1 --spec-type ngram-mod --spec-ngram-mod-n-match 40 --spec-ngram-mod-n-min 0 --spec-ngram-mod-n-max 16 -fa on --no-mmproj --fit on --no-warmup
Very often i get repetition loops.
# Use a more robust method: use a color histogram and threshold
# For simplicity, use a threshold on the L channel
# But we need to use a color space that is perceptually uniform
# Use a more robust method: use a color histogram and threshold
# For simplicity, use a threshold on the L channel
# But we need to use a color space that is perceptually uniform
# Use a more robust method: use a color histogram and threshold
# For simplicity, use a threshold on the L channel
I use these settings:
parameters="$(jq -nR '{
temperature: 1,
top_p: 1,
top_k: 1,
min_p: 0.0,
repeat_penalty: 1.0,
presence_penalty: 0.5,
jinja: true,
flash_attn: true,
cont_batching: true,
repeat_last_n: 0,
penalize_nl: false,
n_predict: -1,
stream: true,
cache_prompt: true,
thinking_budget_tokens: 240,
}')"
Is there a way to avoid the loops?
Thanks for the interesting model.
I am now testing with fewer parameters and seem to have much better success:
parameters="$(jq -nR '{
jinja: true,
flash_attn: true,
cont_batching: true,
repeat_last_n: 0,
penalize_nl: false,
n_predict: -1,
stream: true,
cache_prompt: true,
thinking_budget_tokens: 240,
}')"
Performance on ryzen 3500u laptop (+ vulkan on Vega8) is approxL: pp:44 tg: 13.5
It is one of the smartest 10+t/s models to have run on this laptop. Congratulations.