Aekanun commited on
Commit
a88db73
·
1 Parent(s): 78744e1
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import os
2
  import torch
3
- from transformers import AutoModelForVision2Seq, AutoProcessor
4
  from PIL import Image
5
  import gradio as gr
6
 
@@ -15,7 +15,14 @@ def load_model():
15
  hub_model_path = "Aekanun/thai-handwriting-llm"
16
 
17
  processor = AutoProcessor.from_pretrained(base_model_path, token=token)
18
- model = AutoModelForVision2Seq.from_pretrained(hub_model_path, token=token)
 
 
 
 
 
 
 
19
 
20
  return model, processor
21
 
 
1
  import os
2
  import torch
3
+ from transformers import AutoModelForCausalLM, AutoProcessor
4
  from PIL import Image
5
  import gradio as gr
6
 
 
15
  hub_model_path = "Aekanun/thai-handwriting-llm"
16
 
17
  processor = AutoProcessor.from_pretrained(base_model_path, token=token)
18
+
19
+ # โหลดโมเดลด้วย CausalLM ตาม task_type ใน adapter_config
20
+ model = AutoModelForCausalLM.from_pretrained(
21
+ hub_model_path,
22
+ trust_remote_code=True,
23
+ target_modules=["q_proj", "v_proj"], # จาก adapter_config
24
+ token=token
25
+ )
26
 
27
  return model, processor
28