Views
No views yet
iter_5_model) from an Active Learning (AL) study for Jawi OCR.workspace_models/)models/ directory:workspace_models/al-run-dynamic-10/iter_5_modelworkspace_models/al-run-dynamic-50/iter_5_modelworkspace_models/al-run-new-way-20/iter_5_modelworkspace_models/al-run-new-way-30/iter_5_modelworkspace_models/al-run-new-way-40/iter_5_modelworkspace_models/al-run-new-way/iter_5_modelworkspace_models/al-run-new-way_pool10/iter_5_modelworkspace_models/al-run-old-way/iter_5_modelworkspace_models/al-run-old-way_pool10/iter_5_modelworkspace_models/al_entropy_full_orig_models_pool10/iter_5_modelworkspace_models/al_entropy_full_orig_models_pool20/iter_5_modelworkspace_models/al_entropy_full_orig_models_pool30/iter_5_modelworkspace_models/al_entropy_full_orig_models_pool40/iter_5_modelworkspace_models/al_entropy_full_orig_models_pool50/iter_5_modelworkspace_models/al_kmeans_center_full_orig_models_pool10/iter_5_modelworkspace_models/al_kmeans_center_full_orig_models_pool20/iter_5_modelworkspace_models/al_kmeans_center_full_orig_models_pool30/iter_5_modelworkspace_models/al_kmeans_center_full_orig_models_pool40/iter_5_modelworkspace_models/al_kmeans_center_full_orig_models_pool50/iter_5_modelworkspace_models/al_random_full_aug_models_pool10/iter_5_modelworkspace_models/al_random_full_aug_models_pool20/iter_5_modelworkspace_models/al_random_full_aug_models_pool30/iter_5_modelworkspace_models/al_random_full_aug_models_pool40/iter_5_modelworkspace_models/al_random_full_aug_models_pool50/iter_5_modelworkspace_models/al_random_full_orig_models_pool10/iter_5_modelworkspace_models/al_random_full_orig_models_pool20/iter_5_modelworkspace_models/al_random_full_orig_models_pool30/iter_5_modelworkspace_models/al_random_full_orig_models_pool40/iter_5_modelworkspace_models/al_random_full_orig_models_pool50/iter_5_modelJawi_Paper_Repo/)other_hist_bench/)other_hist_bench/Jawi-OCR-data-v4_al_diva_alpha10/iter_5_modelother_hist_bench/Jawi-OCR-data-v4_al_entropy/iter_5_modelother_hist_bench/Jawi-OCR-data-v4_al_kmeans_center/iter_5_modelother_hist_bench/Jawi-OCR-data-v4_al_random/iter_5_modelother_hist_bench/Teklia_Esposalles-line_al_diva_alpha10/iter_5_modelother_hist_bench/Teklia_Esposalles-line_al_diva_alpha10_full/iter_5_modelother_hist_bench/Teklia_Esposalles-line_al_diva_alpha10_full_50/iter_5_modelother_hist_bench/Teklia_Esposalles-line_al_entropy/iter_5_modelother_hist_bench/Teklia_Esposalles-line_al_entropy_full/iter_5_modelother_hist_bench/Teklia_Esposalles-line_al_entropy_full_50/iter_5_modelother_hist_bench/Teklia_Esposalles-line_al_kmeans_center/iter_5_modelother_hist_bench/Teklia_Esposalles-line_al_kmeans_center_full/iter_5_modelother_hist_bench/Teklia_Esposalles-line_al_kmeans_center_full_50/iter_5_modelother_hist_bench/Teklia_Esposalles-line_al_random/iter_5_modelother_hist_bench/Teklia_Esposalles-line_al_random_full/iter_5_modelother_hist_bench/Teklia_Esposalles-line_al_random_full_50/iter_5_modeltransformers and peft libraries in Python.1import torch
2from transformers import AutoProcessor, AutoModelForImageTextToText
3from peft import PeftModel
4
5# 1. Specify the base model and this repository
6base_model_id = "aisingapore/Qwen-SEA-LION-v4-8B-VL"
7adapter_repo_id = "ThuraAung1601/jawi-ocr-al-models"
8
9# 2. Choose the specific adapter subfolder path from the list above
10# Example: Loading the random active learning run with pool size 30
11subfolder_path = "workspace_models/al_random_full_orig_models_pool30/iter_5_model"
12
13print("Loading base model...")
14model = AutoModelForImageTextToText.from_pretrained(
15 base_model_id,
16 device_map="auto",
17 torch_dtype=torch.bfloat16,
18 trust_remote_code=True
19)
20processor = AutoProcessor.from_pretrained(base_model_id, trust_remote_code=True)
21
22print(f"Loading adapter from {subfolder_path}...")
23model = PeftModel.from_pretrained(
24 model,
25 adapter_repo_id,
26 subfolder=subfolder_path
27)
28
29print("Model is successfully loaded and ready for inference!")