<jupyter_start><jupyter_text>Pretrain Models for pytorch<jupyter_code>import torch
from efficientnet_pytorch import EfficientNet

PRE_TRAIN_MODEL_DIR = "../model/pretrain/"
torch.hub.list("pytorch/vision", force_reload=True)<jupyter_output>Downloading: "https://github.com/pytorch/vision/archive/master.zip" to /home/icebee/.cache/torch/hub/master.zip<jupyter_text>DenseNet<jupyter_code>model = torch.hub.load('pytorch/vision', 'densenet121', pretrained=True)
torch.save(model.state_dict(), PRE_TRAIN_MODEL_DIR + "densenet121.pth")
print(model)<jupyter_output>Using cache found in /home/icebee/.cache/torch/hub/pytorch_vision_master
Downloading: "https://download.pytorch.org/models/densenet121-a639ec97.pth" to /home/icebee/.cache/torch/checkpoints/densenet121-a639ec97.pth
100%|██████████| 32342954/32342954 [00:02<00:00, 11968911.48it/s]<jupyter_text>Inception V3<jupyter_code>model = torch.hub.load('pytorch/vision', 'inception_v3', pretrained=True)
torch.save(model.state_dict(), PRE_TRAIN_MODEL_DIR + "inception_v3.pth")
print(model)<jupyter_output>Using cache found in /home/icebee/.cache/torch/hub/pytorch_vision_master
Downloading: "https://download.pytorch.org/models/inception_v3_google-1a9a5a14.pth" to /home/icebee/.cache/torch/checkpoints/inception_v3_google-1a9a5a14.pth
100%|██████████| 108857766/108857766 [01:32<00:00, 1171869.20it/s]<jupyter_text>MobileNet V2<jupyter_code>model = torch.hub.load('pytorch/vision', 'mobilenet_v2', pretrained=True)
torch.save(model.state_dict(), PRE_TRAIN_MODEL_DIR + "mobilenet_v2.pth")
print(model)<jupyter_output>MobileNetV2(
  (features): Sequential(
    (0): ConvBNReLU(
      (0): Conv2d(3, 32, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
      (1): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (2): ReLU6(inplace)
    )
    (1): InvertedResidual(
      (conv): Sequential(
        (0): ConvBNReLU(
          (0): Conv2d(32, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=32, bias=False)
          (1): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (2): ReLU6(inplace)
        )
        (1): Conv2d(32, 16, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (2): BatchNorm2d(16, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      )
    )
    (2): InvertedResidual(
      (conv): Sequential(
        (0): ConvBNReLU(
          (0): Conv2d(16, 96, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (1): BatchNorm2d(96, eps=1e-05, momentum=0.1, affine=True, track_[...]<jupyter_text>ResNet<jupyter_code>model = torch.hub.load('pytorch/vision', 'resnet18', pretrained=True)
torch.save(model.state_dict(), PRE_TRAIN_MODEL_DIR + "resnet18.pth")
print(model)
model = torch.hub.load('pytorch/vision', 'resnet34', pretrained=True)
torch.save(model.state_dict(), PRE_TRAIN_MODEL_DIR + "resnet34.pth")
print(model)
model = torch.hub.load('pytorch/vision', 'resnet50', pretrained=True)
torch.save(model.state_dict(), PRE_TRAIN_MODEL_DIR + "resnet50.pth")
print(model)
model = torch.hub.load('pytorch/vision', 'resnet101', pretrained=True)
torch.save(model.state_dict(), PRE_TRAIN_MODEL_DIR + "resnet101.pth")
print(model)<jupyter_output>Using cache found in /home/icebee/.cache/torch/hub/pytorch_vision_master
Downloading: "https://download.pytorch.org/models/resnet101-5d3b4d8f.pth" to /home/icebee/.cache/torch/checkpoints/resnet101-5d3b4d8f.pth
100%|██████████| 178728960/178728960 [00:02<00:00, 87111864.82it/s]<jupyter_text>EfficientNetref : https://github.com/lukemelas/EfficientNet-PyTorch<jupyter_code>model = EfficientNet.from_pretrained("efficientnet-b0")
torch.save(model.state_dict(), PRE_TRAIN_MODEL_DIR + "efficientnet-b0.pth")
print(model)
model = EfficientNet.from_pretrained("efficientnet-b1")
torch.save(model.state_dict(), PRE_TRAIN_MODEL_DIR + "efficientnet-b1.pth")
print(model)
model = EfficientNet.from_pretrained("efficientnet-b2")
torch.save(model.state_dict(), PRE_TRAIN_MODEL_DIR + "efficientnet-b2.pth")
print(model)
model = EfficientNet.from_pretrained("efficientnet-b3")
torch.save(model.state_dict(), PRE_TRAIN_MODEL_DIR + "efficientnet-b3.pth")
print(model)
model = EfficientNet.from_pretrained("efficientnet-b4")
torch.save(model.state_dict(), PRE_TRAIN_MODEL_DIR + "efficientnet-b4.pth")
print(model)
model = EfficientNet.from_pretrained("efficientnet-b5")
torch.save(model.state_dict(), PRE_TRAIN_MODEL_DIR + "efficientnet-b5.pth")
print(model)<jupyter_output>Loaded pretrained weights for efficientnet-b5
EfficientNet(
  (_conv_stem): Conv2dStaticSamePadding(
    3, 48, kernel_size=(3, 3), stride=(2, 2), bias=False
    (static_padding): ZeroPad2d(padding=(0, 1, 0, 1), value=0.0)
  )
  (_bn0): BatchNorm2d(48, eps=0.001, momentum=0.010000000000000009, affine=True, track_running_stats=True)
  (_blocks): ModuleList(
    (0): MBConvBlock(
      (_depthwise_conv): Conv2dStaticSamePadding(
        48, 48, kernel_size=(3, 3), stride=[1, 1], groups=48, bias=False
        (static_padding): ZeroPad2d(padding=(1, 1, 1, 1), value=0.0)
      )
      (_bn1): BatchNorm2d(48, eps=0.001, momentum=0.010000000000000009, affine=True, track_running_stats=True)
      (_se_reduce): Conv2dStaticSamePadding(
        48, 12, kernel_size=(1, 1), stride=(1, 1)
        (static_padding): Identity()
      )
      (_se_expand): Conv2dStaticSamePadding(
        12, 48, kernel_size=(1, 1), stride=(1, 1)
        (static_padding): Identity()
      )
      (_project_conv): Conv2[...]
{'fraction_non_alphanumeric': 0.16217692027666544, 'fraction_numerical': 0.07226064797961412, 'mean_word_length': 5.800742574257426, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 19, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '174062', 'license': 'MIT', 'n_tokens_mistral': 2393, 'n_tokens_neox': 2192, 'n_words': 297, 'path': 'notebook/[Prepare]_07_pretrained_models.ipynb', 'repo_name': 'icebee16/kaggle_APTOS2019', 'size': '5494'}