Spaces:
Runtime error
Runtime error
update app.py
Browse files
app.py
CHANGED
@@ -16,19 +16,28 @@ from PIL import Image
|
|
16 |
from huggingface_hub import hf_hub_download, login
|
17 |
|
18 |
from open_flamingo.src.factory import create_model_and_transforms
|
|
|
|
|
19 |
flamingo, image_processor, tokenizer, vis_embed_size = create_model_and_transforms(
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
checkpoint_path = hf_hub_download("chendl/compositional_test", "pythiaS.pt")
|
31 |
-
checkpoint = torch.load(checkpoint_path, map_location="cpu")
|
32 |
model_state_dict = {}
|
33 |
for key in checkpoint.keys():
|
34 |
model_state_dict[key.replace("module.", "")] = checkpoint[key]
|
|
|
16 |
from huggingface_hub import hf_hub_download, login
|
17 |
|
18 |
from open_flamingo.src.factory import create_model_and_transforms
|
19 |
+
|
20 |
+
|
21 |
flamingo, image_processor, tokenizer, vis_embed_size = create_model_and_transforms(
|
22 |
+
args.vision_encoder_path,
|
23 |
+
args.vision_encoder_pretrained,
|
24 |
+
args.lm_path,
|
25 |
+
args.lm_tokenizer_path,
|
26 |
+
location_token_num=1000,
|
27 |
+
lora=False,
|
28 |
+
lora_r=16,
|
29 |
+
use_sam=None,
|
30 |
+
add_visual_token=True,
|
31 |
+
use_format_v2=True,
|
32 |
+
add_box=True,
|
33 |
+
add_pe=False,
|
34 |
+
add_relation=False,
|
35 |
+
enhance_data=False,
|
36 |
+
)
|
37 |
+
|
38 |
|
39 |
checkpoint_path = hf_hub_download("chendl/compositional_test", "pythiaS.pt")
|
40 |
+
checkpoint = torch.load(checkpoint_path, map_location="cpu")["model_state_dict"]
|
41 |
model_state_dict = {}
|
42 |
for key in checkpoint.keys():
|
43 |
model_state_dict[key.replace("module.", "")] = checkpoint[key]
|