Hugging Face's logo Hugging Face
  • Models
  • Datasets
  • Spaces
  • Buckets new
  • Docs
  • Enterprise
  • Pricing

  • Log In
  • Sign Up

zai-org
/
LongWriter-glm4-9b

Text Generation
Transformers
Safetensors
English
Chinese
chatglm
feature-extraction
Long Context
llama
conversational
custom_code
Model card Files Files and versions
xet
Community
12

Instructions to use zai-org/LongWriter-glm4-9b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.

  • Libraries
  • Transformers

    How to use zai-org/LongWriter-glm4-9b with Transformers:

    # Use a pipeline as a high-level helper
    from transformers import pipeline
    
    pipe = pipeline("text-generation", model="zai-org/LongWriter-glm4-9b", trust_remote_code=True)
    messages = [
        {"role": "user", "content": "Who are you?"},
    ]
    pipe(messages)
    # Load model directly
    from transformers import AutoModel
    model = AutoModel.from_pretrained("zai-org/LongWriter-glm4-9b", trust_remote_code=True, dtype="auto")
  • Notebooks
  • Google Colab
  • Kaggle
  • Local Apps
  • vLLM

    How to use zai-org/LongWriter-glm4-9b with vLLM:

    Install from pip and serve model
    # Install vLLM from pip:
    pip install vllm
    # Start the vLLM server:
    vllm serve "zai-org/LongWriter-glm4-9b"
    # Call the server using curl (OpenAI-compatible API):
    curl -X POST "http://localhost:8000/v1/chat/completions" \
    	-H "Content-Type: application/json" \
    	--data '{
    		"model": "zai-org/LongWriter-glm4-9b",
    		"messages": [
    			{
    				"role": "user",
    				"content": "What is the capital of France?"
    			}
    		]
    	}'
    Use Docker
    docker model run hf.co/zai-org/LongWriter-glm4-9b
  • SGLang

    How to use zai-org/LongWriter-glm4-9b 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 "zai-org/LongWriter-glm4-9b" \
        --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": "zai-org/LongWriter-glm4-9b",
    		"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 "zai-org/LongWriter-glm4-9b" \
            --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": "zai-org/LongWriter-glm4-9b",
    		"messages": [
    			{
    				"role": "user",
    				"content": "What is the capital of France?"
    			}
    		]
    	}'
  • Docker Model Runner

    How to use zai-org/LongWriter-glm4-9b with Docker Model Runner:

    docker model run hf.co/zai-org/LongWriter-glm4-9b
New discussion
Resources
  • PR & discussions documentation
  • Code of Conduct
  • Hub documentation

Fix for missing _extract_past_from_model_output (cpu, text-generation-webui)

#12 opened 10 months ago by
Kefpull

TypeError: BFloat16 is not supported on MPS

1
#11 opened over 1 year ago by
hiepsiga

After importing the model into Ollama, an error occurs when the text is slightly longer.

🔥 1
#8 opened over 1 year ago by
MultEase

GGUF Quants are here!

#7 opened over 1 year ago by
aashish1904

我使用llama.cpp进行转化到ollama,遇到错误

#6 opened over 1 year ago by
sunboaizhy

Request: DOI

#5 opened over 1 year ago by
iamferdi255

Getting error while using on CPU

3
#4 opened over 1 year ago by
mohi0170

"Attention Mask Not Set"

3
#3 opened over 1 year ago by
trbielec
Company
TOS Privacy About Careers
Website
Models Datasets Spaces Pricing Docs