Training with classification_pyt

Please provide the following information when requesting support.

• Hardware (T4/V100/Xavier/Nano/etc) RTX4080
• Network Type (Detectnet_v2/Faster_rcnn/Yolo_v4/LPRnet/Mask_rcnn/Classification/etc) Classification using classification_pyt

Training spec file is as follow.

encryption_key: tlt_encode
results_dir: StAndrew/classification/classification_results
wandb:
  enable: False
train:
  enable_ema: False
  seed: 47
  resume_training_checkpoint_path: null
  num_nodes: 1
  num_gpus: 2
  gpu_ids: [0,1]
  validation_interval: 5
  checkpoint_interval: 5
  tensorboard:
    enabled: True
  optim:
    lr: 0.001
    optim: "adamw"
    policy: "cosine"
    weight_decay: 0.05
    warmup_epochs: 0
dataset:
  dataset: "CLDataset"
  root_dir: StAndrew/classification/abscondment
  batch_size: 128
  workers: 8
  num_classes: 3
  img_size: 224
  augmentation:
    random_flip:
      vflip_probability: 0
      hflip_probability: 0.5
      enable: True
    random_rotate:
      rotate_probability: 0.5
      angle_list: [90, 180, 270]
      enable: True
    random_color:
      brightness: 0.4
      contrast: 0.4
      saturation: 0.4
      enable: False
    with_scale_random_crop:
      enable: False
    with_random_crop: False
    with_random_blur: False
  train_dataset:
    images_dir: StAndrew/classification/abscondment/training_set
  val_dataset:
    images_dir: StAndrew/classification/abscondment/val_set
  test_dataset:
    images_dir: StAndrew/classification/abscondment/test_set
model:
  backbone:
    type: "fan_small_12_p4_hybrid"
    pretrained_backbone_path: StAndrew/classification/pretrained_fan_hybrid_small/fan_hybrid_large_in22k.pth
    freeze_backbone: True
  head:
    type: "TAOLinearClsHead"
    binary: False
    topk: [1]
    loss:
      type: CrossEntropyLoss
      label_smooth_val: 0.1

I am going to train using fan_hybrid_large_in22k.pth pretrained model.
I have errors as

Seed set to 47
2025-11-10 07:33:13,335 - [TAO Toolkit] - WARNING - The backbone is frozen. (backbone_base.py:358)The backbone is frozen.
2025-11-10 07:33:13,335 - [TAO Toolkit] - INFO - Loading pretrained weights from StAndrew/classification/pretrained_fan_hybrid_small/fan_hybrid_large_in22k.pth (classifier.py:64)Loading pretrained weights from StAndrew/classification/pretrained_fan_hybrid_small/fan_hybrid_large_in22k.pth
Error executing job with overrides: ['results_dir=/workspace/home/user/tao_tutorials_ver_6_25_9/StAndrew/classification/abscondment_results', 'train.num_epochs=40']Traceback (most recent call last):
  File "/usr/local/lib/python3.12/dist-packages/nvidia_tao_pytorch/core/decorators/workflow.py", line 72, in _func
    raise e
  File "/usr/local/lib/python3.12/dist-packages/nvidia_tao_pytorch/core/decorators/workflow.py", line 51, in _func
    runner(cfg, **kwargs)
  File "/usr/local/lib/python3.12/dist-packages/nvidia_tao_pytorch/cv/classification_pyt/scripts/train.py", line 81, in main
    run_experiment(
  File "/usr/local/lib/python3.12/dist-packages/nvidia_tao_pytorch/cv/classification_pyt/scripts/train.py", line 49, in run_experiment
    model = lightning_module(experiment_config)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/nvidia_tao_pytorch/cv/classification_pyt/model/classifier_pl_model.py", line 112, in __init__
    self._build_model(export)
  File "/usr/local/lib/python3.12/dist-packages/nvidia_tao_pytorch/cv/classification_pyt/model/classifier_pl_model.py", line 172, in _build_model
    self.model = build_model(experiment_config=self.experiment_spec, export=export)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/nvidia_tao_pytorch/cv/classification_pyt/model/classifier.py", line 66, in build_model
    msg = model.load_state_dict(state_dict, strict=False)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/torch/nn/modules/module.py", line 2588, in load_state_dict
    raise RuntimeError(
RuntimeError: Error(s) in loading state_dict for FAN:
size mismatch for norm.bias: copying a param with shape torch.Size([480]) from checkpoint, the shape in current model is torch.Size([384]).). torch.Size([384]).([384, 1536]).36, 1, 3, 3]).
Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
2025-11-10 07:33:14,072 - [TAO Toolkit] - WARNING - Telemetry data couldn't be sent, but the command ran successfully. (entrypoint.py:339)
2025-11-10 07:33:14,072 - TAO Toolkit - WARNING - Telemetry data couldn't be sent, but the command ran successfully.
2025-11-10 07:33:14,072 - [TAO Toolkit] - WARNING - [Error]: 'str' object has no attribute 'decode' (entrypoint.py:342)
2025-11-10 07:33:14,072 - TAO Toolkit - WARNING - [Error]: 'str' object has no attribute 'decode'
2025-11-10 07:33:14,072 - [TAO Toolkit] - WARNING - Execution status: FAIL (entrypoint.py:346)
2025-11-10 07:33:14,072 - TAO Toolkit - WARNING - Execution status: FAIL
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=31 encoding='UTF-8'>
/usr/lib/python3.12/tempfile.py:1075: ResourceWarning: Implicitly cleaning up <TemporaryDirectory '/tmp/tmpsjqrc1v0'>
  _warnings.warn(warn_message, ResourceWarning)

What could be wrong?

Please use the pretrained model belongs to backbone.type: "fan_small_12_p4_hybrid"

Currently, you are using the fan_large model.

I want to use the fan_large_model, what should I charge in config file?

Please refer to Image Classification PyT — Tao Toolkit.

Yes they are for fan_small_12_p4_hybrid.
If I want to use fan_hybrid_large_in22k_1k_384, what should be

backbone: 
    type:

in the config file?

Please use
image

I have this error after training for 49 epochs.

Epoch 4: 100%|██████████| 188/188 [00:39<00:00,  4.81it/s, v_num=1, train_loss_step=0.398, lr=0.00099, train_loss_epoch=0.398]]
Epoch 9: 100%|██████████| 188/188 [00:39<00:00,  4.79it/s, v_num=1, train_loss_step=0.359, lr=0.000962, train_loss_epoch=0.373, val_loss=0.360, val_acc_1=0.968]
Epoch 14: 100%|██████████| 188/188 [00:38<00:00,  4.84it/s, v_num=1, train_loss_step=0.327, lr=0.000916, train_loss_epoch=0.372, val_loss=0.341, val_acc_1=0.982]
Epoch 19: 100%|██████████| 188/188 [00:38<00:00,  4.83it/s, v_num=1, train_loss_step=0.296, lr=0.000854, train_loss_epoch=0.345, val_loss=0.370, val_acc_1=0.965]
Epoch 24: 100%|██████████| 188/188 [00:38<00:00,  4.83it/s, v_num=1, train_loss_step=0.324, lr=0.000778, train_loss_epoch=0.330, val_loss=0.362, val_acc_1=0.963]
Epoch 29: 100%|██████████| 188/188 [00:39<00:00,  4.81it/s, v_num=1, train_loss_step=0.293, lr=0.000691, train_loss_epoch=0.322, val_loss=0.348, val_acc_1=0.974]
Epoch 34: 100%|██████████| 188/188 [00:40<00:00,  4.59it/s, v_num=1, train_loss_step=0.311, lr=0.000598, train_loss_epoch=0.320, val_loss=0.330, val_acc_1=0.985]
Epoch 39: 100%|██████████| 188/188 [00:39<00:00,  4.79it/s, v_num=1, train_loss_step=0.296, lr=0.0005, train_loss_epoch=0.324, val_loss=0.330, val_acc_1=0.983]3]
Epoch 44: 100%|██████████| 188/188 [00:39<00:00,  4.82it/s, v_num=1, train_loss_step=0.292, lr=0.000403, train_loss_epoch=0.314, val_loss=0.332, val_acc_1=0.983]
Epoch 49: 100%|██████████| 188/188 [00:39<00:00,  4.79it/s, v_num=1, train_loss_step=0.292, lr=0.000309, train_loss_epoch=0.312, val_loss=0.341, val_acc_1=0.981]
Epoch 49: 100%|██████████| 188/188 [00:42<00:00,  4.48it/s, v_num=1, train_loss_step=0.292, lr=0.000309, train_loss_epoch=0.313, val_loss=0.328, val_acc_1=0.985][rank1]:[E1117 09:01:57.969242689 ProcessGroupNCCL.cpp:627] [Rank 1] Watchdog caught collective operation timeout: WorkNCCL(SeqNum=602302, OpType=ALLREDUCE, NumelIn=1, NumelOut=1, Timeout(ms)=1800000) ran for 1800023 milliseconds before timing out[rank1]:[E1117 09:01:57.977487731 ProcessGroupNCCL.cpp:2060] [PG ID 0 PG GUID 0(default_pg) Rank 1]  failure detected by watchdog at work sequence id: 602302 PG status: last enqueued work: 602302, last co[rank1]:[E1117 09:01:57.977492360 ProcessGroupNCCL.cpp:665] Stack trace of the failed collective not found, potentially because FlightRecorder is disabled. You can enable it by setting TORCH_NCCL_TRACE_BU[rank1]:[E1117 09:01:57.977494191 ProcessGroupNCCL.cpp:679] [Rank 1] Some NCCL operations have failed or timed out. Due to the asynchronous nature of CUDA kernels, subsequent GPU operations might run on c[rank1]:[E1117 09:01:57.982598033 ProcessGroupNCCL.cpp:1790] [PG ID 0 PG GUID 0(default_pg) Rank 1] Process group watchdog thread terminated with exception: [Rank 1] Watchdog caught collective operation timeout: WorkNCCL(SeqNum=602302, OpType=ALLREDUCE, NumelIn=1, NumelOut=1, Timeout(ms)=1800000) ran for 1800023 milliseconds before timing out.Exception raised from checkTimeout at /opt/pytorch/pytorch/torch/csrc/distributed/c10d/ProcessGroupNCCL.cpp:630 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) + 0x98 (0x7e7f9029e748 in /usr/local/lib/python3.12/dist-packages/torch/lib/libc10.so)
frame #1: c10d::ProcessGroupNCCL::WorkNCCL::checkTimeout(std::optional<std::chrono::duration<long, std::ratio<1l, 1000l> > >) + 0x23d (0x7e7f9105cf9d in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_cuda.so)
frame #2: c10d::ProcessGroupNCCL::watchdogHandler() + 0x9e8 (0x7e7f9105e598 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_cuda.so)
frame #3: c10d::ProcessGroupNCCL::ncclCommWatchdog() + 0x14d (0x7e7f9105f23d in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_cuda.so)
frame #4: <unknown function> + 0xecdb4 (0x7e7f81e6edb4 in /usr/lib/x86_64-linux-gnu/libstdc++.so.6)
frame #5: <unknown function> + 0x9caa4 (0x7e7ff8732aa4 in /usr/lib/x86_64-linux-gnu/libc.so.6)
frame #6: <unknown function> + 0x129c3c (0x7e7ff87bfc3c in /usr/lib/x86_64-linux-gnu/libc.so.6)

terminate called after throwing an instance of 'c10::DistBackendError'
what():  [PG ID 0 PG GUID 0(default_pg) Rank 1] Process group watchdog thread terminated with exception: [Rank 1] Watchdog caught collective operation timeout: WorkNCCL(SeqNum=602302, OpType=ALLREDUCE, NumelIn=1, NumelOut=1, Timeout(ms)=1800000) ran for 1800023 milliseconds before timing out.Exception raised from checkTimeout at /opt/pytorch/pytorch/torch/csrc/distributed/c10d/ProcessGroupNCCL.cpp:630 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) + 0x98 (0x7e7f9029e748 in /usr/local/lib/python3.12/dist-packages/torch/lib/libc10.so)
frame #1: c10d::ProcessGroupNCCL::WorkNCCL::checkTimeout(std::optional<std::chrono::duration<long, std::ratio<1l, 1000l> > >) + 0x23d (0x7e7f9105cf9d in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_cuda.so)
frame #2: c10d::ProcessGroupNCCL::watchdogHandler() + 0x9e8 (0x7e7f9105e598 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_cuda.so)
frame #3: c10d::ProcessGroupNCCL::ncclCommWatchdog() + 0x14d (0x7e7f9105f23d in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_cuda.so)
frame #4: <unknown function> + 0xecdb4 (0x7e7f81e6edb4 in /usr/lib/x86_64-linux-gnu/libstdc++.so.6)
frame #5: <unknown function> + 0x9caa4 (0x7e7ff8732aa4 in /usr/lib/x86_64-linux-gnu/libc.so.6)
frame #6: <unknown function> + 0x129c3c (0x7e7ff87bfc3c in /usr/lib/x86_64-linux-gnu/libc.so.6)

Exception raised from ncclCommWatchdog at /opt/pytorch/pytorch/torch/csrc/distributed/c10d/ProcessGroupNCCL.cpp:1796 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) + 0x98 (0x7e7f9029e748 in /usr/local/lib/python3.12/dist-packages/torch/lib/libc10.so)
frame #1: <unknown function> + 0xc80f1e (0x7e7f91039f1e in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_cuda.so)
frame #2: <unknown function> + 0x8fb125 (0x7e7f90cb4125 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_cuda.so)
frame #3: <unknown function> + 0xecdb4 (0x7e7f81e6edb4 in /usr/lib/x86_64-linux-gnu/libstdc++.so.6)
frame #4: <unknown function> + 0x9caa4 (0x7e7ff8732aa4 in /usr/lib/x86_64-linux-gnu/libc.so.6)
frame #5: <unknown function> + 0x129c3c (0x7e7ff87bfc3c in /usr/lib/x86_64-linux-gnu/libc.so.6)

2025-11-17 09:02:02,725 - [TAO Toolkit] - WARNING - Telemetry data couldn't be sent, but the command ran successfully. (entrypoint.py:339)
2025-11-17 09:02:02,725 - TAO Toolkit - WARNING - Telemetry data couldn't be sent, but the command ran successfully.
2025-11-17 09:02:02,741 - [TAO Toolkit] - WARNING - [Error]: 'str' object has no attribute 'decode' (entrypoint.py:342)
2025-11-17 09:02:02,741 - TAO Toolkit - WARNING - [Error]: 'str' object has no attribute 'decode'
2025-11-17 09:02:02,741 - [TAO Toolkit] - WARNING - Execution status: FAIL (entrypoint.py:346)
2025-11-17 09:02:02,741 - TAO Toolkit - WARNING - Execution status: FAIL
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=31 encoding='UTF-8'>
/usr/lib/python3.12/tempfile.py:1075: ResourceWarning: Implicitly cleaning up <TemporaryDirectory '/tmp/tmp48lqjic7'>
  _warnings.warn(warn_message, ResourceWarning)
root@user-Nuvo-10000-Series:/workspace/home/user/tao_tutorials_ver_6_25_9#

I am training the model “fan_hybrid_large_in22k.pth”

This is my config file in training.

encryption_key: tlt_encode
results_dir: StAndrew/classification/abscondment_results
wandb:
  enable: False
train:
  enable_ema: False
  seed: 47
  resume_training_checkpoint_path: null
  num_nodes: 1
  num_gpus: 2
  gpu_ids: [0,1]
  validation_interval: 5
  checkpoint_interval: 5
  tensorboard:
    enabled: True
  optim:
    lr: 0.001
    optim: "adamw"
    policy: "cosine"
    weight_decay: 0.05
    warmup_epochs: 0
dataset:
  dataset: "CLDataset"
  root_dir: StAndrew/classification/abscondment
  batch_size: 16
  workers: 8
  num_classes: 3
  img_size: 224
  augmentation:
    random_flip:
      vflip_probability: 0
      hflip_probability: 0.5
      enable: True
    random_rotate:
      rotate_probability: 0.5
      angle_list: [90, 180, 270]
      enable: True
    random_color:
      brightness: 0.4
      contrast: 0.4
      saturation: 0.4
      enable: False
    with_scale_random_crop:
      enable: False
    with_random_crop: False
    with_random_blur: False
  train_dataset:
    images_dir: StAndrew/classification/abscondment/training_set
  val_dataset:
    images_dir: StAndrew/classification/abscondment/val_set
  test_dataset:
    images_dir: StAndrew/classification/abscondment/test_set
model:
  backbone:
    type: "fan_large_16_p4_hybrid"
    pretrained_backbone_path: StAndrew/classification/pretrained_fan_hybrid_small/fan_hybrid_large_in22k.pth
    freeze_backbone: False
  head:
    type: "TAOLinearClsHead"
    binary: False
    topk: [1]
    loss:
      type: CrossEntropyLoss
      label_smooth_val: 0.1

My system has two RTX4080 GPUs.

To narrow down, please try:

  • exp1: reduce batch_size to 8 or 4 and retry.
  • exp2: use smaller backbone and retry.

Hi! Since we haven’t heard back from you for a while, we’re assuming everything is resolved and will close this topic. If you need any further help, don’t hesitate to open a new topic. Thanks!