Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion image_classification/models/uniformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from timm.models.vision_transformer import _cfg
from timm.models.registry import register_model
from timm.models.layers import trunc_normal_, DropPath, to_2tuple
from huggingface_hub import PyTorchModelHubMixin

layer_scale = False
init_value = 1e-6
Expand Down Expand Up @@ -196,7 +197,10 @@ def forward(self, x):
return x


class UniFormer(nn.Module):
class UniFormer(nn.Module,
PyTorchModelHubMixin,
library_name = "UniFormer",
repo_url = "https://github.com/Sense-X/UniFormer"):
""" Vision Transformer
A PyTorch impl of : `An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale` -
https://arxiv.org/abs/2010.11929
Expand Down
6 changes: 5 additions & 1 deletion image_classification/models/uniformer_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from timm.models.vision_transformer import _cfg
from timm.models.registry import register_model
from timm.models.layers import trunc_normal_, DropPath, to_2tuple
from huggingface_hub import PyTorchModelHubMixin


layer_scale = False
Expand Down Expand Up @@ -330,7 +331,10 @@ def forward(self, x):
return x


class UniFormer_Light(nn.Module):
class UniFormer_Light(nn.Module,
PyTorchModelHubMixin,
library_name = "UniFormer",
repo_url = "https://github.com/Sense-X/UniFormer"):
""" Vision Transformer
A PyTorch impl of : `An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale` -
https://arxiv.org/abs/2010.11929
Expand Down
3 changes: 2 additions & 1 deletion image_classification/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
torch==1.7.0
torchvision==0.8.1
timm==0.4.12
timm==0.4.12
huggingface_hub>=0.22.0
6 changes: 5 additions & 1 deletion image_classification/token_labeling/tlt/models/uniformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from timm.models.vision_transformer import _cfg
from timm.models.registry import register_model
from timm.models.layers import trunc_normal_, DropPath, to_2tuple
from huggingface_hub import PyTorchModelHubMixin

layer_scale = False
init_value = 1e-6
Expand Down Expand Up @@ -230,7 +231,10 @@ def forward(self, x):
return x


class UniFormer(nn.Module):
class UniFormer(nn.Module,
PyTorchModelHubMixin,
library_name = "UniFormer",
repo_url = "https://github.com/Sense-X/UniFormer"):
""" Vision Transformer
A PyTorch impl of : `An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale` -
https://arxiv.org/abs/2010.11929
Expand Down
6 changes: 5 additions & 1 deletion object_detection/mmdet/models/backbones/uniformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import torch.utils.checkpoint as checkpoint
import numpy as np
from timm.models.layers import DropPath, to_2tuple, trunc_normal_
from huggingface_hub import PyTorchModelHubMixin

from mmcv_custom import load_checkpoint
from mmdet.utils import get_root_logger
Expand Down Expand Up @@ -240,7 +241,10 @@ def forward(self, x):


@BACKBONES.register_module()
class UniFormer(nn.Module):
class UniFormer(nn.Module,
PyTorchModelHubMixin,
library_name = "UniFormer",
repo_url = "https://github.com/Sense-X/UniFormer"):
""" Vision Transformer
A PyTorch impl of : `An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale` -
https://arxiv.org/abs/2010.11929
Expand Down
6 changes: 5 additions & 1 deletion object_detection/mmdet/models/backbones/uniformer_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from timm.models.vision_transformer import _cfg
from timm.models.layers import trunc_normal_, DropPath
from torch.nn.modules.batchnorm import _BatchNorm
from huggingface_hub import PyTorchModelHubMixin

from mmcv_custom import load_checkpoint
from mmdet.utils import get_root_logger
Expand Down Expand Up @@ -333,7 +334,10 @@ def forward(self, x):


@BACKBONES.register_module()
class UniFormer_Light(nn.Module):
class UniFormer_Light(nn.Module,
PyTorchModelHubMixin,
library_name = "UniFormer",
repo_url = "https://github.com/Sense-X/UniFormer"):
""" Vision Transformer
A PyTorch impl of : `An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale` -
https://arxiv.org/abs/2010.11929
Expand Down
6 changes: 5 additions & 1 deletion pose_estimation/mmpose/models/backbones/uniformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import torch.utils.checkpoint as checkpoint
import numpy as np
from timm.models.layers import DropPath, to_2tuple, trunc_normal_
from huggingface_hub import PyTorchModelHubMixin

from mmcv_custom import load_checkpoint
from mmpose.utils import get_root_logger
Expand Down Expand Up @@ -240,7 +241,10 @@ def forward(self, x):


@BACKBONES.register_module()
class UniFormer(nn.Module):
class UniFormer(nn.Module,
PyTorchModelHubMixin,
library_name = "UniFormer",
repo_url = "https://github.com/Sense-X/UniFormer"):
""" Vision Transformer
A PyTorch impl of : `An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale` -
https://arxiv.org/abs/2010.11929
Expand Down
6 changes: 5 additions & 1 deletion semantic_segmentation/fpn_seg/uniformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import torch.utils.checkpoint as checkpoint
import numpy as np
from timm.models.layers import DropPath, to_2tuple, trunc_normal_
from huggingface_hub import PyTorchModelHubMixin

from mmcv_custom import load_checkpoint
from mmseg.utils import get_root_logger
Expand Down Expand Up @@ -240,7 +241,10 @@ def forward(self, x):


@BACKBONES.register_module()
class UniFormer(nn.Module):
class UniFormer(nn.Module,
PyTorchModelHubMixin,
library_name = "UniFormer",
repo_url = "https://github.com/Sense-X/UniFormer"):
""" Vision Transformer
A PyTorch impl of : `An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale` -
https://arxiv.org/abs/2010.11929
Expand Down
6 changes: 5 additions & 1 deletion semantic_segmentation/fpn_seg/uniformer_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from timm.models.vision_transformer import _cfg
from timm.models.layers import trunc_normal_, DropPath
from torch.nn.modules.batchnorm import _BatchNorm
from huggingface_hub import PyTorchModelHubMixin

from mmcv_custom import load_checkpoint
from mmseg.utils import get_root_logger
Expand Down Expand Up @@ -332,7 +333,10 @@ def forward(self, x):


@BACKBONES.register_module()
class UniFormer_Light(nn.Module):
class UniFormer_Light(nn.Module,
PyTorchModelHubMixin,
library_name = "UniFormer",
repo_url = "https://github.com/Sense-X/UniFormer"):
""" Vision Transformer
A PyTorch impl of : `An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale` -
https://arxiv.org/abs/2010.11929
Expand Down
6 changes: 5 additions & 1 deletion semantic_segmentation/mmseg/models/backbones/uniformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import torch.utils.checkpoint as checkpoint
import numpy as np
from timm.models.layers import DropPath, to_2tuple, trunc_normal_
from huggingface_hub import PyTorchModelHubMixin

from mmcv_custom import load_checkpoint
from mmseg.utils import get_root_logger
Expand Down Expand Up @@ -240,7 +241,10 @@ def forward(self, x):


@BACKBONES.register_module()
class UniFormer(nn.Module):
class UniFormer(nn.Module,
PyTorchModelHubMixin,
library_name = "UniFormer",
repo_url = "https://github.com/Sense-X/UniFormer"):
""" Vision Transformer
A PyTorch impl of : `An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale` -
https://arxiv.org/abs/2010.11929
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from timm.models.vision_transformer import _cfg
from timm.models.layers import trunc_normal_, DropPath
from torch.nn.modules.batchnorm import _BatchNorm
from huggingface_hub import PyTorchModelHubMixin

from mmcv_custom import load_checkpoint
from mmseg.utils import get_root_logger
Expand Down Expand Up @@ -332,7 +333,10 @@ def forward(self, x):


@BACKBONES.register_module()
class UniFormer_Light(nn.Module):
class UniFormer_Light(nn.Module,
PyTorchModelHubMixin,
library_name = "UniFormer",
repo_url = "https://github.com/Sense-X/UniFormer"):
""" Vision Transformer
A PyTorch impl of : `An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale` -
https://arxiv.org/abs/2010.11929
Expand Down
2 changes: 1 addition & 1 deletion video_classification/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ line_length=100
multi_line_output=4
known_standard_library=numpy,setuptools
known_myself=slowfast
known_third_party=fvcore,iopath,av,torch,pycocotools,yacs,termcolor,scipy,simplejson,matplotlib,detectron2,torchvision,yaml,tqdm,psutil,opencv-python,pandas,tensorboard,moviepy,sklearn,cv2,PIL
known_third_party=fvcore,iopath,av,torch,pycocotools,yacs,termcolor,scipy,simplejson,matplotlib,detectron2,torchvision,yaml,tqdm,psutil,opencv-python,pandas,tensorboard,moviepy,scikit-learn,cv2,PIL
no_lines_before=STDLIB,THIRDPARTY
sections=FUTURE,STDLIB,THIRDPARTY,myself,FIRSTPARTY,LOCALFOLDER
default_section=FIRSTPARTY
Expand Down
5 changes: 3 additions & 2 deletions video_classification/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
"pandas",
"torchvision>=0.4.2",
"pillow",
"sklearn",
"scikit-learn",
"tensorboard",
"timm"
"timm",
"huggingface_hub>=0.22.0"
],
extras_require={"tensorboard_video_visualization": ["moviepy"]},
packages=find_packages(exclude=("configs", "tests")),
Expand Down
6 changes: 5 additions & 1 deletion video_classification/slowfast/models/uniformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from timm.models.layers import trunc_normal_, DropPath, to_2tuple
from .build import MODEL_REGISTRY
import os
from huggingface_hub import PyTorchModelHubMixin

import slowfast.utils.logging as logging

Expand Down Expand Up @@ -258,7 +259,10 @@ def forward(self, x):


@MODEL_REGISTRY.register()
class Uniformer(nn.Module):
class Uniformer(nn.Module,
PyTorchModelHubMixin,
library_name = "UniFormer",
repo_url = "https://github.com/Sense-X/UniFormer"):
""" Vision Transformer
A PyTorch impl of : `An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale` -
https://arxiv.org/abs/2010.11929
Expand Down
6 changes: 5 additions & 1 deletion video_classification/slowfast/models/uniformer_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from timm.models.layers import trunc_normal_, DropPath, to_2tuple
from .build import MODEL_REGISTRY
import os
from huggingface_hub import PyTorchModelHubMixin

import slowfast.utils.logging as logging

Expand Down Expand Up @@ -396,7 +397,10 @@ def forward(self, x):


@MODEL_REGISTRY.register()
class Uniformer_light(nn.Module):
class Uniformer_light(nn.Module,
PyTorchModelHubMixin,
library_name = "UniFormer",
repo_url = "https://github.com/Sense-X/UniFormer"):
""" Vision Transformer
A PyTorch impl of : `An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale` -
https://arxiv.org/abs/2010.11929
Expand Down
6 changes: 5 additions & 1 deletion video_classification/slowfast/models/uniformer_light_fp32.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from timm.models.layers import trunc_normal_, DropPath, to_2tuple
from .build import MODEL_REGISTRY
import os
from huggingface_hub import PyTorchModelHubMixin

import slowfast.utils.logging as logging

Expand Down Expand Up @@ -408,7 +409,10 @@ def forward(self, x):


@MODEL_REGISTRY.register()
class Uniformer_light_fp32(nn.Module):
class Uniformer_light_fp32(nn.Module,
PyTorchModelHubMixin,
library_name = "UniFormer",
repo_url = "https://github.com/Sense-X/UniFormer"):
""" Vision Transformer
A PyTorch impl of : `An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale` -
https://arxiv.org/abs/2010.11929
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from timm.models.layers import trunc_normal_, DropPath, to_2tuple
from .build import MODEL_REGISTRY
import os
from huggingface_hub import PyTorchModelHubMixin

import slowfast.utils.logging as logging

Expand Down Expand Up @@ -420,7 +421,10 @@ def forward(self, x):


@MODEL_REGISTRY.register()
class Uniformer_light_ls_fp32(nn.Module):
class Uniformer_light_ls_fp32(nn.Module,
PyTorchModelHubMixin,
library_name = "UniFormer",
repo_url = "https://github.com/Sense-X/UniFormer"):
""" Vision Transformer
A PyTorch impl of : `An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale` -
https://arxiv.org/abs/2010.11929
Expand Down
6 changes: 5 additions & 1 deletion video_classification/vis/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import torch.nn as nn
from functools import partial
from timm.models.layers import trunc_normal_, DropPath, to_2tuple
from huggingface_hub import PyTorchModelHubMixin


def conv_3xnxn(inp, oup, kernel_size=3, stride=3, groups=1):
Expand Down Expand Up @@ -236,7 +237,10 @@ def forward(self, x):
return x


class Uniformer(nn.Module):
class Uniformer(nn.Module,
PyTorchModelHubMixin,
library_name = "UniFormer",
repo_url = "https://github.com/Sense-X/UniFormer"):
""" Vision Transformer
A PyTorch impl of : `An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale` -
https://arxiv.org/abs/2010.11929
Expand Down