Spaces:
Running
on
Zero
Running
on
Zero
fixing
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import os
|
2 |
import torch
|
3 |
-
from transformers import
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
|