Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -42,13 +42,18 @@ MAX_PATCHES = 512
|
|
42 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
43 |
|
44 |
# Paths to the models
|
45 |
-
ko_deplot_model_path = './deplot_model_ver_24.11.21_korean_only(exclude NUUA)_epoch1.bin'
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
# Load first model ko-deplot
|
48 |
def load_model1():
|
49 |
processor1 = Pix2StructProcessor.from_pretrained('nuua/ko-deplot')
|
50 |
model1 = Pix2StructForConditionalGeneration.from_pretrained('nuua/ko-deplot')
|
51 |
-
model1.load_state_dict(torch.load(
|
52 |
model1.to(torch.device("cuda"))
|
53 |
return processor1, model1
|
54 |
|
|
|
42 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
43 |
|
44 |
# Paths to the models
|
45 |
+
#ko_deplot_model_path = './deplot_model_ver_24.11.21_korean_only(exclude NUUA)_epoch1.bin'
|
46 |
+
|
47 |
+
file_path = hf_hub_download(
|
48 |
+
repo_id="Sangjun2/skku-Deplot",
|
49 |
+
filename="deplot_model_ver_24.11.21_korean_only(exclude NUUA)_epoch3.bin"
|
50 |
+
)
|
51 |
|
52 |
# Load first model ko-deplot
|
53 |
def load_model1():
|
54 |
processor1 = Pix2StructProcessor.from_pretrained('nuua/ko-deplot')
|
55 |
model1 = Pix2StructForConditionalGeneration.from_pretrained('nuua/ko-deplot')
|
56 |
+
model1.load_state_dict(torch.load(file_path, map_location="cpu"))
|
57 |
model1.to(torch.device("cuda"))
|
58 |
return processor1, model1
|
59 |
|