[NbConvertApp] Converting notebook HCP_downstream_finetune.ipynb to python | |
[NbConvertApp] Writing 31825 bytes to HCP_downstream_finetune.py | |
/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/HCP_downstream_finetune.py:658: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature. | |
state = torch.load(checkpoint_path) | |
wandb: Using wandb-core as the SDK backend. Please refer to https://wandb.me/wandb-core for more information. | |
wandb: Currently logged in as: ckadirt. Use `wandb login --relogin` to force relogin | |
wandb: Tracking run with wandb version 0.18.3 | |
wandb: Run data is saved locally in /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241126_213826-HCPflat_large_gsrFalse__beta_sex_HCPFT_83810 | |
wandb: Run `wandb offline` to turn off syncing. | |
wandb: Resuming run HCPflat_large_gsrFalse__beta_sex_HCPFT | |
wandb: ⭐️ View project at https://stability.wandb.io/ckadirt/fMRI-foundation-model | |
wandb: 🚀 View run at https://stability.wandb.io/ckadirt/fMRI-foundation-model/runs/HCPflat_large_gsrFalse__beta_sex_HCPFT_83810 | |
Epoch 1/20 - Training: 0%| | 0/4638 [00:00<?, ?it/s] Epoch 1/20 - Training: 0%| | 0/4638 [00:04<?, ?it/s] | |
Traceback (most recent call last): | |
File "/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/HCP_downstream_finetune.py", line 843, in <module> | |
outputs = model(images, gsr=gsr) # Shape: [num_train_samples, num_classes] | |
^^^^^^^^^^^^^^^^^^^^^^ | |
File "/admin/home-ckadirt/foundation_env/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl | |
return self._call_impl(*args, **kwargs) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
File "/admin/home-ckadirt/foundation_env/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl | |
return forward_call(*args, **kwargs) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
File "/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/HCP_downstream_finetune.py", line 696, in forward | |
x = self.mae_model(x, global_pool=global_pool, forward_features = True) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
File "/admin/home-ckadirt/foundation_env/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl | |
return self._call_impl(*args, **kwargs) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
File "/admin/home-ckadirt/foundation_env/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl | |
return forward_call(*args, **kwargs) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
File "/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/mae_utils/flat_models.py", line 753, in forward | |
x = blk(x) | |
^^^^^^ | |
File "/admin/home-ckadirt/foundation_env/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl | |
return self._call_impl(*args, **kwargs) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
File "/admin/home-ckadirt/foundation_env/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl | |
return forward_call(*args, **kwargs) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
File "/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/mae_utils/video_vit.py", line 166, in forward | |
x = x + self.drop_path(self.attn(self.norm1(x))) | |
^^^^^^^^^^^^^^^^^^^^^^^^ | |
File "/admin/home-ckadirt/foundation_env/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1553, in _wrapped_call_impl | |
return self._call_impl(*args, **kwargs) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
File "/admin/home-ckadirt/foundation_env/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl | |
return forward_call(*args, **kwargs) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
File "/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/mae_utils/video_vit.py", line 114, in forward | |
attn = (q @ k.transpose(-2, -1)) * self.scale | |
~~^~~~~~~~~~~~~~~~~~~~~ | |
torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 2.04 GiB. GPU 0 has a total capacity of 79.11 GiB of which 1.06 GiB is free. Including non-PyTorch memory, this process has 78.04 GiB memory in use. Of the allocated memory 75.85 GiB is allocated by PyTorch, and 1.52 GiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables) | |