Text Generation
Transformers
Safetensors
Arabic
English
qwen2
llama-factory
lora
python
arabic
code
instruction-tuning
fine-tuned
conversational
text-generation-inference
Instructions to use jana-ashraf-ai/python-assistant with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jana-ashraf-ai/python-assistant with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="jana-ashraf-ai/python-assistant") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("jana-ashraf-ai/python-assistant") model = AutoModelForCausalLM.from_pretrained("jana-ashraf-ai/python-assistant") 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]:])) - Inference
- Local Apps Settings
- vLLM
How to use jana-ashraf-ai/python-assistant with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jana-ashraf-ai/python-assistant" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jana-ashraf-ai/python-assistant", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/jana-ashraf-ai/python-assistant
- SGLang
How to use jana-ashraf-ai/python-assistant 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 "jana-ashraf-ai/python-assistant" \ --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": "jana-ashraf-ai/python-assistant", "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 "jana-ashraf-ai/python-assistant" \ --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": "jana-ashraf-ai/python-assistant", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use jana-ashraf-ai/python-assistant with Docker Model Runner:
docker model run hf.co/jana-ashraf-ai/python-assistant
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
|
| 2 |
library_name: transformers
|
| 3 |
license: apache-2.0
|
| 4 |
base_model: Qwen/Qwen2.5-1.5B-Instruct
|
|
@@ -17,13 +17,13 @@ tags:
|
|
| 17 |
- code
|
| 18 |
- instruction-tuning
|
| 19 |
- fine-tuned
|
| 20 |
-
|
| 21 |
|
| 22 |
# 🐍 Python Assistant (Arabic)
|
| 23 |
|
| 24 |
A fine-tuned version of **Qwen2.5-1.5B-Instruct** that answers Python programming questions in **Arabic**, with structured JSON output. Fine-tuned using LoRA via LLaMA-Factory.
|
| 25 |
|
| 26 |
-
|
| 27 |
|
| 28 |
## Model Details
|
| 29 |
|
|
@@ -34,13 +34,13 @@ A fine-tuned version of **Qwen2.5-1.5B-Instruct** that answers Python programmin
|
|
| 34 |
- **License:** Apache 2.0
|
| 35 |
- **Fine-tuning method:** QLoRA (LoRA rank=32) via LLaMA-Factory
|
| 36 |
|
| 37 |
-
|
| 38 |
|
| 39 |
## What does this model do?
|
| 40 |
|
| 41 |
Given a Python programming question in English, the model returns a structured JSON answer **in Arabic**, explaining the solution step by step.
|
| 42 |
|
| 43 |
-
|
| 44 |
|
| 45 |
## How to Use
|
| 46 |
```python
|
|
@@ -74,7 +74,7 @@ outputs = model.generate(**inputs, max_new_tokens=512)
|
|
| 74 |
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 75 |
```
|
| 76 |
|
| 77 |
-
|
| 78 |
|
| 79 |
## Training Details
|
| 80 |
|
|
@@ -95,7 +95,7 @@ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
|
| 95 |
| Framework | LLaMA-Factory |
|
| 96 |
| Hardware | Google Colab T4 GPU |
|
| 97 |
|
| 98 |
-
|
| 99 |
|
| 100 |
## Training Data
|
| 101 |
|
|
@@ -105,7 +105,7 @@ The answers were annotated and structured using GPT to produce Arabic explanatio
|
|
| 105 |
|
| 106 |
**Train / Val split:** 90% / 10%
|
| 107 |
|
| 108 |
-
|
| 109 |
|
| 110 |
## Limitations
|
| 111 |
|
|
|
|
| 1 |
+
---
|
| 2 |
library_name: transformers
|
| 3 |
license: apache-2.0
|
| 4 |
base_model: Qwen/Qwen2.5-1.5B-Instruct
|
|
|
|
| 17 |
- code
|
| 18 |
- instruction-tuning
|
| 19 |
- fine-tuned
|
| 20 |
+
---
|
| 21 |
|
| 22 |
# 🐍 Python Assistant (Arabic)
|
| 23 |
|
| 24 |
A fine-tuned version of **Qwen2.5-1.5B-Instruct** that answers Python programming questions in **Arabic**, with structured JSON output. Fine-tuned using LoRA via LLaMA-Factory.
|
| 25 |
|
| 26 |
+
---
|
| 27 |
|
| 28 |
## Model Details
|
| 29 |
|
|
|
|
| 34 |
- **License:** Apache 2.0
|
| 35 |
- **Fine-tuning method:** QLoRA (LoRA rank=32) via LLaMA-Factory
|
| 36 |
|
| 37 |
+
---
|
| 38 |
|
| 39 |
## What does this model do?
|
| 40 |
|
| 41 |
Given a Python programming question in English, the model returns a structured JSON answer **in Arabic**, explaining the solution step by step.
|
| 42 |
|
| 43 |
+
---
|
| 44 |
|
| 45 |
## How to Use
|
| 46 |
```python
|
|
|
|
| 74 |
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 75 |
```
|
| 76 |
|
| 77 |
+
---
|
| 78 |
|
| 79 |
## Training Details
|
| 80 |
|
|
|
|
| 95 |
| Framework | LLaMA-Factory |
|
| 96 |
| Hardware | Google Colab T4 GPU |
|
| 97 |
|
| 98 |
+
---
|
| 99 |
|
| 100 |
## Training Data
|
| 101 |
|
|
|
|
| 105 |
|
| 106 |
**Train / Val split:** 90% / 10%
|
| 107 |
|
| 108 |
+
---
|
| 109 |
|
| 110 |
## Limitations
|
| 111 |
|