Hugging Face's logo Hugging Face
  • Models
  • Datasets
  • Spaces
  • Buckets new
  • Docs
  • Enterprise
  • Pricing
    • Website
      • Tasks
      • HuggingChat
      • Collections
      • Languages
      • Organizations
    • Community
      • Blog
      • Posts
      • Daily Papers
      • Hardware
      • Learn
      • Discord
      • Forum
      • GitHub
    • Solutions
      • Team & Enterprise
      • Hugging Face PRO
      • Enterprise Support
      • Inference Providers
      • Inference Endpoints
      • Storage Buckets

  • Log In
  • Sign Up

Nanbeige
/
Nanbeige4.2-3B

Text Generation
Transformers
Safetensors
English
Chinese
nanbeige
llm
conversational
custom_code
Eval Results
Model card Files Files and versions
xet
Community
13

Instructions to use Nanbeige/Nanbeige4.2-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.

  • Libraries
  • Transformers

    How to use Nanbeige/Nanbeige4.2-3B with Transformers:

    # Use a pipeline as a high-level helper
    from transformers import pipeline
    
    pipe = pipeline("text-generation", model="Nanbeige/Nanbeige4.2-3B", trust_remote_code=True)
    messages = [
        {"role": "user", "content": "Who are you?"},
    ]
    pipe(messages)
    # Load model directly
    from transformers import AutoModelForCausalLM
    model = AutoModelForCausalLM.from_pretrained("Nanbeige/Nanbeige4.2-3B", trust_remote_code=True, device_map="auto")
  • Notebooks
  • Google Colab
  • Kaggle
  • Local Apps Settings
  • vLLM

    How to use Nanbeige/Nanbeige4.2-3B with vLLM:

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

    How to use Nanbeige/Nanbeige4.2-3B 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 "Nanbeige/Nanbeige4.2-3B" \
        --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": "Nanbeige/Nanbeige4.2-3B",
    		"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 "Nanbeige/Nanbeige4.2-3B" \
            --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": "Nanbeige/Nanbeige4.2-3B",
    		"messages": [
    			{
    				"role": "user",
    				"content": "What is the capital of France?"
    			}
    		]
    	}'
  • Docker Model Runner

    How to use Nanbeige/Nanbeige4.2-3B with Docker Model Runner:

    docker model run hf.co/Nanbeige/Nanbeige4.2-3B
New discussion
Resources
  • PR & discussions documentation
  • Code of Conduct
  • Hub documentation

Installation Video and Testing - Step by Step

👍 4
#13 opened 1 day ago by
fahdmirzac

Do you have any plans to include multilingual support?

👀 1
#12 opened 1 day ago by
mangoo3431

Can't use bnb 4bit to load your model.

#11 opened 1 day ago by
Gavin-chen

preserve_thinking

5
#9 opened 2 days ago by
owao

Please specify max context size in model's card.

1
#8 opened 2 days ago by
Reverger

Issue: Grammar-constrained decoding (`response_format: json_schema`) fails at sampler init — but `--no-jinja` fixes it

#6 opened 2 days ago by
dmhagar

Any plans for FP8?

1
#5 opened 2 days ago by
spanspek

Q on the model

4
#3 opened 3 days ago by
TomLucidor

damn i was in the process of doing something very similar

1
#2 opened 3 days ago by
nraxl1

gguf

➕ 3
4
#1 opened 3 days ago by
Tapka
Company
TOS Privacy About Careers
Website
Models Datasets Spaces Pricing Docs