Text Generation
Transformers
Safetensors
GGUF
English
gpt2
chatbot
lora
instruction-tuned
distilled
microllm2
conversational
text-generation-inference
Instructions to use MLVXN/MicroLLM2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MLVXN/MicroLLM2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MLVXN/MicroLLM2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("MLVXN/MicroLLM2") model = AutoModelForCausalLM.from_pretrained("MLVXN/MicroLLM2", device_map="auto") 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 Settings
- llama.cpp
How to use MLVXN/MicroLLM2 with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf MLVXN/MicroLLM2:Q4_K_M # Run inference directly in the terminal: llama cli -hf MLVXN/MicroLLM2:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf MLVXN/MicroLLM2:Q4_K_M # Run inference directly in the terminal: llama cli -hf MLVXN/MicroLLM2:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf MLVXN/MicroLLM2:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf MLVXN/MicroLLM2:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf MLVXN/MicroLLM2:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf MLVXN/MicroLLM2:Q4_K_M
Use Docker
docker model run hf.co/MLVXN/MicroLLM2:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use MLVXN/MicroLLM2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MLVXN/MicroLLM2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MLVXN/MicroLLM2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/MLVXN/MicroLLM2:Q4_K_M
- SGLang
How to use MLVXN/MicroLLM2 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 "MLVXN/MicroLLM2" \ --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": "MLVXN/MicroLLM2", "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 "MLVXN/MicroLLM2" \ --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": "MLVXN/MicroLLM2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use MLVXN/MicroLLM2 with Ollama:
ollama run hf.co/MLVXN/MicroLLM2:Q4_K_M
- Unsloth Studio
How to use MLVXN/MicroLLM2 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for MLVXN/MicroLLM2 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for MLVXN/MicroLLM2 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for MLVXN/MicroLLM2 to start chatting
- Docker Model Runner
How to use MLVXN/MicroLLM2 with Docker Model Runner:
docker model run hf.co/MLVXN/MicroLLM2:Q4_K_M
- Lemonade
How to use MLVXN/MicroLLM2 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull MLVXN/MicroLLM2:Q4_K_M
Run and chat with the model
lemonade run user.MicroLLM2-Q4_K_M
List all available models
lemonade list
- Atomic Chat
| { | |
| "model": "/home/zeus/microllm2/microllm2-checkpoints/final_merged", | |
| "shots": 5, | |
| "limit": 20, | |
| "overall": { | |
| "correct": 318, | |
| "total": 1140, | |
| "accuracy": 0.2789473684210526 | |
| }, | |
| "subjects": { | |
| "abstract_algebra": { | |
| "correct": 6, | |
| "total": 20, | |
| "accuracy": 0.3 | |
| }, | |
| "anatomy": { | |
| "correct": 5, | |
| "total": 20, | |
| "accuracy": 0.25 | |
| }, | |
| "astronomy": { | |
| "correct": 7, | |
| "total": 20, | |
| "accuracy": 0.35 | |
| }, | |
| "business_ethics": { | |
| "correct": 6, | |
| "total": 20, | |
| "accuracy": 0.3 | |
| }, | |
| "clinical_knowledge": { | |
| "correct": 9, | |
| "total": 20, | |
| "accuracy": 0.45 | |
| }, | |
| "college_biology": { | |
| "correct": 9, | |
| "total": 20, | |
| "accuracy": 0.45 | |
| }, | |
| "college_chemistry": { | |
| "correct": 3, | |
| "total": 20, | |
| "accuracy": 0.15 | |
| }, | |
| "college_computer_science": { | |
| "correct": 9, | |
| "total": 20, | |
| "accuracy": 0.45 | |
| }, | |
| "college_mathematics": { | |
| "correct": 7, | |
| "total": 20, | |
| "accuracy": 0.35 | |
| }, | |
| "college_medicine": { | |
| "correct": 6, | |
| "total": 20, | |
| "accuracy": 0.3 | |
| }, | |
| "college_physics": { | |
| "correct": 3, | |
| "total": 20, | |
| "accuracy": 0.15 | |
| }, | |
| "computer_security": { | |
| "correct": 6, | |
| "total": 20, | |
| "accuracy": 0.3 | |
| }, | |
| "conceptual_physics": { | |
| "correct": 1, | |
| "total": 20, | |
| "accuracy": 0.05 | |
| }, | |
| "econometrics": { | |
| "correct": 6, | |
| "total": 20, | |
| "accuracy": 0.3 | |
| }, | |
| "electrical_engineering": { | |
| "correct": 4, | |
| "total": 20, | |
| "accuracy": 0.2 | |
| }, | |
| "elementary_mathematics": { | |
| "correct": 6, | |
| "total": 20, | |
| "accuracy": 0.3 | |
| }, | |
| "formal_logic": { | |
| "correct": 2, | |
| "total": 20, | |
| "accuracy": 0.1 | |
| }, | |
| "global_facts": { | |
| "correct": 7, | |
| "total": 20, | |
| "accuracy": 0.35 | |
| }, | |
| "high_school_biology": { | |
| "correct": 9, | |
| "total": 20, | |
| "accuracy": 0.45 | |
| }, | |
| "high_school_chemistry": { | |
| "correct": 7, | |
| "total": 20, | |
| "accuracy": 0.35 | |
| }, | |
| "high_school_computer_science": { | |
| "correct": 7, | |
| "total": 20, | |
| "accuracy": 0.35 | |
| }, | |
| "high_school_european_history": { | |
| "correct": 4, | |
| "total": 20, | |
| "accuracy": 0.2 | |
| }, | |
| "high_school_geography": { | |
| "correct": 5, | |
| "total": 20, | |
| "accuracy": 0.25 | |
| }, | |
| "high_school_government_and_politics": { | |
| "correct": 4, | |
| "total": 20, | |
| "accuracy": 0.2 | |
| }, | |
| "high_school_macroeconomics": { | |
| "correct": 0, | |
| "total": 20, | |
| "accuracy": 0.0 | |
| }, | |
| "high_school_mathematics": { | |
| "correct": 4, | |
| "total": 20, | |
| "accuracy": 0.2 | |
| }, | |
| "high_school_microeconomics": { | |
| "correct": 7, | |
| "total": 20, | |
| "accuracy": 0.35 | |
| }, | |
| "high_school_physics": { | |
| "correct": 4, | |
| "total": 20, | |
| "accuracy": 0.2 | |
| }, | |
| "high_school_psychology": { | |
| "correct": 5, | |
| "total": 20, | |
| "accuracy": 0.25 | |
| }, | |
| "high_school_statistics": { | |
| "correct": 8, | |
| "total": 20, | |
| "accuracy": 0.4 | |
| }, | |
| "high_school_us_history": { | |
| "correct": 4, | |
| "total": 20, | |
| "accuracy": 0.2 | |
| }, | |
| "high_school_world_history": { | |
| "correct": 7, | |
| "total": 20, | |
| "accuracy": 0.35 | |
| }, | |
| "human_aging": { | |
| "correct": 8, | |
| "total": 20, | |
| "accuracy": 0.4 | |
| }, | |
| "human_sexuality": { | |
| "correct": 3, | |
| "total": 20, | |
| "accuracy": 0.15 | |
| }, | |
| "international_law": { | |
| "correct": 7, | |
| "total": 20, | |
| "accuracy": 0.35 | |
| }, | |
| "jurisprudence": { | |
| "correct": 8, | |
| "total": 20, | |
| "accuracy": 0.4 | |
| }, | |
| "logical_fallacies": { | |
| "correct": 7, | |
| "total": 20, | |
| "accuracy": 0.35 | |
| }, | |
| "machine_learning": { | |
| "correct": 10, | |
| "total": 20, | |
| "accuracy": 0.5 | |
| }, | |
| "management": { | |
| "correct": 4, | |
| "total": 20, | |
| "accuracy": 0.2 | |
| }, | |
| "marketing": { | |
| "correct": 7, | |
| "total": 20, | |
| "accuracy": 0.35 | |
| }, | |
| "medical_genetics": { | |
| "correct": 8, | |
| "total": 20, | |
| "accuracy": 0.4 | |
| }, | |
| "miscellaneous": { | |
| "correct": 6, | |
| "total": 20, | |
| "accuracy": 0.3 | |
| }, | |
| "moral_disputes": { | |
| "correct": 4, | |
| "total": 20, | |
| "accuracy": 0.2 | |
| }, | |
| "moral_scenarios": { | |
| "correct": 3, | |
| "total": 20, | |
| "accuracy": 0.15 | |
| }, | |
| "nutrition": { | |
| "correct": 4, | |
| "total": 20, | |
| "accuracy": 0.2 | |
| }, | |
| "philosophy": { | |
| "correct": 3, | |
| "total": 20, | |
| "accuracy": 0.15 | |
| }, | |
| "prehistory": { | |
| "correct": 5, | |
| "total": 20, | |
| "accuracy": 0.25 | |
| }, | |
| "professional_accounting": { | |
| "correct": 6, | |
| "total": 20, | |
| "accuracy": 0.3 | |
| }, | |
| "professional_law": { | |
| "correct": 7, | |
| "total": 20, | |
| "accuracy": 0.35 | |
| }, | |
| "professional_medicine": { | |
| "correct": 1, | |
| "total": 20, | |
| "accuracy": 0.05 | |
| }, | |
| "professional_psychology": { | |
| "correct": 9, | |
| "total": 20, | |
| "accuracy": 0.45 | |
| }, | |
| "public_relations": { | |
| "correct": 9, | |
| "total": 20, | |
| "accuracy": 0.45 | |
| }, | |
| "security_studies": { | |
| "correct": 5, | |
| "total": 20, | |
| "accuracy": 0.25 | |
| }, | |
| "sociology": { | |
| "correct": 4, | |
| "total": 20, | |
| "accuracy": 0.2 | |
| }, | |
| "us_foreign_policy": { | |
| "correct": 5, | |
| "total": 20, | |
| "accuracy": 0.25 | |
| }, | |
| "virology": { | |
| "correct": 5, | |
| "total": 20, | |
| "accuracy": 0.25 | |
| }, | |
| "world_religions": { | |
| "correct": 3, | |
| "total": 20, | |
| "accuracy": 0.15 | |
| } | |
| } | |
| } |