Instructions to use CodeShield/Qwen3-8B-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CodeShield/Qwen3-8B-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CodeShield/Qwen3-8B-Base") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("CodeShield/Qwen3-8B-Base") model = AutoModelForCausalLM.from_pretrained("CodeShield/Qwen3-8B-Base") 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 CodeShield/Qwen3-8B-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CodeShield/Qwen3-8B-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CodeShield/Qwen3-8B-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/CodeShield/Qwen3-8B-Base
- SGLang
How to use CodeShield/Qwen3-8B-Base 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 "CodeShield/Qwen3-8B-Base" \ --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": "CodeShield/Qwen3-8B-Base", "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 "CodeShield/Qwen3-8B-Base" \ --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": "CodeShield/Qwen3-8B-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use CodeShield/Qwen3-8B-Base with Docker Model Runner:
docker model run hf.co/CodeShield/Qwen3-8B-Base
Upload Qwen3ForCausalLM
Browse files- README.md +1 -1
- config.json +4 -4
- generation_config.json +2 -2
README.md
CHANGED
|
@@ -2,4 +2,4 @@
|
|
| 2 |
license: apache-2.0
|
| 3 |
pipeline_tag: text-generation
|
| 4 |
library_name: transformers
|
| 5 |
-
---
|
|
|
|
| 2 |
license: apache-2.0
|
| 3 |
pipeline_tag: text-generation
|
| 4 |
library_name: transformers
|
| 5 |
+
---
|
config.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
],
|
| 5 |
"attention_bias": false,
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
-
"bos_token_id":
|
| 8 |
"dtype": "bfloat16",
|
| 9 |
"eos_token_id": 151643,
|
| 10 |
"head_dim": 128,
|
|
@@ -50,7 +50,7 @@
|
|
| 50 |
"full_attention",
|
| 51 |
"full_attention"
|
| 52 |
],
|
| 53 |
-
"max_position_embeddings":
|
| 54 |
"max_window_layers": 36,
|
| 55 |
"model_type": "qwen3",
|
| 56 |
"num_attention_heads": 32,
|
|
@@ -59,12 +59,12 @@
|
|
| 59 |
"pad_token_id": 151656,
|
| 60 |
"rms_norm_eps": 1e-06,
|
| 61 |
"rope_parameters": {
|
| 62 |
-
"rope_theta":
|
| 63 |
"rope_type": "default"
|
| 64 |
},
|
| 65 |
"sliding_window": null,
|
| 66 |
"tie_word_embeddings": false,
|
| 67 |
-
"transformers_version": "5.
|
| 68 |
"use_cache": true,
|
| 69 |
"use_sliding_window": false,
|
| 70 |
"vocab_size": 151936
|
|
|
|
| 4 |
],
|
| 5 |
"attention_bias": false,
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": null,
|
| 8 |
"dtype": "bfloat16",
|
| 9 |
"eos_token_id": 151643,
|
| 10 |
"head_dim": 128,
|
|
|
|
| 50 |
"full_attention",
|
| 51 |
"full_attention"
|
| 52 |
],
|
| 53 |
+
"max_position_embeddings": 131072,
|
| 54 |
"max_window_layers": 36,
|
| 55 |
"model_type": "qwen3",
|
| 56 |
"num_attention_heads": 32,
|
|
|
|
| 59 |
"pad_token_id": 151656,
|
| 60 |
"rms_norm_eps": 1e-06,
|
| 61 |
"rope_parameters": {
|
| 62 |
+
"rope_theta": 10000000,
|
| 63 |
"rope_type": "default"
|
| 64 |
},
|
| 65 |
"sliding_window": null,
|
| 66 |
"tie_word_embeddings": false,
|
| 67 |
+
"transformers_version": "5.8.1",
|
| 68 |
"use_cache": true,
|
| 69 |
"use_sliding_window": false,
|
| 70 |
"vocab_size": 151936
|
generation_config.json
CHANGED
|
@@ -7,6 +7,6 @@
|
|
| 7 |
151656
|
| 8 |
],
|
| 9 |
"pad_token_id": 151656,
|
| 10 |
-
"transformers_version": "5.
|
| 11 |
"trust_remote_code": true
|
| 12 |
-
}
|
|
|
|
| 7 |
151656
|
| 8 |
],
|
| 9 |
"pad_token_id": 151656,
|
| 10 |
+
"transformers_version": "5.8.1",
|
| 11 |
"trust_remote_code": true
|
| 12 |
+
}
|