while validating my model i am getting RuntimeError: There were no tensor arguments to this function error that i am unable to understand how to solve,below i am attaching the code and full error log,please let me know if you can detect where i am making mistakes,thanks in advance.
model training full code(sharing thorugh pastebin because it exceeding limit here in discuss.pytorch.org) :
code : seti - Pastebin.com
output with error log :
Pretrained is True
----------------------------------------------------------------
Layer (type) Output Shape Param #
================================================================
Conv2d-1 [-1, 32, 4, 4] 288
BatchNorm2d-2 [-1, 32, 4, 4] 64
SiLU-3 [-1, 32, 4, 4] 0
Conv2d-4 [-1, 32, 4, 4] 288
BatchNorm2d-5 [-1, 32, 4, 4] 64
SiLU-6 [-1, 32, 4, 4] 0
Conv2d-7 [-1, 8, 1, 1] 264
SiLU-8 [-1, 8, 1, 1] 0
Conv2d-9 [-1, 32, 1, 1] 288
Sigmoid-10 [-1, 32, 1, 1] 0
SqueezeExcite-11 [-1, 32, 4, 4] 0
Conv2d-12 [-1, 16, 4, 4] 512
BatchNorm2d-13 [-1, 16, 4, 4] 32
Identity-14 [-1, 16, 4, 4] 0
DepthwiseSeparableConv-15 [-1, 16, 4, 4] 0
Conv2d-16 [-1, 96, 4, 4] 1,536
BatchNorm2d-17 [-1, 96, 4, 4] 192
SiLU-18 [-1, 96, 4, 4] 0
Conv2d-19 [-1, 96, 2, 2] 864
BatchNorm2d-20 [-1, 96, 2, 2] 192
SiLU-21 [-1, 96, 2, 2] 0
Conv2d-22 [-1, 4, 1, 1] 388
SiLU-23 [-1, 4, 1, 1] 0
Conv2d-24 [-1, 96, 1, 1] 480
Sigmoid-25 [-1, 96, 1, 1] 0
SqueezeExcite-26 [-1, 96, 2, 2] 0
Conv2d-27 [-1, 24, 2, 2] 2,304
BatchNorm2d-28 [-1, 24, 2, 2] 48
InvertedResidual-29 [-1, 24, 2, 2] 0
Conv2d-30 [-1, 144, 2, 2] 3,456
BatchNorm2d-31 [-1, 144, 2, 2] 288
SiLU-32 [-1, 144, 2, 2] 0
Conv2d-33 [-1, 144, 2, 2] 1,296
BatchNorm2d-34 [-1, 144, 2, 2] 288
SiLU-35 [-1, 144, 2, 2] 0
Conv2d-36 [-1, 6, 1, 1] 870
SiLU-37 [-1, 6, 1, 1] 0
Conv2d-38 [-1, 144, 1, 1] 1,008
Sigmoid-39 [-1, 144, 1, 1] 0
SqueezeExcite-40 [-1, 144, 2, 2] 0
Conv2d-41 [-1, 24, 2, 2] 3,456
BatchNorm2d-42 [-1, 24, 2, 2] 48
InvertedResidual-43 [-1, 24, 2, 2] 0
Conv2d-44 [-1, 144, 2, 2] 3,456
BatchNorm2d-45 [-1, 144, 2, 2] 288
SiLU-46 [-1, 144, 2, 2] 0
Conv2d-47 [-1, 144, 1, 1] 3,600
BatchNorm2d-48 [-1, 144, 1, 1] 288
SiLU-49 [-1, 144, 1, 1] 0
Conv2d-50 [-1, 6, 1, 1] 870
SiLU-51 [-1, 6, 1, 1] 0
Conv2d-52 [-1, 144, 1, 1] 1,008
Sigmoid-53 [-1, 144, 1, 1] 0
SqueezeExcite-54 [-1, 144, 1, 1] 0
Conv2d-55 [-1, 40, 1, 1] 5,760
BatchNorm2d-56 [-1, 40, 1, 1] 80
InvertedResidual-57 [-1, 40, 1, 1] 0
Conv2d-58 [-1, 240, 1, 1] 9,600
BatchNorm2d-59 [-1, 240, 1, 1] 480
SiLU-60 [-1, 240, 1, 1] 0
Conv2d-61 [-1, 240, 1, 1] 6,000
BatchNorm2d-62 [-1, 240, 1, 1] 480
SiLU-63 [-1, 240, 1, 1] 0
Conv2d-64 [-1, 10, 1, 1] 2,410
SiLU-65 [-1, 10, 1, 1] 0
Conv2d-66 [-1, 240, 1, 1] 2,640
Sigmoid-67 [-1, 240, 1, 1] 0
SqueezeExcite-68 [-1, 240, 1, 1] 0
Conv2d-69 [-1, 40, 1, 1] 9,600
BatchNorm2d-70 [-1, 40, 1, 1] 80
InvertedResidual-71 [-1, 40, 1, 1] 0
Conv2d-72 [-1, 240, 1, 1] 9,600
BatchNorm2d-73 [-1, 240, 1, 1] 480
SiLU-74 [-1, 240, 1, 1] 0
Conv2d-75 [-1, 240, 1, 1] 2,160
BatchNorm2d-76 [-1, 240, 1, 1] 480
SiLU-77 [-1, 240, 1, 1] 0
Conv2d-78 [-1, 10, 1, 1] 2,410
SiLU-79 [-1, 10, 1, 1] 0
Conv2d-80 [-1, 240, 1, 1] 2,640
Sigmoid-81 [-1, 240, 1, 1] 0
SqueezeExcite-82 [-1, 240, 1, 1] 0
Conv2d-83 [-1, 80, 1, 1] 19,200
BatchNorm2d-84 [-1, 80, 1, 1] 160
InvertedResidual-85 [-1, 80, 1, 1] 0
Conv2d-86 [-1, 480, 1, 1] 38,400
BatchNorm2d-87 [-1, 480, 1, 1] 960
SiLU-88 [-1, 480, 1, 1] 0
Conv2d-89 [-1, 480, 1, 1] 4,320
BatchNorm2d-90 [-1, 480, 1, 1] 960
SiLU-91 [-1, 480, 1, 1] 0
Conv2d-92 [-1, 20, 1, 1] 9,620
SiLU-93 [-1, 20, 1, 1] 0
Conv2d-94 [-1, 480, 1, 1] 10,080
Sigmoid-95 [-1, 480, 1, 1] 0
SqueezeExcite-96 [-1, 480, 1, 1] 0
Conv2d-97 [-1, 80, 1, 1] 38,400
BatchNorm2d-98 [-1, 80, 1, 1] 160
InvertedResidual-99 [-1, 80, 1, 1] 0
Conv2d-100 [-1, 480, 1, 1] 38,400
BatchNorm2d-101 [-1, 480, 1, 1] 960
SiLU-102 [-1, 480, 1, 1] 0
Conv2d-103 [-1, 480, 1, 1] 4,320
BatchNorm2d-104 [-1, 480, 1, 1] 960
SiLU-105 [-1, 480, 1, 1] 0
Conv2d-106 [-1, 20, 1, 1] 9,620
SiLU-107 [-1, 20, 1, 1] 0
Conv2d-108 [-1, 480, 1, 1] 10,080
Sigmoid-109 [-1, 480, 1, 1] 0
SqueezeExcite-110 [-1, 480, 1, 1] 0
Conv2d-111 [-1, 80, 1, 1] 38,400
BatchNorm2d-112 [-1, 80, 1, 1] 160
InvertedResidual-113 [-1, 80, 1, 1] 0
Conv2d-114 [-1, 480, 1, 1] 38,400
BatchNorm2d-115 [-1, 480, 1, 1] 960
SiLU-116 [-1, 480, 1, 1] 0
Conv2d-117 [-1, 480, 1, 1] 12,000
BatchNorm2d-118 [-1, 480, 1, 1] 960
SiLU-119 [-1, 480, 1, 1] 0
Conv2d-120 [-1, 20, 1, 1] 9,620
SiLU-121 [-1, 20, 1, 1] 0
Conv2d-122 [-1, 480, 1, 1] 10,080
Sigmoid-123 [-1, 480, 1, 1] 0
SqueezeExcite-124 [-1, 480, 1, 1] 0
Conv2d-125 [-1, 112, 1, 1] 53,760
BatchNorm2d-126 [-1, 112, 1, 1] 224
InvertedResidual-127 [-1, 112, 1, 1] 0
Conv2d-128 [-1, 672, 1, 1] 75,264
BatchNorm2d-129 [-1, 672, 1, 1] 1,344
SiLU-130 [-1, 672, 1, 1] 0
Conv2d-131 [-1, 672, 1, 1] 16,800
BatchNorm2d-132 [-1, 672, 1, 1] 1,344
SiLU-133 [-1, 672, 1, 1] 0
Conv2d-134 [-1, 28, 1, 1] 18,844
SiLU-135 [-1, 28, 1, 1] 0
Conv2d-136 [-1, 672, 1, 1] 19,488
Sigmoid-137 [-1, 672, 1, 1] 0
SqueezeExcite-138 [-1, 672, 1, 1] 0
Conv2d-139 [-1, 112, 1, 1] 75,264
BatchNorm2d-140 [-1, 112, 1, 1] 224
InvertedResidual-141 [-1, 112, 1, 1] 0
Conv2d-142 [-1, 672, 1, 1] 75,264
BatchNorm2d-143 [-1, 672, 1, 1] 1,344
SiLU-144 [-1, 672, 1, 1] 0
Conv2d-145 [-1, 672, 1, 1] 16,800
BatchNorm2d-146 [-1, 672, 1, 1] 1,344
SiLU-147 [-1, 672, 1, 1] 0
Conv2d-148 [-1, 28, 1, 1] 18,844
SiLU-149 [-1, 28, 1, 1] 0
Conv2d-150 [-1, 672, 1, 1] 19,488
Sigmoid-151 [-1, 672, 1, 1] 0
SqueezeExcite-152 [-1, 672, 1, 1] 0
Conv2d-153 [-1, 112, 1, 1] 75,264
BatchNorm2d-154 [-1, 112, 1, 1] 224
InvertedResidual-155 [-1, 112, 1, 1] 0
Conv2d-156 [-1, 672, 1, 1] 75,264
BatchNorm2d-157 [-1, 672, 1, 1] 1,344
SiLU-158 [-1, 672, 1, 1] 0
Conv2d-159 [-1, 672, 1, 1] 16,800
BatchNorm2d-160 [-1, 672, 1, 1] 1,344
SiLU-161 [-1, 672, 1, 1] 0
Conv2d-162 [-1, 28, 1, 1] 18,844
SiLU-163 [-1, 28, 1, 1] 0
Conv2d-164 [-1, 672, 1, 1] 19,488
Sigmoid-165 [-1, 672, 1, 1] 0
SqueezeExcite-166 [-1, 672, 1, 1] 0
Conv2d-167 [-1, 192, 1, 1] 129,024
BatchNorm2d-168 [-1, 192, 1, 1] 384
InvertedResidual-169 [-1, 192, 1, 1] 0
Conv2d-170 [-1, 1152, 1, 1] 221,184
BatchNorm2d-171 [-1, 1152, 1, 1] 2,304
SiLU-172 [-1, 1152, 1, 1] 0
Conv2d-173 [-1, 1152, 1, 1] 28,800
BatchNorm2d-174 [-1, 1152, 1, 1] 2,304
SiLU-175 [-1, 1152, 1, 1] 0
Conv2d-176 [-1, 48, 1, 1] 55,344
SiLU-177 [-1, 48, 1, 1] 0
Conv2d-178 [-1, 1152, 1, 1] 56,448
Sigmoid-179 [-1, 1152, 1, 1] 0
SqueezeExcite-180 [-1, 1152, 1, 1] 0
Conv2d-181 [-1, 192, 1, 1] 221,184
BatchNorm2d-182 [-1, 192, 1, 1] 384
InvertedResidual-183 [-1, 192, 1, 1] 0
Conv2d-184 [-1, 1152, 1, 1] 221,184
BatchNorm2d-185 [-1, 1152, 1, 1] 2,304
SiLU-186 [-1, 1152, 1, 1] 0
Conv2d-187 [-1, 1152, 1, 1] 28,800
BatchNorm2d-188 [-1, 1152, 1, 1] 2,304
SiLU-189 [-1, 1152, 1, 1] 0
Conv2d-190 [-1, 48, 1, 1] 55,344
SiLU-191 [-1, 48, 1, 1] 0
Conv2d-192 [-1, 1152, 1, 1] 56,448
Sigmoid-193 [-1, 1152, 1, 1] 0
SqueezeExcite-194 [-1, 1152, 1, 1] 0
Conv2d-195 [-1, 192, 1, 1] 221,184
BatchNorm2d-196 [-1, 192, 1, 1] 384
InvertedResidual-197 [-1, 192, 1, 1] 0
Conv2d-198 [-1, 1152, 1, 1] 221,184
BatchNorm2d-199 [-1, 1152, 1, 1] 2,304
SiLU-200 [-1, 1152, 1, 1] 0
Conv2d-201 [-1, 1152, 1, 1] 28,800
BatchNorm2d-202 [-1, 1152, 1, 1] 2,304
SiLU-203 [-1, 1152, 1, 1] 0
Conv2d-204 [-1, 48, 1, 1] 55,344
SiLU-205 [-1, 48, 1, 1] 0
Conv2d-206 [-1, 1152, 1, 1] 56,448
Sigmoid-207 [-1, 1152, 1, 1] 0
SqueezeExcite-208 [-1, 1152, 1, 1] 0
Conv2d-209 [-1, 192, 1, 1] 221,184
BatchNorm2d-210 [-1, 192, 1, 1] 384
InvertedResidual-211 [-1, 192, 1, 1] 0
Conv2d-212 [-1, 1152, 1, 1] 221,184
BatchNorm2d-213 [-1, 1152, 1, 1] 2,304
SiLU-214 [-1, 1152, 1, 1] 0
Conv2d-215 [-1, 1152, 1, 1] 10,368
BatchNorm2d-216 [-1, 1152, 1, 1] 2,304
SiLU-217 [-1, 1152, 1, 1] 0
Conv2d-218 [-1, 48, 1, 1] 55,344
SiLU-219 [-1, 48, 1, 1] 0
Conv2d-220 [-1, 1152, 1, 1] 56,448
Sigmoid-221 [-1, 1152, 1, 1] 0
SqueezeExcite-222 [-1, 1152, 1, 1] 0
Conv2d-223 [-1, 320, 1, 1] 368,640
BatchNorm2d-224 [-1, 320, 1, 1] 640
InvertedResidual-225 [-1, 320, 1, 1] 0
Conv2d-226 [-1, 1280, 1, 1] 409,600
BatchNorm2d-227 [-1, 1280, 1, 1] 2,560
SiLU-228 [-1, 1280, 1, 1] 0
AdaptiveAvgPool2d-229 [-1, 1280, 1, 1] 0
Flatten-230 [-1, 1280] 0
SelectAdaptivePool2d-231 [-1, 1280] 0
Identity-232 [-1, 1280] 0
EfficientNet-233 [-1, 1280] 0
Linear-234 [-1, 1280] 1,639,680
Swish_Module-235 [-1, 1280] 0
Swish_Module-236 [-1, 1280] 0
Linear-237 [-1, 1] 1,281
================================================================
Total params: 5,647,933
Trainable params: 5,647,933
Non-trainable params: 0
----------------------------------------------------------------
Input size (MB): 0.00
Forward/backward pass size (MB): 0.88
Params size (MB): 21.55
Estimated Total Size (MB): 22.43
----------------------------------------------------------------
Model Summary:
None
Fitter prepared. Device is cuda
Epoch 0: adjusting learning rate of group 0 to 1.0000e-04.
Trainer prepared. We are using cuda device.
Training on Fold 0 and using efficientnet_b0
2021-08-08 04-57-26
LR: 0.0001
[RESULT]: Train. Epoch 1 | Avg Train Summary Loss: 0.453 | Time Elapsed: 00:01:32
cuda
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-26-5b29f33fdeb0> in <module>
1 model_pretrained = AlienSingleHead(config=config, pretrained=True)
----> 2 train_loop(
3 model_pretrained, df_folds, config, fold_num=0, train_one_fold=True, neptune=None
4 )
<ipython-input-25-05245855038d> in train_loop(model, df_folds, config, fold_num, train_one_fold, neptune)
73 oof_df = pd.DataFrame()
74 if train_one_fold:
---> 75 _oof_df = train_on_fold(
76 model, df_folds=df_folds, config=config, fold=fold_num, neptune=neptune
77 )
<ipython-input-25-05245855038d> in train_on_fold(model, df_folds, config, fold, neptune)
49 hongnan_classifier = Trainer(model=model, config=config, neptune=neptune)
50
---> 51 curr_fold_best_checkpoint = hongnan_classifier.fit(train_loader, valid_loader, fold)
52 # print(len(curr_fold_best_checkpoint["oof_preds"]))
53 df_valid[
<ipython-input-24-e1408d350d88> in fit(self, train_loader, val_loader, fold)
135 avg_val_roc,
136 val_predictions,
--> 137 ) = self.valid_one_epoch(val_loader)
138 # here we get oof preds
139 self.val_predictions = val_predictions
<ipython-input-24-e1408d350d88> in valid_one_epoch(self, val_loader)
377 )
378
--> 379 LOGITS = torch.cat(LOGITS).numpy()
380 Y_TRUE = torch.cat(Y_TRUE).numpy()
381 Y_PROBS = torch.cat(Y_PROBS).numpy()
RuntimeError: There were no tensor arguments to this function (e.g., you passed an empty list of Tensors), but no fallback function is registered for schema aten::_cat. This usually means that this function requires a non-empty list of Tensors. Available functions are [CPU, CUDA, QuantizedCPU, BackendSelect, Named, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradNestedTensor, UNKNOWN_TENSOR_TYPE_ID, AutogradPrivateUse1, AutogradPrivateUse2, AutogradPrivateUse3, Tracer, Autocast, Batched, VmapMode].
CPU: registered at /opt/conda/conda-bld/pytorch_1616554793803/work/build/aten/src/ATen/RegisterCPU.cpp:5925 [kernel]
CUDA: registered at /opt/conda/conda-bld/pytorch_1616554793803/work/build/aten/src/ATen/RegisterCUDA.cpp:7100 [kernel]
QuantizedCPU: registered at /opt/conda/conda-bld/pytorch_1616554793803/work/build/aten/src/ATen/RegisterQuantizedCPU.cpp:641 [kernel]
BackendSelect: fallthrough registered at /opt/conda/conda-bld/pytorch_1616554793803/work/aten/src/ATen/core/BackendSelectFallbackKernel.cpp:3 [backend fallback]
Named: registered at /opt/conda/conda-bld/pytorch_1616554793803/work/aten/src/ATen/core/NamedRegistrations.cpp:7 [backend fallback]
AutogradOther: registered at /opt/conda/conda-bld/pytorch_1616554793803/work/torch/csrc/autograd/generated/VariableType_2.cpp:9122 [autograd kernel]
AutogradCPU: registered at /opt/conda/conda-bld/pytorch_1616554793803/work/torch/csrc/autograd/generated/VariableType_2.cpp:9122 [autograd kernel]
AutogradCUDA: registered at /opt/conda/conda-bld/pytorch_1616554793803/work/torch/csrc/autograd/generated/VariableType_2.cpp:9122 [autograd kernel]
AutogradXLA: registered at /opt/conda/conda-bld/pytorch_1616554793803/work/torch/csrc/autograd/generated/VariableType_2.cpp:9122 [autograd kernel]
AutogradNestedTensor: registered at /opt/conda/conda-bld/pytorch_1616554793803/work/torch/csrc/autograd/generated/VariableType_2.cpp:9122 [autograd kernel]
UNKNOWN_TENSOR_TYPE_ID: registered at /opt/conda/conda-bld/pytorch_1616554793803/work/torch/csrc/autograd/generated/VariableType_2.cpp:9122 [autograd kernel]
AutogradPrivateUse1: registered at /opt/conda/conda-bld/pytorch_1616554793803/work/torch/csrc/autograd/generated/VariableType_2.cpp:9122 [autograd kernel]
AutogradPrivateUse2: registered at /opt/conda/conda-bld/pytorch_1616554793803/work/torch/csrc/autograd/generated/VariableType_2.cpp:9122 [autograd kernel]
AutogradPrivateUse3: registered at /opt/conda/conda-bld/pytorch_1616554793803/work/torch/csrc/autograd/generated/VariableType_2.cpp:9122 [autograd kernel]
Tracer: registered at /opt/conda/conda-bld/pytorch_1616554793803/work/torch/csrc/autograd/generated/TraceType_2.cpp:10525 [kernel]
Autocast: registered at /opt/conda/conda-bld/pytorch_1616554793803/work/aten/src/ATen/autocast_mode.cpp:254 [kernel]
Batched: registered at /opt/conda/conda-bld/pytorch_1616554793803/work/aten/src/ATen/BatchingRegistrations.cpp:1016 [backend fallback]
VmapMode: fallthrough registered at /opt/conda/conda-bld/pytorch_1616554793803/work/aten/src/ATen/VmapModeRegistrations.cpp:33 [backend fallback]