Repository: pytorch
Issue: dataloader crashes after several epochs if the trained model contains triton-based operators
Labels: module: dataloader,triaged

### 🐛 Describe the bug

Compete codes uploaded to:
[minifer.py](https://gist.github.com/flishwang/9e561371966ab12c7f3709f7315aea14)

Key codes  (Line 990 to Line 1068):
```
use_block_attn = sys.argv[-1] == '1'
print(f'use_block_attn = {use_block_attn} {sys.argv[-1]}')
model = ViTA(
        patch_size=16, embed_dim=768, depth=12, num_heads=12,
        decoder_embed_dim=0, attn_left_one= use_block_attn,
        mlp_ratio=4, norm_layer=torch.nn.LayerNorm, use_checkpoint=True,
        num_classes = 1000, img_size = 224, global_pool = True).to(device)

model = DDP(model)

transform = create_transform(
            input_size=224,
            is_training=True,
            interpolation='bicubic',
        )
transform2 = create_transform(
            input_size=224,
            is_training=False,
            interpolation='bicubic',
        )
dataset_train = datasets.ImageFolder('/tmp/ILSVRC2012_debug/train', transform=transform)
dataset_val = datasets.ImageFolder('/tmp/ILSVRC2012_debug/val', transform=transform)

sampler_train = torch.utils.data.DistributedSampler(
            dataset_train, num_replicas=num_tasks, rank=rank, shuffle=True
        )
sampler_val = torch.utils.data.DistributedSampler(
                dataset_val, num_replicas=num_tasks, rank=rank, shuffle=True)

data_loader_train = torch.utils.data.DataLoader(
        dataset_train, sampler=sampler_train,
        batch_size=batch_size,
        num_workers=num_workers,
        pin_memory=True,
        drop_last=True,
    )

data_loader_val = torch.utils.data.DataLoader(
    dataset_val, sampler=sampler_val,
    batch_size=batch_size,
    num_workers=num_workers,
    pin_memory=True,
    drop_last=False
)

scaler = torch.cuda.amp.GradScaler()
optimizer = torch.optim.AdamW(model.parameters(), lr=1e-4, betas=(0.9,0.95))
criterion = torch.nn.CrossEntropyLoss()

for epoch in range(10):
    model.train()
    data_loader_train.sampler.set_epoch(epoch)
    optimizer.zero_grad()
    for data_iter_step, (samples, targets) in enumerate(data_loader_train):
        print(f'train batch {epoch}/{data_iter_step}')
        samples = samples.to(device, non_blocking=True)
        targets = targets.to(device, non_blocking=True)
        with torch.cuda.amp.autocast():
            outputs = model(samples)
        loss = criterion(outputs, targets)
        scaler.scale(loss).backward(create_graph=False)
        scaler.unscale_(optimizer)
        scaler.step(optimizer)
        scaler.update()
        optimizer.zero_grad()
        torch.cuda.synchronize()
    print('train epoch {} done'.format(epoch))

    model.eval()
    total_loss = 0
    for idx,(images,target) in enumerate(data_loader_val):
        print(f'test batch {epoch}/{idx}')
        images = images.to(device, non_blocking=True)
        target = target.to(device, non_blocking=True)
        with torch.cuda.amp.autocast():
            output = model(images)
            loss = criterion(output, target)
        total_loss += loss
    print('eval epoch {} done'.format(epoch))
```

Before running the code, one should put some images in the same subfolders in /tmp/ILSVRC2012_debug/train and /tmp/ILSVRC2012_debug/val, or modify Line 1010-1011 to point to the data path.

Running the code with cmd
```
python -m torch.distributed.launch --nproc_per_node auto --master_port 33333 minifer.py 0
```
passes, but running the code with cmd 
```
python -m torch.distributed.launch --nproc_per_node auto --master_port 33333 minifer.py 1
```
crashes. The only difference is whether the trained model uses the triton kernel in block_attention.

# Crash info
```

train batch 2/0
train batch 2/0
train batch 2/0
train batch 2/0
train batch 2/0
train batch 2/0
train batch 2/0
train batch 2/0
train batch 2/1
train batch 2/1
train batch 2/1
train batch 2/1
train batch 2/1
train batch 2/1
train batch 2/1
train batch 2/1
train epoch 2 done
train epoch 2 done
train epoch 2 done
train epoch 2 done
train epoch 2 done
train epoch 2 done
train epoch 2 done
train epoch 2 done
ERROR: Unexpected segmentation fault encountered in worker.
ERROR: Unexpected segmentation fault encountered in worker.
ERROR: Unexpected segmentation fault encountered in worker.
ERROR: Unexpected segmentation fault encountered in worker.
ERROR: Unexpected segmentation fault encountered in worker.
ERROR: Unexpected segmentation fault encountered in worker.
ERROR: Unexpected segmentation fault encountered in worker.
ERROR: Unexpected segmentation fault encountered in worker.
[rank4]: Traceback (most recent call last):
[rank4]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1133, in _try_get_data
[rank4]:     data = self._data_queue.get(timeout=timeout)
[rank4]:   File "/usr/local/lib/python3.10/queue.py", line 180, in get
[rank4]:     self.not_empty.wait(remaining)
[rank4]:   File "/usr/local/lib/python3.10/threading.py", line 324, in wait
[rank4]:     gotit = waiter.acquire(True, timeout)
[rank4]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/_utils/signal_handling.py", line 66, in handler
[rank4]:     _error_if_any_worker_fails()
[rank4]: RuntimeError: DataLoader worker (pid 42819) is killed by signal: Segmentation fault. 

[rank4]: The above exception was the direct cause of the following exception:

[rank4]: Traceback (most recent call last):
[rank4]:   File "/mnt/modeling/home/bwang/projects/mae-d2v/test2.py", line 1060, in <module>
[rank4]:     for idx,(images,target) in enumerate(data_loader_val):
[rank4]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 631, in __next__
[rank4]:     data = self._next_data()
[rank4]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1329, in _next_data
[rank4]:     idx, data = self._get_data()
[rank4]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1285, in _get_data
[rank4]:     success, data = self._try_get_data()
[rank4]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1146, in _try_get_data
[rank4]:     raise RuntimeError(f'DataLoader worker (pid(s) {pids_str}) exited unexpectedly') from e
[rank4]: RuntimeError: DataLoader worker (pid(s) 42819) exited unexpectedly
[rank7]: Traceback (most recent call last):
[rank7]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1133, in _try_get_data
[rank7]:     data = self._data_queue.get(timeout=timeout)
[rank7]:   File "/usr/local/lib/python3.10/queue.py", line 180, in get
[rank7]:     self.not_empty.wait(remaining)
[rank7]:   File "/usr/local/lib/python3.10/threading.py", line 324, in wait
[rank7]:     gotit = waiter.acquire(True, timeout)
[rank7]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/_utils/signal_handling.py", line 66, in handler
[rank7]:     _error_if_any_worker_fails()
[rank7]: RuntimeError: DataLoader worker (pid 42817) is killed by signal: Segmentation fault. 

[rank7]: The above exception was the direct cause of the following exception:

[rank7]: Traceback (most recent call last):
[rank7]:   File "/mnt/modeling/home/bwang/projects/mae-d2v/test2.py", line 1060, in <module>
[rank7]:     for idx,(images,target) in enumerate(data_loader_val):
[rank7]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 631, in __next__
[rank7]:     data = self._next_data()
[rank7]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1329, in _next_data
[rank7]:     idx, data = self._get_data()
[rank7]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1285, in _get_data
[rank7]:     success, data = self._try_get_data()
[rank7]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1146, in _try_get_data
[rank7]:     raise RuntimeError(f'DataLoader worker (pid(s) {pids_str}) exited unexpectedly') from e
[rank7]: RuntimeError: DataLoader worker (pid(s) 42817) exited unexpectedly
[rank6]: Traceback (most recent call last):
[rank6]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1133, in _try_get_data
[rank6]:     data = self._data_queue.get(timeout=timeout)
[rank6]:   File "/usr/local/lib/python3.10/queue.py", line 180, in get
[rank6]:     self.not_empty.wait(remaining)
[rank6]:   File "/usr/local/lib/python3.10/threading.py", line 324, in wait
[rank6]:     gotit = waiter.acquire(True, timeout)
[rank6]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/_utils/signal_handling.py", line 66, in handler
[rank6]:     _error_if_any_worker_fails()
[rank6]: RuntimeError: DataLoader worker (pid 42812) is killed by signal: Segmentation fault. 

[rank6]: The above exception was the direct cause of the following exception:

[rank6]: Traceback (most recent call last):
[rank6]:   File "/mnt/modeling/home/bwang/projects/mae-d2v/test2.py", line 1060, in <module>
[rank6]:     for idx,(images,target) in enumerate(data_loader_val):
[rank6]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 631, in __next__
[rank6]:     data = self._next_data()
[rank6]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1329, in _next_data
[rank6]:     idx, data = self._get_data()
[rank6]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1285, in _get_data
[rank6]:     success, data = self._try_get_data()
[rank6]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1146, in _try_get_data
[rank6]:     raise RuntimeError(f'DataLoader worker (pid(s) {pids_str}) exited unexpectedly') from e
[rank6]: RuntimeError: DataLoader worker (pid(s) 42812) exited unexpectedly
[rank1]: Traceback (most recent call last):
[rank1]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1133, in _try_get_data
[rank1]:     data = self._data_queue.get(timeout=timeout)
[rank1]:   File "/usr/local/lib/python3.10/queue.py", line 180, in get
[rank1]:     self.not_empty.wait(remaining)
[rank1]:   File "/usr/local/lib/python3.10/threading.py", line 324, in wait
[rank1]:     gotit = waiter.acquire(True, timeout)
[rank1]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/_utils/signal_handling.py", line 66, in handler
[rank1]:     _error_if_any_worker_fails()
[rank1]: RuntimeError: DataLoader worker (pid 42816) is killed by signal: Segmentation fault. 

[rank1]: The above exception was the direct cause of the following exception:

[rank1]: Traceback (most recent call last):
[rank1]:   File "/mnt/modeling/home/bwang/projects/mae-d2v/test2.py", line 1060, in <module>
[rank1]:     for idx,(images,target) in enumerate(data_loader_val):
[rank1]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 631, in __next__
[rank1]:     data = self._next_data()
[rank1]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1329, in _next_data
[rank1]:     idx, data = self._get_data()
[rank1]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1285, in _get_data
[rank1]:     success, data = self._try_get_data()
[rank1]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1146, in _try_get_data
[rank1]:     raise RuntimeError(f'DataLoader worker (pid(s) {pids_str}) exited unexpectedly') from e
[rank1]: RuntimeError: DataLoader worker (pid(s) 42816) exited unexpectedly
[rank0]: Traceback (most recent call last):
[rank0]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1133, in _try_get_data
[rank0]:     data = self._data_queue.get(timeout=timeout)
[rank0]:   File "/usr/local/lib/python3.10/queue.py", line 180, in get
[rank0]:     self.not_empty.wait(remaining)
[rank0]:   File "/usr/local/lib/python3.10/threading.py", line 324, in wait
[rank0]:     gotit = waiter.acquire(True, timeout)
[rank0]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/_utils/signal_handling.py", line 66, in handler
[rank0]:     _error_if_any_worker_fails()
[rank0]: RuntimeError: DataLoader worker (pid 42820) is killed by signal: Segmentation fault. 

[rank0]: The above exception was the direct cause of the following exception:

[rank0]: Traceback (most recent call last):
[rank0]:   File "/mnt/modeling/home/bwang/projects/mae-d2v/test2.py", line 1060, in <module>
[rank0]:     for idx,(images,target) in enumerate(data_loader_val):
[rank0]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 631, in __next__
[rank0]:     data = self._next_data()
[rank0]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1329, in _next_data
[rank0]:     idx, data = self._get_data()
[rank0]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1285, in _get_data
[rank0]:     success, data = self._try_get_data()
[rank0]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1146, in _try_get_data
[rank0]:     raise RuntimeError(f'DataLoader worker (pid(s) {pids_str}) exited unexpectedly') from e
[rank0]: RuntimeError: DataLoader worker (pid(s) 42820) exited unexpectedly
[rank5]: Traceback (most recent call last):
[rank5]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1133, in _try_get_data
[rank5]:     data = self._data_queue.get(timeout=timeout)
[rank5]:   File "/usr/local/lib/python3.10/queue.py", line 180, in get
[rank5]:     self.not_empty.wait(remaining)
[rank5]:   File "/usr/local/lib/python3.10/threading.py", line 324, in wait
[rank5]:     gotit = waiter.acquire(True, timeout)
[rank5]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/_utils/signal_handling.py", line 66, in handler
[rank5]:     _error_if_any_worker_fails()
[rank5]: RuntimeError: DataLoader worker (pid 42814) is killed by signal: Segmentation fault. 

[rank5]: The above exception was the direct cause of the following exception:

[rank5]: Traceback (most recent call last):
[rank5]:   File "/mnt/modeling/home/bwang/projects/mae-d2v/test2.py", line 1060, in <module>
[rank5]:     for idx,(images,target) in enumerate(data_loader_val):
[rank5]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 631, in __next__
[rank5]:     data = self._next_data()
[rank5]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1329, in _next_data
[rank5]:     idx, data = self._get_data()
[rank5]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1285, in _get_data
[rank5]:     success, data = self._try_get_data()
[rank5]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1146, in _try_get_data
[rank5]:     raise RuntimeError(f'DataLoader worker (pid(s) {pids_str}) exited unexpectedly') from e
[rank5]: RuntimeError: DataLoader worker (pid(s) 42814) exited unexpectedly
[rank3]: Traceback (most recent call last):
[rank3]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1133, in _try_get_data
[rank3]:     data = self._data_queue.get(timeout=timeout)
[rank3]:   File "/usr/local/lib/python3.10/queue.py", line 180, in get
[rank3]:     self.not_empty.wait(remaining)
[rank3]:   File "/usr/local/lib/python3.10/threading.py", line 324, in wait
[rank3]:     gotit = waiter.acquire(True, timeout)
[rank3]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/_utils/signal_handling.py", line 66, in handler
[rank3]:     _error_if_any_worker_fails()
[rank3]: RuntimeError: DataLoader worker (pid 42813) is killed by signal: Segmentation fault. 

[rank3]: The above exception was the direct cause of the following exception:

[rank3]: Traceback (most recent call last):
[rank3]:   File "/mnt/modeling/home/bwang/projects/mae-d2v/test2.py", line 1060, in <module>
[rank3]:     for idx,(images,target) in enumerate(data_loader_val):
[rank3]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 631, in __next__
[rank3]:     data = self._next_data()
[rank3]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1329, in _next_data
[rank3]:     idx, data = self._get_data()
[rank3]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1285, in _get_data
[rank3]:     success, data = self._try_get_data()
[rank3]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1146, in _try_get_data
[rank3]:     raise RuntimeError(f'DataLoader worker (pid(s) {pids_str}) exited unexpectedly') from e
[rank3]: RuntimeError: DataLoader worker (pid(s) 42813) exited unexpectedly
[rank2]: Traceback (most recent call last):
[rank2]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1133, in _try_get_data
[rank2]:     data = self._data_queue.get(timeout=timeout)
[rank2]:   File "/usr/local/lib/python3.10/queue.py", line 180, in get
[rank2]:     self.not_empty.wait(remaining)
[rank2]:   File "/usr/local/lib/python3.10/threading.py", line 324, in wait
[rank2]:     gotit = waiter.acquire(True, timeout)
[rank2]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/_utils/signal_handling.py", line 66, in handler
[rank2]:     _error_if_any_worker_fails()
[rank2]: RuntimeError: DataLoader worker (pid 42815) is killed by signal: Segmentation fault. 

[rank2]: The above exception was the direct cause of the following exception:

[rank2]: Traceback (most recent call last):
[rank2]:   File "/mnt/modeling/home/bwang/projects/mae-d2v/test2.py", line 1060, in <module>
[rank2]:     for idx,(images,target) in enumerate(data_loader_val):
[rank2]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 631, in __next__
[rank2]:     data = self._next_data()
[rank2]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1329, in _next_data
[rank2]:     idx, data = self._get_data()
[rank2]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1285, in _get_data
[rank2]:     success, data = self._try_get_data()
[rank2]:   File "/usr/local/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1146, in _try_get_data
[rank2]:     raise RuntimeError(f'DataLoader worker (pid(s) {pids_str}) exited unexpectedly') from e
[rank2]: RuntimeError: DataLoader worker (pid(s) 42815) exited unexpectedly
E0518 22:21:36.438000 140223792096448 torch/distributed/elastic/multiprocessing/api.py:826] failed (exitcode: 1) local_rank: 0 (pid: 39482) of binary: /usr/local/bin/python
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.10/site-packages/torch/distributed/launch.py", line 198, in <module>
    main()
  File "/usr/local/lib/python3.10/site-packages/torch/distributed/launch.py", line 194, in main
    launch(args)
  File "/usr/local/lib/python3.10/site-packages/torch/distributed/launch.py", line 179, in launch
    run(args)
  File "/usr/local/lib/python3.10/site-packages/torch/distributed/run.py", line 870, in run
    elastic_launch(
  File "/usr/local/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 132, in __call__
    return launch_agent(self._config, self._entrypoint, list(args))
  File "/usr/local/lib/python3.10/site-packages/torch/distributed/launcher/api.py", line 263, in launch_agent
    raise ChildFailedError(
torch.distributed.elastic.multiprocessing.errors.ChildFailedError: 
============================================================
test2.py FAILED
------------------------------------------------------------
Failures:
[1]:
  time      : 2024-05-18_22:21:36
  host      : training-dist3-698d76b4bb-65tcv
  rank      : 1 (local_rank: 1)
  exitcode  : 1 (pid: 39483)
  error_file: <N/A>
  traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html
[2]:
  time      : 2024-05-18_22:21:36
  host      : training-dist3-698d76b4bb-65tcv
  rank      : 2 (local_rank: 2)
  exitcode  : 1 (pid: 39484)
  error_file: <N/A>
  traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html
[3]:
  time      : 2024-05-18_22:21:36
  host      : training-dist3-698d76b4bb-65tcv
  rank      : 3 (local_rank: 3)
  exitcode  : 1 (pid: 39485)
  error_file: <N/A>
  traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html
[4]:
  time      : 2024-05-18_22:21:36
  host      : training-dist3-698d76b4bb-65tcv
  rank      : 4 (local_rank: 4)
  exitcode  : 1 (pid: 39486)
  error_file: <N/A>
  traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html
[5]:
  time      : 2024-05-18_22:21:36
  host      : training-dist3-698d76b4bb-65tcv
  rank      : 5 (local_rank: 5)
  exitcode  : 1 (pid: 39487)
  error_file: <N/A>
  traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html
[6]:
  time      : 2024-05-18_22:21:36
  host      : training-dist3-698d76b4bb-65tcv
  rank      : 6 (local_rank: 6)
  exitcode  : 1 (pid: 39488)
  error_file: <N/A>
  traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html
[7]:
  time      : 2024-05-18_22:21:36
  host      : training-dist3-698d76b4bb-65tcv
  rank      : 7 (local_rank: 7)
  exitcode  : 1 (pid: 39489)
  error_file: <N/A>
  traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html
------------------------------------------------------------
Root Cause (first observed failure):
[0]:
  time      : 2024-05-18_22:21:36
  host      : training-dist3-698d76b4bb-65tcv
  rank      : 0 (local_rank: 0)
  exitcode  : 1 (pid: 39482)
  error_file: <N/A>
  traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html
============================================================
```






### Versions

```
/usr/local/lib/python3.10/runpy.py:126: RuntimeWarning: 'torch.utils.collect_env' found in sys.modules after import of package 'torch.utils', but prior to execution of 'torch.utils.collect_env'; this may result in unpredictable behaviour
  warn(RuntimeWarning(msg))
Collecting environment information...
PyTorch version: 2.3.0+cu118
Is debug build: False
CUDA used to build PyTorch: 11.8
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.6 LTS (x86_64)
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Clang version: Could not collect
CMake version: version 3.16.3
Libc version: glibc-2.31

Python version: 3.10.13 (main, Apr 26 2024, 04:45:52) [GCC 9.4.0] (64-bit runtime)
Python platform: Linux-4.15.0-76-generic-x86_64-with-glibc2.31
Is CUDA available: True
CUDA runtime version: 11.8.89
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: 
GPU 0: NVIDIA A100-PCIE-40GB
GPU 1: NVIDIA A100-PCIE-40GB
GPU 2: NVIDIA A100-PCIE-40GB
GPU 3: NVIDIA A100-PCIE-40GB
GPU 4: NVIDIA A100-PCIE-40GB
GPU 5: NVIDIA A100-PCIE-40GB
GPU 6: NVIDIA A100-PCIE-40GB
GPU 7: NVIDIA A100-PCIE-40GB

Nvidia driver version: 525.60.13
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.9.6
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.9.6
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.9.6
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.9.6
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.9.6
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.9.6
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.9.6
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   46 bits physical, 48 bits virtual
CPU(s):                          64
On-line CPU(s) list:             0-63
Thread(s) per core:              2
Core(s) per socket:              16
Socket(s):                       2
NUMA node(s):                    2
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           85
Model name:                      Intel(R) Xeon(R) Gold 5218 CPU @ 2.30GHz
Stepping:                        7
CPU MHz:                         1121.293
CPU max MHz:                     3900.0000
CPU min MHz:                     1000.0000
BogoMIPS:                        4600.00
Virtualization:                  VT-x
L1d cache:                       1 MiB
L1i cache:                       1 MiB
L2 cache:                        32 MiB
L3 cache:                        44 MiB
NUMA node0 CPU(s):               0-15,32-47
NUMA node1 CPU(s):               16-31,48-63
Vulnerability Itlb multihit:     KVM: Mitigation: Split huge pages
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Enhanced IBRS, IBPB conditional, RSB filling
Vulnerability Tsx async abort:   Mitigation; TSX disabled
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req pku ospke avx512_vnni md_clear flush_l1d arch_capabilities

Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] open-clip-torch==2.24.0
[pip3] torch==2.3.0+cu118
[pip3] torchlaunch==1.0
[pip3] torchvision==0.18.0+cu118
[pip3] triton==2.3.0
[conda] Could not collect
```


cc @andrewkho @gokulavasan @SsnL @VitalyFedyunin @dzhulgakov