Instructions to use meituan-longcat/LongCat-Flash-Thinking with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use meituan-longcat/LongCat-Flash-Thinking with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="meituan-longcat/LongCat-Flash-Thinking", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("meituan-longcat/LongCat-Flash-Thinking", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use meituan-longcat/LongCat-Flash-Thinking with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "meituan-longcat/LongCat-Flash-Thinking" # 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-Flash-Thinking", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/meituan-longcat/LongCat-Flash-Thinking
- SGLang
How to use meituan-longcat/LongCat-Flash-Thinking 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-Flash-Thinking" \ --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-Flash-Thinking", "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-Flash-Thinking" \ --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-Flash-Thinking", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use meituan-longcat/LongCat-Flash-Thinking with Docker Model Runner:
docker model run hf.co/meituan-longcat/LongCat-Flash-Thinking
Update configuration_longcat_flash.py (#5)
Browse files- Update configuration_longcat_flash.py (4357d408aa0bfbac7d38b5cea2bda88745a338b5)
Co-authored-by: WangJianing <wjn1996@users.noreply.huggingface.co>
configuration_longcat_flash.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
|
| 2 |
"""LongcatFlash model configuration"""
|
| 3 |
|
| 4 |
from transformers.configuration_utils import PretrainedConfig
|
|
@@ -53,7 +52,7 @@ class LongcatFlashConfig(PretrainedConfig):
|
|
| 53 |
Dimension of the value heads.
|
| 54 |
qk_nope_head_dim (`int`, *optional*, defaults to 128):
|
| 55 |
Dimension of the query/key heads that don't use rotary position embeddings.
|
| 56 |
-
norm_topk_prob (`bool`, *optional*, defaults to `
|
| 57 |
Whether to normalize the weights of the routed experts.
|
| 58 |
hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
|
| 59 |
The non-linear activation function (function or string) in the decoder.
|
|
@@ -213,4 +212,4 @@ class LongcatFlashConfig(PretrainedConfig):
|
|
| 213 |
return self.num_layers
|
| 214 |
|
| 215 |
|
| 216 |
-
__all__ = ["LongcatFlashConfig"]
|
|
|
|
|
|
|
| 1 |
"""LongcatFlash model configuration"""
|
| 2 |
|
| 3 |
from transformers.configuration_utils import PretrainedConfig
|
|
|
|
| 52 |
Dimension of the value heads.
|
| 53 |
qk_nope_head_dim (`int`, *optional*, defaults to 128):
|
| 54 |
Dimension of the query/key heads that don't use rotary position embeddings.
|
| 55 |
+
norm_topk_prob (`bool`, *optional*, defaults to `False`):
|
| 56 |
Whether to normalize the weights of the routed experts.
|
| 57 |
hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
|
| 58 |
The non-linear activation function (function or string) in the decoder.
|
|
|
|
| 212 |
return self.num_layers
|
| 213 |
|
| 214 |
|
| 215 |
+
__all__ = ["LongcatFlashConfig"]
|