Image-to-Text
PEFT
Safetensors
Portuguese
English
vision-language
table-extraction
scientific-figures
markdown-table
lightonocr
qwen2.5-vl
qwen3-vl
lora
icdar-metric-loss
Instructions to use lucasoc/sci-image-models with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use lucasoc/sci-image-models with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-VL-3B-Instruct") model = PeftModel.from_pretrained(base_model, "lucasoc/sci-image-models") - Notebooks
- Google Colab
- Kaggle
feat(config): upload configs/training/train_7b_icdar_loss.yaml
Browse files
configs/training/train_7b_icdar_loss.yaml
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Training Configuration for Qwen2.5-VL-7B-Instruct with Custom ICDAR Metric Loss
|
| 2 |
+
project_name: "sci-image-markdown"
|
| 3 |
+
experiment_name: "qwen2_5_vl_7b_icdar_loss"
|
| 4 |
+
seed: 42
|
| 5 |
+
|
| 6 |
+
data:
|
| 7 |
+
raw_dir: "data/raw"
|
| 8 |
+
processed_dir: "data/processed"
|
| 9 |
+
splits_dir: "data/splits"
|
| 10 |
+
train_file: "data/processed/train.jsonl"
|
| 11 |
+
val_file: "data/processed/val.jsonl"
|
| 12 |
+
test_file: "data/processed/test.jsonl"
|
| 13 |
+
image_folder: "data/processed"
|
| 14 |
+
max_image_resolution: null # Native resolution, aspect-ratio preserved
|
| 15 |
+
min_pixels: 50176 # Minimum vision patch grid (64 * 28 * 28)
|
| 16 |
+
max_pixels: 200704 # 256 * 28 * 28 (~448x448 native vision patch budget, highly detailed & memory safe)
|
| 17 |
+
max_table_chars: 800
|
| 18 |
+
system_prompt: "You are an expert scientific figure analyzer. Your task is to extract the exact data points and values plotted in the given scientific figure panel and format them into a structured Markdown table with proper column headers."
|
| 19 |
+
|
| 20 |
+
model:
|
| 21 |
+
name_or_path: "Qwen/Qwen2.5-VL-7B-Instruct"
|
| 22 |
+
model_type: "qwen2_5_vl"
|
| 23 |
+
trust_remote_code: true
|
| 24 |
+
torch_dtype: "bfloat16"
|
| 25 |
+
attn_implementation: "sdpa"
|
| 26 |
+
use_cache: false
|
| 27 |
+
|
| 28 |
+
training:
|
| 29 |
+
method: "qlora"
|
| 30 |
+
loss_type: "token_weighted"
|
| 31 |
+
output_dir: "/media/ssd2/lucas.ocunha/sci-image-markdown-data/outputs/qwen2_5_vl_7b_icdar_loss"
|
| 32 |
+
num_train_epochs: 3
|
| 33 |
+
per_device_train_batch_size: 1
|
| 34 |
+
per_device_eval_batch_size: 1
|
| 35 |
+
gradient_accumulation_steps: 8
|
| 36 |
+
optim: "paged_adamw_8bit"
|
| 37 |
+
learning_rate: 1.0e-4
|
| 38 |
+
lr_scheduler_type: "cosine"
|
| 39 |
+
warmup_steps: 20
|
| 40 |
+
weight_decay: 0.01
|
| 41 |
+
logging_steps: 10
|
| 42 |
+
eval_strategy: "epoch"
|
| 43 |
+
save_strategy: "epoch"
|
| 44 |
+
save_total_limit: 2
|
| 45 |
+
gradient_checkpointing: true
|
| 46 |
+
bf16: false
|
| 47 |
+
fp16: false
|
| 48 |
+
dataloader_num_workers: 2
|
| 49 |
+
report_to: "none"
|
| 50 |
+
metric_loss:
|
| 51 |
+
lambda_metric: 0.3
|
| 52 |
+
rel_tol: 0.05
|
| 53 |
+
numeric_weight: 3.0
|
| 54 |
+
structural_weight: 2.0
|
| 55 |
+
reward_mode: "gpu_tensor"
|
| 56 |
+
|
| 57 |
+
peft:
|
| 58 |
+
r: 16
|
| 59 |
+
lora_alpha: 32
|
| 60 |
+
lora_dropout: 0.05
|
| 61 |
+
bias: "none"
|
| 62 |
+
task_type: "CAUSAL_LM"
|
| 63 |
+
target_modules:
|
| 64 |
+
- "q_proj"
|
| 65 |
+
- "v_proj"
|
| 66 |
+
|
| 67 |
+
quantization:
|
| 68 |
+
load_in_4bit: true
|
| 69 |
+
bnb_4bit_quant_type: "nf4"
|
| 70 |
+
bnb_4bit_compute_dtype: "bfloat16"
|
| 71 |
+
bnb_4bit_use_double_quant: true
|
| 72 |
+
|
| 73 |
+
evaluation:
|
| 74 |
+
batch_size: 1
|
| 75 |
+
max_new_tokens: 1024
|
| 76 |
+
temperature: 0.0
|
| 77 |
+
do_sample: false
|
| 78 |
+
numerical_relative_tolerance: 0.05
|
| 79 |
+
output_eval_dir: "/media/ssd2/lucas.ocunha/sci-image-markdown-data/outputs/eval_results/7b_icdar_loss"
|