New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add model: regionvit #144
add model: regionvit #144
Conversation
可以先用nn.Unfold绕过去 |
测速时,196行加下面的代码 for i, line in enumerate(lines):
if "self.rel_pos_index = flow.tensor(out, dtype=flow.long)" in line:
lines = lines[:i] + [" self.rel_pos_index = flow.tensor(out)",] + lines[i + 1 :]
break
for i, line in enumerate(lines):
if "out.append(tmp[dy - y + offset_y, dx - x + offset_x].numpy())" in line:
lines = lines[:i] + [" out.append(tmp[dy - y + offset_y, dx - x + offset_x])",] + lines[i + 1 :]
break
for i, line in enumerate(lines):
if "attn = attn.masked_fill(mask == 0, float(np.finfo(attn.numpy().dtype).min))" in line:
lines = lines[:i] + [" attn = attn.masked_fill(mask == 0, torch.finfo(attn.dtype).min)",] + lines[i + 1 :]
break |
OneFlow regionvit_tiny_224 time: 75.4ms (= 7537.5ms / 100, input_shape=[16, 3, 224, 224]) OneFlow regionvit_small_224 time: 87.5ms (= 8751.0ms / 100, input_shape=[16, 3, 224, 224]) OneFlow regionvit_small_w14_224 time: 168.0ms (= 16804.1ms / 100, input_shape=[16, 3, 224, 224]) OneFlow regionvit_small_w14_peg_224 time: 178.5ms (= 17849.5ms / 100, input_shape=[16, 3, 224, 224]) OneFlow regionvit_medium_224 time: 139.1ms (= 13908.7ms / 100, input_shape=[16, 3, 224, 224]) OneFlow regionvit_base_224 time: 166.2ms (= 16623.4ms / 100, input_shape=[16, 3, 224, 224]) OneFlow regionvit_base_w14_224 time: 299.6ms (= 29962.9ms / 100, input_shape=[16, 3, 224, 224]) OneFlow regionvit_base_w14_peg_224 time: 305.8ms (= 30583.4ms / 100, input_shape=[16, 3, 224, 224]) OneFlow regionvit_tiny_224 time: 75.9ms (= 7591.4ms / 100, input_shape=[16, 3, 224, 224], world size=2) OneFlow regionvit_small_224 time: 87.8ms (= 8775.0ms / 100, input_shape=[16, 3, 224, 224], world size=2) OneFlow regionvit_small_w14_224 time: 168.5ms (= 16848.2ms / 100, input_shape=[16, 3, 224, 224], world size=2) OneFlow regionvit_small_w14_peg_224 time: 206.7ms (= 20672.3ms / 100, input_shape=[16, 3, 224, 224], world size=2) OneFlow regionvit_medium_224 time: 141.2ms (= 14120.5ms / 100, input_shape=[16, 3, 224, 224], world size=2) OneFlow regionvit_base_224 time: 166.3ms (= 16634.6ms / 100, input_shape=[16, 3, 224, 224], world size=2) |
OneFlow regionvit_base_w14_224 time: 185.0ms (= 18498.5ms / 100, input_shape=[8, 3, 224, 224], world size=2) OneFlow regionvit_base_w14_peg_224 time: 190.5ms (= 19045.6ms / 100, input_shape=[8, 3, 224, 224], world size=2) |
flowvision/models/regionvit.py
Outdated
|
||
|
||
model_urls = { | ||
"tiny": "https://oneflow-public.oss-cn-beijing.aliyuncs.com/model_zoo/flowvision/classification/RegionViT/regionvit_tiny_224.zip", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里是不是改成region_vit_tiny更合适一些呢, 我感觉这里的名字用全一点比较好
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改了
Add RegionViT