Unverified Commit 183a7221 authored by Nicolas Hug's avatar Nicolas Hug Committed by GitHub
Browse files

[FBcode->GH] Group all internally replaced utils into a single file (#4095)

parent d391a0e9
...@@ -5,7 +5,7 @@ import torch.nn as nn ...@@ -5,7 +5,7 @@ import torch.nn as nn
import torch.nn.functional as F import torch.nn.functional as F
from torchvision.models import inception as inception_module from torchvision.models import inception as inception_module
from torchvision.models.inception import InceptionOutputs from torchvision.models.inception import InceptionOutputs
from torchvision.models.utils import load_state_dict_from_url from ..._internally_replaced_utils import load_state_dict_from_url
from .utils import _replace_relu, quantize_model from .utils import _replace_relu, quantize_model
......
from torch import nn from torch import nn
from torchvision.models.utils import load_state_dict_from_url from ..._internally_replaced_utils import load_state_dict_from_url
from torchvision.models.mobilenetv2 import InvertedResidual, ConvBNReLU, MobileNetV2, model_urls from torchvision.models.mobilenetv2 import InvertedResidual, ConvBNReLU, MobileNetV2, model_urls
from torch.quantization import QuantStub, DeQuantStub, fuse_modules from torch.quantization import QuantStub, DeQuantStub, fuse_modules
from .utils import _replace_relu, quantize_model from .utils import _replace_relu, quantize_model
......
import torch import torch
from torch import nn, Tensor from torch import nn, Tensor
from torchvision.models.utils import load_state_dict_from_url from ..._internally_replaced_utils import load_state_dict_from_url
from torchvision.models.mobilenetv3 import InvertedResidual, InvertedResidualConfig, ConvBNActivation, MobileNetV3,\ from torchvision.models.mobilenetv3 import InvertedResidual, InvertedResidualConfig, ConvBNActivation, MobileNetV3,\
SqueezeExcitation, model_urls, _mobilenet_v3_conf SqueezeExcitation, model_urls, _mobilenet_v3_conf
from torch.quantization import QuantStub, DeQuantStub, fuse_modules from torch.quantization import QuantStub, DeQuantStub, fuse_modules
......
import torch import torch
from torchvision.models.resnet import Bottleneck, BasicBlock, ResNet, model_urls from torchvision.models.resnet import Bottleneck, BasicBlock, ResNet, model_urls
import torch.nn as nn import torch.nn as nn
from torchvision.models.utils import load_state_dict_from_url from ..._internally_replaced_utils import load_state_dict_from_url
from torch.quantization import fuse_modules from torch.quantization import fuse_modules
from .utils import _replace_relu, quantize_model from .utils import _replace_relu, quantize_model
......
import torch import torch
import torch.nn as nn import torch.nn as nn
from torchvision.models.utils import load_state_dict_from_url from ..._internally_replaced_utils import load_state_dict_from_url
import torchvision.models.shufflenetv2 import torchvision.models.shufflenetv2
import sys import sys
from .utils import _replace_relu, quantize_model from .utils import _replace_relu, quantize_model
......
import torch import torch
from torch import Tensor from torch import Tensor
import torch.nn as nn import torch.nn as nn
from .utils import load_state_dict_from_url from .._internally_replaced_utils import load_state_dict_from_url
from typing import Type, Any, Callable, Union, List, Optional from typing import Type, Any, Callable, Union, List, Optional
......
from .._utils import IntermediateLayerGetter from .._utils import IntermediateLayerGetter
from ..utils import load_state_dict_from_url from ..._internally_replaced_utils import load_state_dict_from_url
from .. import mobilenetv3 from .. import mobilenetv3
from .. import resnet from .. import resnet
from .deeplabv3 import DeepLabHead, DeepLabV3 from .deeplabv3 import DeepLabHead, DeepLabV3
......
import torch import torch
from torch import Tensor from torch import Tensor
import torch.nn as nn import torch.nn as nn
from .utils import load_state_dict_from_url from .._internally_replaced_utils import load_state_dict_from_url
from typing import Callable, Any, List from typing import Callable, Any, List
......
import torch import torch
import torch.nn as nn import torch.nn as nn
import torch.nn.init as init import torch.nn.init as init
from .utils import load_state_dict_from_url from .._internally_replaced_utils import load_state_dict_from_url
from typing import Any from typing import Any
__all__ = ['SqueezeNet', 'squeezenet1_0', 'squeezenet1_1'] __all__ = ['SqueezeNet', 'squeezenet1_0', 'squeezenet1_1']
......
# Don't remove this file and don't change the imports of load_state_dict_from_url
# from other files. We need this so that we can swap load_state_dict_from_url with
# a custom internal version in fbcode.
try:
from torch.hub import load_state_dict_from_url
except ImportError:
from torch.utils.model_zoo import load_url as load_state_dict_from_url
import torch import torch
import torch.nn as nn import torch.nn as nn
from .utils import load_state_dict_from_url from .._internally_replaced_utils import load_state_dict_from_url
from typing import Union, List, Dict, Any, cast from typing import Union, List, Dict, Any, cast
......
import torch.nn as nn import torch.nn as nn
from ..utils import load_state_dict_from_url from ..._internally_replaced_utils import load_state_dict_from_url
__all__ = ['r3d_18', 'mc3_18', 'r2plus1d_18'] __all__ = ['r3d_18', 'mc3_18', 'r2plus1d_18']
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment