Instructions to use yujiepan/minimax-m2-tiny-random with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yujiepan/minimax-m2-tiny-random with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yujiepan/minimax-m2-tiny-random", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("yujiepan/minimax-m2-tiny-random", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("yujiepan/minimax-m2-tiny-random", trust_remote_code=True) 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 yujiepan/minimax-m2-tiny-random with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yujiepan/minimax-m2-tiny-random" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yujiepan/minimax-m2-tiny-random", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/yujiepan/minimax-m2-tiny-random
- SGLang
How to use yujiepan/minimax-m2-tiny-random 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 "yujiepan/minimax-m2-tiny-random" \ --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": "yujiepan/minimax-m2-tiny-random", "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 "yujiepan/minimax-m2-tiny-random" \ --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": "yujiepan/minimax-m2-tiny-random", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use yujiepan/minimax-m2-tiny-random with Docker Model Runner:
docker model run hf.co/yujiepan/minimax-m2-tiny-random
Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -8,9 +8,16 @@ This tiny model is intended for debugging. It is randomly initialized using the
|
|
| 8 |
|
| 9 |
### Example usage:
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
```python
|
| 12 |
import torch
|
| 13 |
-
|
| 14 |
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
| 15 |
|
| 16 |
model_id = "yujiepan/minimax-m2-tiny-random"
|
|
@@ -31,9 +38,8 @@ print(pipe('Write an article about Artificial Intelligence.'))
|
|
| 31 |
import json
|
| 32 |
from pathlib import Path
|
| 33 |
|
| 34 |
-
import torch
|
| 35 |
-
|
| 36 |
import accelerate
|
|
|
|
| 37 |
from huggingface_hub import file_exists, hf_hub_download
|
| 38 |
from transformers import (
|
| 39 |
AutoConfig,
|
|
|
|
| 8 |
|
| 9 |
### Example usage:
|
| 10 |
|
| 11 |
+
- vLLM
|
| 12 |
+
|
| 13 |
+
```bash
|
| 14 |
+
vllm serve yujiepan/minimax-m2-tiny-random --trust-remote-code
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
- Transformers
|
| 18 |
+
|
| 19 |
```python
|
| 20 |
import torch
|
|
|
|
| 21 |
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
| 22 |
|
| 23 |
model_id = "yujiepan/minimax-m2-tiny-random"
|
|
|
|
| 38 |
import json
|
| 39 |
from pathlib import Path
|
| 40 |
|
|
|
|
|
|
|
| 41 |
import accelerate
|
| 42 |
+
import torch
|
| 43 |
from huggingface_hub import file_exists, hf_hub_download
|
| 44 |
from transformers import (
|
| 45 |
AutoConfig,
|