Text Generation
Transformers
Safetensors
English
qwen3
competitive-programming
cpp
algorithm-explanation
code-understanding
lora
experimental
codeforces
leetcode
conversational
text-generation-inference
Instructions to use orucexe/Qwen3-8B-Algorithmic-Code-Analyzer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use orucexe/Qwen3-8B-Algorithmic-Code-Analyzer with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="orucexe/Qwen3-8B-Algorithmic-Code-Analyzer") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("orucexe/Qwen3-8B-Algorithmic-Code-Analyzer") model = AutoModelForCausalLM.from_pretrained("orucexe/Qwen3-8B-Algorithmic-Code-Analyzer", device_map="auto") 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use orucexe/Qwen3-8B-Algorithmic-Code-Analyzer with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "orucexe/Qwen3-8B-Algorithmic-Code-Analyzer" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "orucexe/Qwen3-8B-Algorithmic-Code-Analyzer", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/orucexe/Qwen3-8B-Algorithmic-Code-Analyzer
- SGLang
How to use orucexe/Qwen3-8B-Algorithmic-Code-Analyzer 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 "orucexe/Qwen3-8B-Algorithmic-Code-Analyzer" \ --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": "orucexe/Qwen3-8B-Algorithmic-Code-Analyzer", "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 "orucexe/Qwen3-8B-Algorithmic-Code-Analyzer" \ --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": "orucexe/Qwen3-8B-Algorithmic-Code-Analyzer", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use orucexe/Qwen3-8B-Algorithmic-Code-Analyzer with Docker Model Runner:
docker model run hf.co/orucexe/Qwen3-8B-Algorithmic-Code-Analyzer
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: Qwen3-8B Algorithmic Code Analyzer
|
| 3 |
+
base_model: Qwen/Qwen3-8B
|
| 4 |
+
base_model_relation: finetune
|
| 5 |
+
library_name: transformers
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
language:
|
| 8 |
+
- en
|
| 9 |
+
tags:
|
| 10 |
+
- competitive-programming
|
| 11 |
+
- cpp
|
| 12 |
+
- algorithm-explanation
|
| 13 |
+
- code-understanding
|
| 14 |
+
- lora
|
| 15 |
+
- experimental
|
| 16 |
+
- codeforces
|
| 17 |
+
- leetcode
|
| 18 |
+
datasets:
|
| 19 |
+
- orucexe/algorithmic-code-understanding
|
| 20 |
+
license: apache-2.0
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
# Qwen3-8B Algorithmic Code Analyzer
|
| 24 |
+
|
| 25 |
+
Experimental Qwen3-8B fine-tune for exploring **C++ code explanations, algorithm ideas, invariants, complexity and explanation checking**.
|
| 26 |
+
Trained on 3,613 [problem → code + analysis examples](https://huggingface.co/datasets/orucexe/algorithmic-code-understanding); supplied-code analysis is an exploratory use.
|
| 27 |
+
|
| 28 |
+
## Usage
|
| 29 |
+
|
| 30 |
+
```bash
|
| 31 |
+
pip install "transformers>=4.51,<5" accelerate torch
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
```python
|
| 35 |
+
import torch
|
| 36 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 37 |
+
|
| 38 |
+
repo = "orucexe/Qwen3-8B-Algorithmic-Code-Analyzer"
|
| 39 |
+
tokenizer = AutoTokenizer.from_pretrained(repo)
|
| 40 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 41 |
+
repo, torch_dtype="auto", device_map="auto"
|
| 42 |
+
).eval()
|
| 43 |
+
|
| 44 |
+
prompt = """Explain what this C++ code computes, its core idea,
|
| 45 |
+
loop invariant, time and auxiliary-space complexity, and edge cases.
|
| 46 |
+
Do not rewrite the code.
|
| 47 |
+
|
| 48 |
+
long long sum(const std::vector<int>& a) {
|
| 49 |
+
long long s = 0;
|
| 50 |
+
for (int x : a) s += x;
|
| 51 |
+
return s;
|
| 52 |
+
}
|
| 53 |
+
"""
|
| 54 |
+
inputs = tokenizer.apply_chat_template(
|
| 55 |
+
[{"role": "user", "content": prompt}],
|
| 56 |
+
add_generation_prompt=True, enable_thinking=False,
|
| 57 |
+
return_dict=True, return_tensors="pt"
|
| 58 |
+
).to(model.device)
|
| 59 |
+
with torch.inference_mode():
|
| 60 |
+
output = model.generate(
|
| 61 |
+
**inputs, max_new_tokens=1024, do_sample=True,
|
| 62 |
+
temperature=0.7, top_p=0.8, top_k=20,
|
| 63 |
+
pad_token_id=tokenizer.eos_token_id
|
| 64 |
+
)
|
| 65 |
+
print(tokenizer.decode(output[0, inputs.input_ids.shape[1]:], skip_special_tokens=True))
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
For thinking mode, set `enable_thinking=True`, `temperature=0.6`, `top_p=0.95` ([Qwen guidance](https://huggingface.co/Qwen/Qwen3-8B#best-practices)).
|