Text Generation
Transformers
Safetensors
English
qwen2
python
code-generation
lora
conversational
text-generation-inference
Instructions to use Noor-Khan/python-coder-3b-research with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Noor-Khan/python-coder-3b-research with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Noor-Khan/python-coder-3b-research") 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("Noor-Khan/python-coder-3b-research") model = AutoModelForCausalLM.from_pretrained("Noor-Khan/python-coder-3b-research", 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 Noor-Khan/python-coder-3b-research with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Noor-Khan/python-coder-3b-research" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Noor-Khan/python-coder-3b-research", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Noor-Khan/python-coder-3b-research
- SGLang
How to use Noor-Khan/python-coder-3b-research 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 "Noor-Khan/python-coder-3b-research" \ --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": "Noor-Khan/python-coder-3b-research", "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 "Noor-Khan/python-coder-3b-research" \ --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": "Noor-Khan/python-coder-3b-research", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Noor-Khan/python-coder-3b-research with Docker Model Runner:
docker model run hf.co/Noor-Khan/python-coder-3b-research
|
Download README.md from Noor-Khan/python-coder-3b-research: direct link, hf CLI and curl.
- Browser
- Download file 2.15 kB
-
https://huggingface.co/Noor-Khan/python-coder-3b-research/resolve/main/README.md
- Command line
-
hf download hf://Noor-Khan/python-coder-3b-research/README.md
-
curl -L -o README.md https://huggingface.co/Noor-Khan/python-coder-3b-research/resolve/main/README.md
2.15 kB
| license: other | |
| license_name: qwen-research | |
| license_link: LICENSE | |
| base_model: huihui-ai/Qwen2.5-3B-Instruct-abliterated-SFT | |
| base_model_relation: finetune | |
| language: | |
| - en | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| tags: | |
| - python | |
| - code-generation | |
| - lora | |
| # Python Coder 3B Research | |
| **Built with Qwen.** This 3.09B-parameter model completes short Python functions from | |
| a function signature and a docstring. It is prepared for noncommercial research and | |
| evaluation under the [Qwen Research License](LICENSE). | |
| ## Training | |
| This model started from [huihui-ai/Qwen2.5-3B-Instruct-abliterated-SFT](https://huggingface.co/huihui-ai/Qwen2.5-3B-Instruct-abliterated-SFT) | |
| at revision e21343fbcabbb6225d1cb9122061404f2d21f1ad, derived from | |
| [Qwen2.5-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-3B-Instruct). | |
| The Python fine-tune used 120 LoRA steps on 165 synthetic training rows. The LoRA | |
| updates were merged into the BF16 weights. The four SafeTensors shards contain | |
| the modified model weights. See [NOTICE](NOTICE) for attribution and file changes. | |
| ## Evaluation | |
| A prompt passed when its generated function passed every test input. These were | |
| small, synthetic Python suites scored using a restricted subset of the language. | |
| | Suite | Source checkpoint | This model | | |
| | --- | ---: | ---: | | |
| | Familiar operation patterns | 124/144 | 125/144 | | |
| | Original combination challenge | 24/24 | 24/24 | | |
| | Fresh task families | 27/40 | 24/40 | | |
| The 60% fresh-task score applies to short functions in this evaluation. The | |
| benchmark did not measure repository-level bug fixing, other programming languages, | |
| or refusal behavior. Detailed results are in [evaluation.json](evaluation.json). | |
| ## Inference | |
| Load this repository with Transformers using AutoTokenizer and | |
| AutoModelForCausalLM. Use the included chat template. To match the benchmark | |
| format, give the signature and docstring in the user message and place the same | |
| signature and docstring at the start of the assistant completion. The model then | |
| generates the function body. Review and test generated code before using it. | |