RuntimeError: There were no tensor arguments to this function (e.g., you passed an empty list of Tensors)

mobassir94: <p>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.</p>
<p><strong>model training full code(sharing thorugh pastebin because it exceeding limit here in <a href="http://discuss.pytorch.org">discuss.pytorch.org</a>)</strong> :</p>
<p>code : <a href="https://pastebin.com/35XSma1N" class="inline-onebox" rel="noopener nofollow ugc">seti - Pastebin.com</a></p>
<p><strong>output with error log :</strong></p>
<pre><code class="lang-auto">

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)
&lt;ipython-input-26-5b29f33fdeb0&gt; in &lt;module&gt;
      1 model_pretrained = AlienSingleHead(config=config, pretrained=True)
----&gt; 2 train_loop(
      3     model_pretrained, df_folds, config, fold_num=0, train_one_fold=True, neptune=None
      4 )

&lt;ipython-input-25-05245855038d&gt; in train_loop(model, df_folds, config, fold_num, train_one_fold, neptune)
     73     oof_df = pd.DataFrame()
     74     if train_one_fold:
---&gt; 75         _oof_df = train_on_fold(
     76             model, df_folds=df_folds, config=config, fold=fold_num, neptune=neptune
     77         )

&lt;ipython-input-25-05245855038d&gt; in train_on_fold(model, df_folds, config, fold, neptune)
     49     hongnan_classifier = Trainer(model=model, config=config, neptune=neptune)
     50 
---&gt; 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[

&lt;ipython-input-24-e1408d350d88&gt; in fit(self, train_loader, val_loader, fold)
    135                 avg_val_roc,
    136                 val_predictions,
--&gt; 137             ) = self.valid_one_epoch(val_loader)
    138             # here we get oof preds
    139             self.val_predictions = val_predictions

&lt;ipython-input-24-e1408d350d88&gt; in valid_one_epoch(self, val_loader)
    377                         )
    378 
--&gt; 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]
</code></pre>

gphilip: <p>Why does it say</p>
<aside class="quote no-group" data-username="mobassir94" data-post="1" data-topic="128877">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/mobassir94/48/21181_2.png" class="avatar"> mobassir94:</div>
<blockquote>
<p><code>Input size (MB): 0.00</code></p>
</blockquote>
</aside>
<p>?</p>
<p>Are you not passing anything as input to the validation step? Try printing <code>len(val_loader)</code> <strong>before</strong> the line <code>print(images)</code>  in <code>valid_one_epoch()</code>.</p>

mobassir94: <p>[quote=“gphilip, post:2, topic:128877”]<br>
df_valid showing me empty dataframe even though i did this :</p>
<p>df_train = df_folds[df_folds[“fold”] != fold].reset_index(drop=True)<br>
df_valid = df_folds[df_folds[“fold”] == fold].reset_index(drop=True)</p>
<p>inside train_on_fold function,and when i check df_folds dataframe i get</p>
<div class="md-table">
<table>
<thead>
<tr>
<th></th>
<th>id</th>
<th>target</th>
<th>file_path</th>
<th>fold</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>0000799a2b2c42d</td>
<td>0</td>
<td>/home/apsisdev/data/seti/seti-breakthrough-lis…</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>00042890562ff68</td>
<td>0</td>
<td>/home/apsisdev/data/seti/seti-breakthrough-lis…</td>
<td>1</td>
</tr>
<tr>
<td>2</td>
<td>0005364cdcb8e5b</td>
<td>0</td>
<td>/home/apsisdev/data/seti/seti-breakthrough-lis…</td>
<td>4</td>
</tr>
<tr>
<td>3</td>
<td>0007a5a46901c56</td>
<td>0</td>
<td>/home/apsisdev/data/seti/seti-breakthrough-lis…</td>
<td>2</td>
</tr>
<tr>
<td>4</td>
<td>0009283e145448e</td>
<td>0</td>
<td>/home/apsisdev/data/seti/seti-breakthrough-lis…</td>
<td>3</td>
</tr>
<tr>
<td>…</td>
<td>…</td>
<td>…</td>
<td>…</td>
<td>…</td>
</tr>
<tr>
<td>59995</td>
<td>fff8217fe05aba3</td>
<td>0</td>
<td>/home/apsisdev/data/seti/seti-breakthrough-lis…</td>
<td>3</td>
</tr>
<tr>
<td>59996</td>
<td>fffa939e610ed70</td>
<td>0</td>
<td>/home/apsisdev/data/seti/seti-breakthrough-lis…</td>
<td>4</td>
</tr>
<tr>
<td>59997</td>
<td>fffbb1c9c3d6c31</td>
<td>1</td>
<td>/home/apsisdev/data/seti/seti-breakthrough-lis…</td>
<td>3</td>
</tr>
<tr>
<td>59998</td>
<td>fffc9a763d23647</td>
<td>0</td>
<td>/home/apsisdev/data/seti/seti-breakthrough-lis…</td>
<td>2</td>
</tr>
<tr>
<td>59999</td>
<td>ffff0a799efa529</td>
<td>0</td>
<td>/home/apsisdev/data/seti/seti-breakthrough-lis…</td>
<td>1</td>
</tr>
</tbody>
</table>
</div><p>id target file_path fold</p>
<p>i can’t understand why df_valid is 0</p>

gphilip: <p>Could you describe what you expect the following line of code to do?</p>
<aside class="quote no-group" data-username="mobassir94" data-post="3" data-topic="128877">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/mobassir94/48/21181_2.png" class="avatar"> mobassir94:</div>
<blockquote>
<p><code>df_valid = df_folds[df_folds[“fold”] == fold].reset_index(drop=True)</code></p>
</blockquote>
</aside>
<p>Also, what kind of object is <code>fold</code> when this line is executed, and what is its value?</p>

mobassir94: <p><a class="mention" href="/u/gphilip">@gphilip</a> i have 5 stratified folds for cross validation,so if i choose fold = 1,then<br>
<code>df_valid = df_folds[df_folds[“fold”] == fold].reset_index(drop=True)</code><br>
df_valid will take all the samples from dataframe where fold == 1 and all other samples will be used for training,in fold column i have 1-5 values as you can see from this :<br>
id	                      target                	file_path	                                               fold<br>
0	0000799a2b2c42d	0	/home/apsisdev/data/seti/seti-breakthrough-lis…	1<br>
1	00042890562ff68	0	/home/apsisdev/data/seti/seti-breakthrough-lis…	1<br>
2	0005364cdcb8e5b	0	/home/apsisdev/data/seti/seti-breakthrough-lis…	4<br>
3	0007a5a46901c56	0	/home/apsisdev/data/seti/seti-breakthrough-lis…	2<br>
4	0009283e145448e	0	/home/apsisdev/data/seti/seti-breakthrough-lis…	3<br>
…	…	…	…	…<br>
59995	fff8217fe05aba3	0	/home/apsisdev/data/seti/seti-breakthrough-lis…	3<br>
59996	fffa939e610ed70	0	/home/apsisdev/data/seti/seti-breakthrough-lis…	4<br>
59997	fffbb1c9c3d6c31	1	/home/apsisdev/data/seti/seti-breakthrough-lis…	3<br>
59998	fffc9a763d23647	0	/home/apsisdev/data/seti/seti-breakthrough-lis…	2<br>
59999	ffff0a799efa529	0	/home/apsisdev/data/seti/seti-breakthrough-lis…	1<br>
id target file_path fold</p>
<p>now i understand my silly mistake…while training i was doing this :</p>
<p>model_pretrained = AlienSingleHead(config=config, pretrained=True)<br>
train_loop(<br>
model_pretrained, df_folds, config, fold_num=0, train_one_fold=True, neptune=None<br>
)</p>
<p>where my fold starts from 1 and not from 0,so this silly mistake causes df_valid to contain 0 samples…for first fold training i need to do this :</p>
<p>model_pretrained = AlienSingleHead(config=config, pretrained=True)<br>
train_loop(<br>
model_pretrained, df_folds, config, fold_num=1, train_one_fold=True, neptune=None<br>
)</p>
<p>and then everything is fine,thank you for your time</p>