Spaces:
Sleeping
Sleeping
howard-hou
commited on
Commit
•
6fb11b4
1
Parent(s):
7bcd65d
Update app.py
Browse files
app.py
CHANGED
@@ -33,17 +33,17 @@ for key in state_dict:
|
|
33 |
rwkv_state_dict[key[5:]] = state_dict[key].half()
|
34 |
else:
|
35 |
visual_state_dict[key] = state_dict[key].half()
|
36 |
-
print("rwkv state dict has keys: ", len(rwkv_state_dict))
|
37 |
-
print("visual state dict has keys: ", len(visual_state_dict))
|
38 |
# save
|
39 |
vision_local_path = output_dir / f"visual.pth"
|
40 |
rwkv_local_path = output_dir / f"rwkv.pth"
|
41 |
torch.save(rwkv_state_dict, rwkv_local_path)
|
42 |
torch.save(visual_state_dict, vision_local_path)
|
|
|
|
|
43 |
##########################################################################
|
44 |
vision_tower_name = 'openai/clip-vit-large-patch14-336'
|
45 |
|
46 |
-
model = RWKV(model=rwkv_local_path, strategy='cuda fp16')
|
47 |
from rwkv.utils import PIPELINE, PIPELINE_ARGS
|
48 |
pipeline = PIPELINE(model, "rwkv_vocab_v20230424")
|
49 |
|
|
|
33 |
rwkv_state_dict[key[5:]] = state_dict[key].half()
|
34 |
else:
|
35 |
visual_state_dict[key] = state_dict[key].half()
|
|
|
|
|
36 |
# save
|
37 |
vision_local_path = output_dir / f"visual.pth"
|
38 |
rwkv_local_path = output_dir / f"rwkv.pth"
|
39 |
torch.save(rwkv_state_dict, rwkv_local_path)
|
40 |
torch.save(visual_state_dict, vision_local_path)
|
41 |
+
print("rwkv state dict has keys: ", len(rwkv_state_dict), "saved to ", rwkv_local_path)
|
42 |
+
print("visual state dict has keys: ", len(visual_state_dict), "saved to ", vision_local_path)
|
43 |
##########################################################################
|
44 |
vision_tower_name = 'openai/clip-vit-large-patch14-336'
|
45 |
|
46 |
+
model = RWKV(model=str(rwkv_local_path), strategy='cuda fp16')
|
47 |
from rwkv.utils import PIPELINE, PIPELINE_ARGS
|
48 |
pipeline = PIPELINE(model, "rwkv_vocab_v20230424")
|
49 |
|