Instructions to use U4RASD/DRU-RE-qwen35-9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use U4RASD/DRU-RE-qwen35-9B with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("/root/workspace/models/Qwen/Qwen3.5-9B") model = PeftModel.from_pretrained(base_model, "U4RASD/DRU-RE-qwen35-9B") - Notebooks
- Google Colab
- Kaggle
DRU-RE-qwen35-9B
QLoRA adapter for Arabic relation extraction using Qwen/Qwen3.5-9B as the base model.
This repository stores the adapter, training/evaluation artifacts, prompt/GEPA experiments, ontology resources, and the code used for training and evaluation.
Best Checkpoint
The main adapter files at the repository root are from checkpoint-2000, which had the best full validation score.
| checkpoint | validation rows | correct | micro F1 | macro-style F1 field |
|---|---|---|---|---|
| step 1000 | 1687 | 1034 | 0.612922 | 0.503539 |
| step 2000 | 1687 | 1177 | 0.697688 | 0.715525 |
| step 2943 | 1687 | 1171 | 0.694132 | 0.709890 |
Repository Contents
- Root adapter files: best QLoRA adapter from
checkpoint-2000. checkpoints/: saved checkpoints for step 1000, 2000, and 2943, including trainer state and optimizer state for resume.evals/: evaluation metrics for each saved step.predictions.txt: validation predictions from checkpoint 2000, formatted astriple_id<TAB>predicted_label.ontology/:wojood_ontology.json,relation_mapper.json, andrelation_disambiguation.json.code/: training, evaluation, prompt optimization, metrics, and utility scripts.gepa/: GEPA prompt optimization summaries, best candidates, split summaries, and metrics.baseline_evals/: base-prompt evaluation metrics before finetuning.
Prediction File Format
predictions.txt contains one validation prediction per line:
11352 Location.located_in
11353 Location.located_in
4838 Location.located_in
Training Command
cd /root/workspace
python RE/finetune_qwen.py --config RE/finetune_config.yaml
To resume:
cd /root/workspace
python RE/finetune_qwen.py --config RE/finetune_config.yaml --resume-from-checkpoint latest
Inference Notes
Load this repository as a PEFT adapter on top of Qwen/Qwen3.5-9B. The prompt format and ontology filtering logic are included in code/prompt_baseline.py, code/ontology.py, and code/finetune_config.yaml.
The model should output exactly one relation label from the configured label set.
Known Weaknesses
The step-2000 evaluation still showed confusion around:
PartOf.geopolitical_divisionversusno_relation.Location.headquartered_inversusLocation.located_in.- Overprediction of
Personal.has_occupationfor someno_relationexamples. - Low recall for several rare relation classes.
Important
This repo contains a QLoRA/PEFT adapter, not the full Qwen base model weights.
- Downloads last month
- 13