Instructions to use meituan-longcat/LongCat-2.0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use meituan-longcat/LongCat-2.0 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="meituan-longcat/LongCat-2.0") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import LongcatCausalLM model = LongcatCausalLM.from_pretrained("meituan-longcat/LongCat-2.0", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use meituan-longcat/LongCat-2.0 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "meituan-longcat/LongCat-2.0" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "meituan-longcat/LongCat-2.0", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/meituan-longcat/LongCat-2.0
- SGLang
How to use meituan-longcat/LongCat-2.0 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 "meituan-longcat/LongCat-2.0" \ --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": "meituan-longcat/LongCat-2.0", "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 "meituan-longcat/LongCat-2.0" \ --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": "meituan-longcat/LongCat-2.0", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use meituan-longcat/LongCat-2.0 with Docker Model Runner:
docker model run hf.co/meituan-longcat/LongCat-2.0
upload config.json
Browse files- config.json +61 -0
config.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"LongcatCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"vocab_size": 163840,
|
| 8 |
+
"hidden_size": 8192,
|
| 9 |
+
"ffn_hidden_size": 12288,
|
| 10 |
+
"expert_ffn_hidden_size": 2048,
|
| 11 |
+
"num_layers": 38,
|
| 12 |
+
"num_attention_heads": 64,
|
| 13 |
+
"kv_lora_rank": 512,
|
| 14 |
+
"q_lora_rank": 1536,
|
| 15 |
+
"qk_rope_head_dim": 64,
|
| 16 |
+
"v_head_dim": 128,
|
| 17 |
+
"qk_nope_head_dim": 128,
|
| 18 |
+
"mla_scale_q_lora": true,
|
| 19 |
+
"mla_scale_kv_lora": true,
|
| 20 |
+
"routed_scaling_factor": 9,
|
| 21 |
+
"n_routed_experts": 768,
|
| 22 |
+
"max_position_embeddings": 262144,
|
| 23 |
+
"rms_norm_eps": 1e-5,
|
| 24 |
+
"use_cache": true,
|
| 25 |
+
"bos_token_id": 1,
|
| 26 |
+
"eos_token_id": 2,
|
| 27 |
+
"rope_theta": 1000000.0,
|
| 28 |
+
"rope_scaling": {
|
| 29 |
+
"original_max_position_embeddings": 8192,
|
| 30 |
+
"rope_type": "deepseek_yarn",
|
| 31 |
+
"factor": 120,
|
| 32 |
+
"beta_fast": 32,
|
| 33 |
+
"beta_slow": 1,
|
| 34 |
+
"mscale": 1,
|
| 35 |
+
"mscale_all_dim": 1
|
| 36 |
+
},
|
| 37 |
+
"attention_method": "MLA",
|
| 38 |
+
"zero_expert_num": 128,
|
| 39 |
+
"zero_expert_type": "identity",
|
| 40 |
+
"moe_topk": 12,
|
| 41 |
+
"use_mla": 1,
|
| 42 |
+
"moe_switch_token_num": 1024,
|
| 43 |
+
"moe_impl": "mix",
|
| 44 |
+
"oe_vocab_size_ratio": 100.567,
|
| 45 |
+
"oe_neighbor_num": 5,
|
| 46 |
+
"oe_split_num": 4,
|
| 47 |
+
|
| 48 |
+
"mtp_num_layers": 3,
|
| 49 |
+
"mtp_replicate_modules": true,
|
| 50 |
+
"mtp_disable_over_tokenizer": true,
|
| 51 |
+
|
| 52 |
+
"index_n_heads": 32,
|
| 53 |
+
"index_head_dim": 128,
|
| 54 |
+
"index_topk": 2048,
|
| 55 |
+
"index_k_norm_type": "rms",
|
| 56 |
+
"cli_factor": 2,
|
| 57 |
+
"dsa_mtp_cli": true,
|
| 58 |
+
"index_local_tokens": 1024,
|
| 59 |
+
"index_init_tokens": 16
|
| 60 |
+
}
|
| 61 |
+
|