Downloads · 30 days
5
4% of all-time downloads
shenwenAI/shenwen-coderV2-Instruct
shenwen-coderV2-Instruct is a machine learning model from shenwenAI. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
5
4% of all-time downloads
All-time downloads
116
Public
Parameters
494M
1000 MB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors988 MB · 99%
From the Hugging Face model README
shenwen-coderV2-Instruct is an instruction-tuned code generation model based on Qwen2.5-Coder-0.5B-Instruct, optimized for various code generation tasks.
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "shenwenAI/shenwen-coderV2-Instruct"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
prompt = "Write a Python function to calculate factorial:"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
from vllm import LLM, SamplingParams
llm = LLM(model="shenwenAI/shenwen-coderV2-Instruct")
sampling_params = SamplingParams(temperature=0.8, top_p=0.95, max_tokens=512)
prompts = ["Write a Python function to calculate factorial:"]
outputs = llm.generate(prompts, sampling_params)
print(outputs[0].outputs[0].text)
For optimized code generation, we recommend using our custom swllm.cpp tool:
# Clone swllm.cpp
git clone https://github.com/shenwenAI/swllm.cpp
cd swllm.cpp
# Build with this model
# Convert model to GGUF format first if needed
# Run inference
./build/bin/swllm-cli -m path/to/model.gguf -n 512 -p "Write a Python function to calculate factorial:"
swllm.cpp provides optimized code generation capabilities for enhanced performance and quality.
For quantized versions, please visit: shenwenAI/shenwen-coderV2-GGUF
| Quantization | Size |
|---|---|
| Q2_K | 339 MB |
| Q4_K_M | 398 MB |
| Q5_K_M | 420 MB |
| Q8_0 | 531 MB |
| F16 | 994 MB |
Apache 2.0 - See LICENSE
If this model is helpful, please consider giving us a star on GitHub and following us on social media!