Spaces:
Sleeping
Sleeping
howard-hou
commited on
Commit
•
fc28316
1
Parent(s):
9d6c917
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
-
import os, gc
|
3 |
import base64
|
4 |
from io import BytesIO
|
5 |
import torch
|
@@ -16,17 +21,13 @@ rwkv_remote_path = "rwkv1b5-vitl336p14-577token_mix665k_rwkv.pth"
|
|
16 |
vision_remote_path = "rwkv1b5-vitl336p14-577token_mix665k_visual.pth"
|
17 |
vision_tower_name = 'openai/clip-vit-large-patch14-336'
|
18 |
|
19 |
-
os.environ["RWKV_JIT_ON"] = '1'
|
20 |
-
os.environ["RWKV_CUDA_ON"] = '1' # if '1' then use CUDA kernel for seq mode (much faster)
|
21 |
-
|
22 |
-
from modeling_vision import VisionEncoder, VisionEncoderConfig
|
23 |
-
from modeling_rwkv import RWKV
|
24 |
model_path = hf_hub_download(repo_id="howard-hou/visualrwkv-5", filename=rwkv_remote_path)
|
25 |
model = RWKV(model=model_path, strategy='cuda fp16')
|
26 |
from rwkv.utils import PIPELINE, PIPELINE_ARGS
|
27 |
pipeline = PIPELINE(model, "rwkv_vocab_v20230424")
|
28 |
|
29 |
##########################################################################
|
|
|
30 |
config = VisionEncoderConfig(n_embd=model.args.n_embd,
|
31 |
vision_tower_name=vision_tower_name,
|
32 |
grid_size=-1)
|
|
|
1 |
+
import os
|
2 |
+
os.environ["RWKV_JIT_ON"] = '1'
|
3 |
+
os.environ["RWKV_CUDA_ON"] = '1' # if '1' then use CUDA kernel for seq mode (much faster)
|
4 |
+
from modeling_rwkv import RWKV
|
5 |
+
|
6 |
+
import gc
|
7 |
import gradio as gr
|
|
|
8 |
import base64
|
9 |
from io import BytesIO
|
10 |
import torch
|
|
|
21 |
vision_remote_path = "rwkv1b5-vitl336p14-577token_mix665k_visual.pth"
|
22 |
vision_tower_name = 'openai/clip-vit-large-patch14-336'
|
23 |
|
|
|
|
|
|
|
|
|
|
|
24 |
model_path = hf_hub_download(repo_id="howard-hou/visualrwkv-5", filename=rwkv_remote_path)
|
25 |
model = RWKV(model=model_path, strategy='cuda fp16')
|
26 |
from rwkv.utils import PIPELINE, PIPELINE_ARGS
|
27 |
pipeline = PIPELINE(model, "rwkv_vocab_v20230424")
|
28 |
|
29 |
##########################################################################
|
30 |
+
from modeling_vision import VisionEncoder, VisionEncoderConfig
|
31 |
config = VisionEncoderConfig(n_embd=model.args.n_embd,
|
32 |
vision_tower_name=vision_tower_name,
|
33 |
grid_size=-1)
|