How to use from
SGLangUse 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 "MalikIbrar/flan-python-expert" \
--host 0.0.0.0 \
--port 30000# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "MalikIbrar/flan-python-expert",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'Quick Links
flan-python-expert π
This model is a fine-tuned version of google/flan-t5-base on the codeagent-python dataset.
It is designed to generate Python code from natural language instructions.
π§ Model Details
- Base Model: FLAN-T5 Base
- Fine-tuned on: Python code dataset (
codeagent-python) - Task: Text-to-code generation
- Language: English
- Framework: π€ Transformers
- Library:
adapter-transformers
ποΈ Training
The model was trained using the following setup:
from transformers import TrainingArguments
training_args = TrainingArguments(
output_dir="flan-python-expert",
evaluation_strategy="epoch",
learning_rate=2e-6,
per_device_train_batch_size=1,
per_device_eval_batch_size=1,
num_train_epochs=1,
weight_decay=0.01,
save_total_limit=2,
logging_steps=1,
push_to_hub=False,
)
Trained for 1 epoch
Optimized for low-resource fine-tuning
Training performed using Hugging Face Trainer
Example Usage
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
model = AutoModelForSeq2SeqLM.from_pretrained("MalikIbrar/flan-python-expert")
tokenizer = AutoTokenizer.from_pretrained("MalikIbrar/flan-python-expert")
input_text = "Write a Python function to check if a number is prime."
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**inputs, max_length=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
- Downloads last month
- 10
Model tree for MalikIbrar/flan-python-expert
Base model
google/flan-t5-base
Install from pip and serve model
# Install SGLang from pip: pip install sglang# Start the SGLang server: python3 -m sglang.launch_server \ --model-path "MalikIbrar/flan-python-expert" \ --host 0.0.0.0 \ --port 30000# Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MalikIbrar/flan-python-expert", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'