ckadirt commited on
Commit
d11d0fb
·
verified ·
1 Parent(s): 4917273

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +6 -0
  2. fMRI-foundation-model/src/wandb/run-20241023_035909-HCPflat_large_gsrFalse__HCP_FT_83810/files/output.log +0 -0
  3. fMRI-foundation-model/src/wandb/run-20241023_035909-HCPflat_large_gsrFalse__HCP_FT_83810/files/requirements.txt +198 -0
  4. fMRI-foundation-model/src/wandb/run-20241023_035909-HCPflat_large_gsrFalse__HCP_FT_83810/files/wandb-metadata.json +144 -0
  5. fMRI-foundation-model/src/wandb/run-20241023_035909-HCPflat_large_gsrFalse__HCP_FT_83810/logs/debug-core.log +8 -0
  6. fMRI-foundation-model/src/wandb/run-20241023_035909-HCPflat_large_gsrFalse__HCP_FT_83810/logs/debug-internal.log +15 -0
  7. fMRI-foundation-model/src/wandb/run-20241023_035909-HCPflat_large_gsrFalse__HCP_FT_83810/logs/debug.log +34 -0
  8. fMRI-foundation-model/src/wandb/run-20241023_035909-HCPflat_large_gsrFalse__HCP_FT_83810/run-HCPflat_large_gsrFalse__HCP_FT_83810.wandb +0 -0
  9. fMRI-foundation-model/src/wandb/run-20241023_040448-NSDflat_large_gsrFalse__HCP_FT_83810/files/code/src/HCP_downstream_finetune.py +587 -0
  10. fMRI-foundation-model/src/wandb/run-20241023_040448-NSDflat_large_gsrFalse__HCP_FT_83810/files/output.log +4 -0
  11. fMRI-foundation-model/src/wandb/run-20241023_040448-NSDflat_large_gsrFalse__HCP_FT_83810/files/requirements.txt +198 -0
  12. fMRI-foundation-model/src/wandb/run-20241023_040448-NSDflat_large_gsrFalse__HCP_FT_83810/files/wandb-metadata.json +131 -0
  13. fMRI-foundation-model/src/wandb/run-20241023_040448-NSDflat_large_gsrFalse__HCP_FT_83810/logs/debug-core.log +7 -0
  14. fMRI-foundation-model/src/wandb/run-20241023_040448-NSDflat_large_gsrFalse__HCP_FT_83810/logs/debug-internal.log +11 -0
  15. fMRI-foundation-model/src/wandb/run-20241023_040448-NSDflat_large_gsrFalse__HCP_FT_83810/logs/debug.log +25 -0
  16. fMRI-foundation-model/src/wandb/run-20241023_040448-NSDflat_large_gsrFalse__HCP_FT_83810/run-NSDflat_large_gsrFalse__HCP_FT_83810.wandb +0 -0
  17. fMRI-foundation-model/src/wandb/run-20241024_030627-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3/files/code/src/HCP_downstream_finetune.py +597 -0
  18. fMRI-foundation-model/src/wandb/run-20241024_030627-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3/files/output.log +1060 -0
  19. fMRI-foundation-model/src/wandb/run-20241024_030627-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3/files/requirements.txt +198 -0
  20. fMRI-foundation-model/src/wandb/run-20241024_030627-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3/files/wandb-metadata.json +131 -0
  21. fMRI-foundation-model/src/wandb/run-20241024_030627-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3/logs/debug-core.log +7 -0
  22. fMRI-foundation-model/src/wandb/run-20241024_030627-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3/logs/debug-internal.log +11 -0
  23. fMRI-foundation-model/src/wandb/run-20241024_030627-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3/logs/debug.log +25 -0
  24. fMRI-foundation-model/src/wandb/run-20241024_030627-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3/run-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3.wandb +3 -0
  25. fMRI-foundation-model/src/wandb/run-20241024_160745-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427/files/code/src/HCP_downstream_finetune.py +597 -0
  26. fMRI-foundation-model/src/wandb/run-20241024_160745-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427/files/output.log +41 -0
  27. fMRI-foundation-model/src/wandb/run-20241024_160745-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427/files/requirements.txt +198 -0
  28. fMRI-foundation-model/src/wandb/run-20241024_160745-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427/files/wandb-metadata.json +131 -0
  29. fMRI-foundation-model/src/wandb/run-20241024_160745-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427/logs/debug-core.log +7 -0
  30. fMRI-foundation-model/src/wandb/run-20241024_160745-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427/logs/debug-internal.log +11 -0
  31. fMRI-foundation-model/src/wandb/run-20241024_160745-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427/logs/debug.log +25 -0
  32. fMRI-foundation-model/src/wandb/run-20241024_160745-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427/run-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427.wandb +3 -0
  33. fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/files/code/_session_history.ipynb +510 -0
  34. fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/files/config.yaml +49 -0
  35. fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/files/output.log +4 -0
  36. fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/files/wandb-metadata.json +144 -0
  37. fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/files/wandb-summary.json +1 -0
  38. fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/logs/debug-core.log +16 -0
  39. fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/logs/debug-internal.log +23 -0
  40. fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/logs/debug.log +56 -0
  41. fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/run-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275.wandb +0 -0
  42. fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/tmp/code/_session_history.ipynb +510 -0
  43. fMRI-foundation-model/src/wandb/run-20241126_220105-HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de/files/code/src/HCP_downstream_raw_flatmaps.py +1138 -0
  44. fMRI-foundation-model/src/wandb/run-20241126_220105-HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de/files/output.log +14 -0
  45. fMRI-foundation-model/src/wandb/run-20241126_220105-HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de/files/requirements.txt +199 -0
  46. fMRI-foundation-model/src/wandb/run-20241126_220105-HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de/files/wandb-metadata.json +139 -0
  47. fMRI-foundation-model/src/wandb/run-20241126_220105-HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de/logs/debug-core.log +7 -0
  48. fMRI-foundation-model/src/wandb/run-20241126_220105-HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de/logs/debug-internal.log +11 -0
  49. fMRI-foundation-model/src/wandb/run-20241126_220105-HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de/logs/debug.log +25 -0
  50. fMRI-foundation-model/src/wandb/run-20241126_220105-HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de/run-HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de.wandb +0 -0
.gitattributes CHANGED
@@ -5029,3 +5029,9 @@ fMRI-foundation-model/src/wandb/run-20241126_204427-HCPflat_raw_beta_sex_83810/r
5029
  fMRI-foundation-model/src/wandb/run-20241126_141525-HCPflat_large_gsrFalse__HCP_FT_06a43d89-5346-4bb5-ac55-1b000bfb55d9/run-HCPflat_large_gsrFalse__HCP_FT_06a43d89-5346-4bb5-ac55-1b000bfb55d9.wandb filter=lfs diff=lfs merge=lfs -text
5030
  fMRI-foundation-model/src/wandb/run-20241023_132808-HCPflat_large_gsrFalse__HCP_FT_a1fd5808-55ff-41af-bf18-5f6191368115/run-HCPflat_large_gsrFalse__HCP_FT_a1fd5808-55ff-41af-bf18-5f6191368115.wandb filter=lfs diff=lfs merge=lfs -text
5031
  fMRI-foundation-model/src/wandb/run-20241126_221003-HCPflat_raw_beta_age_9a3e14f1-ec90-47c9-a06e-a395872f2271/run-HCPflat_raw_beta_age_9a3e14f1-ec90-47c9-a06e-a395872f2271.wandb filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
5029
  fMRI-foundation-model/src/wandb/run-20241126_141525-HCPflat_large_gsrFalse__HCP_FT_06a43d89-5346-4bb5-ac55-1b000bfb55d9/run-HCPflat_large_gsrFalse__HCP_FT_06a43d89-5346-4bb5-ac55-1b000bfb55d9.wandb filter=lfs diff=lfs merge=lfs -text
5030
  fMRI-foundation-model/src/wandb/run-20241023_132808-HCPflat_large_gsrFalse__HCP_FT_a1fd5808-55ff-41af-bf18-5f6191368115/run-HCPflat_large_gsrFalse__HCP_FT_a1fd5808-55ff-41af-bf18-5f6191368115.wandb filter=lfs diff=lfs merge=lfs -text
5031
  fMRI-foundation-model/src/wandb/run-20241126_221003-HCPflat_raw_beta_age_9a3e14f1-ec90-47c9-a06e-a395872f2271/run-HCPflat_raw_beta_age_9a3e14f1-ec90-47c9-a06e-a395872f2271.wandb filter=lfs diff=lfs merge=lfs -text
5032
+ fMRI-foundation-model/src/wandb/run-20241127_020911-HCPflat_raw_beta_trial_type_81853367-3038-4b91-805f-5066c048cef4/run-HCPflat_raw_beta_trial_type_81853367-3038-4b91-805f-5066c048cef4.wandb filter=lfs diff=lfs merge=lfs -text
5033
+ fMRI-foundation-model/src/wandb/run-20241126_221204-HCPflat_large_gsrFalse__beta_age_HCPFT_185e68b7-ea11-4f13-b6c7-a9ecc17084b1/run-HCPflat_large_gsrFalse__beta_age_HCPFT_185e68b7-ea11-4f13-b6c7-a9ecc17084b1.wandb filter=lfs diff=lfs merge=lfs -text
5034
+ fMRI-foundation-model/src/wandb/run-20241024_030627-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3/run-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3.wandb filter=lfs diff=lfs merge=lfs -text
5035
+ fMRI-foundation-model/src/wandb/run-20241024_160745-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427/run-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427.wandb filter=lfs diff=lfs merge=lfs -text
5036
+ fMRI-foundation-model/src/wandb/run-20241127_125303-HCPflat_raw_beta_trial_type_a0e1e642-966f-441b-9bc7-974dce26cba1/run-HCPflat_raw_beta_trial_type_a0e1e642-966f-441b-9bc7-974dce26cba1.wandb filter=lfs diff=lfs merge=lfs -text
5037
+ fMRI-foundation-model/src/wandb/run-20241127_023946-NSDflat_large_gsrFalse__beta_age_HCPFT_260e5584-8c2b-4e13-a5ed-11dcdc2a522f/run-NSDflat_large_gsrFalse__beta_age_HCPFT_260e5584-8c2b-4e13-a5ed-11dcdc2a522f.wandb filter=lfs diff=lfs merge=lfs -text
fMRI-foundation-model/src/wandb/run-20241023_035909-HCPflat_large_gsrFalse__HCP_FT_83810/files/output.log ADDED
File without changes
fMRI-foundation-model/src/wandb/run-20241023_035909-HCPflat_large_gsrFalse__HCP_FT_83810/files/requirements.txt ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ protobuf==5.28.2
2
+ imageio==2.35.1
3
+ MarkupSafe==3.0.0
4
+ regex==2024.9.11
5
+ matplotlib==3.9.2
6
+ notebook==7.2.2
7
+ debugpy==1.8.6
8
+ aiosignal==1.3.1
9
+ jupyter_core==5.7.2
10
+ torchaudio==2.4.1+cu121
11
+ python-json-logger==2.0.7
12
+ six==1.16.0
13
+ scikit-image==0.24.0
14
+ types-python-dateutil==2.9.0.20241003
15
+ PyYAML==6.0.2
16
+ httpcore==1.0.6
17
+ clip==1.0
18
+ babel==2.16.0
19
+ webcolors==24.8.0
20
+ omegaconf==2.3.0
21
+ webencodings==0.5.1
22
+ kiwisolver==1.4.7
23
+ uri-template==1.3.0
24
+ diffusers==0.23.0
25
+ idna==3.10
26
+ fsspec==2024.9.0
27
+ parso==0.8.4
28
+ setuptools==65.5.0
29
+ tornado==6.4.1
30
+ webdataset==0.2.100
31
+ decord==0.6.0
32
+ nvidia-curand-cu12==10.3.2.106
33
+ ipykernel==6.29.5
34
+ jupyter==1.1.1
35
+ pexpect==4.9.0
36
+ kornia_rs==0.1.5
37
+ iopath==0.1.10
38
+ async-lru==2.0.4
39
+ future==1.0.0
40
+ torchvision==0.19.1+cu121
41
+ botocore==1.34.162
42
+ cycler==0.12.1
43
+ tzdata==2024.2
44
+ jupyter_server_terminals==0.5.3
45
+ click==8.1.7
46
+ einops==0.8.0
47
+ pyzmq==26.2.0
48
+ jupyter_client==8.6.3
49
+ nbconvert==7.16.4
50
+ scikit-learn==1.5.2
51
+ executing==2.1.0
52
+ asttokens==2.4.1
53
+ docker-pycreds==0.4.0
54
+ matplotlib-inline==0.1.7
55
+ overrides==7.7.0
56
+ websocket-client==1.8.0
57
+ nbformat==5.10.4
58
+ elbow==0.1.1
59
+ contourpy==1.3.0
60
+ nvidia-cudnn-cu12==9.1.0.70
61
+ transformers==4.44.2
62
+ gitdb==4.0.11
63
+ jupyterlab_nvdashboard==0.11.0
64
+ lazy_loader==0.4
65
+ jsonpointer==3.0.0
66
+ notebook_shim==0.2.4
67
+ nvidia-nccl-cu12==2.20.5
68
+ ffmpeg-python==0.2.0
69
+ triton==3.0.0
70
+ mistune==3.0.2
71
+ python-dateutil==2.9.0.post0
72
+ beautifulsoup4==4.12.3
73
+ nbclient==0.10.0
74
+ h5py==3.12.1
75
+ ftfy==6.2.3
76
+ zipp==3.20.2
77
+ ptyprocess==0.7.0
78
+ huggingface-hub==0.25.1
79
+ pytz==2024.2
80
+ jupyterlab_pygments==0.3.0
81
+ nvidia-cublas-cu12==12.1.3.1
82
+ pandocfilters==1.5.1
83
+ Jinja2==3.1.4
84
+ arrow==1.3.0
85
+ rpds-py==0.20.0
86
+ jupyter_server==2.14.2
87
+ simplejson==3.19.3
88
+ networkx==3.3
89
+ packaging==24.1
90
+ traitlets==5.14.3
91
+ pandas==2.2.3
92
+ xformers==0.0.22.post7
93
+ lightning-utilities==0.11.7
94
+ tifffile==2024.9.20
95
+ nvidia-cuda-cupti-cu12==12.1.105
96
+ mpmath==1.3.0
97
+ GitPython==3.1.43
98
+ scipy==1.14.1
99
+ jsonschema==4.23.0
100
+ prompt_toolkit==3.0.48
101
+ s3transfer==0.10.2
102
+ multidict==6.1.0
103
+ bleach==6.1.0
104
+ sentry-sdk==2.15.0
105
+ nibabel==5.2.1
106
+ accelerate==1.0.0
107
+ pyarrow==17.0.0
108
+ threadpoolctl==3.5.0
109
+ attrs==24.2.0
110
+ rfc3986-validator==0.1.1
111
+ nvidia-cuda-runtime-cu12==12.1.105
112
+ ipywidgets==8.1.5
113
+ frozenlist==1.4.1
114
+ pycparser==2.22
115
+ jupyterlab_server==2.27.3
116
+ nvidia-cuda-nvrtc-cu12==12.1.105
117
+ yarl==1.13.1
118
+ setproctitle==1.3.3
119
+ isoduration==20.11.0
120
+ Pygments==2.18.0
121
+ jedi==0.19.1
122
+ boto3==1.34.57
123
+ tokenizers==0.19.1
124
+ referencing==0.35.1
125
+ rfc3339-validator==0.1.4
126
+ pillow==10.4.0
127
+ jupyterlab==4.2.5
128
+ stack-data==0.6.3
129
+ h11==0.14.0
130
+ anyio==4.6.0
131
+ nilearn==0.10.4
132
+ nvidia-cusolver-cu12==11.4.5.107
133
+ tinycss2==1.3.0
134
+ defusedxml==0.7.1
135
+ argon2-cffi-bindings==21.2.0
136
+ soupsieve==2.6
137
+ nest-asyncio==1.6.0
138
+ torchmetrics==1.3.0.post0
139
+ tqdm==4.66.5
140
+ cffi==1.17.1
141
+ charset-normalizer==3.3.2
142
+ jsonschema-specifications==2023.12.1
143
+ decorator==5.1.1
144
+ open_clip_torch==2.26.1
145
+ jupyter-events==0.10.0
146
+ smart-open==7.0.5
147
+ antlr4-python3-runtime==4.9.3
148
+ prometheus_client==0.21.0
149
+ kornia==0.7.3
150
+ typing_extensions==4.12.2
151
+ sniffio==1.3.1
152
+ joblib==1.4.2
153
+ comm==0.2.2
154
+ aiohappyeyeballs==2.4.3
155
+ numpy==2.1.2
156
+ braceexpand==0.1.7
157
+ certifi==2024.8.30
158
+ psutil==6.0.0
159
+ pyparsing==3.1.4
160
+ pure_eval==0.2.3
161
+ nvidia-cusparse-cu12==12.1.0.106
162
+ wandb==0.18.3
163
+ urllib3==2.2.3
164
+ smmap==5.0.1
165
+ platformdirs==4.3.6
166
+ torch==2.4.1+cu121
167
+ requests==2.32.3
168
+ json5==0.9.25
169
+ nvidia-nvjitlink-cu12==12.6.77
170
+ jupyterlab_widgets==3.0.13
171
+ lxml==5.3.0
172
+ httpx==0.27.2
173
+ opencv-python==4.6.0.66
174
+ portalocker==2.10.1
175
+ pytorch-lightning==2.0.1
176
+ sympy==1.13.3
177
+ wcwidth==0.2.13
178
+ jmespath==1.0.1
179
+ fqdn==1.5.1
180
+ pynvml==11.5.3
181
+ pip==24.0
182
+ wrapt==1.16.0
183
+ aiohttp==3.10.9
184
+ filelock==3.16.1
185
+ fonttools==4.54.1
186
+ fastjsonschema==2.20.0
187
+ jupyter-console==6.6.3
188
+ widgetsnbextension==4.0.13
189
+ timm==1.0.9
190
+ nvidia-cufft-cu12==11.0.2.54
191
+ ipython==8.28.0
192
+ nvidia-nvtx-cu12==12.1.105
193
+ jupyter-lsp==2.2.5
194
+ safetensors==0.4.5
195
+ terminado==0.18.1
196
+ argon2-cffi==23.1.0
197
+ Send2Trash==1.8.3
198
+ importlib_metadata==8.5.0
fMRI-foundation-model/src/wandb/run-20241023_035909-HCPflat_large_gsrFalse__HCP_FT_83810/files/wandb-metadata.json ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "os": "Linux-5.15.0-1058-aws-x86_64-with-glibc2.31",
3
+ "python": "3.11.10",
4
+ "startedAt": "2024-10-23T03:59:10.168693Z",
5
+ "program": "ckadirt/fMRI-foundation-model/src/HCP_downstream_finetune.ipynb",
6
+ "git": {
7
+ "remote": "https://github.com/MedARC-AI/fMRI-foundation-model",
8
+ "commit": "b1ba684ae7a5cc4155cc046b0abe613de09bf700"
9
+ },
10
+ "email": "torrico.villanueva.cesar.kadir@gmail.com",
11
+ "root": "/weka/proj-fmri/ckadirt/fMRI-foundation-model/src",
12
+ "host": "ip-10-0-160-143",
13
+ "username": "ckadirt",
14
+ "executable": "/admin/home-ckadirt/foundation_env/bin/python",
15
+ "cpu_count": 96,
16
+ "cpu_count_logical": 192,
17
+ "gpu": "[NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3]",
18
+ "gpu_count": 8,
19
+ "disk": {
20
+ "/": {
21
+ "total": "249555763200",
22
+ "used": "184981258240"
23
+ }
24
+ },
25
+ "memory": {
26
+ "total": "2147443429376"
27
+ },
28
+ "cpu": {
29
+ "count": 96,
30
+ "countLogical": 192
31
+ },
32
+ "gpu_nvidia": [
33
+ {
34
+ "name": "NVIDIA H100 80GB HBM3",
35
+ "memoryTotal": "85520809984",
36
+ "cudaCores": 16896,
37
+ "architecture": "Hopper"
38
+ },
39
+ {
40
+ "name": "NVIDIA H100 80GB HBM3",
41
+ "memoryTotal": "85520809984",
42
+ "cudaCores": 16896,
43
+ "architecture": "Hopper"
44
+ },
45
+ {
46
+ "name": "NVIDIA H100 80GB HBM3",
47
+ "memoryTotal": "85520809984",
48
+ "cudaCores": 16896,
49
+ "architecture": "Hopper"
50
+ },
51
+ {
52
+ "name": "NVIDIA H100 80GB HBM3",
53
+ "memoryTotal": "85520809984",
54
+ "cudaCores": 16896,
55
+ "architecture": "Hopper"
56
+ },
57
+ {
58
+ "name": "NVIDIA H100 80GB HBM3",
59
+ "memoryTotal": "85520809984",
60
+ "cudaCores": 16896,
61
+ "architecture": "Hopper"
62
+ },
63
+ {
64
+ "name": "NVIDIA H100 80GB HBM3",
65
+ "memoryTotal": "85520809984",
66
+ "cudaCores": 16896,
67
+ "architecture": "Hopper"
68
+ },
69
+ {
70
+ "name": "NVIDIA H100 80GB HBM3",
71
+ "memoryTotal": "85520809984",
72
+ "cudaCores": 16896,
73
+ "architecture": "Hopper"
74
+ },
75
+ {
76
+ "name": "NVIDIA H100 80GB HBM3",
77
+ "memoryTotal": "85520809984",
78
+ "cudaCores": 16896,
79
+ "architecture": "Hopper"
80
+ }
81
+ ],
82
+ "slurm": {
83
+ "cluster_name": "sagemaker2",
84
+ "conf": "/opt/slurm/etc/slurm.conf",
85
+ "cpu_bind": "quiet,mask_cpu:0x00000000000000FFC000000000000000000000FFC0000000",
86
+ "cpu_bind_list": "0x00000000000000FFC000000000000000000000FFC0000000",
87
+ "cpu_bind_type": "mask_cpu:",
88
+ "cpu_bind_verbose": "quiet",
89
+ "cpus_on_node": "20",
90
+ "gpus": "1",
91
+ "gpus_on_node": "1",
92
+ "gtids": "0",
93
+ "job_account": "fmri",
94
+ "job_cpus_per_node": "20",
95
+ "job_end_time": "1729702756",
96
+ "job_gid": "1879800513",
97
+ "job_group": "Domain Users",
98
+ "job_id": "528040",
99
+ "job_name": "bash",
100
+ "job_nodelist": "ip-10-0-160-143",
101
+ "job_num_nodes": "1",
102
+ "job_partition": "p5",
103
+ "job_qos": "idle",
104
+ "job_start_time": "1729648756",
105
+ "job_uid": "1879804696",
106
+ "job_user": "ckadirt",
107
+ "jobid": "528040",
108
+ "launch_node_ipaddr": "172.17.12.61",
109
+ "localid": "0",
110
+ "mpi_type": "pmix_v3",
111
+ "nnodes": "1",
112
+ "nodeid": "0",
113
+ "nodelist": "ip-10-0-160-143",
114
+ "nprocs": "1",
115
+ "ntasks": "1",
116
+ "pmix_mapping_serv": "(vector,(0,1,1))",
117
+ "pmixp_abort_agent_port": "34923",
118
+ "prio_process": "0",
119
+ "procid": "0",
120
+ "pty_port": "45733",
121
+ "pty_win_col": "199",
122
+ "pty_win_row": "17",
123
+ "script_context": "prolog_task",
124
+ "srun_comm_host": "172.17.12.61",
125
+ "srun_comm_port": "39353",
126
+ "step_gpus": "3",
127
+ "step_id": "0",
128
+ "step_launcher_port": "39353",
129
+ "step_nodelist": "ip-10-0-160-143",
130
+ "step_num_nodes": "1",
131
+ "step_num_tasks": "1",
132
+ "step_tasks_per_node": "1",
133
+ "stepid": "0",
134
+ "submit_dir": "/weka/proj-fmri",
135
+ "submit_host": "ip-172-17-12-61",
136
+ "task_pid": "1032669",
137
+ "tasks_per_node": "1",
138
+ "topology_addr": "ip-10-0-160-143",
139
+ "topology_addr_pattern": "node",
140
+ "umask": "0022",
141
+ "working_cluster": "sagemaker2:ip-172-17-63-161:6817:9984:109"
142
+ },
143
+ "cudaVersion": "12.2"
144
+ }
fMRI-foundation-model/src/wandb/run-20241023_035909-HCPflat_large_gsrFalse__HCP_FT_83810/logs/debug-core.log ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {"time":"2024-10-23T03:59:09.35824386Z","level":"INFO","msg":"started logging, with flags","port-filename":"/tmp/tmpadv06gi0/port-1085242.txt","pid":1085242,"debug":false,"disable-analytics":false}
2
+ {"time":"2024-10-23T03:59:09.358524366Z","level":"INFO","msg":"FeatureState","shutdownOnParentExitEnabled":false}
3
+ {"time":"2024-10-23T03:59:09.361482495Z","level":"INFO","msg":"Will exit if parent process dies.","ppid":1085242}
4
+ {"time":"2024-10-23T03:59:09.361467865Z","level":"INFO","msg":"server is running","addr":{"IP":"127.0.0.1","Port":35009,"Zone":""}}
5
+ {"time":"2024-10-23T03:59:09.547796327Z","level":"INFO","msg":"connection: ManageConnectionData: new connection created","id":"127.0.0.1:45782"}
6
+ {"time":"2024-10-23T03:59:10.170052493Z","level":"INFO","msg":"handleInformInit: received","streamId":"HCPflat_large_gsrFalse__HCP_FT_83810","id":"127.0.0.1:45782"}
7
+ {"time":"2024-10-23T03:59:10.250032739Z","level":"INFO","msg":"handleInformInit: stream started","streamId":"HCPflat_large_gsrFalse__HCP_FT_83810","id":"127.0.0.1:45782"}
8
+ {"time":"2024-10-23T03:59:58.484736734Z","level":"INFO","msg":"Parent process exited, terminating service process."}
fMRI-foundation-model/src/wandb/run-20241023_035909-HCPflat_large_gsrFalse__HCP_FT_83810/logs/debug-internal.log ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"time":"2024-10-23T03:59:10.192960404Z","level":"INFO","msg":"using version","core version":"0.18.3"}
2
+ {"time":"2024-10-23T03:59:10.192977364Z","level":"INFO","msg":"created symlink","path":"/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241023_035909-HCPflat_large_gsrFalse__HCP_FT_83810/logs/debug-core.log"}
3
+ {"time":"2024-10-23T03:59:10.202676429Z","level":"ERROR","msg":"dialing: google: could not find default credentials. See https://cloud.google.com/docs/authentication/external/set-up-adc for more information"}
4
+ {"time":"2024-10-23T03:59:10.249979458Z","level":"INFO","msg":"created new stream","id":"HCPflat_large_gsrFalse__HCP_FT_83810"}
5
+ {"time":"2024-10-23T03:59:10.250026889Z","level":"INFO","msg":"stream: started","id":"HCPflat_large_gsrFalse__HCP_FT_83810"}
6
+ {"time":"2024-10-23T03:59:10.25005014Z","level":"INFO","msg":"handler: started","stream_id":{"value":"HCPflat_large_gsrFalse__HCP_FT_83810"}}
7
+ {"time":"2024-10-23T03:59:10.25005038Z","level":"INFO","msg":"sender: started","stream_id":{"value":"HCPflat_large_gsrFalse__HCP_FT_83810"}}
8
+ {"time":"2024-10-23T03:59:10.25004447Z","level":"INFO","msg":"writer: Do: started","stream_id":{"value":"HCPflat_large_gsrFalse__HCP_FT_83810"}}
9
+ {"time":"2024-10-23T03:59:10.775112054Z","level":"INFO","msg":"wandb-core","!BADKEY":null}
10
+ {"time":"2024-10-23T03:59:10.786594425Z","level":"INFO","msg":"Starting system monitor"}
11
+ {"time":"2024-10-23T03:59:10.786621065Z","level":"WARN","msg":"handleCodeSave: program relative path is empty"}
12
+ {"time":"2024-10-23T03:59:10.789050854Z","level":"ERROR","msg":"git repo not found","error":"repository does not exist"}
13
+ {"time":"2024-10-23T03:59:11.138322779Z","level":"INFO","msg":"Pausing system monitor"}
14
+ {"time":"2024-10-23T03:59:11.198391755Z","level":"INFO","msg":"Resuming system monitor"}
15
+ {"time":"2024-10-23T03:59:53.40248499Z","level":"INFO","msg":"Pausing system monitor"}
fMRI-foundation-model/src/wandb/run-20241023_035909-HCPflat_large_gsrFalse__HCP_FT_83810/logs/debug.log ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 2024-10-23 03:59:10,155 INFO MainThread:1085242 [wandb_setup.py:_flush():79] Current SDK version is 0.18.3
2
+ 2024-10-23 03:59:10,155 INFO MainThread:1085242 [wandb_setup.py:_flush():79] Configure stats pid to 1085242
3
+ 2024-10-23 03:59:10,155 INFO MainThread:1085242 [wandb_setup.py:_flush():79] Loading settings from /admin/home-ckadirt/.config/wandb/settings
4
+ 2024-10-23 03:59:10,155 INFO MainThread:1085242 [wandb_setup.py:_flush():79] Loading settings from /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/settings
5
+ 2024-10-23 03:59:10,155 INFO MainThread:1085242 [wandb_setup.py:_flush():79] Loading settings from environment variables: {}
6
+ 2024-10-23 03:59:10,155 INFO MainThread:1085242 [wandb_setup.py:_flush():79] Applying setup settings: {'mode': None, '_disable_service': None}
7
+ 2024-10-23 03:59:10,155 INFO MainThread:1085242 [wandb_setup.py:_flush():79] Inferring run settings from compute environment: {'program': '<python with no main file>'}
8
+ 2024-10-23 03:59:10,155 INFO MainThread:1085242 [wandb_setup.py:_flush():79] Applying login settings: {}
9
+ 2024-10-23 03:59:10,156 INFO MainThread:1085242 [wandb_init.py:_log_setup():532] Logging user logs to /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241023_035909-HCPflat_large_gsrFalse__HCP_FT_83810/logs/debug.log
10
+ 2024-10-23 03:59:10,157 INFO MainThread:1085242 [wandb_init.py:_log_setup():533] Logging internal logs to /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241023_035909-HCPflat_large_gsrFalse__HCP_FT_83810/logs/debug-internal.log
11
+ 2024-10-23 03:59:10,157 INFO MainThread:1085242 [wandb_init.py:_jupyter_setup():478] configuring jupyter hooks <wandb.sdk.wandb_init._WandbInit object at 0x7f0e10f46650>
12
+ 2024-10-23 03:59:10,157 INFO MainThread:1085242 [wandb_init.py:init():617] calling init triggers
13
+ 2024-10-23 03:59:10,157 INFO MainThread:1085242 [wandb_init.py:init():624] wandb.init called with sweep_config: {}
14
+ config: {'model_name': 'HCPflat_large_gsrFalse__HCP_FT', 'batch_size': 8, 'learning_rate': 0.0001, 'weight_decay': 1e-05, 'num_epochs': 20, 'seed': 42}
15
+ 2024-10-23 03:59:10,157 INFO MainThread:1085242 [wandb_init.py:init():667] starting backend
16
+ 2024-10-23 03:59:10,157 INFO MainThread:1085242 [wandb_init.py:init():671] sending inform_init request
17
+ 2024-10-23 03:59:10,167 INFO MainThread:1085242 [backend.py:_multiprocessing_setup():104] multiprocessing start_methods=fork,spawn,forkserver, using: spawn
18
+ 2024-10-23 03:59:10,167 INFO MainThread:1085242 [wandb_init.py:init():684] backend started and connected
19
+ 2024-10-23 03:59:10,192 INFO MainThread:1085242 [wandb_run.py:_label_probe_notebook():1346] probe notebook
20
+ 2024-10-23 03:59:10,193 INFO MainThread:1085242 [wandb_run.py:_label_probe_notebook():1356] Unable to probe notebook: 'NoneType' object has no attribute 'get'
21
+ 2024-10-23 03:59:10,193 INFO MainThread:1085242 [wandb_init.py:init():779] updated telemetry
22
+ 2024-10-23 03:59:10,240 INFO MainThread:1085242 [wandb_init.py:init():812] communicating run to backend with 90.0 second timeout
23
+ 2024-10-23 03:59:10,716 INFO MainThread:1085242 [wandb_init.py:init():855] run resumed
24
+ 2024-10-23 03:59:10,759 INFO MainThread:1085242 [wandb_init.py:init():863] starting run threads in backend
25
+ 2024-10-23 03:59:11,092 INFO MainThread:1085242 [wandb_run.py:_console_start():2465] atexit reg
26
+ 2024-10-23 03:59:11,092 INFO MainThread:1085242 [wandb_run.py:_redirect():2313] redirect: wrap_raw
27
+ 2024-10-23 03:59:11,092 INFO MainThread:1085242 [wandb_run.py:_redirect():2378] Wrapping output streams.
28
+ 2024-10-23 03:59:11,092 INFO MainThread:1085242 [wandb_run.py:_redirect():2403] Redirects installed.
29
+ 2024-10-23 03:59:11,095 INFO MainThread:1085242 [wandb_init.py:init():907] run started, returning control to user process
30
+ 2024-10-23 03:59:11,101 INFO MainThread:1085242 [jupyter.py:_save_ipynb():398] looking for notebook: ckadirt/fMRI-foundation-model/src/HCP_downstream_finetune.ipynb
31
+ 2024-10-23 03:59:11,101 INFO MainThread:1085242 [wandb_init.py:_pause_backend():443] pausing backend
32
+ 2024-10-23 03:59:11,197 INFO MainThread:1085242 [wandb_init.py:_resume_backend():448] resuming backend
33
+ 2024-10-23 03:59:53,401 INFO MainThread:1085242 [jupyter.py:_save_ipynb():398] looking for notebook: ckadirt/fMRI-foundation-model/src/HCP_downstream_finetune.ipynb
34
+ 2024-10-23 03:59:53,402 INFO MainThread:1085242 [wandb_init.py:_pause_backend():443] pausing backend
fMRI-foundation-model/src/wandb/run-20241023_035909-HCPflat_large_gsrFalse__HCP_FT_83810/run-HCPflat_large_gsrFalse__HCP_FT_83810.wandb ADDED
Binary file (32.8 kB). View file
 
fMRI-foundation-model/src/wandb/run-20241023_040448-NSDflat_large_gsrFalse__HCP_FT_83810/files/code/src/HCP_downstream_finetune.py ADDED
@@ -0,0 +1,587 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # coding: utf-8
3
+
4
+ # In[1]:
5
+
6
+
7
+ # Import packages and setup gpu configuration.
8
+ # This code block shouldnt need to be adjusted!
9
+ import os
10
+ import sys
11
+ import json
12
+ import yaml
13
+ import numpy as np
14
+ import copy
15
+ import math
16
+ import time
17
+ import random
18
+ from tqdm.auto import tqdm
19
+ import webdataset as wds
20
+ import matplotlib.pyplot as plt
21
+
22
+ import torch
23
+ import torch.nn as nn
24
+ from torchvision import transforms
25
+ import utils
26
+ from mae_utils.flat_models import *
27
+ import h5py
28
+ from mae_utils import flat_models
29
+
30
+ # tf32 data type is faster than standard float32
31
+ torch.backends.cuda.matmul.allow_tf32 = True
32
+ # following fixes a Conv3D CUDNN_NOT_SUPPORTED error
33
+ torch.backends.cudnn.benchmark = True
34
+
35
+ # ## MODEL TO LOAD ##
36
+ if utils.is_interactive():
37
+ model_name = "HCPflat_large_gsrFalse_"
38
+ else:
39
+ model_name = sys.argv[1]
40
+
41
+
42
+ # outdir = os.path.abspath(f'checkpoints/{model_name}')
43
+ outdir = os.path.abspath(f'checkpoints/{model_name}')
44
+
45
+ print("outdir", outdir)
46
+ # Load previous config.yaml if available
47
+ if os.path.exists(f"{outdir}/config.yaml"):
48
+ config = yaml.load(open(f"{outdir}/config.yaml", 'r'), Loader=yaml.FullLoader)
49
+ print(f"Loaded config.yaml from ckpt folder {outdir}")
50
+ # create global variables from the config
51
+ print("\n__CONFIG__")
52
+ for attribute_name in config.keys():
53
+ print(f"{attribute_name} = {config[attribute_name]}")
54
+ globals()[attribute_name] = config[f'{attribute_name}']
55
+ print("\n")
56
+
57
+ world_size = os.getenv('WORLD_SIZE')
58
+ if world_size is None:
59
+ world_size = 1
60
+ else:
61
+ world_size = int(world_size)
62
+ print(f"WORLD_SIZE={world_size}")
63
+
64
+ if utils.is_interactive():
65
+ # Following allows you to change functions in models.py or utils.py and
66
+ # have this notebook automatically update with your revisions
67
+ get_ipython().run_line_magic('load_ext', 'autoreload')
68
+ get_ipython().run_line_magic('autoreload', '2')
69
+
70
+ batch_size = probe_batch_size
71
+ num_epochs = probe_num_epochs
72
+
73
+ data_type = torch.float32 # change depending on your mixed_precision
74
+ global_batch_size = batch_size * world_size
75
+
76
+ device = torch.device('cuda')
77
+
78
+ hcp_flat_path = "/weka/proj-medarc/shared/HCP-Flat"
79
+ # seed = 42
80
+ # num_frames = 16
81
+ # gsr = False
82
+ # num_workers = 10
83
+ # batch_size = 128
84
+
85
+ print("PID of this process =",os.getpid())
86
+ utils.seed_everything(seed)
87
+
88
+
89
+ # In[2]:
90
+
91
+
92
+ if os.getenv('global_pool') == "False":
93
+ global_pool = False
94
+ else:
95
+ global_pool = True
96
+ print(f"global_pool = {global_pool}")
97
+
98
+ try:
99
+ gsr
100
+ except:
101
+ gsr = True
102
+ print("set gsr to True")
103
+ print(f"gsr = {gsr}")
104
+
105
+
106
+ # In[3]:
107
+
108
+
109
+ #### UNCOMMENT THIS TO SAVE THE HCP-FLAT IN HDF5 FORMAT
110
+
111
+
112
+ # from torch.utils.data import default_collate
113
+ # from mae_utils.flat import load_hcp_flat_mask
114
+ # from mae_utils.flat import create_hcp_flat
115
+ # from mae_utils.flat import batch_unmask
116
+ # import mae_utils.visualize as vis
117
+
118
+
119
+ # batch_size = 26
120
+ # print(f"changed batch_size to {batch_size}")
121
+
122
+ # ## Test ##
123
+ # datasets_to_include = "HCP"
124
+ # assert "HCP" in datasets_to_include
125
+ # test_dataset = create_hcp_flat(root=hcp_flat_path,
126
+ # clip_mode="event", frames=num_frames, shuffle=False, gsr=gsr, sub_list = 'test')
127
+ # test_dl = wds.WebLoader(
128
+ # test_dataset.batched(batch_size, partial=False, collation_fn=default_collate),
129
+ # batch_size=None,
130
+ # shuffle=False,
131
+ # num_workers=num_workers,
132
+ # pin_memory=True,
133
+ # )
134
+
135
+ # ## Train ##
136
+ # assert "HCP" in datasets_to_include
137
+ # train_dataset = create_hcp_flat(root=hcp_flat_path,
138
+ # clip_mode="event", frames=num_frames, shuffle=False, gsr=gsr, sub_list = 'train')
139
+ # train_dl = wds.WebLoader(
140
+ # train_dataset.batched(batch_size, partial=False, collation_fn=default_collate),
141
+ # batch_size=None,
142
+ # shuffle=False,
143
+ # num_workers=num_workers,
144
+ # pin_memory=True,
145
+ # )
146
+
147
+ # def flatten_meta(meta_dict):
148
+ # """
149
+ # Flatten the meta dictionary by:
150
+ # - Replacing single-item lists with the item itself.
151
+ # - Converting tensors to scalar numbers.
152
+ # """
153
+ # flattened = {}
154
+ # for key, value in meta_dict.items():
155
+ # if isinstance(value, list):
156
+ # if len(value) == 1:
157
+ # flattened[key] = value[0] # Replace list with its single item
158
+ # else:
159
+ # flattened[key] = value # Keep as is if multiple items
160
+ # elif isinstance(value, torch.Tensor):
161
+ # # Convert tensor to scalar
162
+ # if value.numel() == 1:
163
+ # flattened[key] = value.item()
164
+ # else:
165
+ # flattened[key] = value.tolist() # Convert multi-element tensor to list
166
+ # else:
167
+ # flattened[key] = value # Keep the value as is
168
+ # return flattened
169
+
170
+ # import h5py
171
+ # meta_array = np.array([], dtype=object)
172
+ # # Open an HDF5 file in write mode
173
+ # with h5py.File('train_hcp.hdf5', 'w') as h5f:
174
+ # flatmaps_dset = None
175
+
176
+ # total_samples = 0
177
+
178
+ # for i, batch in tqdm(enumerate(train_dl), total = 120000):
179
+ # images = batch['image'][0]
180
+ # meta = batch['meta']
181
+ # batch_size = images.shape[0]
182
+ # meta_serializable = meta.copy()
183
+
184
+
185
+ # # Step 2: Serialize the dictionary to a JSON string
186
+ # meta_str = json.dumps(flatten_meta(meta_serializable), indent=4)
187
+ # meta_array = np.append(meta_array, meta_str)
188
+ # if flatmaps_dset is None:
189
+ # # Initialize datasets with unlimited (None) maxshape along the first axis
190
+ # flatmaps_shape = (0,) + images.shape[1:]
191
+ # flatmaps_maxshape = (None,) + images.shape[1:]
192
+
193
+ # flatmaps_dset = h5f.create_dataset(
194
+ # 'flatmaps',
195
+ # shape=flatmaps_shape,
196
+ # maxshape=flatmaps_maxshape,
197
+ # dtype=np.float16,
198
+ # chunks=True # Enable chunking for efficient resizing
199
+ # )
200
+
201
+ # # Resize datasets to accommodate new data
202
+ # flatmaps_dset.resize(total_samples + batch_size, axis=0)
203
+
204
+ # # Write data to the datasets
205
+ # flatmaps_dset[total_samples:total_samples + batch_size] = images.numpy().astype(np.float16)
206
+
207
+ # total_samples += batch_size
208
+
209
+ # print(f"Processed {total_samples} samples")
210
+ # np.save('metadata_test_HCP.npy', meta_array)
211
+
212
+
213
+ # import h5py
214
+ # meta_array = np.array([], dtype=object)
215
+ # # Open an HDF5 file in write mode
216
+ # with h5py.File('test_hcp.hdf5', 'w') as h5f:
217
+ # flatmaps_dset = None
218
+
219
+ # total_samples = 0
220
+
221
+ # for i, batch in tqdm(enumerate(test_dl), total = 12000):
222
+ # images = batch['image'][0]
223
+ # meta = batch['meta']
224
+ # batch_size = images.shape[0]
225
+ # meta_serializable = meta.copy()
226
+
227
+
228
+ # # Step 2: Serialize the dictionary to a JSON string
229
+ # meta_str = json.dumps(flatten_meta(meta_serializable), indent=4)
230
+ # meta_array = np.append(meta_array, meta_str)
231
+ # if flatmaps_dset is None:
232
+ # # Initialize datasets with unlimited (None) maxshape along the first axis
233
+ # flatmaps_shape = (0,) + images.shape[1:]
234
+ # flatmaps_maxshape = (None,) + images.shape[1:]
235
+
236
+ # flatmaps_dset = h5f.create_dataset(
237
+ # 'flatmaps',
238
+ # shape=flatmaps_shape,
239
+ # maxshape=flatmaps_maxshape,
240
+ # dtype=np.float16,
241
+ # chunks=True # Enable chunking for efficient resizing
242
+ # )
243
+
244
+ # # Resize datasets to accommodate new data
245
+ # flatmaps_dset.resize(total_samples + batch_size, axis=0)
246
+
247
+ # # Write data to the datasets
248
+ # flatmaps_dset[total_samples:total_samples + batch_size] = images.numpy().astype(np.float16)
249
+
250
+ # total_samples += batch_size
251
+
252
+ # print(f"Processed {total_samples} samples")
253
+ # np.save('metadata_train_HCP.npy', meta_array)
254
+
255
+
256
+ # ### Preparing data
257
+
258
+ # In[4]:
259
+
260
+
261
+ from sklearn.preprocessing import LabelEncoder
262
+
263
+ INCLUDE_CONDS = {
264
+ "fear",
265
+ "neut",
266
+ "math",
267
+ "story",
268
+ "lf",
269
+ "lh",
270
+ "rf",
271
+ "rh",
272
+ "t",
273
+ "match",
274
+ "relation",
275
+ "mental",
276
+ "rnd",
277
+ "0bk_body",
278
+ "2bk_body",
279
+ "0bk_faces",
280
+ "2bk_faces",
281
+ "0bk_places",
282
+ "2bk_places",
283
+ "0bk_tools",
284
+ "2bk_tools",
285
+ }
286
+
287
+ # test_data = []
288
+
289
+ # # Iterate over the DataLoader with a progress bar
290
+ # for sample in tqdm(train_dl, desc="Processing samples"):
291
+ # x = sample['image']
292
+ # y = sample['meta']['trial_type']
293
+ # key = sample['meta']['key']
294
+ # print(x.shape, y, key)
295
+ # break
296
+ # Initialize the label encoder
297
+ label_encoder = LabelEncoder()
298
+ label_encoder.fit(sorted(INCLUDE_CONDS)) # Ensure consistent ordering
299
+
300
+ num_classes = len(label_encoder.classes_)
301
+ print(f"Number of classes: {num_classes}")
302
+
303
+
304
+ # In[5]:
305
+
306
+
307
+ f_train = h5py.File('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/train_hcp.hdf5', 'r')
308
+ flatmaps_train = f_train['flatmaps']
309
+
310
+ f_test = h5py.File('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/test_hcp.hdf5', 'r')
311
+ flatmaps_test = f_test['flatmaps']
312
+
313
+ metadata_train = np.load('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/metadata_train_HCP.npy', allow_pickle=True)
314
+ metadata_test = np.load('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/metadata_test_HCP.npy', allow_pickle=True)
315
+
316
+
317
+ # In[6]:
318
+
319
+
320
+ from torch.utils.data import Dataset, DataLoader
321
+
322
+ class HCPFlatDataset(Dataset):
323
+ def __init__(self, flatmaps, metadata):
324
+ self.flatmaps = flatmaps
325
+ self.metadata = metadata
326
+
327
+ def __len__(self):
328
+ return len(self.metadata)
329
+
330
+ def __getitem__(self, idx):
331
+ return self.flatmaps[idx], json.loads(self.metadata[idx])
332
+ print("Moving datasets to ram")
333
+ # Loading to cpu for faster training, this can take several minutes. Remove this [:] if you want to move one at the time.
334
+ train_dataset = HCPFlatDataset(flatmaps_train, metadata_train)
335
+ train_dl = DataLoader(train_dataset, batch_size=batch_size, shuffle=True, num_workers=num_workers)
336
+
337
+ test_dataset = HCPFlatDataset(flatmaps_test, metadata_test)
338
+ test_dl = DataLoader(test_dataset, batch_size=batch_size, shuffle=False, num_workers=0)
339
+ print("Datasets ready")
340
+
341
+
342
+ # ### Creating and loading Model
343
+
344
+ # In[7]:
345
+
346
+
347
+ from mae_utils.flat import load_hcp_flat_mask
348
+ from mae_utils.flat import create_hcp_flat
349
+ from mae_utils.flat import batch_unmask
350
+ import mae_utils.visualize as vis
351
+
352
+ flat_mask = load_hcp_flat_mask(hcp_flat_path)
353
+
354
+ mae_model = flat_models.mae_vit_large_fmri(
355
+ patch_size=patch_size,
356
+ decoder_embed_dim=decoder_embed_dim,
357
+ t_patch_size=t_patch_size,
358
+ pred_t_dim=pred_t_dim,
359
+ decoder_depth=4,
360
+ cls_embed=cls_embed,
361
+ norm_pix_loss=norm_pix_loss,
362
+ no_qkv_bias=no_qkv_bias,
363
+ sep_pos_embed=sep_pos_embed,
364
+ trunc_init=trunc_init,
365
+ pct_masks_to_decode=pct_masks_to_decode,
366
+ img_mask=flat_mask,
367
+ )
368
+
369
+
370
+ # In[8]:
371
+
372
+
373
+ checkpoint_files = [f for f in os.listdir(outdir) if f.endswith('.pth')]
374
+
375
+ if utils.is_interactive():
376
+ latest_checkpoint = "epoch99.pth"
377
+ else:
378
+ latest_checkpoint = sys.argv[2]
379
+ print(f"latest_checkpoint: {latest_checkpoint}")
380
+
381
+ # Load the checkpoint
382
+ checkpoint_path = os.path.join(outdir, latest_checkpoint)
383
+
384
+ state = torch.load(checkpoint_path)
385
+ mae_model.load_state_dict(state["model_state_dict"], strict=False)
386
+ mae_model.to(device)
387
+
388
+ print(f"\nLoaded checkpoint {latest_checkpoint} from {outdir}\n")
389
+
390
+
391
+ # In[9]:
392
+
393
+
394
+ class LinearClassifier(nn.Module):
395
+ def __init__(self, input_dim, num_classes):
396
+ super(LinearClassifier, self).__init__()
397
+ self.linear = nn.Linear(input_dim, num_classes)
398
+
399
+ def forward(self, x):
400
+ # Flatten the input except for the batch dimension
401
+ x = x.view(x.size(0), -1)
402
+ out = self.linear(x)
403
+ return out # Raw logits
404
+
405
+ # Determine the input dimension from a single sample
406
+ # Assuming images are of shape [1, 16, 144, 320]
407
+ input_dim = np.prod(mae_model(torch.randn(1,1,16,144,320).to(device),global_pool=global_pool, forward_features = True).shape[1:])
408
+ print(f"Input dimension: {input_dim}")
409
+
410
+
411
+ # In[10]:
412
+
413
+
414
+ class FullModel(nn.Module):
415
+ def __init__(self, lc_model, mae_model):
416
+ super(FullModel, self).__init__()
417
+ self.lc_model = lc_model
418
+ self.mae_model = mae_model
419
+
420
+
421
+ def forward(self, x, gsr):
422
+ x = self.mae_model(x, global_pool=global_pool, forward_features = True)
423
+ x = self.lc_model(x)
424
+ return x
425
+
426
+
427
+ # In[11]:
428
+
429
+
430
+ # Initialize the model
431
+ lc_model = LinearClassifier(input_dim=input_dim, num_classes=num_classes)
432
+
433
+ model = FullModel(lc_model, mae_model)
434
+
435
+ # Move the model to the GPU
436
+ model.to(device)
437
+
438
+ # Define loss function
439
+ criterion = nn.CrossEntropyLoss()
440
+
441
+ # Define optimizer with L2 regularization (weight_decay)
442
+ learning_rate = 1e-4
443
+ weight_decay = 1e-5 # Adjust based on your needs
444
+ optimizer = torch.optim.Adam(model.parameters(), lr=learning_rate, weight_decay=weight_decay)
445
+ num_epochs = 20 # Adjust as needed
446
+
447
+
448
+ # ### Data
449
+
450
+ # In[12]:
451
+
452
+
453
+ import wandb
454
+
455
+ if utils.is_interactive():
456
+ print("Running in interactive notebook. Disabling W&B and ckpt saving.")
457
+ wandb_log = True
458
+ save_ckpt = True
459
+
460
+ if wandb_log:
461
+ wandb_project = 'fMRI-foundation-model'
462
+ wandb_config = {
463
+ "model_name": model_name+'_HCP_FT',
464
+ "batch_size": batch_size,
465
+ "learning_rate": learning_rate,
466
+ "weight_decay": weight_decay,
467
+ "num_epochs": num_epochs,
468
+ "seed": seed,
469
+ }
470
+ print("wandb_config:\n", wandb_config)
471
+ random_id = random.randint(0, 100000)
472
+ print("wandb_id:", "HCPflat_raw" + f"_{random_id}")
473
+ wandb.init(
474
+ id=model_name+'_HCP_FT' + f"_{random_id}",
475
+ project=wandb_project,
476
+ name=model_name+'_HCP_FT',
477
+ config=wandb_config,
478
+ resume="allow",
479
+ )
480
+
481
+
482
+ # In[13]:
483
+
484
+
485
+ for epoch in range(num_epochs):
486
+ running_train_loss = 0.0
487
+ correct_train = 0
488
+ total_train = 0
489
+ step = 0
490
+
491
+ # with torch.amp.autocast(device_type='cuda'):
492
+ # Training Phase
493
+ model.train()
494
+ for batch in tqdm(train_dl, desc=f"Epoch {epoch+1}/{num_epochs} - Training"):
495
+ optimizer.zero_grad()
496
+ images = batch[0].to(device).float().unsqueeze(1) #fix this # Shape: [batch_size, 1, 16, 144, 320]
497
+ labels = batch[1]['trial_type'] # List of labels
498
+
499
+ encoded_labels = label_encoder.transform(labels)
500
+ encoded_labels = torch.tensor(encoded_labels, dtype=torch.long).to(device) # Shape: [batch_size]
501
+
502
+ # Forward pass
503
+ outputs = model(images, gsr=gsr) # Shape: [num_train_samples, num_classes]
504
+
505
+ # Compute loss
506
+ loss = criterion(outputs, encoded_labels)
507
+
508
+ # Backward pass and optimization
509
+ loss.backward()
510
+ optimizer.step()
511
+
512
+ # Accumulate loss
513
+ running_train_loss += loss.item() * images.size(0)
514
+
515
+
516
+ # Calculate accuracy
517
+ _, predicted = torch.max(outputs, 1)
518
+
519
+ correct_train += (predicted == encoded_labels).sum().item()
520
+ total_train += encoded_labels.size(0)
521
+
522
+ step = step + 1
523
+ if step % 100 == 0:
524
+ print(f"Step [{step}/{len(train_dl)}] - Training Loss: {loss.item():.4f} - Training Accuracy: {100 * correct_train / total_train:.2f}%")
525
+ # thth
526
+
527
+ epoch_train_loss = running_train_loss / total_train if total_train > 0 else 0.0
528
+ train_accuracy = 100 * correct_train / total_train if total_train > 0 else 0.0
529
+
530
+ # Validation Phase
531
+ model.eval()
532
+ running_val_loss = 0.0
533
+ correct_val = 0
534
+ total_val = 0
535
+
536
+ with torch.no_grad():
537
+ for batch in tqdm(test_dl, desc=f"Epoch {epoch+1}/{num_epochs} - Validation"):
538
+
539
+ images = batch[0].to(device).float().unsqueeze(1) #fix this
540
+ labels = batch[1]['trial_type']
541
+
542
+ # Encode labels to integer indices
543
+ encoded_labels = label_encoder.transform(labels)
544
+ encoded_labels = torch.tensor(encoded_labels, dtype=torch.long).to(device)
545
+
546
+
547
+ # Forward pass
548
+ outputs = model(images, gsr=gsr)
549
+
550
+ # Compute loss
551
+ loss = criterion(outputs, encoded_labels)
552
+
553
+ # Accumulate loss
554
+ running_val_loss += loss.item() * images.size(0)
555
+
556
+ # Calculate accuracy
557
+ _, predicted = torch.max(outputs, 1)
558
+ correct_val += (predicted == encoded_labels).sum().item()
559
+ total_val += encoded_labels.size(0)
560
+
561
+
562
+
563
+ epoch_val_loss = running_val_loss / total_val if total_val > 0 else 0.0
564
+ val_accuracy = 100 * correct_val / total_val if total_val > 0 else 0.0
565
+
566
+ print(f"Epoch [{epoch+1}/{num_epochs}] "
567
+ f"- Training Loss: {epoch_train_loss:.4f}, Training Accuracy: {train_accuracy:.2f}% "
568
+ f"- Validation Loss: {epoch_val_loss:.4f}, Validation Accuracy: {val_accuracy:.2f}%")
569
+
570
+ if wandb_log:
571
+ wandb.log({
572
+ "epoch_train_loss": epoch_train_loss,
573
+ "epoch_val_loss": epoch_val_loss,
574
+ "train_accuracy": train_accuracy,
575
+ "val_accuracy": val_accuracy,
576
+ })
577
+ if save_ckpt:
578
+ outdir = os.path.abspath(f'checkpoints/{model_name+"HCP_FT"}')
579
+ os.makedirs(outdir, exist_ok=True)
580
+ print("outdir", outdir)
581
+ # Save model and config
582
+ torch.save(model.state_dict(), f"{outdir}/model.pth")
583
+ with open(f"{outdir}/config.yaml", 'w') as f:
584
+ yaml.dump(wandb_config, f)
585
+ print(f"Saved model and config to {outdir}")
586
+
587
+
fMRI-foundation-model/src/wandb/run-20241023_040448-NSDflat_large_gsrFalse__HCP_FT_83810/files/output.log ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ Epoch 1/20 - Training: 2%|▏ | 314/13913 [01:59<1:19:19, 2.86it/s]
2
+ Step [100/13913] - Training Loss: 2.6343 - Training Accuracy: 10.25%
3
+ Step [200/13913] - Training Loss: 3.1541 - Training Accuracy: 20.75%
4
+ Step [300/13913] - Training Loss: 0.8357 - Training Accuracy: 32.00%
fMRI-foundation-model/src/wandb/run-20241023_040448-NSDflat_large_gsrFalse__HCP_FT_83810/files/requirements.txt ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ protobuf==5.28.2
2
+ imageio==2.35.1
3
+ MarkupSafe==3.0.0
4
+ regex==2024.9.11
5
+ matplotlib==3.9.2
6
+ notebook==7.2.2
7
+ debugpy==1.8.6
8
+ aiosignal==1.3.1
9
+ jupyter_core==5.7.2
10
+ torchaudio==2.4.1+cu121
11
+ python-json-logger==2.0.7
12
+ six==1.16.0
13
+ scikit-image==0.24.0
14
+ types-python-dateutil==2.9.0.20241003
15
+ PyYAML==6.0.2
16
+ httpcore==1.0.6
17
+ clip==1.0
18
+ babel==2.16.0
19
+ webcolors==24.8.0
20
+ omegaconf==2.3.0
21
+ webencodings==0.5.1
22
+ kiwisolver==1.4.7
23
+ uri-template==1.3.0
24
+ diffusers==0.23.0
25
+ idna==3.10
26
+ fsspec==2024.9.0
27
+ parso==0.8.4
28
+ setuptools==65.5.0
29
+ tornado==6.4.1
30
+ webdataset==0.2.100
31
+ decord==0.6.0
32
+ nvidia-curand-cu12==10.3.2.106
33
+ ipykernel==6.29.5
34
+ jupyter==1.1.1
35
+ pexpect==4.9.0
36
+ kornia_rs==0.1.5
37
+ iopath==0.1.10
38
+ async-lru==2.0.4
39
+ future==1.0.0
40
+ torchvision==0.19.1+cu121
41
+ botocore==1.34.162
42
+ cycler==0.12.1
43
+ tzdata==2024.2
44
+ jupyter_server_terminals==0.5.3
45
+ click==8.1.7
46
+ einops==0.8.0
47
+ pyzmq==26.2.0
48
+ jupyter_client==8.6.3
49
+ nbconvert==7.16.4
50
+ scikit-learn==1.5.2
51
+ executing==2.1.0
52
+ asttokens==2.4.1
53
+ docker-pycreds==0.4.0
54
+ matplotlib-inline==0.1.7
55
+ overrides==7.7.0
56
+ websocket-client==1.8.0
57
+ nbformat==5.10.4
58
+ elbow==0.1.1
59
+ contourpy==1.3.0
60
+ nvidia-cudnn-cu12==9.1.0.70
61
+ transformers==4.44.2
62
+ gitdb==4.0.11
63
+ jupyterlab_nvdashboard==0.11.0
64
+ lazy_loader==0.4
65
+ jsonpointer==3.0.0
66
+ notebook_shim==0.2.4
67
+ nvidia-nccl-cu12==2.20.5
68
+ ffmpeg-python==0.2.0
69
+ triton==3.0.0
70
+ mistune==3.0.2
71
+ python-dateutil==2.9.0.post0
72
+ beautifulsoup4==4.12.3
73
+ nbclient==0.10.0
74
+ h5py==3.12.1
75
+ ftfy==6.2.3
76
+ zipp==3.20.2
77
+ ptyprocess==0.7.0
78
+ huggingface-hub==0.25.1
79
+ pytz==2024.2
80
+ jupyterlab_pygments==0.3.0
81
+ nvidia-cublas-cu12==12.1.3.1
82
+ pandocfilters==1.5.1
83
+ Jinja2==3.1.4
84
+ arrow==1.3.0
85
+ rpds-py==0.20.0
86
+ jupyter_server==2.14.2
87
+ simplejson==3.19.3
88
+ networkx==3.3
89
+ packaging==24.1
90
+ traitlets==5.14.3
91
+ pandas==2.2.3
92
+ xformers==0.0.22.post7
93
+ lightning-utilities==0.11.7
94
+ tifffile==2024.9.20
95
+ nvidia-cuda-cupti-cu12==12.1.105
96
+ mpmath==1.3.0
97
+ GitPython==3.1.43
98
+ scipy==1.14.1
99
+ jsonschema==4.23.0
100
+ prompt_toolkit==3.0.48
101
+ s3transfer==0.10.2
102
+ multidict==6.1.0
103
+ bleach==6.1.0
104
+ sentry-sdk==2.15.0
105
+ nibabel==5.2.1
106
+ accelerate==1.0.0
107
+ pyarrow==17.0.0
108
+ threadpoolctl==3.5.0
109
+ attrs==24.2.0
110
+ rfc3986-validator==0.1.1
111
+ nvidia-cuda-runtime-cu12==12.1.105
112
+ ipywidgets==8.1.5
113
+ frozenlist==1.4.1
114
+ pycparser==2.22
115
+ jupyterlab_server==2.27.3
116
+ nvidia-cuda-nvrtc-cu12==12.1.105
117
+ yarl==1.13.1
118
+ setproctitle==1.3.3
119
+ isoduration==20.11.0
120
+ Pygments==2.18.0
121
+ jedi==0.19.1
122
+ boto3==1.34.57
123
+ tokenizers==0.19.1
124
+ referencing==0.35.1
125
+ rfc3339-validator==0.1.4
126
+ pillow==10.4.0
127
+ jupyterlab==4.2.5
128
+ stack-data==0.6.3
129
+ h11==0.14.0
130
+ anyio==4.6.0
131
+ nilearn==0.10.4
132
+ nvidia-cusolver-cu12==11.4.5.107
133
+ tinycss2==1.3.0
134
+ defusedxml==0.7.1
135
+ argon2-cffi-bindings==21.2.0
136
+ soupsieve==2.6
137
+ nest-asyncio==1.6.0
138
+ torchmetrics==1.3.0.post0
139
+ tqdm==4.66.5
140
+ cffi==1.17.1
141
+ charset-normalizer==3.3.2
142
+ jsonschema-specifications==2023.12.1
143
+ decorator==5.1.1
144
+ open_clip_torch==2.26.1
145
+ jupyter-events==0.10.0
146
+ smart-open==7.0.5
147
+ antlr4-python3-runtime==4.9.3
148
+ prometheus_client==0.21.0
149
+ kornia==0.7.3
150
+ typing_extensions==4.12.2
151
+ sniffio==1.3.1
152
+ joblib==1.4.2
153
+ comm==0.2.2
154
+ aiohappyeyeballs==2.4.3
155
+ numpy==2.1.2
156
+ braceexpand==0.1.7
157
+ certifi==2024.8.30
158
+ psutil==6.0.0
159
+ pyparsing==3.1.4
160
+ pure_eval==0.2.3
161
+ nvidia-cusparse-cu12==12.1.0.106
162
+ wandb==0.18.3
163
+ urllib3==2.2.3
164
+ smmap==5.0.1
165
+ platformdirs==4.3.6
166
+ torch==2.4.1+cu121
167
+ requests==2.32.3
168
+ json5==0.9.25
169
+ nvidia-nvjitlink-cu12==12.6.77
170
+ jupyterlab_widgets==3.0.13
171
+ lxml==5.3.0
172
+ httpx==0.27.2
173
+ opencv-python==4.6.0.66
174
+ portalocker==2.10.1
175
+ pytorch-lightning==2.0.1
176
+ sympy==1.13.3
177
+ wcwidth==0.2.13
178
+ jmespath==1.0.1
179
+ fqdn==1.5.1
180
+ pynvml==11.5.3
181
+ pip==24.0
182
+ wrapt==1.16.0
183
+ aiohttp==3.10.9
184
+ filelock==3.16.1
185
+ fonttools==4.54.1
186
+ fastjsonschema==2.20.0
187
+ jupyter-console==6.6.3
188
+ widgetsnbextension==4.0.13
189
+ timm==1.0.9
190
+ nvidia-cufft-cu12==11.0.2.54
191
+ ipython==8.28.0
192
+ nvidia-nvtx-cu12==12.1.105
193
+ jupyter-lsp==2.2.5
194
+ safetensors==0.4.5
195
+ terminado==0.18.1
196
+ argon2-cffi==23.1.0
197
+ Send2Trash==1.8.3
198
+ importlib_metadata==8.5.0
fMRI-foundation-model/src/wandb/run-20241023_040448-NSDflat_large_gsrFalse__HCP_FT_83810/files/wandb-metadata.json ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "os": "Linux-5.15.0-1058-aws-x86_64-with-glibc2.31",
3
+ "python": "3.11.10",
4
+ "startedAt": "2024-10-23T04:04:48.508503Z",
5
+ "args": [
6
+ "NSDflat_large_gsrFalse_",
7
+ "epoch99.pth"
8
+ ],
9
+ "program": "/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/HCP_downstream_finetune.py",
10
+ "codePath": "src/HCP_downstream_finetune.py",
11
+ "git": {
12
+ "remote": "https://github.com/MedARC-AI/fMRI-foundation-model",
13
+ "commit": "b1ba684ae7a5cc4155cc046b0abe613de09bf700"
14
+ },
15
+ "email": "torrico.villanueva.cesar.kadir@gmail.com",
16
+ "root": "/weka/proj-fmri/ckadirt/fMRI-foundation-model/src",
17
+ "host": "ip-10-0-161-189",
18
+ "username": "ckadirt",
19
+ "executable": "/admin/home-ckadirt/foundation_env/bin/python",
20
+ "codePathLocal": "HCP_downstream_finetune.py",
21
+ "cpu_count": 96,
22
+ "cpu_count_logical": 192,
23
+ "gpu": "[NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3]",
24
+ "gpu_count": 8,
25
+ "disk": {
26
+ "/": {
27
+ "total": "249555763200",
28
+ "used": "184918749184"
29
+ }
30
+ },
31
+ "memory": {
32
+ "total": "2147443396608"
33
+ },
34
+ "cpu": {
35
+ "count": 96,
36
+ "countLogical": 192
37
+ },
38
+ "gpu_nvidia": [
39
+ {
40
+ "name": "NVIDIA H100 80GB HBM3",
41
+ "memoryTotal": "85520809984",
42
+ "cudaCores": 16896,
43
+ "architecture": "Hopper"
44
+ },
45
+ {
46
+ "name": "NVIDIA H100 80GB HBM3",
47
+ "memoryTotal": "85520809984",
48
+ "cudaCores": 16896,
49
+ "architecture": "Hopper"
50
+ },
51
+ {
52
+ "name": "NVIDIA H100 80GB HBM3",
53
+ "memoryTotal": "85520809984",
54
+ "cudaCores": 16896,
55
+ "architecture": "Hopper"
56
+ },
57
+ {
58
+ "name": "NVIDIA H100 80GB HBM3",
59
+ "memoryTotal": "85520809984",
60
+ "cudaCores": 16896,
61
+ "architecture": "Hopper"
62
+ },
63
+ {
64
+ "name": "NVIDIA H100 80GB HBM3",
65
+ "memoryTotal": "85520809984",
66
+ "cudaCores": 16896,
67
+ "architecture": "Hopper"
68
+ },
69
+ {
70
+ "name": "NVIDIA H100 80GB HBM3",
71
+ "memoryTotal": "85520809984",
72
+ "cudaCores": 16896,
73
+ "architecture": "Hopper"
74
+ },
75
+ {
76
+ "name": "NVIDIA H100 80GB HBM3",
77
+ "memoryTotal": "85520809984",
78
+ "cudaCores": 16896,
79
+ "architecture": "Hopper"
80
+ },
81
+ {
82
+ "name": "NVIDIA H100 80GB HBM3",
83
+ "memoryTotal": "85520809984",
84
+ "cudaCores": 16896,
85
+ "architecture": "Hopper"
86
+ }
87
+ ],
88
+ "slurm": {
89
+ "cluster_name": "sagemaker2",
90
+ "conf": "/opt/slurm/etc/slurm.conf",
91
+ "cpus_on_node": "20",
92
+ "gpus_on_node": "1",
93
+ "gpus_per_task": "1",
94
+ "gtids": "0",
95
+ "job_account": "fmri",
96
+ "job_cpus_per_node": "20",
97
+ "job_end_time": "1729699452",
98
+ "job_gid": "1879800513",
99
+ "job_gpus": "6",
100
+ "job_id": "528137",
101
+ "job_name": "finetuneHCP",
102
+ "job_nodelist": "ip-10-0-161-189",
103
+ "job_num_nodes": "1",
104
+ "job_partition": "p5",
105
+ "job_qos": "idle",
106
+ "job_start_time": "1729656252",
107
+ "job_uid": "1879804696",
108
+ "job_user": "ckadirt",
109
+ "jobid": "528137",
110
+ "localid": "0",
111
+ "mem_per_cpu": "11500",
112
+ "nnodes": "1",
113
+ "node_aliases": "(null)",
114
+ "nodeid": "0",
115
+ "nodelist": "ip-10-0-161-189",
116
+ "nprocs": "1",
117
+ "ntasks": "1",
118
+ "ntasks_per_node": "1",
119
+ "prio_process": "0",
120
+ "procid": "0",
121
+ "script_context": "prolog_task",
122
+ "submit_dir": "/weka/proj-fmri/ckadirt/fMRI-foundation-model/src",
123
+ "submit_host": "ip-172-17-12-61",
124
+ "task_pid": "494302",
125
+ "tasks_per_node": "1",
126
+ "topology_addr": "ip-10-0-161-189",
127
+ "topology_addr_pattern": "node",
128
+ "working_cluster": "sagemaker2:ip-172-17-63-161:6817:9984:109"
129
+ },
130
+ "cudaVersion": "12.2"
131
+ }
fMRI-foundation-model/src/wandb/run-20241023_040448-NSDflat_large_gsrFalse__HCP_FT_83810/logs/debug-core.log ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {"time":"2024-10-23T04:04:47.997097191Z","level":"INFO","msg":"started logging, with flags","port-filename":"/tmp/tmpme3bfbqu/port-494604.txt","pid":494604,"debug":false,"disable-analytics":false}
2
+ {"time":"2024-10-23T04:04:47.997570532Z","level":"INFO","msg":"FeatureState","shutdownOnParentExitEnabled":false}
3
+ {"time":"2024-10-23T04:04:48.002076636Z","level":"INFO","msg":"Will exit if parent process dies.","ppid":494604}
4
+ {"time":"2024-10-23T04:04:48.002071246Z","level":"INFO","msg":"server is running","addr":{"IP":"127.0.0.1","Port":38687,"Zone":""}}
5
+ {"time":"2024-10-23T04:04:48.020540604Z","level":"INFO","msg":"connection: ManageConnectionData: new connection created","id":"127.0.0.1:39246"}
6
+ {"time":"2024-10-23T04:04:48.512048605Z","level":"INFO","msg":"handleInformInit: received","streamId":"NSDflat_large_gsrFalse__HCP_FT_83810","id":"127.0.0.1:39246"}
7
+ {"time":"2024-10-23T04:04:48.584955492Z","level":"INFO","msg":"handleInformInit: stream started","streamId":"NSDflat_large_gsrFalse__HCP_FT_83810","id":"127.0.0.1:39246"}
fMRI-foundation-model/src/wandb/run-20241023_040448-NSDflat_large_gsrFalse__HCP_FT_83810/logs/debug-internal.log ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"time":"2024-10-23T04:04:48.523605121Z","level":"INFO","msg":"using version","core version":"0.18.3"}
2
+ {"time":"2024-10-23T04:04:48.523652724Z","level":"INFO","msg":"created symlink","path":"/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241023_040448-NSDflat_large_gsrFalse__HCP_FT_83810/logs/debug-core.log"}
3
+ {"time":"2024-10-23T04:04:48.538681247Z","level":"ERROR","msg":"dialing: google: could not find default credentials. See https://cloud.google.com/docs/authentication/external/set-up-adc for more information"}
4
+ {"time":"2024-10-23T04:04:48.584900459Z","level":"INFO","msg":"created new stream","id":"NSDflat_large_gsrFalse__HCP_FT_83810"}
5
+ {"time":"2024-10-23T04:04:48.584944502Z","level":"INFO","msg":"stream: started","id":"NSDflat_large_gsrFalse__HCP_FT_83810"}
6
+ {"time":"2024-10-23T04:04:48.584971454Z","level":"INFO","msg":"writer: Do: started","stream_id":{"value":"NSDflat_large_gsrFalse__HCP_FT_83810"}}
7
+ {"time":"2024-10-23T04:04:48.584999935Z","level":"INFO","msg":"handler: started","stream_id":{"value":"NSDflat_large_gsrFalse__HCP_FT_83810"}}
8
+ {"time":"2024-10-23T04:04:48.584983914Z","level":"INFO","msg":"sender: started","stream_id":{"value":"NSDflat_large_gsrFalse__HCP_FT_83810"}}
9
+ {"time":"2024-10-23T04:04:49.148918962Z","level":"INFO","msg":"wandb-core","!BADKEY":null}
10
+ {"time":"2024-10-23T04:04:49.156280153Z","level":"INFO","msg":"Starting system monitor"}
11
+ {"time":"2024-10-23T04:04:49.188775358Z","level":"ERROR","msg":"git repo not found","error":"repository does not exist"}
fMRI-foundation-model/src/wandb/run-20241023_040448-NSDflat_large_gsrFalse__HCP_FT_83810/logs/debug.log ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 2024-10-23 04:04:48,496 INFO MainThread:494604 [wandb_setup.py:_flush():79] Current SDK version is 0.18.3
2
+ 2024-10-23 04:04:48,497 INFO MainThread:494604 [wandb_setup.py:_flush():79] Configure stats pid to 494604
3
+ 2024-10-23 04:04:48,497 INFO MainThread:494604 [wandb_setup.py:_flush():79] Loading settings from /admin/home-ckadirt/.config/wandb/settings
4
+ 2024-10-23 04:04:48,497 INFO MainThread:494604 [wandb_setup.py:_flush():79] Loading settings from /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/settings
5
+ 2024-10-23 04:04:48,497 INFO MainThread:494604 [wandb_setup.py:_flush():79] Loading settings from environment variables: {}
6
+ 2024-10-23 04:04:48,497 INFO MainThread:494604 [wandb_setup.py:_flush():79] Applying setup settings: {'mode': None, '_disable_service': None}
7
+ 2024-10-23 04:04:48,497 INFO MainThread:494604 [wandb_setup.py:_flush():79] Inferring run settings from compute environment: {'program_relpath': 'src/HCP_downstream_finetune.py', 'program_abspath': '/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/HCP_downstream_finetune.py', 'program': '/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/HCP_downstream_finetune.py'}
8
+ 2024-10-23 04:04:48,497 INFO MainThread:494604 [wandb_setup.py:_flush():79] Applying login settings: {}
9
+ 2024-10-23 04:04:48,497 INFO MainThread:494604 [wandb_init.py:_log_setup():532] Logging user logs to /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241023_040448-NSDflat_large_gsrFalse__HCP_FT_83810/logs/debug.log
10
+ 2024-10-23 04:04:48,498 INFO MainThread:494604 [wandb_init.py:_log_setup():533] Logging internal logs to /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241023_040448-NSDflat_large_gsrFalse__HCP_FT_83810/logs/debug-internal.log
11
+ 2024-10-23 04:04:48,498 INFO MainThread:494604 [wandb_init.py:init():617] calling init triggers
12
+ 2024-10-23 04:04:48,498 INFO MainThread:494604 [wandb_init.py:init():624] wandb.init called with sweep_config: {}
13
+ config: {'model_name': 'NSDflat_large_gsrFalse__HCP_FT', 'batch_size': 8, 'learning_rate': 0.0001, 'weight_decay': 1e-05, 'num_epochs': 20, 'seed': 42}
14
+ 2024-10-23 04:04:48,498 INFO MainThread:494604 [wandb_init.py:init():667] starting backend
15
+ 2024-10-23 04:04:48,498 INFO MainThread:494604 [wandb_init.py:init():671] sending inform_init request
16
+ 2024-10-23 04:04:48,507 INFO MainThread:494604 [backend.py:_multiprocessing_setup():104] multiprocessing start_methods=fork,spawn,forkserver, using: spawn
17
+ 2024-10-23 04:04:48,507 INFO MainThread:494604 [wandb_init.py:init():684] backend started and connected
18
+ 2024-10-23 04:04:48,527 INFO MainThread:494604 [wandb_init.py:init():779] updated telemetry
19
+ 2024-10-23 04:04:48,584 INFO MainThread:494604 [wandb_init.py:init():812] communicating run to backend with 90.0 second timeout
20
+ 2024-10-23 04:04:49,134 INFO MainThread:494604 [wandb_init.py:init():863] starting run threads in backend
21
+ 2024-10-23 04:04:49,645 INFO MainThread:494604 [wandb_run.py:_console_start():2465] atexit reg
22
+ 2024-10-23 04:04:49,645 INFO MainThread:494604 [wandb_run.py:_redirect():2313] redirect: wrap_raw
23
+ 2024-10-23 04:04:49,645 INFO MainThread:494604 [wandb_run.py:_redirect():2378] Wrapping output streams.
24
+ 2024-10-23 04:04:49,645 INFO MainThread:494604 [wandb_run.py:_redirect():2403] Redirects installed.
25
+ 2024-10-23 04:04:49,652 INFO MainThread:494604 [wandb_init.py:init():907] run started, returning control to user process
fMRI-foundation-model/src/wandb/run-20241023_040448-NSDflat_large_gsrFalse__HCP_FT_83810/run-NSDflat_large_gsrFalse__HCP_FT_83810.wandb ADDED
Binary file (164 kB). View file
 
fMRI-foundation-model/src/wandb/run-20241024_030627-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3/files/code/src/HCP_downstream_finetune.py ADDED
@@ -0,0 +1,597 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # coding: utf-8
3
+
4
+ # In[1]:
5
+
6
+
7
+ # Import packages and setup gpu configuration.
8
+ # This code block shouldnt need to be adjusted!
9
+ import os
10
+ import sys
11
+ import json
12
+ import yaml
13
+ import numpy as np
14
+ import copy
15
+ import math
16
+ import time
17
+ import random
18
+ from tqdm.auto import tqdm
19
+ import webdataset as wds
20
+ import matplotlib.pyplot as plt
21
+
22
+ import torch
23
+ import torch.nn as nn
24
+ from torchvision import transforms
25
+ import utils
26
+ from mae_utils.flat_models import *
27
+ import h5py
28
+ from mae_utils import flat_models
29
+
30
+ # tf32 data type is faster than standard float32
31
+ torch.backends.cuda.matmul.allow_tf32 = True
32
+ # following fixes a Conv3D CUDNN_NOT_SUPPORTED error
33
+ torch.backends.cudnn.benchmark = True
34
+
35
+ # ## MODEL TO LOAD ##
36
+ if utils.is_interactive():
37
+ model_name = "HCPflat_large_gsrFalse_"
38
+ else:
39
+ model_name = sys.argv[1]
40
+
41
+
42
+ # outdir = os.path.abspath(f'checkpoints/{model_name}')
43
+ outdir = os.path.abspath(f'checkpoints/{model_name}')
44
+
45
+ print("outdir", outdir)
46
+ # Load previous config.yaml if available
47
+ if os.path.exists(f"{outdir}/config.yaml"):
48
+ config = yaml.load(open(f"{outdir}/config.yaml", 'r'), Loader=yaml.FullLoader)
49
+ print(f"Loaded config.yaml from ckpt folder {outdir}")
50
+ # create global variables from the config
51
+ print("\n__CONFIG__")
52
+ for attribute_name in config.keys():
53
+ print(f"{attribute_name} = {config[attribute_name]}")
54
+ globals()[attribute_name] = config[f'{attribute_name}']
55
+ print("\n")
56
+
57
+ world_size = os.getenv('WORLD_SIZE')
58
+ if world_size is None:
59
+ world_size = 1
60
+ else:
61
+ world_size = int(world_size)
62
+ print(f"WORLD_SIZE={world_size}")
63
+
64
+ if utils.is_interactive():
65
+ # Following allows you to change functions in models.py or utils.py and
66
+ # have this notebook automatically update with your revisions
67
+ get_ipython().run_line_magic('load_ext', 'autoreload')
68
+ get_ipython().run_line_magic('autoreload', '2')
69
+
70
+ batch_size = probe_batch_size
71
+ num_epochs = probe_num_epochs
72
+
73
+ data_type = torch.float32 # change depending on your mixed_precision
74
+ global_batch_size = batch_size * world_size
75
+
76
+ device = torch.device('cuda')
77
+
78
+ hcp_flat_path = "/weka/proj-medarc/shared/HCP-Flat"
79
+ # seed = 42
80
+ # num_frames = 16
81
+ # gsr = False
82
+ # num_workers = 10
83
+ # batch_size = 128
84
+ save_ckpt = True
85
+ wandb_log = True
86
+ print("PID of this process =",os.getpid())
87
+ utils.seed_everything(seed)
88
+
89
+
90
+ # In[2]:
91
+
92
+
93
+ if os.getenv('global_pool') == "False":
94
+ global_pool = False
95
+ else:
96
+ global_pool = True
97
+ print(f"global_pool = {global_pool}")
98
+
99
+ try:
100
+ gsr
101
+ except:
102
+ gsr = True
103
+ print("set gsr to True")
104
+ print(f"gsr = {gsr}")
105
+
106
+
107
+ # In[3]:
108
+
109
+
110
+ #### UNCOMMENT THIS TO SAVE THE HCP-FLAT IN HDF5 FORMAT
111
+
112
+
113
+ # from torch.utils.data import default_collate
114
+ # from mae_utils.flat import load_hcp_flat_mask
115
+ # from mae_utils.flat import create_hcp_flat
116
+ # from mae_utils.flat import batch_unmask
117
+ # import mae_utils.visualize as vis
118
+
119
+
120
+ # batch_size = 26
121
+ # print(f"changed batch_size to {batch_size}")
122
+
123
+ # ## Test ##
124
+ # datasets_to_include = "HCP"
125
+ # assert "HCP" in datasets_to_include
126
+ # test_dataset = create_hcp_flat(root=hcp_flat_path,
127
+ # clip_mode="event", frames=num_frames, shuffle=False, gsr=gsr, sub_list = 'test')
128
+ # test_dl = wds.WebLoader(
129
+ # test_dataset.batched(batch_size, partial=False, collation_fn=default_collate),
130
+ # batch_size=None,
131
+ # shuffle=False,
132
+ # num_workers=num_workers,
133
+ # pin_memory=True,
134
+ # )
135
+
136
+ # ## Train ##
137
+ # assert "HCP" in datasets_to_include
138
+ # train_dataset = create_hcp_flat(root=hcp_flat_path,
139
+ # clip_mode="event", frames=num_frames, shuffle=False, gsr=gsr, sub_list = 'train')
140
+ # train_dl = wds.WebLoader(
141
+ # train_dataset.batched(batch_size, partial=False, collation_fn=default_collate),
142
+ # batch_size=None,
143
+ # shuffle=False,
144
+ # num_workers=num_workers,
145
+ # pin_memory=True,
146
+ # )
147
+
148
+ # def flatten_meta(meta_dict):
149
+ # """
150
+ # Flatten the meta dictionary by:
151
+ # - Replacing single-item lists with the item itself.
152
+ # - Converting tensors to scalar numbers.
153
+ # """
154
+ # flattened = {}
155
+ # for key, value in meta_dict.items():
156
+ # if isinstance(value, list):
157
+ # if len(value) == 1:
158
+ # flattened[key] = value[0] # Replace list with its single item
159
+ # else:
160
+ # flattened[key] = value # Keep as is if multiple items
161
+ # elif isinstance(value, torch.Tensor):
162
+ # # Convert tensor to scalar
163
+ # if value.numel() == 1:
164
+ # flattened[key] = value.item()
165
+ # else:
166
+ # flattened[key] = value.tolist() # Convert multi-element tensor to list
167
+ # else:
168
+ # flattened[key] = value # Keep the value as is
169
+ # return flattened
170
+
171
+ # import h5py
172
+ # meta_array = np.array([], dtype=object)
173
+ # # Open an HDF5 file in write mode
174
+ # with h5py.File('train_hcp.hdf5', 'w') as h5f:
175
+ # flatmaps_dset = None
176
+
177
+ # total_samples = 0
178
+
179
+ # for i, batch in tqdm(enumerate(train_dl), total = 120000):
180
+ # images = batch['image'][0]
181
+ # meta = batch['meta']
182
+ # batch_size = images.shape[0]
183
+ # meta_serializable = meta.copy()
184
+
185
+
186
+ # # Step 2: Serialize the dictionary to a JSON string
187
+ # meta_str = json.dumps(flatten_meta(meta_serializable), indent=4)
188
+ # meta_array = np.append(meta_array, meta_str)
189
+ # if flatmaps_dset is None:
190
+ # # Initialize datasets with unlimited (None) maxshape along the first axis
191
+ # flatmaps_shape = (0,) + images.shape[1:]
192
+ # flatmaps_maxshape = (None,) + images.shape[1:]
193
+
194
+ # flatmaps_dset = h5f.create_dataset(
195
+ # 'flatmaps',
196
+ # shape=flatmaps_shape,
197
+ # maxshape=flatmaps_maxshape,
198
+ # dtype=np.float16,
199
+ # chunks=True # Enable chunking for efficient resizing
200
+ # )
201
+
202
+ # # Resize datasets to accommodate new data
203
+ # flatmaps_dset.resize(total_samples + batch_size, axis=0)
204
+
205
+ # # Write data to the datasets
206
+ # flatmaps_dset[total_samples:total_samples + batch_size] = images.numpy().astype(np.float16)
207
+
208
+ # total_samples += batch_size
209
+
210
+ # print(f"Processed {total_samples} samples")
211
+ # np.save('metadata_test_HCP.npy', meta_array)
212
+
213
+
214
+ # import h5py
215
+ # meta_array = np.array([], dtype=object)
216
+ # # Open an HDF5 file in write mode
217
+ # with h5py.File('test_hcp.hdf5', 'w') as h5f:
218
+ # flatmaps_dset = None
219
+
220
+ # total_samples = 0
221
+
222
+ # for i, batch in tqdm(enumerate(test_dl), total = 12000):
223
+ # images = batch['image'][0]
224
+ # meta = batch['meta']
225
+ # batch_size = images.shape[0]
226
+ # meta_serializable = meta.copy()
227
+
228
+
229
+ # # Step 2: Serialize the dictionary to a JSON string
230
+ # meta_str = json.dumps(flatten_meta(meta_serializable), indent=4)
231
+ # meta_array = np.append(meta_array, meta_str)
232
+ # if flatmaps_dset is None:
233
+ # # Initialize datasets with unlimited (None) maxshape along the first axis
234
+ # flatmaps_shape = (0,) + images.shape[1:]
235
+ # flatmaps_maxshape = (None,) + images.shape[1:]
236
+
237
+ # flatmaps_dset = h5f.create_dataset(
238
+ # 'flatmaps',
239
+ # shape=flatmaps_shape,
240
+ # maxshape=flatmaps_maxshape,
241
+ # dtype=np.float16,
242
+ # chunks=True # Enable chunking for efficient resizing
243
+ # )
244
+
245
+ # # Resize datasets to accommodate new data
246
+ # flatmaps_dset.resize(total_samples + batch_size, axis=0)
247
+
248
+ # # Write data to the datasets
249
+ # flatmaps_dset[total_samples:total_samples + batch_size] = images.numpy().astype(np.float16)
250
+
251
+ # total_samples += batch_size
252
+
253
+ # print(f"Processed {total_samples} samples")
254
+ # np.save('metadata_train_HCP.npy', meta_array)
255
+
256
+
257
+ # ### Preparing data
258
+
259
+ # In[4]:
260
+
261
+
262
+ from sklearn.preprocessing import LabelEncoder
263
+
264
+ INCLUDE_CONDS = {
265
+ "fear",
266
+ "neut",
267
+ "math",
268
+ "story",
269
+ "lf",
270
+ "lh",
271
+ "rf",
272
+ "rh",
273
+ "t",
274
+ "match",
275
+ "relation",
276
+ "mental",
277
+ "rnd",
278
+ "0bk_body",
279
+ "2bk_body",
280
+ "0bk_faces",
281
+ "2bk_faces",
282
+ "0bk_places",
283
+ "2bk_places",
284
+ "0bk_tools",
285
+ "2bk_tools",
286
+ }
287
+
288
+ # test_data = []
289
+
290
+ # # Iterate over the DataLoader with a progress bar
291
+ # for sample in tqdm(train_dl, desc="Processing samples"):
292
+ # x = sample['image']
293
+ # y = sample['meta']['trial_type']
294
+ # key = sample['meta']['key']
295
+ # print(x.shape, y, key)
296
+ # break
297
+ # Initialize the label encoder
298
+ label_encoder = LabelEncoder()
299
+ label_encoder.fit(sorted(INCLUDE_CONDS)) # Ensure consistent ordering
300
+
301
+ num_classes = len(label_encoder.classes_)
302
+ print(f"Number of classes: {num_classes}")
303
+
304
+
305
+ # In[5]:
306
+
307
+
308
+ f_train = h5py.File('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/train_hcp.hdf5', 'r')
309
+ flatmaps_train = f_train['flatmaps']
310
+
311
+ f_test = h5py.File('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/test_hcp.hdf5', 'r')
312
+ flatmaps_test = f_test['flatmaps']
313
+
314
+ metadata_train = np.load('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/metadata_train_HCP.npy', allow_pickle=True)
315
+ metadata_test = np.load('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/metadata_test_HCP.npy', allow_pickle=True)
316
+
317
+
318
+ # In[6]:
319
+
320
+
321
+ from torch.utils.data import Dataset, DataLoader
322
+
323
+ class HCPFlatDataset(Dataset):
324
+ def __init__(self, flatmaps, metadata):
325
+ self.flatmaps = flatmaps
326
+ self.metadata = metadata
327
+
328
+ def __len__(self):
329
+ return len(self.metadata)
330
+
331
+ def __getitem__(self, idx):
332
+ return self.flatmaps[idx], json.loads(self.metadata[idx])
333
+ print("Moving datasets to ram")
334
+ # Loading to cpu for faster training, this can take several minutes. Remove this [:] if you want to move one at the time.
335
+ train_dataset = HCPFlatDataset(flatmaps_train, metadata_train)
336
+ train_dl = DataLoader(train_dataset, batch_size=batch_size, shuffle=True, num_workers=num_workers)
337
+
338
+ test_dataset = HCPFlatDataset(flatmaps_test, metadata_test)
339
+ test_dl = DataLoader(test_dataset, batch_size=batch_size, shuffle=False, num_workers=0)
340
+ print("Datasets ready")
341
+
342
+
343
+ # ### Creating and loading Model
344
+
345
+ # In[7]:
346
+
347
+
348
+ from mae_utils.flat import load_hcp_flat_mask
349
+ from mae_utils.flat import create_hcp_flat
350
+ from mae_utils.flat import batch_unmask
351
+ import mae_utils.visualize as vis
352
+
353
+ flat_mask = load_hcp_flat_mask(hcp_flat_path)
354
+
355
+ mae_model = flat_models.mae_vit_large_fmri(
356
+ patch_size=patch_size,
357
+ decoder_embed_dim=decoder_embed_dim,
358
+ t_patch_size=t_patch_size,
359
+ pred_t_dim=pred_t_dim,
360
+ decoder_depth=4,
361
+ cls_embed=cls_embed,
362
+ norm_pix_loss=norm_pix_loss,
363
+ no_qkv_bias=no_qkv_bias,
364
+ sep_pos_embed=sep_pos_embed,
365
+ trunc_init=trunc_init,
366
+ pct_masks_to_decode=pct_masks_to_decode,
367
+ img_mask=flat_mask,
368
+ )
369
+
370
+
371
+ # In[8]:
372
+
373
+
374
+ checkpoint_files = [f for f in os.listdir(outdir) if f.endswith('.pth')]
375
+
376
+ if utils.is_interactive():
377
+ latest_checkpoint = "epoch99.pth"
378
+ else:
379
+ latest_checkpoint = sys.argv[2]
380
+ print(f"latest_checkpoint: {latest_checkpoint}")
381
+
382
+ # Load the checkpoint
383
+ checkpoint_path = os.path.join(outdir, latest_checkpoint)
384
+
385
+ state = torch.load(checkpoint_path)
386
+ mae_model.load_state_dict(state["model_state_dict"], strict=False)
387
+ mae_model.to(device)
388
+
389
+ print(f"\nLoaded checkpoint {latest_checkpoint} from {outdir}\n")
390
+
391
+
392
+ # In[9]:
393
+
394
+
395
+ class LinearClassifier(nn.Module):
396
+ def __init__(self, input_dim, num_classes):
397
+ super(LinearClassifier, self).__init__()
398
+ self.linear = nn.Linear(input_dim, num_classes)
399
+
400
+ def forward(self, x):
401
+ # Flatten the input except for the batch dimension
402
+ x = x.view(x.size(0), -1)
403
+ out = self.linear(x)
404
+ return out # Raw logits
405
+
406
+ # Determine the input dimension from a single sample
407
+ # Assuming images are of shape [1, 16, 144, 320]
408
+ input_dim = np.prod(mae_model(torch.randn(1,1,16,144,320).to(device),global_pool=global_pool, forward_features = True).shape[1:])
409
+ print(f"Input dimension: {input_dim}")
410
+
411
+
412
+ # In[10]:
413
+
414
+
415
+ class FullModel(nn.Module):
416
+ def __init__(self, lc_model, mae_model):
417
+ super(FullModel, self).__init__()
418
+ self.lc_model = lc_model
419
+ self.mae_model = mae_model
420
+
421
+
422
+ def forward(self, x, gsr):
423
+ x = self.mae_model(x, global_pool=global_pool, forward_features = True)
424
+ x = self.lc_model(x)
425
+ return x
426
+
427
+
428
+ # In[11]:
429
+
430
+
431
+ # Initialize the model
432
+ lc_model = LinearClassifier(input_dim=input_dim, num_classes=num_classes)
433
+
434
+ model = FullModel(lc_model, mae_model)
435
+
436
+ # Move the model to the GPU
437
+ model.to(device)
438
+
439
+ # Define loss function
440
+ criterion = nn.CrossEntropyLoss()
441
+
442
+ # Define optimizer with L2 regularization (weight_decay)
443
+ learning_rate = 1e-4
444
+ weight_decay = 1e-5 # Adjust based on your needs
445
+ optimizer = torch.optim.Adam(model.parameters(), lr=learning_rate, weight_decay=weight_decay)
446
+ num_epochs = 20 # Adjust as needed
447
+
448
+
449
+ # ### Data
450
+
451
+ # In[16]:
452
+
453
+
454
+ import uuid
455
+
456
+ myuuid = uuid.uuid4()
457
+ str(myuuid)
458
+
459
+
460
+ # In[17]:
461
+
462
+
463
+ import wandb
464
+
465
+ if utils.is_interactive():
466
+ print("Running in interactive notebook. Disabling W&B and ckpt saving.")
467
+ wandb_log = True
468
+ save_ckpt = True
469
+
470
+ if wandb_log:
471
+ wandb_project = 'fMRI-foundation-model'
472
+ wandb_config = {
473
+ "model_name": model_name+'_HCP_FT',
474
+ "batch_size": batch_size,
475
+ "learning_rate": learning_rate,
476
+ "weight_decay": weight_decay,
477
+ "num_epochs": num_epochs,
478
+ "seed": seed,
479
+ }
480
+ print("wandb_config:\n", wandb_config)
481
+ random_id = str(uuid.uuid4())
482
+ print("wandb_id:", "HCPflat_raw" + f"_{random_id}")
483
+ wandb.init(
484
+ id=model_name+'_HCP_FT' + f"_{random_id}",
485
+ project=wandb_project,
486
+ name=model_name+'_HCP_FT',
487
+ config=wandb_config,
488
+ resume="allow",
489
+ )
490
+
491
+
492
+ # In[13]:
493
+
494
+
495
+ for epoch in range(num_epochs):
496
+ running_train_loss = 0.0
497
+ correct_train = 0
498
+ total_train = 0
499
+ step = 0
500
+
501
+ # with torch.amp.autocast(device_type='cuda'):
502
+ # Training Phase
503
+ model.train()
504
+ for batch in tqdm(train_dl, desc=f"Epoch {epoch+1}/{num_epochs} - Training"):
505
+ optimizer.zero_grad()
506
+ images = batch[0].to(device).float().unsqueeze(1) #fix this # Shape: [batch_size, 1, 16, 144, 320]
507
+ labels = batch[1]['trial_type'] # List of labels
508
+
509
+ encoded_labels = label_encoder.transform(labels)
510
+ encoded_labels = torch.tensor(encoded_labels, dtype=torch.long).to(device) # Shape: [batch_size]
511
+
512
+ # Forward pass
513
+ outputs = model(images, gsr=gsr) # Shape: [num_train_samples, num_classes]
514
+
515
+ # Compute loss
516
+ loss = criterion(outputs, encoded_labels)
517
+
518
+ # Backward pass and optimization
519
+ loss.backward()
520
+ optimizer.step()
521
+
522
+ # Accumulate loss
523
+ running_train_loss += loss.item() * images.size(0)
524
+
525
+
526
+ # Calculate accuracy
527
+ _, predicted = torch.max(outputs, 1)
528
+
529
+ correct_train += (predicted == encoded_labels).sum().item()
530
+ total_train += encoded_labels.size(0)
531
+
532
+ step = step + 1
533
+ if step % 100 == 0:
534
+ print(f"Step [{step}/{len(train_dl)}] - Training Loss: {loss.item():.4f} - Training Accuracy: {100 * correct_train / total_train:.2f}%")
535
+ # thth
536
+
537
+ epoch_train_loss = running_train_loss / total_train if total_train > 0 else 0.0
538
+ train_accuracy = 100 * correct_train / total_train if total_train > 0 else 0.0
539
+
540
+ # Validation Phase
541
+ model.eval()
542
+ running_val_loss = 0.0
543
+ correct_val = 0
544
+ total_val = 0
545
+
546
+ with torch.no_grad():
547
+ for batch in tqdm(test_dl, desc=f"Epoch {epoch+1}/{num_epochs} - Validation"):
548
+
549
+ images = batch[0].to(device).float().unsqueeze(1) #fix this
550
+ labels = batch[1]['trial_type']
551
+
552
+ # Encode labels to integer indices
553
+ encoded_labels = label_encoder.transform(labels)
554
+ encoded_labels = torch.tensor(encoded_labels, dtype=torch.long).to(device)
555
+
556
+
557
+ # Forward pass
558
+ outputs = model(images, gsr=gsr)
559
+
560
+ # Compute loss
561
+ loss = criterion(outputs, encoded_labels)
562
+
563
+ # Accumulate loss
564
+ running_val_loss += loss.item() * images.size(0)
565
+
566
+ # Calculate accuracy
567
+ _, predicted = torch.max(outputs, 1)
568
+ correct_val += (predicted == encoded_labels).sum().item()
569
+ total_val += encoded_labels.size(0)
570
+
571
+
572
+
573
+ epoch_val_loss = running_val_loss / total_val if total_val > 0 else 0.0
574
+ val_accuracy = 100 * correct_val / total_val if total_val > 0 else 0.0
575
+
576
+ print(f"Epoch [{epoch+1}/{num_epochs}] "
577
+ f"- Training Loss: {epoch_train_loss:.4f}, Training Accuracy: {train_accuracy:.2f}% "
578
+ f"- Validation Loss: {epoch_val_loss:.4f}, Validation Accuracy: {val_accuracy:.2f}%")
579
+
580
+ if wandb_log:
581
+ wandb.log({
582
+ "epoch_train_loss": epoch_train_loss,
583
+ "epoch_val_loss": epoch_val_loss,
584
+ "train_accuracy": train_accuracy,
585
+ "val_accuracy": val_accuracy,
586
+ })
587
+ if save_ckpt:
588
+ outdir = os.path.abspath(f'checkpoints/{model_name+"HCP_FT"}')
589
+ os.makedirs(outdir, exist_ok=True)
590
+ print("outdir", outdir)
591
+ # Save model and config
592
+ torch.save(model.state_dict(), f"{outdir}/model.pth")
593
+ with open(f"{outdir}/config.yaml", 'w') as f:
594
+ yaml.dump(wandb_config, f)
595
+ print(f"Saved model and config to {outdir}")
596
+
597
+
fMRI-foundation-model/src/wandb/run-20241024_030627-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3/files/output.log ADDED
@@ -0,0 +1,1060 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Epoch 1/20 - Training: 23%|██▎ | 3199/13913 [18:26<1:01:39, 2.90it/s]
2
+ Step [100/13913] - Training Loss: 1.9649 - Training Accuracy: 59.38%
3
+ Step [200/13913] - Training Loss: 1.0904 - Training Accuracy: 71.19%
4
+ Step [300/13913] - Training Loss: 0.0775 - Training Accuracy: 75.50%
5
+ Step [400/13913] - Training Loss: 0.6052 - Training Accuracy: 78.84%
6
+ Step [500/13913] - Training Loss: 0.0226 - Training Accuracy: 80.95%
7
+ Step [600/13913] - Training Loss: 0.2728 - Training Accuracy: 82.54%
8
+ Step [700/13913] - Training Loss: 0.1662 - Training Accuracy: 83.70%
9
+ Step [800/13913] - Training Loss: 0.0385 - Training Accuracy: 84.89%
10
+ Step [900/13913] - Training Loss: 0.2377 - Training Accuracy: 85.61%
11
+ Step [1000/13913] - Training Loss: 0.8172 - Training Accuracy: 85.83%
12
+ Step [1100/13913] - Training Loss: 0.2276 - Training Accuracy: 86.68%
13
+ Step [1200/13913] - Training Loss: 0.0118 - Training Accuracy: 87.36%
14
+ Step [1300/13913] - Training Loss: 1.0419 - Training Accuracy: 87.68%
15
+ Step [1400/13913] - Training Loss: 0.8943 - Training Accuracy: 87.96%
16
+ Step [1500/13913] - Training Loss: 0.2801 - Training Accuracy: 88.23%
17
+ Step [1600/13913] - Training Loss: 0.6734 - Training Accuracy: 88.58%
18
+ Step [1700/13913] - Training Loss: 0.6202 - Training Accuracy: 88.88%
19
+ Step [1800/13913] - Training Loss: 0.0159 - Training Accuracy: 89.12%
20
+ Step [1900/13913] - Training Loss: 0.0682 - Training Accuracy: 89.37%
21
+ Step [2000/13913] - Training Loss: 0.3378 - Training Accuracy: 89.52%
22
+ Step [2100/13913] - Training Loss: 0.0509 - Training Accuracy: 89.77%
23
+ Step [2200/13913] - Training Loss: 0.1161 - Training Accuracy: 89.99%
24
+ Step [2300/13913] - Training Loss: 0.0025 - Training Accuracy: 90.12%
25
+ Step [2400/13913] - Training Loss: 0.5385 - Training Accuracy: 90.25%
26
+ Step [2500/13913] - Training Loss: 0.0003 - Training Accuracy: 90.47%
27
+ Step [2600/13913] - Training Loss: 0.0962 - Training Accuracy: 90.52%
28
+ Step [2700/13913] - Training Loss: 0.0480 - Training Accuracy: 90.62%
29
+ Step [2800/13913] - Training Loss: 0.0004 - Training Accuracy: 90.71%
30
+ Step [2900/13913] - Training Loss: 0.3049 - Training Accuracy: 90.84%
31
+ Step [3000/13913] - Training Loss: 0.0339 - Training Accuracy: 90.95%
32
+ Step [3100/13913] - Training Loss: 0.5572 - Training Accuracy: 91.02%
33
+ Step [3200/13913] - Training Loss: 0.0673 - Training Accuracy: 91.11%
34
+ Step [3300/13913] - Training Loss: 0.0018 - Training Accuracy: 91.21%
35
+ Step [3400/13913] - Training Loss: 0.0048 - Training Accuracy: 91.28%
36
+ Step [3500/13913] - Training Loss: 1.2120 - Training Accuracy: 91.33%
37
+ Step [3600/13913] - Training Loss: 0.0542 - Training Accuracy: 91.37%
38
+ Step [3700/13913] - Training Loss: 0.0016 - Training Accuracy: 91.43%
39
+ Step [3800/13913] - Training Loss: 0.0582 - Training Accuracy: 91.52%
40
+ Step [3900/13913] - Training Loss: 0.0960 - Training Accuracy: 91.60%
41
+ Step [4000/13913] - Training Loss: 0.0020 - Training Accuracy: 91.68%
42
+ Step [4100/13913] - Training Loss: 0.0043 - Training Accuracy: 91.76%
43
+ Step [4200/13913] - Training Loss: 0.0029 - Training Accuracy: 91.77%
44
+ Step [4300/13913] - Training Loss: 0.0107 - Training Accuracy: 91.83%
45
+ Step [4400/13913] - Training Loss: 0.1122 - Training Accuracy: 91.86%
46
+ Step [4500/13913] - Training Loss: 0.1595 - Training Accuracy: 91.92%
47
+ Step [4600/13913] - Training Loss: 0.0453 - Training Accuracy: 91.97%
48
+ Step [4700/13913] - Training Loss: 0.2770 - Training Accuracy: 92.05%
49
+ Step [4800/13913] - Training Loss: 0.0057 - Training Accuracy: 92.09%
50
+ Step [4900/13913] - Training Loss: 0.0120 - Training Accuracy: 92.16%
51
+ Step [5000/13913] - Training Loss: 0.0235 - Training Accuracy: 92.24%
52
+ Step [5100/13913] - Training Loss: 0.3907 - Training Accuracy: 92.32%
53
+ Step [5200/13913] - Training Loss: 0.4558 - Training Accuracy: 92.34%
54
+ Step [5300/13913] - Training Loss: 0.0051 - Training Accuracy: 92.40%
55
+ Step [5400/13913] - Training Loss: 0.0017 - Training Accuracy: 92.46%
56
+ Step [5500/13913] - Training Loss: 1.3554 - Training Accuracy: 92.50%
57
+ Step [5600/13913] - Training Loss: 0.0617 - Training Accuracy: 92.55%
58
+ Step [5700/13913] - Training Loss: 0.2618 - Training Accuracy: 92.60%
59
+ Step [5800/13913] - Training Loss: 0.0192 - Training Accuracy: 92.60%
60
+ Step [5900/13913] - Training Loss: 0.3865 - Training Accuracy: 92.67%
61
+ Step [6000/13913] - Training Loss: 0.0139 - Training Accuracy: 92.70%
62
+ Step [6100/13913] - Training Loss: 0.1493 - Training Accuracy: 92.72%
63
+ Step [6200/13913] - Training Loss: 0.3629 - Training Accuracy: 92.77%
64
+ Step [6300/13913] - Training Loss: 0.4069 - Training Accuracy: 92.81%
65
+ Step [6400/13913] - Training Loss: 0.4954 - Training Accuracy: 92.85%
66
+ Step [6500/13913] - Training Loss: 0.0061 - Training Accuracy: 92.88%
67
+ Step [6600/13913] - Training Loss: 0.0373 - Training Accuracy: 92.91%
68
+ Step [6700/13913] - Training Loss: 0.0690 - Training Accuracy: 92.93%
69
+ Step [6800/13913] - Training Loss: 0.0158 - Training Accuracy: 92.97%
70
+ Step [6900/13913] - Training Loss: 0.3957 - Training Accuracy: 92.99%
71
+ Step [7000/13913] - Training Loss: 0.0615 - Training Accuracy: 93.03%
72
+ Step [7100/13913] - Training Loss: 0.0017 - Training Accuracy: 93.06%
73
+ Step [7200/13913] - Training Loss: 0.1726 - Training Accuracy: 93.07%
74
+ Step [7300/13913] - Training Loss: 0.0145 - Training Accuracy: 93.11%
75
+ Step [7400/13913] - Training Loss: 0.1883 - Training Accuracy: 93.15%
76
+ Step [7500/13913] - Training Loss: 0.0286 - Training Accuracy: 93.17%
77
+ Step [7600/13913] - Training Loss: 0.0591 - Training Accuracy: 93.21%
78
+ Step [7700/13913] - Training Loss: 0.4116 - Training Accuracy: 93.22%
79
+ Step [7800/13913] - Training Loss: 0.0143 - Training Accuracy: 93.25%
80
+ Step [7900/13913] - Training Loss: 0.0108 - Training Accuracy: 93.28%
81
+ Step [8000/13913] - Training Loss: 0.0013 - Training Accuracy: 93.30%
82
+ Step [8100/13913] - Training Loss: 0.1299 - Training Accuracy: 93.31%
83
+ Step [8200/13913] - Training Loss: 0.0535 - Training Accuracy: 93.36%
84
+ Step [8300/13913] - Training Loss: 0.1179 - Training Accuracy: 93.37%
85
+ Step [8400/13913] - Training Loss: 0.0817 - Training Accuracy: 93.38%
86
+ Step [8500/13913] - Training Loss: 0.0000 - Training Accuracy: 93.41%
87
+ Step [8600/13913] - Training Loss: 0.1190 - Training Accuracy: 93.45%
88
+ Step [8700/13913] - Training Loss: 0.4036 - Training Accuracy: 93.46%
89
+ Step [8800/13913] - Training Loss: 0.1972 - Training Accuracy: 93.49%
90
+ Step [8900/13913] - Training Loss: 0.0570 - Training Accuracy: 93.51%
91
+ Step [9000/13913] - Training Loss: 0.0005 - Training Accuracy: 93.55%
92
+ Step [9100/13913] - Training Loss: 0.0023 - Training Accuracy: 93.58%
93
+ Step [9200/13913] - Training Loss: 0.0509 - Training Accuracy: 93.60%
94
+ Step [9300/13913] - Training Loss: 0.5032 - Training Accuracy: 93.63%
95
+ Step [9400/13913] - Training Loss: 0.0022 - Training Accuracy: 93.66%
96
+ Step [9500/13913] - Training Loss: 0.1065 - Training Accuracy: 93.68%
97
+ Step [9600/13913] - Training Loss: 0.0017 - Training Accuracy: 93.69%
98
+ Step [9700/13913] - Training Loss: 0.0000 - Training Accuracy: 93.72%
99
+ Step [9800/13913] - Training Loss: 0.1971 - Training Accuracy: 93.72%
100
+ Step [9900/13913] - Training Loss: 0.0001 - Training Accuracy: 93.74%
101
+ Step [10000/13913] - Training Loss: 0.4162 - Training Accuracy: 93.74%
102
+ Step [10100/13913] - Training Loss: 0.0123 - Training Accuracy: 93.77%
103
+ Step [10200/13913] - Training Loss: 0.0439 - Training Accuracy: 93.80%
104
+ Step [10300/13913] - Training Loss: 0.2364 - Training Accuracy: 93.82%
105
+ Step [10400/13913] - Training Loss: 0.0197 - Training Accuracy: 93.84%
106
+ Step [10500/13913] - Training Loss: 0.3435 - Training Accuracy: 93.86%
107
+ Step [10600/13913] - Training Loss: 0.0243 - Training Accuracy: 93.87%
108
+ Step [10700/13913] - Training Loss: 0.0080 - Training Accuracy: 93.88%
109
+ Step [10800/13913] - Training Loss: 0.0018 - Training Accuracy: 93.92%
110
+ Step [10900/13913] - Training Loss: 0.1508 - Training Accuracy: 93.92%
111
+ Step [11000/13913] - Training Loss: 0.0002 - Training Accuracy: 93.94%
112
+ Step [11100/13913] - Training Loss: 0.5014 - Training Accuracy: 93.96%
113
+ Step [11200/13913] - Training Loss: 0.3636 - Training Accuracy: 93.98%
114
+ Step [11300/13913] - Training Loss: 0.1294 - Training Accuracy: 94.00%
115
+ Step [11400/13913] - Training Loss: 0.8976 - Training Accuracy: 94.01%
116
+ Step [11500/13913] - Training Loss: 0.0029 - Training Accuracy: 94.03%
117
+ Step [11600/13913] - Training Loss: 0.0006 - Training Accuracy: 94.05%
118
+ Step [11700/13913] - Training Loss: 0.1646 - Training Accuracy: 94.08%
119
+ Step [11800/13913] - Training Loss: 0.5143 - Training Accuracy: 94.08%
120
+ Step [11900/13913] - Training Loss: 0.1646 - Training Accuracy: 94.10%
121
+ Step [12000/13913] - Training Loss: 0.0189 - Training Accuracy: 94.13%
122
+ Step [12100/13913] - Training Loss: 0.0067 - Training Accuracy: 94.14%
123
+ Step [12200/13913] - Training Loss: 0.2044 - Training Accuracy: 94.15%
124
+ Step [12300/13913] - Training Loss: 0.0247 - Training Accuracy: 94.15%
125
+ Step [12400/13913] - Training Loss: 0.5848 - Training Accuracy: 94.17%
126
+ Step [12500/13913] - Training Loss: 0.0024 - Training Accuracy: 94.20%
127
+ Step [12600/13913] - Training Loss: 0.0015 - Training Accuracy: 94.21%
128
+ Step [12700/13913] - Training Loss: 0.6383 - Training Accuracy: 94.23%
129
+ Step [12800/13913] - Training Loss: 0.3236 - Training Accuracy: 94.24%
130
+ Step [12900/13913] - Training Loss: 0.4483 - Training Accuracy: 94.25%
131
+ Step [13000/13913] - Training Loss: 0.0402 - Training Accuracy: 94.25%
132
+ Step [13100/13913] - Training Loss: 0.0103 - Training Accuracy: 94.26%
133
+ Step [13200/13913] - Training Loss: 0.0004 - Training Accuracy: 94.27%
134
+ Step [13300/13913] - Training Loss: 0.0488 - Training Accuracy: 94.28%
135
+ Step [13400/13913] - Training Loss: 0.0009 - Training Accuracy: 94.30%
136
+ Step [13500/13913] - Training Loss: 0.0705 - Training Accuracy: 94.32%
137
+ Step [13600/13913] - Training Loss: 0.0214 - Training Accuracy: 94.33%
138
+ Step [13700/13913] - Training Loss: 0.0036 - Training Accuracy: 94.33%
139
+ Step [13800/13913] - Training Loss: 0.0102 - Training Accuracy: 94.34%
140
+ Step [13900/13913] - Training Loss: 0.0112 - Training Accuracy: 94.36%
141
+ Epoch 1/20 - Validation: 100%|██████████| 1511/1511 [07:11<00:00, 3.50it/s]
142
+ Epoch [1/20] - Training Loss: 0.1951, Training Accuracy: 94.36% - Validation Loss: 0.1229, Validation Accuracy: 96.41%
143
+ outdir /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/checkpoints/HCPflat_large_gsrFalse_HCP_FT
144
+ Saved model and config to /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/checkpoints/HCPflat_large_gsrFalse_HCP_FT
145
+ Epoch 2/20 - Training: 23%|██▎ | 3199/13913 [18:26<1:01:36, 2.90it/s]
146
+ Step [100/13913] - Training Loss: 0.0484 - Training Accuracy: 97.75%
147
+ Step [200/13913] - Training Loss: 0.0003 - Training Accuracy: 97.75%
148
+ Step [300/13913] - Training Loss: 0.2112 - Training Accuracy: 97.42%
149
+ Step [400/13913] - Training Loss: 0.0092 - Training Accuracy: 97.34%
150
+ Step [500/13913] - Training Loss: 0.1243 - Training Accuracy: 97.12%
151
+ Step [600/13913] - Training Loss: 0.1019 - Training Accuracy: 97.04%
152
+ Step [700/13913] - Training Loss: 0.0338 - Training Accuracy: 96.93%
153
+ Step [800/13913] - Training Loss: 0.0055 - Training Accuracy: 96.84%
154
+ Step [900/13913] - Training Loss: 0.1397 - Training Accuracy: 96.86%
155
+ Step [1000/13913] - Training Loss: 0.0033 - Training Accuracy: 96.91%
156
+ Step [1100/13913] - Training Loss: 0.0972 - Training Accuracy: 97.03%
157
+ Step [1200/13913] - Training Loss: 0.7068 - Training Accuracy: 96.97%
158
+ Step [1300/13913] - Training Loss: 0.0074 - Training Accuracy: 96.88%
159
+ Step [1400/13913] - Training Loss: 0.5457 - Training Accuracy: 96.78%
160
+ Step [1500/13913] - Training Loss: 0.3180 - Training Accuracy: 96.77%
161
+ Step [1600/13913] - Training Loss: 0.1113 - Training Accuracy: 96.75%
162
+ Step [1700/13913] - Training Loss: 0.6199 - Training Accuracy: 96.72%
163
+ Step [1800/13913] - Training Loss: 0.0160 - Training Accuracy: 96.69%
164
+ Step [1900/13913] - Training Loss: 0.1970 - Training Accuracy: 96.70%
165
+ Step [2000/13913] - Training Loss: 0.0209 - Training Accuracy: 96.65%
166
+ Step [2100/13913] - Training Loss: 0.1269 - Training Accuracy: 96.68%
167
+ Step [2200/13913] - Training Loss: 0.0020 - Training Accuracy: 96.66%
168
+ Step [2300/13913] - Training Loss: 0.4577 - Training Accuracy: 96.65%
169
+ Step [2400/13913] - Training Loss: 0.2302 - Training Accuracy: 96.62%
170
+ Step [2500/13913] - Training Loss: 0.0027 - Training Accuracy: 96.66%
171
+ Step [2600/13913] - Training Loss: 0.0037 - Training Accuracy: 96.66%
172
+ Step [2700/13913] - Training Loss: 0.0286 - Training Accuracy: 96.71%
173
+ Step [2800/13913] - Training Loss: 0.0005 - Training Accuracy: 96.66%
174
+ Step [2900/13913] - Training Loss: 0.0002 - Training Accuracy: 96.69%
175
+ Step [3000/13913] - Training Loss: 0.0001 - Training Accuracy: 96.69%
176
+ Step [3100/13913] - Training Loss: 0.3146 - Training Accuracy: 96.71%
177
+ Step [3200/13913] - Training Loss: 0.0629 - Training Accuracy: 96.69%
178
+ Step [3300/13913] - Training Loss: 0.0039 - Training Accuracy: 96.68%
179
+ Step [3400/13913] - Training Loss: 0.0513 - Training Accuracy: 96.71%
180
+ Step [3500/13913] - Training Loss: 0.0000 - Training Accuracy: 96.75%
181
+ Step [3600/13913] - Training Loss: 0.0009 - Training Accuracy: 96.78%
182
+ Step [3700/13913] - Training Loss: 0.1298 - Training Accuracy: 96.76%
183
+ Step [3800/13913] - Training Loss: 0.0020 - Training Accuracy: 96.74%
184
+ Step [3900/13913] - Training Loss: 0.0000 - Training Accuracy: 96.73%
185
+ Step [4000/13913] - Training Loss: 0.0140 - Training Accuracy: 96.75%
186
+ Step [4100/13913] - Training Loss: 0.0010 - Training Accuracy: 96.76%
187
+ Step [4200/13913] - Training Loss: 0.0001 - Training Accuracy: 96.76%
188
+ Step [4300/13913] - Training Loss: 0.0937 - Training Accuracy: 96.75%
189
+ Step [4400/13913] - Training Loss: 0.0004 - Training Accuracy: 96.75%
190
+ Step [4500/13913] - Training Loss: 0.1811 - Training Accuracy: 96.76%
191
+ Step [4600/13913] - Training Loss: 0.0001 - Training Accuracy: 96.77%
192
+ Step [4700/13913] - Training Loss: 0.0106 - Training Accuracy: 96.77%
193
+ Step [4800/13913] - Training Loss: 0.0616 - Training Accuracy: 96.77%
194
+ Step [4900/13913] - Training Loss: 0.1473 - Training Accuracy: 96.77%
195
+ Step [5000/13913] - Training Loss: 0.1555 - Training Accuracy: 96.77%
196
+ Step [5100/13913] - Training Loss: 0.0002 - Training Accuracy: 96.76%
197
+ Step [5200/13913] - Training Loss: 0.0180 - Training Accuracy: 96.74%
198
+ Step [5300/13913] - Training Loss: 0.0967 - Training Accuracy: 96.74%
199
+ Step [5400/13913] - Training Loss: 0.0007 - Training Accuracy: 96.72%
200
+ Step [5500/13913] - Training Loss: 0.1448 - Training Accuracy: 96.72%
201
+ Step [5600/13913] - Training Loss: 0.0044 - Training Accuracy: 96.71%
202
+ Step [5700/13913] - Training Loss: 0.0082 - Training Accuracy: 96.72%
203
+ Step [5800/13913] - Training Loss: 0.0021 - Training Accuracy: 96.74%
204
+ Step [5900/13913] - Training Loss: 0.0244 - Training Accuracy: 96.75%
205
+ Step [6000/13913] - Training Loss: 0.0058 - Training Accuracy: 96.73%
206
+ Step [6100/13913] - Training Loss: 0.0000 - Training Accuracy: 96.73%
207
+ Step [6200/13913] - Training Loss: 0.5583 - Training Accuracy: 96.72%
208
+ Step [6300/13913] - Training Loss: 0.5765 - Training Accuracy: 96.72%
209
+ Step [6400/13913] - Training Loss: 0.0001 - Training Accuracy: 96.72%
210
+ Step [6500/13913] - Training Loss: 0.1794 - Training Accuracy: 96.72%
211
+ Step [6600/13913] - Training Loss: 0.0678 - Training Accuracy: 96.73%
212
+ Step [6700/13913] - Training Loss: 0.1093 - Training Accuracy: 96.74%
213
+ Step [6800/13913] - Training Loss: 0.0016 - Training Accuracy: 96.74%
214
+ Step [6900/13913] - Training Loss: 0.0117 - Training Accuracy: 96.76%
215
+ Step [7000/13913] - Training Loss: 0.0001 - Training Accuracy: 96.77%
216
+ Step [7100/13913] - Training Loss: 0.0016 - Training Accuracy: 96.77%
217
+ Step [7200/13913] - Training Loss: 0.0494 - Training Accuracy: 96.77%
218
+ Step [7300/13913] - Training Loss: 0.0904 - Training Accuracy: 96.77%
219
+ Step [7400/13913] - Training Loss: 0.3266 - Training Accuracy: 96.77%
220
+ Step [7500/13913] - Training Loss: 0.0205 - Training Accuracy: 96.79%
221
+ Step [7600/13913] - Training Loss: 0.0002 - Training Accuracy: 96.78%
222
+ Step [7700/13913] - Training Loss: 0.0069 - Training Accuracy: 96.77%
223
+ Step [7800/13913] - Training Loss: 1.1386 - Training Accuracy: 96.78%
224
+ Step [7900/13913] - Training Loss: 0.4019 - Training Accuracy: 96.78%
225
+ Step [8000/13913] - Training Loss: 0.0031 - Training Accuracy: 96.79%
226
+ Step [8100/13913] - Training Loss: 0.0004 - Training Accuracy: 96.80%
227
+ Step [8200/13913] - Training Loss: 0.0503 - Training Accuracy: 96.79%
228
+ Step [8300/13913] - Training Loss: 0.1181 - Training Accuracy: 96.80%
229
+ Step [8400/13913] - Training Loss: 0.0002 - Training Accuracy: 96.80%
230
+ Step [8500/13913] - Training Loss: 0.2571 - Training Accuracy: 96.78%
231
+ Step [8600/13913] - Training Loss: 0.0954 - Training Accuracy: 96.78%
232
+ Step [8700/13913] - Training Loss: 0.0251 - Training Accuracy: 96.78%
233
+ Step [8800/13913] - Training Loss: 0.3624 - Training Accuracy: 96.78%
234
+ Step [8900/13913] - Training Loss: 0.4100 - Training Accuracy: 96.78%
235
+ Step [9000/13913] - Training Loss: 0.0001 - Training Accuracy: 96.79%
236
+ Step [9100/13913] - Training Loss: 0.0633 - Training Accuracy: 96.79%
237
+ Step [9200/13913] - Training Loss: 0.0163 - Training Accuracy: 96.77%
238
+ Step [9300/13913] - Training Loss: 0.0001 - Training Accuracy: 96.78%
239
+ Step [9400/13913] - Training Loss: 0.0169 - Training Accuracy: 96.78%
240
+ Step [9500/13913] - Training Loss: 0.8337 - Training Accuracy: 96.79%
241
+ Step [9600/13913] - Training Loss: 0.0002 - Training Accuracy: 96.80%
242
+ Step [9700/13913] - Training Loss: 0.1016 - Training Accuracy: 96.80%
243
+ Step [9800/13913] - Training Loss: 0.0004 - Training Accuracy: 96.80%
244
+ Step [9900/13913] - Training Loss: 0.0095 - Training Accuracy: 96.81%
245
+ Step [10000/13913] - Training Loss: 0.3495 - Training Accuracy: 96.81%
246
+ Step [10100/13913] - Training Loss: 0.0330 - Training Accuracy: 96.83%
247
+ Step [10200/13913] - Training Loss: 0.0007 - Training Accuracy: 96.82%
248
+ Step [10300/13913] - Training Loss: 0.0157 - Training Accuracy: 96.83%
249
+ Step [10400/13913] - Training Loss: 0.0001 - Training Accuracy: 96.83%
250
+ Step [10500/13913] - Training Loss: 0.1632 - Training Accuracy: 96.83%
251
+ Step [10600/13913] - Training Loss: 0.0276 - Training Accuracy: 96.84%
252
+ Step [10700/13913] - Training Loss: 0.0029 - Training Accuracy: 96.84%
253
+ Step [10800/13913] - Training Loss: 0.0002 - Training Accuracy: 96.84%
254
+ Step [10900/13913] - Training Loss: 0.0105 - Training Accuracy: 96.85%
255
+ Step [11000/13913] - Training Loss: 0.0011 - Training Accuracy: 96.84%
256
+ Step [11100/13913] - Training Loss: 0.0182 - Training Accuracy: 96.83%
257
+ Step [11200/13913] - Training Loss: 0.0033 - Training Accuracy: 96.84%
258
+ Step [11300/13913] - Training Loss: 0.0940 - Training Accuracy: 96.85%
259
+ Step [11400/13913] - Training Loss: 0.0003 - Training Accuracy: 96.86%
260
+ Step [11500/13913] - Training Loss: 0.0107 - Training Accuracy: 96.85%
261
+ Step [11600/13913] - Training Loss: 0.0001 - Training Accuracy: 96.84%
262
+ Step [11700/13913] - Training Loss: 0.2070 - Training Accuracy: 96.83%
263
+ Step [11800/13913] - Training Loss: 0.0002 - Training Accuracy: 96.84%
264
+ Step [11900/13913] - Training Loss: 0.0758 - Training Accuracy: 96.84%
265
+ Step [12000/13913] - Training Loss: 0.0014 - Training Accuracy: 96.84%
266
+ Step [12100/13913] - Training Loss: 0.0001 - Training Accuracy: 96.85%
267
+ Step [12200/13913] - Training Loss: 0.2332 - Training Accuracy: 96.85%
268
+ Step [12300/13913] - Training Loss: 0.0002 - Training Accuracy: 96.85%
269
+ Step [12400/13913] - Training Loss: 0.1755 - Training Accuracy: 96.86%
270
+ Step [12500/13913] - Training Loss: 0.0284 - Training Accuracy: 96.86%
271
+ Step [12600/13913] - Training Loss: 0.0001 - Training Accuracy: 96.87%
272
+ Step [12700/13913] - Training Loss: 0.0044 - Training Accuracy: 96.86%
273
+ Step [12800/13913] - Training Loss: 0.0067 - Training Accuracy: 96.86%
274
+ Step [12900/13913] - Training Loss: 0.0178 - Training Accuracy: 96.85%
275
+ Step [13000/13913] - Training Loss: 0.0011 - Training Accuracy: 96.85%
276
+ Step [13100/13913] - Training Loss: 0.0576 - Training Accuracy: 96.85%
277
+ Step [13200/13913] - Training Loss: 0.1048 - Training Accuracy: 96.86%
278
+ Step [13300/13913] - Training Loss: 0.1238 - Training Accuracy: 96.86%
279
+ Step [13400/13913] - Training Loss: 0.0002 - Training Accuracy: 96.87%
280
+ Step [13500/13913] - Training Loss: 0.1676 - Training Accuracy: 96.87%
281
+ Step [13600/13913] - Training Loss: 0.0334 - Training Accuracy: 96.86%
282
+ Step [13700/13913] - Training Loss: 0.0000 - Training Accuracy: 96.87%
283
+ Step [13800/13913] - Training Loss: 0.0055 - Training Accuracy: 96.88%
284
+ Step [13900/13913] - Training Loss: 0.0123 - Training Accuracy: 96.89%
285
+ Epoch 2/20 - Validation: 100%|███████��██| 1511/1511 [07:18<00:00, 3.45it/s]
286
+ Epoch [2/20] - Training Loss: 0.1043, Training Accuracy: 96.89% - Validation Loss: 0.1416, Validation Accuracy: 95.99%
287
+ outdir /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/checkpoints/HCPflat_large_gsrFalse_HCP_FT
288
+ Saved model and config to /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/checkpoints/HCPflat_large_gsrFalse_HCP_FT
289
+ Epoch 3/20 - Training: 23%|██▎ | 3199/13913 [18:24<1:01:31, 2.90it/s]
290
+ Step [100/13913] - Training Loss: 0.0050 - Training Accuracy: 97.88%
291
+ Step [200/13913] - Training Loss: 0.0157 - Training Accuracy: 97.94%
292
+ Step [300/13913] - Training Loss: 0.2378 - Training Accuracy: 97.79%
293
+ Step [400/13913] - Training Loss: 0.3344 - Training Accuracy: 97.97%
294
+ Step [500/13913] - Training Loss: 0.1765 - Training Accuracy: 97.72%
295
+ Step [600/13913] - Training Loss: 0.8273 - Training Accuracy: 97.81%
296
+ Step [700/13913] - Training Loss: 0.0089 - Training Accuracy: 97.62%
297
+ Step [800/13913] - Training Loss: 0.0530 - Training Accuracy: 97.67%
298
+ Step [900/13913] - Training Loss: 0.7640 - Training Accuracy: 97.54%
299
+ Step [1000/13913] - Training Loss: 0.0010 - Training Accuracy: 97.55%
300
+ Step [1100/13913] - Training Loss: 0.0181 - Training Accuracy: 97.51%
301
+ Step [1200/13913] - Training Loss: 0.0002 - Training Accuracy: 97.53%
302
+ Step [1300/13913] - Training Loss: 0.0009 - Training Accuracy: 97.45%
303
+ Step [1400/13913] - Training Loss: 0.1841 - Training Accuracy: 97.42%
304
+ Step [1500/13913] - Training Loss: 0.2240 - Training Accuracy: 97.43%
305
+ Step [1600/13913] - Training Loss: 0.0306 - Training Accuracy: 97.28%
306
+ Step [1700/13913] - Training Loss: 0.0008 - Training Accuracy: 97.32%
307
+ Step [1800/13913] - Training Loss: 0.2279 - Training Accuracy: 97.25%
308
+ Step [1900/13913] - Training Loss: 0.0002 - Training Accuracy: 97.24%
309
+ Step [2000/13913] - Training Loss: 0.0280 - Training Accuracy: 97.28%
310
+ Step [2100/13913] - Training Loss: 0.0047 - Training Accuracy: 97.32%
311
+ Step [2200/13913] - Training Loss: 0.0014 - Training Accuracy: 97.39%
312
+ Step [2300/13913] - Training Loss: 0.0353 - Training Accuracy: 97.38%
313
+ Step [2400/13913] - Training Loss: 0.0251 - Training Accuracy: 97.35%
314
+ Step [2500/13913] - Training Loss: 0.0002 - Training Accuracy: 97.39%
315
+ Step [2600/13913] - Training Loss: 0.0111 - Training Accuracy: 97.38%
316
+ Step [2700/13913] - Training Loss: 0.0413 - Training Accuracy: 97.38%
317
+ Step [2800/13913] - Training Loss: 0.0022 - Training Accuracy: 97.35%
318
+ Step [2900/13913] - Training Loss: 0.0000 - Training Accuracy: 97.31%
319
+ Step [3000/13913] - Training Loss: 0.0000 - Training Accuracy: 97.29%
320
+ Step [3100/13913] - Training Loss: 0.0516 - Training Accuracy: 97.26%
321
+ Step [3200/13913] - Training Loss: 0.0299 - Training Accuracy: 97.27%
322
+ Step [3300/13913] - Training Loss: 0.2979 - Training Accuracy: 97.24%
323
+ Step [3400/13913] - Training Loss: 0.0012 - Training Accuracy: 97.25%
324
+ Step [3500/13913] - Training Loss: 0.0004 - Training Accuracy: 97.25%
325
+ Step [3600/13913] - Training Loss: 0.0018 - Training Accuracy: 97.24%
326
+ Step [3700/13913] - Training Loss: 0.0456 - Training Accuracy: 97.25%
327
+ Step [3800/13913] - Training Loss: 0.3416 - Training Accuracy: 97.27%
328
+ Step [3900/13913] - Training Loss: 0.0040 - Training Accuracy: 97.28%
329
+ Step [4000/13913] - Training Loss: 0.1521 - Training Accuracy: 97.28%
330
+ Step [4100/13913] - Training Loss: 0.1356 - Training Accuracy: 97.30%
331
+ Step [4200/13913] - Training Loss: 0.0004 - Training Accuracy: 97.32%
332
+ Step [4300/13913] - Training Loss: 0.2604 - Training Accuracy: 97.31%
333
+ Step [4400/13913] - Training Loss: 0.0000 - Training Accuracy: 97.34%
334
+ Step [4500/13913] - Training Loss: 0.0022 - Training Accuracy: 97.38%
335
+ Step [4600/13913] - Training Loss: 0.3491 - Training Accuracy: 97.39%
336
+ Step [4700/13913] - Training Loss: 0.3658 - Training Accuracy: 97.41%
337
+ Step [4800/13913] - Training Loss: 0.4170 - Training Accuracy: 97.42%
338
+ Step [4900/13913] - Training Loss: 0.0000 - Training Accuracy: 97.42%
339
+ Step [5000/13913] - Training Loss: 0.0664 - Training Accuracy: 97.42%
340
+ Step [5100/13913] - Training Loss: 0.0000 - Training Accuracy: 97.43%
341
+ Step [5200/13913] - Training Loss: 0.0944 - Training Accuracy: 97.44%
342
+ Step [5300/13913] - Training Loss: 0.0337 - Training Accuracy: 97.43%
343
+ Step [5400/13913] - Training Loss: 0.0001 - Training Accuracy: 97.43%
344
+ Step [5500/13913] - Training Loss: 0.0001 - Training Accuracy: 97.45%
345
+ Step [5600/13913] - Training Loss: 0.0000 - Training Accuracy: 97.43%
346
+ Step [5700/13913] - Training Loss: 0.0000 - Training Accuracy: 97.41%
347
+ Step [5800/13913] - Training Loss: 0.0615 - Training Accuracy: 97.40%
348
+ Step [5900/13913] - Training Loss: 0.0139 - Training Accuracy: 97.39%
349
+ Step [6000/13913] - Training Loss: 0.0049 - Training Accuracy: 97.40%
350
+ Step [6100/13913] - Training Loss: 0.3983 - Training Accuracy: 97.39%
351
+ Step [6200/13913] - Training Loss: 0.0031 - Training Accuracy: 97.39%
352
+ Step [6300/13913] - Training Loss: 0.0569 - Training Accuracy: 97.39%
353
+ Step [6400/13913] - Training Loss: 0.0867 - Training Accuracy: 97.39%
354
+ Step [6500/13913] - Training Loss: 0.0031 - Training Accuracy: 97.40%
355
+ Step [6600/13913] - Training Loss: 0.1550 - Training Accuracy: 97.39%
356
+ Step [6700/13913] - Training Loss: 0.5434 - Training Accuracy: 97.37%
357
+ Step [6800/13913] - Training Loss: 0.0062 - Training Accuracy: 97.38%
358
+ Step [6900/13913] - Training Loss: 0.0001 - Training Accuracy: 97.38%
359
+ Step [7000/13913] - Training Loss: 0.0004 - Training Accuracy: 97.37%
360
+ Step [7100/13913] - Training Loss: 0.0256 - Training Accuracy: 97.39%
361
+ Step [7200/13913] - Training Loss: 0.0311 - Training Accuracy: 97.41%
362
+ Step [7300/13913] - Training Loss: 0.0294 - Training Accuracy: 97.43%
363
+ Step [7400/13913] - Training Loss: 0.0071 - Training Accuracy: 97.43%
364
+ Step [7500/13913] - Training Loss: 0.0007 - Training Accuracy: 97.42%
365
+ Step [7600/13913] - Training Loss: 0.0294 - Training Accuracy: 97.44%
366
+ Step [7700/13913] - Training Loss: 0.1505 - Training Accuracy: 97.44%
367
+ Step [7800/13913] - Training Loss: 0.0325 - Training Accuracy: 97.45%
368
+ Step [7900/13913] - Training Loss: 0.0010 - Training Accuracy: 97.46%
369
+ Step [8000/13913] - Training Loss: 0.0002 - Training Accuracy: 97.47%
370
+ Step [8100/13913] - Training Loss: 0.1733 - Training Accuracy: 97.48%
371
+ Step [8200/13913] - Training Loss: 0.0280 - Training Accuracy: 97.48%
372
+ Step [8300/13913] - Training Loss: 0.0002 - Training Accuracy: 97.49%
373
+ Step [8400/13913] - Training Loss: 0.0062 - Training Accuracy: 97.48%
374
+ Step [8500/13913] - Training Loss: 0.0026 - Training Accuracy: 97.47%
375
+ Step [8600/13913] - Training Loss: 0.0054 - Training Accuracy: 97.47%
376
+ Step [8700/13913] - Training Loss: 0.2353 - Training Accuracy: 97.48%
377
+ Step [8800/13913] - Training Loss: 0.1076 - Training Accuracy: 97.48%
378
+ Step [8900/13913] - Training Loss: 0.0002 - Training Accuracy: 97.48%
379
+ Step [9000/13913] - Training Loss: 0.0005 - Training Accuracy: 97.49%
380
+ Step [9100/13913] - Training Loss: 0.0022 - Training Accuracy: 97.50%
381
+ Step [9200/13913] - Training Loss: 0.5432 - Training Accuracy: 97.48%
382
+ Step [9300/13913] - Training Loss: 0.0003 - Training Accuracy: 97.48%
383
+ Step [9400/13913] - Training Loss: 0.0001 - Training Accuracy: 97.46%
384
+ Step [9500/13913] - Training Loss: 0.0036 - Training Accuracy: 97.45%
385
+ Step [9600/13913] - Training Loss: 0.0067 - Training Accuracy: 97.45%
386
+ Step [9700/13913] - Training Loss: 0.0003 - Training Accuracy: 97.47%
387
+ Step [9800/13913] - Training Loss: 0.0001 - Training Accuracy: 97.46%
388
+ Step [9900/13913] - Training Loss: 0.0006 - Training Accuracy: 97.47%
389
+ Step [10000/13913] - Training Loss: 0.0915 - Training Accuracy: 97.47%
390
+ Step [10100/13913] - Training Loss: 0.0174 - Training Accuracy: 97.47%
391
+ Step [10200/13913] - Training Loss: 0.0029 - Training Accuracy: 97.47%
392
+ Step [10300/13913] - Training Loss: 0.0004 - Training Accuracy: 97.46%
393
+ Step [10400/13913] - Training Loss: 0.1532 - Training Accuracy: 97.46%
394
+ Step [10500/13913] - Training Loss: 0.2826 - Training Accuracy: 97.46%
395
+ Step [10600/13913] - Training Loss: 0.0001 - Training Accuracy: 97.47%
396
+ Step [10700/13913] - Training Loss: 0.0045 - Training Accuracy: 97.47%
397
+ Step [10800/13913] - Training Loss: 0.0407 - Training Accuracy: 97.46%
398
+ Step [10900/13913] - Training Loss: 0.0291 - Training Accuracy: 97.45%
399
+ Step [11000/13913] - Training Loss: 0.0109 - Training Accuracy: 97.44%
400
+ Step [11100/13913] - Training Loss: 0.0000 - Training Accuracy: 97.45%
401
+ Step [11200/13913] - Training Loss: 0.0000 - Training Accuracy: 97.46%
402
+ Step [11300/13913] - Training Loss: 0.1742 - Training Accuracy: 97.46%
403
+ Step [11400/13913] - Training Loss: 0.0671 - Training Accuracy: 97.46%
404
+ Step [11500/13913] - Training Loss: 0.1209 - Training Accuracy: 97.44%
405
+ Step [11600/13913] - Training Loss: 0.0020 - Training Accuracy: 97.44%
406
+ Step [11700/13913] - Training Loss: 0.0090 - Training Accuracy: 97.44%
407
+ Step [11800/13913] - Training Loss: 0.0018 - Training Accuracy: 97.43%
408
+ Step [11900/13913] - Training Loss: 0.0005 - Training Accuracy: 97.44%
409
+ Step [12000/13913] - Training Loss: 0.0001 - Training Accuracy: 97.43%
410
+ Step [12100/13913] - Training Loss: 0.0001 - Training Accuracy: 97.44%
411
+ Step [12200/13913] - Training Loss: 0.0114 - Training Accuracy: 97.45%
412
+ Step [12300/13913] - Training Loss: 0.0533 - Training Accuracy: 97.45%
413
+ Step [12400/13913] - Training Loss: 0.0234 - Training Accuracy: 97.45%
414
+ Step [12500/13913] - Training Loss: 0.0052 - Training Accuracy: 97.45%
415
+ Step [12600/13913] - Training Loss: 0.2738 - Training Accuracy: 97.45%
416
+ Step [12700/13913] - Training Loss: 0.0006 - Training Accuracy: 97.45%
417
+ Step [12800/13913] - Training Loss: 0.3752 - Training Accuracy: 97.44%
418
+ Step [12900/13913] - Training Loss: 0.1956 - Training Accuracy: 97.44%
419
+ Step [13000/13913] - Training Loss: 0.0002 - Training Accuracy: 97.44%
420
+ Step [13100/13913] - Training Loss: 0.0002 - Training Accuracy: 97.44%
421
+ Step [13200/13913] - Training Loss: 0.0016 - Training Accuracy: 97.44%
422
+ Step [13300/13913] - Training Loss: 0.3657 - Training Accuracy: 97.44%
423
+ Step [13400/13913] - Training Loss: 0.0003 - Training Accuracy: 97.44%
424
+ Step [13500/13913] - Training Loss: 0.1332 - Training Accuracy: 97.44%
425
+ Step [13600/13913] - Training Loss: 0.0004 - Training Accuracy: 97.44%
426
+ Step [13700/13913] - Training Loss: 0.0250 - Training Accuracy: 97.43%
427
+ Step [13800/13913] - Training Loss: 0.0003 - Training Accuracy: 97.43%
428
+ Step [13900/13913] - Training Loss: 0.0007 - Training Accuracy: 97.43%
429
+ Epoch 3/20 - Validation: 100%|██████████| 1511/1511 [07:10<00:00, 3.51it/s]
430
+ Epoch [3/20] - Training Loss: 0.0839, Training Accuracy: 97.43% - Validation Loss: 0.0985, Validation Accuracy: 97.23%
431
+ outdir /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/checkpoints/HCPflat_large_gsrFalse_HCP_FT
432
+ Saved model and config to /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/checkpoints/HCPflat_large_gsrFalse_HCP_FT
433
+ Epoch 4/20 - Training: 23%|██▎ | 3199/13913 [18:31<1:02:08, 2.87it/s]
434
+ Step [100/13913] - Training Loss: 0.0000 - Training Accuracy: 98.62%
435
+ Step [200/13913] - Training Loss: 0.0057 - Training Accuracy: 98.69%
436
+ Step [300/13913] - Training Loss: 0.0032 - Training Accuracy: 98.42%
437
+ Step [400/13913] - Training Loss: 0.0007 - Training Accuracy: 98.28%
438
+ Step [500/13913] - Training Loss: 0.0670 - Training Accuracy: 98.08%
439
+ Step [600/13913] - Training Loss: 0.0004 - Training Accuracy: 98.15%
440
+ Step [700/13913] - Training Loss: 0.0809 - Training Accuracy: 98.16%
441
+ Step [800/13913] - Training Loss: 0.0019 - Training Accuracy: 98.08%
442
+ Step [900/13913] - Training Loss: 0.1343 - Training Accuracy: 97.97%
443
+ Step [1000/13913] - Training Loss: 0.0000 - Training Accuracy: 98.10%
444
+ Step [1100/13913] - Training Loss: 0.0000 - Training Accuracy: 98.11%
445
+ Step [1200/13913] - Training Loss: 0.0027 - Training Accuracy: 98.02%
446
+ Step [1300/13913] - Training Loss: 0.2686 - Training Accuracy: 97.97%
447
+ Step [1400/13913] - Training Loss: 0.0024 - Training Accuracy: 97.95%
448
+ Step [1500/13913] - Training Loss: 0.0005 - Training Accuracy: 97.95%
449
+ Step [1600/13913] - Training Loss: 0.0674 - Training Accuracy: 97.96%
450
+ Step [1700/13913] - Training Loss: 0.0025 - Training Accuracy: 97.97%
451
+ Step [1800/13913] - Training Loss: 0.0004 - Training Accuracy: 97.99%
452
+ Step [1900/13913] - Training Loss: 0.0002 - Training Accuracy: 97.99%
453
+ Step [2000/13913] - Training Loss: 0.0065 - Training Accuracy: 98.02%
454
+ Step [2100/13913] - Training Loss: 0.0004 - Training Accuracy: 98.01%
455
+ Step [2200/13913] - Training Loss: 0.0000 - Training Accuracy: 98.02%
456
+ Step [2300/13913] - Training Loss: 0.0005 - Training Accuracy: 98.01%
457
+ Step [2400/13913] - Training Loss: 0.0008 - Training Accuracy: 97.98%
458
+ Step [2500/13913] - Training Loss: 0.0000 - Training Accuracy: 97.94%
459
+ Step [2600/13913] - Training Loss: 0.0003 - Training Accuracy: 97.96%
460
+ Step [2700/13913] - Training Loss: 0.0055 - Training Accuracy: 97.94%
461
+ Step [2800/13913] - Training Loss: 0.0000 - Training Accuracy: 98.00%
462
+ Step [2900/13913] - Training Loss: 0.0582 - Training Accuracy: 98.00%
463
+ Step [3000/13913] - Training Loss: 0.0179 - Training Accuracy: 97.96%
464
+ Step [3100/13913] - Training Loss: 0.0018 - Training Accuracy: 97.96%
465
+ Step [3200/13913] - Training Loss: 0.0001 - Training Accuracy: 97.94%
466
+ Step [3300/13913] - Training Loss: 0.0258 - Training Accuracy: 97.94%
467
+ Step [3400/13913] - Training Loss: 0.2070 - Training Accuracy: 97.92%
468
+ Step [3500/13913] - Training Loss: 0.0140 - Training Accuracy: 97.95%
469
+ Step [3600/13913] - Training Loss: 0.0010 - Training Accuracy: 97.94%
470
+ Step [3700/13913] - Training Loss: 0.0186 - Training Accuracy: 97.92%
471
+ Step [3800/13913] - Training Loss: 0.0127 - Training Accuracy: 97.93%
472
+ Step [3900/13913] - Training Loss: 0.0113 - Training Accuracy: 97.92%
473
+ Step [4000/13913] - Training Loss: 0.0786 - Training Accuracy: 97.92%
474
+ Step [4100/13913] - Training Loss: 0.2667 - Training Accuracy: 97.90%
475
+ Step [4200/13913] - Training Loss: 0.0000 - Training Accuracy: 97.91%
476
+ Step [4300/13913] - Training Loss: 0.0042 - Training Accuracy: 97.90%
477
+ Step [4400/13913] - Training Loss: 0.0050 - Training Accuracy: 97.89%
478
+ Step [4500/13913] - Training Loss: 0.0085 - Training Accuracy: 97.91%
479
+ Step [4600/13913] - Training Loss: 0.0012 - Training Accuracy: 97.91%
480
+ Step [4700/13913] - Training Loss: 0.0001 - Training Accuracy: 97.90%
481
+ Step [4800/13913] - Training Loss: 0.0001 - Training Accuracy: 97.92%
482
+ Step [4900/13913] - Training Loss: 0.0004 - Training Accuracy: 97.92%
483
+ Step [5000/13913] - Training Loss: 0.0002 - Training Accuracy: 97.93%
484
+ Step [5100/13913] - Training Loss: 0.0022 - Training Accuracy: 97.92%
485
+ Step [5200/13913] - Training Loss: 0.0004 - Training Accuracy: 97.91%
486
+ Step [5300/13913] - Training Loss: 0.4074 - Training Accuracy: 97.91%
487
+ Step [5400/13913] - Training Loss: 0.0020 - Training Accuracy: 97.91%
488
+ Step [5500/13913] - Training Loss: 0.0001 - Training Accuracy: 97.90%
489
+ Step [5600/13913] - Training Loss: 0.0067 - Training Accuracy: 97.89%
490
+ Step [5700/13913] - Training Loss: 0.0005 - Training Accuracy: 97.90%
491
+ Step [5800/13913] - Training Loss: 0.0001 - Training Accuracy: 97.91%
492
+ Step [5900/13913] - Training Loss: 0.2293 - Training Accuracy: 97.91%
493
+ Step [6000/13913] - Training Loss: 0.0004 - Training Accuracy: 97.91%
494
+ Step [6100/13913] - Training Loss: 0.0006 - Training Accuracy: 97.91%
495
+ Step [6200/13913] - Training Loss: 0.0037 - Training Accuracy: 97.90%
496
+ Step [6300/13913] - Training Loss: 0.0373 - Training Accuracy: 97.87%
497
+ Step [6400/13913] - Training Loss: 0.0821 - Training Accuracy: 97.89%
498
+ Step [6500/13913] - Training Loss: 0.0900 - Training Accuracy: 97.89%
499
+ Step [6600/13913] - Training Loss: 0.0002 - Training Accuracy: 97.91%
500
+ Step [6700/13913] - Training Loss: 0.0001 - Training Accuracy: 97.90%
501
+ Step [6800/13913] - Training Loss: 0.0002 - Training Accuracy: 97.88%
502
+ Step [6900/13913] - Training Loss: 0.0001 - Training Accuracy: 97.89%
503
+ Step [7000/13913] - Training Loss: 0.0414 - Training Accuracy: 97.91%
504
+ Step [7100/13913] - Training Loss: 0.0109 - Training Accuracy: 97.90%
505
+ Step [7200/13913] - Training Loss: 0.0007 - Training Accuracy: 97.92%
506
+ Step [7300/13913] - Training Loss: 0.0003 - Training Accuracy: 97.93%
507
+ Step [7400/13913] - Training Loss: 0.2116 - Training Accuracy: 97.93%
508
+ Step [7500/13913] - Training Loss: 0.0134 - Training Accuracy: 97.94%
509
+ Step [7600/13913] - Training Loss: 0.0035 - Training Accuracy: 97.95%
510
+ Step [7700/13913] - Training Loss: 0.0000 - Training Accuracy: 97.94%
511
+ Step [7800/13913] - Training Loss: 0.0004 - Training Accuracy: 97.95%
512
+ Step [7900/13913] - Training Loss: 0.0012 - Training Accuracy: 97.95%
513
+ Step [8000/13913] - Training Loss: 0.1367 - Training Accuracy: 97.95%
514
+ Step [8100/13913] - Training Loss: 0.0000 - Training Accuracy: 97.96%
515
+ Step [8200/13913] - Training Loss: 0.0000 - Training Accuracy: 97.95%
516
+ Step [8300/13913] - Training Loss: 0.0117 - Training Accuracy: 97.94%
517
+ Step [8400/13913] - Training Loss: 0.2911 - Training Accuracy: 97.94%
518
+ Step [8500/13913] - Training Loss: 0.0003 - Training Accuracy: 97.94%
519
+ Step [8600/13913] - Training Loss: 0.0000 - Training Accuracy: 97.93%
520
+ Step [8700/13913] - Training Loss: 0.0186 - Training Accuracy: 97.93%
521
+ Step [8800/13913] - Training Loss: 0.0001 - Training Accuracy: 97.94%
522
+ Step [8900/13913] - Training Loss: 0.0124 - Training Accuracy: 97.94%
523
+ Step [9000/13913] - Training Loss: 0.2614 - Training Accuracy: 97.94%
524
+ Step [9100/13913] - Training Loss: 0.0000 - Training Accuracy: 97.95%
525
+ Step [9200/13913] - Training Loss: 0.0219 - Training Accuracy: 97.94%
526
+ Step [9300/13913] - Training Loss: 0.0945 - Training Accuracy: 97.94%
527
+ Step [9400/13913] - Training Loss: 0.0013 - Training Accuracy: 97.93%
528
+ Step [9500/13913] - Training Loss: 0.0015 - Training Accuracy: 97.93%
529
+ Step [9600/13913] - Training Loss: 0.0262 - Training Accuracy: 97.93%
530
+ Step [9700/13913] - Training Loss: 0.0000 - Training Accuracy: 97.93%
531
+ Step [9800/13913] - Training Loss: 0.0243 - Training Accuracy: 97.93%
532
+ Step [9900/13913] - Training Loss: 0.0034 - Training Accuracy: 97.93%
533
+ Step [10000/13913] - Training Loss: 0.0156 - Training Accuracy: 97.93%
534
+ Step [10100/13913] - Training Loss: 0.3591 - Training Accuracy: 97.93%
535
+ Step [10200/13913] - Training Loss: 0.0010 - Training Accuracy: 97.93%
536
+ Step [10300/13913] - Training Loss: 0.0001 - Training Accuracy: 97.92%
537
+ Step [10400/13913] - Training Loss: 0.0003 - Training Accuracy: 97.93%
538
+ Step [10500/13913] - Training Loss: 0.0044 - Training Accuracy: 97.94%
539
+ Step [10600/13913] - Training Loss: 0.0000 - Training Accuracy: 97.94%
540
+ Step [10700/13913] - Training Loss: 0.0158 - Training Accuracy: 97.94%
541
+ Step [10800/13913] - Training Loss: 0.0302 - Training Accuracy: 97.93%
542
+ Step [10900/13913] - Training Loss: 0.0004 - Training Accuracy: 97.92%
543
+ Step [11000/13913] - Training Loss: 0.0386 - Training Accuracy: 97.92%
544
+ Step [11100/13913] - Training Loss: 0.1169 - Training Accuracy: 97.92%
545
+ Step [11200/13913] - Training Loss: 0.0117 - Training Accuracy: 97.92%
546
+ Step [11300/13913] - Training Loss: 0.0020 - Training Accuracy: 97.91%
547
+ Step [11400/13913] - Training Loss: 0.0001 - Training Accuracy: 97.92%
548
+ Step [11500/13913] - Training Loss: 0.0147 - Training Accuracy: 97.91%
549
+ Step [11600/13913] - Training Loss: 0.0006 - Training Accuracy: 97.90%
550
+ Step [11700/13913] - Training Loss: 0.0305 - Training Accuracy: 97.90%
551
+ Step [11800/13913] - Training Loss: 0.0000 - Training Accuracy: 97.90%
552
+ Step [11900/13913] - Training Loss: 0.0053 - Training Accuracy: 97.90%
553
+ Step [12000/13913] - Training Loss: 0.9078 - Training Accuracy: 97.91%
554
+ Step [12100/13913] - Training Loss: 0.0001 - Training Accuracy: 97.90%
555
+ Step [12200/13913] - Training Loss: 0.3940 - Training Accuracy: 97.90%
556
+ Step [12300/13913] - Training Loss: 0.0006 - Training Accuracy: 97.89%
557
+ Step [12400/13913] - Training Loss: 0.0000 - Training Accuracy: 97.89%
558
+ Step [12500/13913] - Training Loss: 0.0009 - Training Accuracy: 97.89%
559
+ Step [12600/13913] - Training Loss: 0.3751 - Training Accuracy: 97.89%
560
+ Step [12700/13913] - Training Loss: 0.0002 - Training Accuracy: 97.89%
561
+ Step [12800/13913] - Training Loss: 0.0032 - Training Accuracy: 97.90%
562
+ Step [12900/13913] - Training Loss: 0.0635 - Training Accuracy: 97.90%
563
+ Step [13000/13913] - Training Loss: 0.0442 - Training Accuracy: 97.90%
564
+ Step [13100/13913] - Training Loss: 0.0000 - Training Accuracy: 97.91%
565
+ Step [13200/13913] - Training Loss: 0.0721 - Training Accuracy: 97.90%
566
+ Step [13300/13913] - Training Loss: 0.0469 - Training Accuracy: 97.89%
567
+ Step [13400/13913] - Training Loss: 0.0005 - Training Accuracy: 97.89%
568
+ Step [13500/13913] - Training Loss: 0.0582 - Training Accuracy: 97.89%
569
+ Step [13600/13913] - Training Loss: 0.0218 - Training Accuracy: 97.89%
570
+ Step [13700/13913] - Training Loss: 0.0290 - Training Accuracy: 97.89%
571
+ Step [13800/13913] - Training Loss: 0.0028 - Training Accuracy: 97.88%
572
+ Step [13900/13913] - Training Loss: 0.2266 - Training Accuracy: 97.88%
573
+ Epoch 4/20 - Validation: 100%|██████████| 1511/1511 [06:19<00:00, 3.98it/s]
574
+ Epoch [4/20] - Training Loss: 0.0701, Training Accuracy: 97.88% - Validation Loss: 0.0842, Validation Accuracy: 97.33%
575
+ outdir /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/checkpoints/HCPflat_large_gsrFalse_HCP_FT
576
+ Saved model and config to /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/checkpoints/HCPflat_large_gsrFalse_HCP_FT
577
+ Epoch 5/20 - Training: 23%|██▎ | 3199/13913 [18:29<1:01:35, 2.90it/s]
578
+ Step [100/13913] - Training Loss: 0.0034 - Training Accuracy: 98.75%
579
+ Step [200/13913] - Training Loss: 0.0004 - Training Accuracy: 99.25%
580
+ Step [300/13913] - Training Loss: 0.3141 - Training Accuracy: 99.17%
581
+ Step [400/13913] - Training Loss: 0.0053 - Training Accuracy: 98.84%
582
+ Step [500/13913] - Training Loss: 0.0011 - Training Accuracy: 98.70%
583
+ Step [600/13913] - Training Loss: 0.0001 - Training Accuracy: 98.69%
584
+ Step [700/13913] - Training Loss: 0.0420 - Training Accuracy: 98.80%
585
+ Step [800/13913] - Training Loss: 0.0000 - Training Accuracy: 98.84%
586
+ Step [900/13913] - Training Loss: 0.0025 - Training Accuracy: 98.82%
587
+ Step [1000/13913] - Training Loss: 0.0005 - Training Accuracy: 98.79%
588
+ Step [1100/13913] - Training Loss: 0.0015 - Training Accuracy: 98.81%
589
+ Step [1200/13913] - Training Loss: 0.0422 - Training Accuracy: 98.71%
590
+ Step [1300/13913] - Training Loss: 0.0000 - Training Accuracy: 98.76%
591
+ Step [1400/13913] - Training Loss: 0.0091 - Training Accuracy: 98.67%
592
+ Step [1500/13913] - Training Loss: 0.0001 - Training Accuracy: 98.64%
593
+ Step [1600/13913] - Training Loss: 0.0027 - Training Accuracy: 98.59%
594
+ Step [1700/13913] - Training Loss: 0.0000 - Training Accuracy: 98.54%
595
+ Step [1800/13913] - Training Loss: 0.0523 - Training Accuracy: 98.57%
596
+ Step [1900/13913] - Training Loss: 0.0001 - Training Accuracy: 98.56%
597
+ Step [2000/13913] - Training Loss: 0.0000 - Training Accuracy: 98.54%
598
+ Step [2100/13913] - Training Loss: 0.0011 - Training Accuracy: 98.54%
599
+ Step [2200/13913] - Training Loss: 0.0001 - Training Accuracy: 98.51%
600
+ Step [2300/13913] - Training Loss: 0.2477 - Training Accuracy: 98.48%
601
+ Step [2400/13913] - Training Loss: 0.0002 - Training Accuracy: 98.51%
602
+ Step [2500/13913] - Training Loss: 0.0001 - Training Accuracy: 98.52%
603
+ Step [2600/13913] - Training Loss: 0.0000 - Training Accuracy: 98.49%
604
+ Step [2700/13913] - Training Loss: 0.2288 - Training Accuracy: 98.44%
605
+ Step [2800/13913] - Training Loss: 0.0062 - Training Accuracy: 98.43%
606
+ Step [2900/13913] - Training Loss: 0.3466 - Training Accuracy: 98.41%
607
+ Step [3000/13913] - Training Loss: 0.0002 - Training Accuracy: 98.42%
608
+ Step [3100/13913] - Training Loss: 0.0000 - Training Accuracy: 98.39%
609
+ Step [3200/13913] - Training Loss: 0.0241 - Training Accuracy: 98.41%
610
+ Step [3300/13913] - Training Loss: 0.0042 - Training Accuracy: 98.40%
611
+ Step [3400/13913] - Training Loss: 0.0003 - Training Accuracy: 98.39%
612
+ Step [3500/13913] - Training Loss: 0.0594 - Training Accuracy: 98.39%
613
+ Step [3600/13913] - Training Loss: 0.0782 - Training Accuracy: 98.40%
614
+ Step [3700/13913] - Training Loss: 0.0003 - Training Accuracy: 98.40%
615
+ Step [3800/13913] - Training Loss: 0.0472 - Training Accuracy: 98.41%
616
+ Step [3900/13913] - Training Loss: 0.0012 - Training Accuracy: 98.40%
617
+ Step [4000/13913] - Training Loss: 0.0001 - Training Accuracy: 98.43%
618
+ Step [4100/13913] - Training Loss: 0.0454 - Training Accuracy: 98.43%
619
+ Step [4200/13913] - Training Loss: 0.0884 - Training Accuracy: 98.42%
620
+ Step [4300/13913] - Training Loss: 0.7254 - Training Accuracy: 98.40%
621
+ Step [4400/13913] - Training Loss: 0.0008 - Training Accuracy: 98.39%
622
+ Step [4500/13913] - Training Loss: 0.5238 - Training Accuracy: 98.34%
623
+ Step [4600/13913] - Training Loss: 0.0061 - Training Accuracy: 98.34%
624
+ Step [4700/13913] - Training Loss: 0.1348 - Training Accuracy: 98.31%
625
+ Step [4800/13913] - Training Loss: 0.4050 - Training Accuracy: 98.29%
626
+ Step [4900/13913] - Training Loss: 0.5176 - Training Accuracy: 98.27%
627
+ Step [5000/13913] - Training Loss: 0.3474 - Training Accuracy: 98.27%
628
+ Step [5100/13913] - Training Loss: 0.0004 - Training Accuracy: 98.26%
629
+ Step [5200/13913] - Training Loss: 0.6380 - Training Accuracy: 98.25%
630
+ Step [5300/13913] - Training Loss: 0.0029 - Training Accuracy: 98.25%
631
+ Step [5400/13913] - Training Loss: 0.0000 - Training Accuracy: 98.25%
632
+ Step [5500/13913] - Training Loss: 0.0021 - Training Accuracy: 98.25%
633
+ Step [5600/13913] - Training Loss: 0.0005 - Training Accuracy: 98.24%
634
+ Step [5700/13913] - Training Loss: 0.0000 - Training Accuracy: 98.23%
635
+ Step [5800/13913] - Training Loss: 0.0033 - Training Accuracy: 98.24%
636
+ Step [5900/13913] - Training Loss: 0.0000 - Training Accuracy: 98.24%
637
+ Step [6000/13913] - Training Loss: 0.0000 - Training Accuracy: 98.25%
638
+ Step [6100/13913] - Training Loss: 0.0056 - Training Accuracy: 98.26%
639
+ Step [6200/13913] - Training Loss: 0.0003 - Training Accuracy: 98.25%
640
+ Step [6300/13913] - Training Loss: 0.0010 - Training Accuracy: 98.24%
641
+ Step [6400/13913] - Training Loss: 0.0114 - Training Accuracy: 98.26%
642
+ Step [6500/13913] - Training Loss: 0.2371 - Training Accuracy: 98.26%
643
+ Step [6600/13913] - Training Loss: 0.0026 - Training Accuracy: 98.25%
644
+ Step [6700/13913] - Training Loss: 0.0004 - Training Accuracy: 98.25%
645
+ Step [6800/13913] - Training Loss: 0.0003 - Training Accuracy: 98.27%
646
+ Step [6900/13913] - Training Loss: 0.0078 - Training Accuracy: 98.26%
647
+ Step [7000/13913] - Training Loss: 0.0006 - Training Accuracy: 98.26%
648
+ Step [7100/13913] - Training Loss: 0.1243 - Training Accuracy: 98.27%
649
+ Step [7200/13913] - Training Loss: 0.0007 - Training Accuracy: 98.26%
650
+ Step [7300/13913] - Training Loss: 0.0001 - Training Accuracy: 98.25%
651
+ Step [7400/13913] - Training Loss: 0.0033 - Training Accuracy: 98.23%
652
+ Step [7500/13913] - Training Loss: 0.0024 - Training Accuracy: 98.23%
653
+ Step [7600/13913] - Training Loss: 0.0146 - Training Accuracy: 98.23%
654
+ Step [7700/13913] - Training Loss: 0.0004 - Training Accuracy: 98.24%
655
+ Step [7800/13913] - Training Loss: 0.0025 - Training Accuracy: 98.23%
656
+ Step [7900/13913] - Training Loss: 0.0343 - Training Accuracy: 98.23%
657
+ Step [8000/13913] - Training Loss: 0.0002 - Training Accuracy: 98.22%
658
+ Step [8100/13913] - Training Loss: 0.0004 - Training Accuracy: 98.23%
659
+ Step [8200/13913] - Training Loss: 0.0842 - Training Accuracy: 98.24%
660
+ Step [8300/13913] - Training Loss: 0.0283 - Training Accuracy: 98.24%
661
+ Step [8400/13913] - Training Loss: 0.0009 - Training Accuracy: 98.25%
662
+ Step [8500/13913] - Training Loss: 0.0022 - Training Accuracy: 98.25%
663
+ Step [8600/13913] - Training Loss: 0.4054 - Training Accuracy: 98.25%
664
+ Step [8700/13913] - Training Loss: 0.0003 - Training Accuracy: 98.26%
665
+ Step [8800/13913] - Training Loss: 0.0705 - Training Accuracy: 98.27%
666
+ Step [8900/13913] - Training Loss: 0.0031 - Training Accuracy: 98.27%
667
+ Step [9000/13913] - Training Loss: 0.0000 - Training Accuracy: 98.26%
668
+ Step [9100/13913] - Training Loss: 0.0134 - Training Accuracy: 98.26%
669
+ Step [9200/13913] - Training Loss: 0.0111 - Training Accuracy: 98.24%
670
+ Step [9300/13913] - Training Loss: 0.0052 - Training Accuracy: 98.24%
671
+ Step [9400/13913] - Training Loss: 0.0020 - Training Accuracy: 98.24%
672
+ Step [9500/13913] - Training Loss: 0.0005 - Training Accuracy: 98.23%
673
+ Step [9600/13913] - Training Loss: 0.0110 - Training Accuracy: 98.23%
674
+ Step [9700/13913] - Training Loss: 0.0098 - Training Accuracy: 98.23%
675
+ Step [9800/13913] - Training Loss: 0.0029 - Training Accuracy: 98.23%
676
+ Step [9900/13913] - Training Loss: 0.0004 - Training Accuracy: 98.23%
677
+ Step [10000/13913] - Training Loss: 0.2605 - Training Accuracy: 98.23%
678
+ Step [10100/13913] - Training Loss: 0.0057 - Training Accuracy: 98.21%
679
+ Step [10200/13913] - Training Loss: 0.0000 - Training Accuracy: 98.21%
680
+ Step [10300/13913] - Training Loss: 0.0004 - Training Accuracy: 98.21%
681
+ Step [10400/13913] - Training Loss: 0.1648 - Training Accuracy: 98.21%
682
+ Step [10500/13913] - Training Loss: 0.0012 - Training Accuracy: 98.21%
683
+ Step [10600/13913] - Training Loss: 0.0001 - Training Accuracy: 98.21%
684
+ Step [10700/13913] - Training Loss: 0.0014 - Training Accuracy: 98.20%
685
+ Step [10800/13913] - Training Loss: 0.0002 - Training Accuracy: 98.21%
686
+ Step [10900/13913] - Training Loss: 0.0001 - Training Accuracy: 98.20%
687
+ Step [11000/13913] - Training Loss: 0.0001 - Training Accuracy: 98.20%
688
+ Step [11100/13913] - Training Loss: 0.0000 - Training Accuracy: 98.19%
689
+ Step [11200/13913] - Training Loss: 0.6204 - Training Accuracy: 98.20%
690
+ Step [11300/13913] - Training Loss: 0.0090 - Training Accuracy: 98.21%
691
+ Step [11400/13913] - Training Loss: 0.0018 - Training Accuracy: 98.21%
692
+ Step [11500/13913] - Training Loss: 0.0003 - Training Accuracy: 98.21%
693
+ Step [11600/13913] - Training Loss: 0.0001 - Training Accuracy: 98.20%
694
+ Step [11700/13913] - Training Loss: 0.0782 - Training Accuracy: 98.19%
695
+ Step [11800/13913] - Training Loss: 0.0000 - Training Accuracy: 98.19%
696
+ Step [11900/13913] - Training Loss: 0.0090 - Training Accuracy: 98.18%
697
+ Step [12000/13913] - Training Loss: 0.0707 - Training Accuracy: 98.18%
698
+ Step [12100/13913] - Training Loss: 0.0172 - Training Accuracy: 98.18%
699
+ Step [12200/13913] - Training Loss: 0.0000 - Training Accuracy: 98.18%
700
+ Step [12300/13913] - Training Loss: 0.0119 - Training Accuracy: 98.19%
701
+ Step [12400/13913] - Training Loss: 0.0160 - Training Accuracy: 98.19%
702
+ Step [12500/13913] - Training Loss: 0.0002 - Training Accuracy: 98.19%
703
+ Step [12600/13913] - Training Loss: 0.0003 - Training Accuracy: 98.19%
704
+ Step [12700/13913] - Training Loss: 0.0466 - Training Accuracy: 98.19%
705
+ Step [12800/13913] - Training Loss: 0.2281 - Training Accuracy: 98.19%
706
+ Step [12900/13913] - Training Loss: 0.0498 - Training Accuracy: 98.19%
707
+ Step [13000/13913] - Training Loss: 0.8033 - Training Accuracy: 98.20%
708
+ Step [13100/13913] - Training Loss: 0.0009 - Training Accuracy: 98.19%
709
+ Step [13200/13913] - Training Loss: 0.0207 - Training Accuracy: 98.19%
710
+ Step [13300/13913] - Training Loss: 0.0017 - Training Accuracy: 98.18%
711
+ Step [13400/13913] - Training Loss: 0.0059 - Training Accuracy: 98.18%
712
+ Step [13500/13913] - Training Loss: 0.3887 - Training Accuracy: 98.17%
713
+ Step [13600/13913] - Training Loss: 0.0047 - Training Accuracy: 98.16%
714
+ Step [13700/13913] - Training Loss: 0.0004 - Training Accuracy: 98.17%
715
+ Step [13800/13913] - Training Loss: 0.0017 - Training Accuracy: 98.16%
716
+ Step [13900/13913] - Training Loss: 0.0000 - Training Accuracy: 98.16%
717
+ Epoch 5/20 - Validation: 100%|██████████| 1511/1511 [06:15<00:00, 4.02it/s]
718
+ Epoch [5/20] - Training Loss: 0.0607, Training Accuracy: 98.16% - Validation Loss: 0.0884, Validation Accuracy: 97.59%
719
+ outdir /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/checkpoints/HCPflat_large_gsrFalse_HCP_FT
720
+ Saved model and config to /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/checkpoints/HCPflat_large_gsrFalse_HCP_FT
721
+ Epoch 6/20 - Training: 23%|██▎ | 3199/13913 [18:29<1:01:42, 2.89it/s]
722
+ Step [100/13913] - Training Loss: 0.0022 - Training Accuracy: 99.12%
723
+ Step [200/13913] - Training Loss: 0.0005 - Training Accuracy: 98.94%
724
+ Step [300/13913] - Training Loss: 0.0000 - Training Accuracy: 99.12%
725
+ Step [400/13913] - Training Loss: 0.1077 - Training Accuracy: 99.06%
726
+ Step [500/13913] - Training Loss: 0.0000 - Training Accuracy: 98.95%
727
+ Step [600/13913] - Training Loss: 0.0275 - Training Accuracy: 98.96%
728
+ Step [700/13913] - Training Loss: 0.0000 - Training Accuracy: 99.05%
729
+ Step [800/13913] - Training Loss: 0.0007 - Training Accuracy: 99.03%
730
+ Step [900/13913] - Training Loss: 0.0544 - Training Accuracy: 98.89%
731
+ Step [1000/13913] - Training Loss: 0.0911 - Training Accuracy: 98.80%
732
+ Step [1100/13913] - Training Loss: 0.0000 - Training Accuracy: 98.83%
733
+ Step [1200/13913] - Training Loss: 0.0071 - Training Accuracy: 98.84%
734
+ Step [1300/13913] - Training Loss: 0.1687 - Training Accuracy: 98.80%
735
+ Step [1400/13913] - Training Loss: 0.0361 - Training Accuracy: 98.79%
736
+ Step [1500/13913] - Training Loss: 0.0002 - Training Accuracy: 98.68%
737
+ Step [1600/13913] - Training Loss: 0.0009 - Training Accuracy: 98.66%
738
+ Step [1700/13913] - Training Loss: 0.0000 - Training Accuracy: 98.62%
739
+ Step [1800/13913] - Training Loss: 0.0024 - Training Accuracy: 98.63%
740
+ Step [1900/13913] - Training Loss: 0.0295 - Training Accuracy: 98.62%
741
+ Step [2000/13913] - Training Loss: 0.0467 - Training Accuracy: 98.61%
742
+ Step [2100/13913] - Training Loss: 0.0003 - Training Accuracy: 98.60%
743
+ Step [2200/13913] - Training Loss: 0.0001 - Training Accuracy: 98.58%
744
+ Step [2300/13913] - Training Loss: 0.0000 - Training Accuracy: 98.63%
745
+ Step [2400/13913] - Training Loss: 0.0014 - Training Accuracy: 98.67%
746
+ Step [2500/13913] - Training Loss: 0.1068 - Training Accuracy: 98.68%
747
+ Step [2600/13913] - Training Loss: 0.0287 - Training Accuracy: 98.69%
748
+ Step [2700/13913] - Training Loss: 0.0056 - Training Accuracy: 98.69%
749
+ Step [2800/13913] - Training Loss: 0.0000 - Training Accuracy: 98.68%
750
+ Step [2900/13913] - Training Loss: 0.0010 - Training Accuracy: 98.64%
751
+ Step [3000/13913] - Training Loss: 0.0000 - Training Accuracy: 98.62%
752
+ Step [3100/13913] - Training Loss: 0.2059 - Training Accuracy: 98.63%
753
+ Step [3200/13913] - Training Loss: 0.0028 - Training Accuracy: 98.60%
754
+ Step [3300/13913] - Training Loss: 0.0023 - Training Accuracy: 98.59%
755
+ Step [3400/13913] - Training Loss: 0.0643 - Training Accuracy: 98.58%
756
+ Step [3500/13913] - Training Loss: 0.0001 - Training Accuracy: 98.60%
757
+ Step [3600/13913] - Training Loss: 0.0004 - Training Accuracy: 98.60%
758
+ Step [3700/13913] - Training Loss: 0.0022 - Training Accuracy: 98.60%
759
+ Step [3800/13913] - Training Loss: 0.0125 - Training Accuracy: 98.61%
760
+ Step [3900/13913] - Training Loss: 0.0003 - Training Accuracy: 98.61%
761
+ Step [4000/13913] - Training Loss: 0.0154 - Training Accuracy: 98.59%
762
+ Step [4100/13913] - Training Loss: 0.0008 - Training Accuracy: 98.60%
763
+ Step [4200/13913] - Training Loss: 0.0051 - Training Accuracy: 98.58%
764
+ Step [4300/13913] - Training Loss: 0.0007 - Training Accuracy: 98.57%
765
+ Step [4400/13913] - Training Loss: 0.0293 - Training Accuracy: 98.55%
766
+ Step [4500/13913] - Training Loss: 0.0001 - Training Accuracy: 98.58%
767
+ Step [4600/13913] - Training Loss: 0.0003 - Training Accuracy: 98.59%
768
+ Step [4700/13913] - Training Loss: 0.0001 - Training Accuracy: 98.59%
769
+ Step [4800/13913] - Training Loss: 0.0004 - Training Accuracy: 98.56%
770
+ Step [4900/13913] - Training Loss: 0.1204 - Training Accuracy: 98.55%
771
+ Step [5000/13913] - Training Loss: 0.0000 - Training Accuracy: 98.54%
772
+ Step [5100/13913] - Training Loss: 0.0004 - Training Accuracy: 98.52%
773
+ Step [5200/13913] - Training Loss: 0.0005 - Training Accuracy: 98.54%
774
+ Step [5300/13913] - Training Loss: 0.0000 - Training Accuracy: 98.54%
775
+ Step [5400/13913] - Training Loss: 0.0000 - Training Accuracy: 98.54%
776
+ Step [5500/13913] - Training Loss: 0.0041 - Training Accuracy: 98.54%
777
+ Step [5600/13913] - Training Loss: 0.0034 - Training Accuracy: 98.52%
778
+ Step [5700/13913] - Training Loss: 0.0134 - Training Accuracy: 98.52%
779
+ Step [5800/13913] - Training Loss: 0.0003 - Training Accuracy: 98.52%
780
+ Step [5900/13913] - Training Loss: 0.0000 - Training Accuracy: 98.52%
781
+ Step [6000/13913] - Training Loss: 0.0700 - Training Accuracy: 98.51%
782
+ Step [6100/13913] - Training Loss: 0.1069 - Training Accuracy: 98.51%
783
+ Step [6200/13913] - Training Loss: 0.0114 - Training Accuracy: 98.53%
784
+ Step [6300/13913] - Training Loss: 0.0000 - Training Accuracy: 98.52%
785
+ Step [6400/13913] - Training Loss: 0.0000 - Training Accuracy: 98.53%
786
+ Step [6500/13913] - Training Loss: 0.0007 - Training Accuracy: 98.52%
787
+ Step [6600/13913] - Training Loss: 0.0020 - Training Accuracy: 98.52%
788
+ Step [6700/13913] - Training Loss: 0.0001 - Training Accuracy: 98.52%
789
+ Step [6800/13913] - Training Loss: 0.0000 - Training Accuracy: 98.52%
790
+ Step [6900/13913] - Training Loss: 0.0000 - Training Accuracy: 98.54%
791
+ Step [7000/13913] - Training Loss: 0.0005 - Training Accuracy: 98.54%
792
+ Step [7100/13913] - Training Loss: 0.2401 - Training Accuracy: 98.54%
793
+ Step [7200/13913] - Training Loss: 0.0000 - Training Accuracy: 98.54%
794
+ Step [7300/13913] - Training Loss: 0.0990 - Training Accuracy: 98.51%
795
+ Step [7400/13913] - Training Loss: 0.0971 - Training Accuracy: 98.50%
796
+ Step [7500/13913] - Training Loss: 0.0811 - Training Accuracy: 98.50%
797
+ Step [7600/13913] - Training Loss: 0.0021 - Training Accuracy: 98.49%
798
+ Step [7700/13913] - Training Loss: 0.0700 - Training Accuracy: 98.48%
799
+ Step [7800/13913] - Training Loss: 0.0002 - Training Accuracy: 98.47%
800
+ Step [7900/13913] - Training Loss: 0.0016 - Training Accuracy: 98.47%
801
+ Step [8000/13913] - Training Loss: 0.5057 - Training Accuracy: 98.48%
802
+ Step [8100/13913] - Training Loss: 0.0005 - Training Accuracy: 98.48%
803
+ Step [8200/13913] - Training Loss: 0.0023 - Training Accuracy: 98.47%
804
+ Step [8300/13913] - Training Loss: 0.0000 - Training Accuracy: 98.47%
805
+ Step [8400/13913] - Training Loss: 0.0002 - Training Accuracy: 98.48%
806
+ Step [8500/13913] - Training Loss: 0.5496 - Training Accuracy: 98.46%
807
+ Step [8600/13913] - Training Loss: 0.5422 - Training Accuracy: 98.45%
808
+ Step [8700/13913] - Training Loss: 0.0006 - Training Accuracy: 98.45%
809
+ Step [8800/13913] - Training Loss: 0.0000 - Training Accuracy: 98.45%
810
+ Step [8900/13913] - Training Loss: 0.5334 - Training Accuracy: 98.44%
811
+ Step [9000/13913] - Training Loss: 0.0003 - Training Accuracy: 98.42%
812
+ Step [9100/13913] - Training Loss: 0.0000 - Training Accuracy: 98.43%
813
+ Step [9200/13913] - Training Loss: 0.0000 - Training Accuracy: 98.43%
814
+ Step [9300/13913] - Training Loss: 0.0011 - Training Accuracy: 98.42%
815
+ Step [9400/13913] - Training Loss: 0.0000 - Training Accuracy: 98.42%
816
+ Step [9500/13913] - Training Loss: 0.1300 - Training Accuracy: 98.42%
817
+ Step [9600/13913] - Training Loss: 0.0016 - Training Accuracy: 98.43%
818
+ Step [9700/13913] - Training Loss: 0.2555 - Training Accuracy: 98.42%
819
+ Step [9800/13913] - Training Loss: 0.0001 - Training Accuracy: 98.43%
820
+ Step [9900/13913] - Training Loss: 0.0121 - Training Accuracy: 98.44%
821
+ Step [10000/13913] - Training Loss: 0.0040 - Training Accuracy: 98.43%
822
+ Step [10100/13913] - Training Loss: 0.1039 - Training Accuracy: 98.43%
823
+ Step [10200/13913] - Training Loss: 0.0048 - Training Accuracy: 98.42%
824
+ Step [10300/13913] - Training Loss: 0.0000 - Training Accuracy: 98.42%
825
+ Step [10400/13913] - Training Loss: 0.2141 - Training Accuracy: 98.41%
826
+ Step [10500/13913] - Training Loss: 0.0000 - Training Accuracy: 98.40%
827
+ Step [10600/13913] - Training Loss: 0.0054 - Training Accuracy: 98.40%
828
+ Step [10700/13913] - Training Loss: 0.0001 - Training Accuracy: 98.40%
829
+ Step [10800/13913] - Training Loss: 0.0001 - Training Accuracy: 98.40%
830
+ Step [10900/13913] - Training Loss: 0.0003 - Training Accuracy: 98.40%
831
+ Step [11000/13913] - Training Loss: 0.3801 - Training Accuracy: 98.41%
832
+ Step [11100/13913] - Training Loss: 0.0000 - Training Accuracy: 98.41%
833
+ Step [11200/13913] - Training Loss: 0.0099 - Training Accuracy: 98.41%
834
+ Step [11300/13913] - Training Loss: 0.0222 - Training Accuracy: 98.41%
835
+ Step [11400/13913] - Training Loss: 0.0000 - Training Accuracy: 98.41%
836
+ Step [11500/13913] - Training Loss: 1.1546 - Training Accuracy: 98.41%
837
+ Step [11600/13913] - Training Loss: 0.0000 - Training Accuracy: 98.41%
838
+ Step [11700/13913] - Training Loss: 0.0002 - Training Accuracy: 98.41%
839
+ Step [11800/13913] - Training Loss: 0.3440 - Training Accuracy: 98.41%
840
+ Step [11900/13913] - Training Loss: 0.1629 - Training Accuracy: 98.40%
841
+ Step [12000/13913] - Training Loss: 0.0413 - Training Accuracy: 98.40%
842
+ Step [12100/13913] - Training Loss: 0.0000 - Training Accuracy: 98.40%
843
+ Step [12200/13913] - Training Loss: 0.3073 - Training Accuracy: 98.40%
844
+ Step [12300/13913] - Training Loss: 0.5376 - Training Accuracy: 98.39%
845
+ Step [12400/13913] - Training Loss: 0.0105 - Training Accuracy: 98.39%
846
+ Step [12500/13913] - Training Loss: 0.0021 - Training Accuracy: 98.39%
847
+ Step [12600/13913] - Training Loss: 0.0001 - Training Accuracy: 98.40%
848
+ Step [12700/13913] - Training Loss: 0.5449 - Training Accuracy: 98.39%
849
+ Step [12800/13913] - Training Loss: 0.0008 - Training Accuracy: 98.39%
850
+ Step [12900/13913] - Training Loss: 0.0001 - Training Accuracy: 98.39%
851
+ Step [13000/13913] - Training Loss: 0.0000 - Training Accuracy: 98.39%
852
+ Step [13100/13913] - Training Loss: 0.1067 - Training Accuracy: 98.39%
853
+ Step [13200/13913] - Training Loss: 0.2587 - Training Accuracy: 98.38%
854
+ Step [13300/13913] - Training Loss: 0.0012 - Training Accuracy: 98.39%
855
+ Step [13400/13913] - Training Loss: 0.0015 - Training Accuracy: 98.39%
856
+ Step [13500/13913] - Training Loss: 0.1734 - Training Accuracy: 98.39%
857
+ Step [13600/13913] - Training Loss: 0.0018 - Training Accuracy: 98.38%
858
+ Step [13700/13913] - Training Loss: 0.0569 - Training Accuracy: 98.38%
859
+ Step [13800/13913] - Training Loss: 0.1768 - Training Accuracy: 98.38%
860
+ Step [13900/13913] - Training Loss: 0.0001 - Training Accuracy: 98.38%
861
+ Epoch 6/20 - Validation: 100%|██████████| 1511/1511 [06:15<00:00, 4.03it/s]
862
+ Epoch [6/20] - Training Loss: 0.0540, Training Accuracy: 98.38% - Validation Loss: 0.1040, Validation Accuracy: 97.08%
863
+ outdir /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/checkpoints/HCPflat_large_gsrFalse_HCP_FT
864
+ Saved model and config to /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/checkpoints/HCPflat_large_gsrFalse_HCP_FT
865
+ Epoch 7/20 - Training: 23%|██▎ | 3199/13913 [18:27<1:01:45, 2.89it/s]
866
+ Step [100/13913] - Training Loss: 0.0001 - Training Accuracy: 98.12%
867
+ Step [200/13913] - Training Loss: 0.0001 - Training Accuracy: 98.75%
868
+ Step [300/13913] - Training Loss: 0.0001 - Training Accuracy: 98.71%
869
+ Step [400/13913] - Training Loss: 0.0001 - Training Accuracy: 98.75%
870
+ Step [500/13913] - Training Loss: 0.0013 - Training Accuracy: 98.83%
871
+ Step [600/13913] - Training Loss: 0.0152 - Training Accuracy: 98.73%
872
+ Step [700/13913] - Training Loss: 0.0471 - Training Accuracy: 98.80%
873
+ Step [800/13913] - Training Loss: 0.0001 - Training Accuracy: 98.86%
874
+ Step [900/13913] - Training Loss: 0.0041 - Training Accuracy: 98.79%
875
+ Step [1000/13913] - Training Loss: 0.0094 - Training Accuracy: 98.78%
876
+ Step [1100/13913] - Training Loss: 1.1584 - Training Accuracy: 98.74%
877
+ Step [1200/13913] - Training Loss: 0.0034 - Training Accuracy: 98.74%
878
+ Step [1300/13913] - Training Loss: 0.0024 - Training Accuracy: 98.75%
879
+ Step [1400/13913] - Training Loss: 0.0001 - Training Accuracy: 98.75%
880
+ Step [1500/13913] - Training Loss: 0.4006 - Training Accuracy: 98.72%
881
+ Step [1600/13913] - Training Loss: 0.0118 - Training Accuracy: 98.66%
882
+ Step [1700/13913] - Training Loss: 0.0001 - Training Accuracy: 98.65%
883
+ Step [1800/13913] - Training Loss: 0.0000 - Training Accuracy: 98.63%
884
+ Step [1900/13913] - Training Loss: 0.0000 - Training Accuracy: 98.64%
885
+ Step [2000/13913] - Training Loss: 0.3126 - Training Accuracy: 98.58%
886
+ Step [2100/13913] - Training Loss: 0.0057 - Training Accuracy: 98.58%
887
+ Step [2200/13913] - Training Loss: 0.3064 - Training Accuracy: 98.57%
888
+ Step [2300/13913] - Training Loss: 0.0000 - Training Accuracy: 98.59%
889
+ Step [2400/13913] - Training Loss: 0.0002 - Training Accuracy: 98.60%
890
+ Step [2500/13913] - Training Loss: 0.0329 - Training Accuracy: 98.61%
891
+ Step [2600/13913] - Training Loss: 0.0000 - Training Accuracy: 98.63%
892
+ Step [2700/13913] - Training Loss: 0.0000 - Training Accuracy: 98.63%
893
+ Step [2800/13913] - Training Loss: 0.0000 - Training Accuracy: 98.64%
894
+ Step [2900/13913] - Training Loss: 0.0000 - Training Accuracy: 98.66%
895
+ Step [3000/13913] - Training Loss: 0.0002 - Training Accuracy: 98.62%
896
+ Step [3100/13913] - Training Loss: 0.0025 - Training Accuracy: 98.60%
897
+ Step [3200/13913] - Training Loss: 0.0015 - Training Accuracy: 98.58%
898
+ Step [3300/13913] - Training Loss: 0.0009 - Training Accuracy: 98.57%
899
+ Step [3400/13913] - Training Loss: 0.0001 - Training Accuracy: 98.56%
900
+ Step [3500/13913] - Training Loss: 0.4877 - Training Accuracy: 98.54%
901
+ Step [3600/13913] - Training Loss: 0.0026 - Training Accuracy: 98.53%
902
+ Step [3700/13913] - Training Loss: 0.1348 - Training Accuracy: 98.54%
903
+ Step [3800/13913] - Training Loss: 0.0002 - Training Accuracy: 98.54%
904
+ Step [3900/13913] - Training Loss: 0.0010 - Training Accuracy: 98.56%
905
+ Step [4000/13913] - Training Loss: 0.0001 - Training Accuracy: 98.55%
906
+ Step [4100/13913] - Training Loss: 0.0064 - Training Accuracy: 98.53%
907
+ Step [4200/13913] - Training Loss: 0.0090 - Training Accuracy: 98.54%
908
+ Step [4300/13913] - Training Loss: 0.8442 - Training Accuracy: 98.56%
909
+ Step [4400/13913] - Training Loss: 0.1955 - Training Accuracy: 98.55%
910
+ Step [4500/13913] - Training Loss: 0.0000 - Training Accuracy: 98.55%
911
+ Step [4600/13913] - Training Loss: 0.0529 - Training Accuracy: 98.57%
912
+ Step [4700/13913] - Training Loss: 0.2288 - Training Accuracy: 98.53%
913
+ Step [4800/13913] - Training Loss: 0.0197 - Training Accuracy: 98.55%
914
+ Step [4900/13913] - Training Loss: 0.0265 - Training Accuracy: 98.55%
915
+ Step [5000/13913] - Training Loss: 0.0004 - Training Accuracy: 98.53%
916
+ Step [5100/13913] - Training Loss: 0.0008 - Training Accuracy: 98.52%
917
+ Step [5200/13913] - Training Loss: 0.3313 - Training Accuracy: 98.52%
918
+ Step [5300/13913] - Training Loss: 0.0014 - Training Accuracy: 98.52%
919
+ Step [5400/13913] - Training Loss: 0.0187 - Training Accuracy: 98.52%
920
+ Step [5500/13913] - Training Loss: 0.0000 - Training Accuracy: 98.53%
921
+ Step [5600/13913] - Training Loss: 0.0002 - Training Accuracy: 98.54%
922
+ Step [5700/13913] - Training Loss: 0.0002 - Training Accuracy: 98.54%
923
+ Step [5800/13913] - Training Loss: 0.9370 - Training Accuracy: 98.53%
924
+ Step [5900/13913] - Training Loss: 0.0004 - Training Accuracy: 98.53%
925
+ Step [6000/13913] - Training Loss: 0.0434 - Training Accuracy: 98.51%
926
+ Step [6100/13913] - Training Loss: 0.0004 - Training Accuracy: 98.51%
927
+ Step [6200/13913] - Training Loss: 0.0000 - Training Accuracy: 98.51%
928
+ Step [6300/13913] - Training Loss: 0.0000 - Training Accuracy: 98.51%
929
+ Step [6400/13913] - Training Loss: 0.0003 - Training Accuracy: 98.51%
930
+ Step [6500/13913] - Training Loss: 0.0013 - Training Accuracy: 98.52%
931
+ Step [6600/13913] - Training Loss: 0.0005 - Training Accuracy: 98.52%
932
+ Step [6700/13913] - Training Loss: 0.0384 - Training Accuracy: 98.50%
933
+ Step [6800/13913] - Training Loss: 0.0000 - Training Accuracy: 98.51%
934
+ Step [6900/13913] - Training Loss: 0.0022 - Training Accuracy: 98.50%
935
+ Step [7000/13913] - Training Loss: 0.3338 - Training Accuracy: 98.51%
936
+ Step [7100/13913] - Training Loss: 0.0000 - Training Accuracy: 98.51%
937
+ Step [7200/13913] - Training Loss: 0.0000 - Training Accuracy: 98.52%
938
+ Step [7300/13913] - Training Loss: 0.0062 - Training Accuracy: 98.52%
939
+ Step [7400/13913] - Training Loss: 0.0701 - Training Accuracy: 98.52%
940
+ Step [7500/13913] - Training Loss: 0.0000 - Training Accuracy: 98.52%
941
+ Step [7600/13913] - Training Loss: 0.0377 - Training Accuracy: 98.51%
942
+ Step [7700/13913] - Training Loss: 0.0004 - Training Accuracy: 98.50%
943
+ Step [7800/13913] - Training Loss: 0.0002 - Training Accuracy: 98.51%
944
+ Step [7900/13913] - Training Loss: 0.0000 - Training Accuracy: 98.50%
945
+ Step [8000/13913] - Training Loss: 0.1488 - Training Accuracy: 98.50%
946
+ Step [8100/13913] - Training Loss: 0.0002 - Training Accuracy: 98.51%
947
+ Step [8200/13913] - Training Loss: 0.0254 - Training Accuracy: 98.50%
948
+ Step [8300/13913] - Training Loss: 0.0000 - Training Accuracy: 98.48%
949
+ Step [8400/13913] - Training Loss: 0.2459 - Training Accuracy: 98.49%
950
+ Step [8500/13913] - Training Loss: 0.0756 - Training Accuracy: 98.49%
951
+ Step [8600/13913] - Training Loss: 0.1091 - Training Accuracy: 98.49%
952
+ Step [8700/13913] - Training Loss: 0.0000 - Training Accuracy: 98.49%
953
+ Step [8800/13913] - Training Loss: 0.0000 - Training Accuracy: 98.50%
954
+ Step [8900/13913] - Training Loss: 0.0426 - Training Accuracy: 98.50%
955
+ Step [9000/13913] - Training Loss: 0.0007 - Training Accuracy: 98.50%
956
+ Step [9100/13913] - Training Loss: 0.0399 - Training Accuracy: 98.50%
957
+ Step [9200/13913] - Training Loss: 0.0001 - Training Accuracy: 98.50%
958
+ Step [9300/13913] - Training Loss: 0.0016 - Training Accuracy: 98.50%
959
+ Step [9400/13913] - Training Loss: 0.0115 - Training Accuracy: 98.50%
960
+ Step [9500/13913] - Training Loss: 0.4933 - Training Accuracy: 98.50%
961
+ Step [9600/13913] - Training Loss: 0.0027 - Training Accuracy: 98.50%
962
+ Step [9700/13913] - Training Loss: 0.0516 - Training Accuracy: 98.49%
963
+ Step [9800/13913] - Training Loss: 0.0001 - Training Accuracy: 98.48%
964
+ Step [9900/13913] - Training Loss: 0.4967 - Training Accuracy: 98.48%
965
+ Step [10000/13913] - Training Loss: 0.0000 - Training Accuracy: 98.49%
966
+ Step [10100/13913] - Training Loss: 0.0000 - Training Accuracy: 98.48%
967
+ Step [10200/13913] - Training Loss: 0.0443 - Training Accuracy: 98.48%
968
+ Step [10300/13913] - Training Loss: 0.0320 - Training Accuracy: 98.47%
969
+ Step [10400/13913] - Training Loss: 0.0268 - Training Accuracy: 98.48%
970
+ Step [10500/13913] - Training Loss: 0.0006 - Training Accuracy: 98.48%
971
+ Step [10600/13913] - Training Loss: 0.2920 - Training Accuracy: 98.46%
972
+ Step [10700/13913] - Training Loss: 0.0000 - Training Accuracy: 98.46%
973
+ Step [10800/13913] - Training Loss: 0.0903 - Training Accuracy: 98.46%
974
+ Step [10900/13913] - Training Loss: 0.0112 - Training Accuracy: 98.46%
975
+ Step [11000/13913] - Training Loss: 0.3210 - Training Accuracy: 98.46%
976
+ Step [11100/13913] - Training Loss: 0.1806 - Training Accuracy: 98.46%
977
+ Step [11200/13913] - Training Loss: 0.0000 - Training Accuracy: 98.47%
978
+ Step [11300/13913] - Training Loss: 0.0009 - Training Accuracy: 98.47%
979
+ Step [11400/13913] - Training Loss: 0.0192 - Training Accuracy: 98.48%
980
+ Step [11500/13913] - Training Loss: 0.0101 - Training Accuracy: 98.48%
981
+ Step [11600/13913] - Training Loss: 0.1834 - Training Accuracy: 98.48%
982
+ Step [11700/13913] - Training Loss: 0.0118 - Training Accuracy: 98.47%
983
+ Step [11800/13913] - Training Loss: 0.0001 - Training Accuracy: 98.47%
984
+ Step [11900/13913] - Training Loss: 0.0039 - Training Accuracy: 98.47%
985
+ Step [12000/13913] - Training Loss: 0.0000 - Training Accuracy: 98.47%
986
+ Step [12100/13913] - Training Loss: 0.3104 - Training Accuracy: 98.46%
987
+ Step [12200/13913] - Training Loss: 0.2120 - Training Accuracy: 98.46%
988
+ Step [12300/13913] - Training Loss: 0.0047 - Training Accuracy: 98.46%
989
+ Step [12400/13913] - Training Loss: 0.0189 - Training Accuracy: 98.46%
990
+ Step [12500/13913] - Training Loss: 0.1018 - Training Accuracy: 98.46%
991
+ Step [12600/13913] - Training Loss: 0.0133 - Training Accuracy: 98.46%
992
+ Step [12700/13913] - Training Loss: 0.0022 - Training Accuracy: 98.47%
993
+ Step [12800/13913] - Training Loss: 0.0004 - Training Accuracy: 98.47%
994
+ Step [12900/13913] - Training Loss: 0.0001 - Training Accuracy: 98.47%
995
+ Step [13000/13913] - Training Loss: 0.0012 - Training Accuracy: 98.46%
996
+ Step [13100/13913] - Training Loss: 0.0368 - Training Accuracy: 98.47%
997
+ Step [13200/13913] - Training Loss: 0.0000 - Training Accuracy: 98.46%
998
+ Step [13300/13913] - Training Loss: 0.0053 - Training Accuracy: 98.46%
999
+ Step [13400/13913] - Training Loss: 0.0000 - Training Accuracy: 98.46%
1000
+ Step [13500/13913] - Training Loss: 0.0019 - Training Accuracy: 98.46%
1001
+ Step [13600/13913] - Training Loss: 0.0007 - Training Accuracy: 98.46%
1002
+ Step [13700/13913] - Training Loss: 0.0117 - Training Accuracy: 98.46%
1003
+ Step [13800/13913] - Training Loss: 0.0079 - Training Accuracy: 98.45%
1004
+ Step [13900/13913] - Training Loss: 0.0001 - Training Accuracy: 98.46%
1005
+ Epoch 7/20 - Validation: 100%|██████████| 1511/1511 [06:12<00:00, 4.06it/s]
1006
+ Epoch [7/20] - Training Loss: 0.0496, Training Accuracy: 98.46% - Validation Loss: 0.0954, Validation Accuracy: 97.53%
1007
+ outdir /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/checkpoints/HCPflat_large_gsrFalse_HCP_FT
1008
+ Saved model and config to /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/checkpoints/HCPflat_large_gsrFalse_HCP_FT
1009
+ Epoch 8/20 - Training: 23%|██▎ | 3199/13913 [18:27<1:01:45, 2.89it/s]
1010
+ Step [100/13913] - Training Loss: 0.0001 - Training Accuracy: 99.00%
1011
+ Step [200/13913] - Training Loss: 0.2565 - Training Accuracy: 98.88%
1012
+ Step [300/13913] - Training Loss: 0.2976 - Training Accuracy: 98.79%
1013
+ Step [400/13913] - Training Loss: 0.0002 - Training Accuracy: 98.81%
1014
+ Step [500/13913] - Training Loss: 0.0002 - Training Accuracy: 98.88%
1015
+ Step [600/13913] - Training Loss: 0.1154 - Training Accuracy: 98.71%
1016
+ Step [700/13913] - Training Loss: 0.0000 - Training Accuracy: 98.75%
1017
+ Step [800/13913] - Training Loss: 0.0067 - Training Accuracy: 98.81%
1018
+ Step [900/13913] - Training Loss: 0.0015 - Training Accuracy: 98.85%
1019
+ Step [1000/13913] - Training Loss: 0.0004 - Training Accuracy: 98.86%
1020
+ Step [1100/13913] - Training Loss: 0.0082 - Training Accuracy: 98.89%
1021
+ Step [1200/13913] - Training Loss: 0.0000 - Training Accuracy: 98.92%
1022
+ Step [1300/13913] - Training Loss: 0.6948 - Training Accuracy: 98.86%
1023
+ Step [1400/13913] - Training Loss: 0.0909 - Training Accuracy: 98.83%
1024
+ Step [1500/13913] - Training Loss: 0.0063 - Training Accuracy: 98.78%
1025
+ Step [1600/13913] - Training Loss: 0.0001 - Training Accuracy: 98.77%
1026
+ Step [1700/13913] - Training Loss: 0.0006 - Training Accuracy: 98.76%
1027
+ Step [1800/13913] - Training Loss: 0.0000 - Training Accuracy: 98.75%
1028
+ Step [1900/13913] - Training Loss: 0.1061 - Training Accuracy: 98.70%
1029
+ Step [2000/13913] - Training Loss: 0.0001 - Training Accuracy: 98.62%
1030
+ Step [2100/13913] - Training Loss: 0.0014 - Training Accuracy: 98.64%
1031
+ Step [2200/13913] - Training Loss: 0.0710 - Training Accuracy: 98.64%
1032
+ Step [2300/13913] - Training Loss: 0.0004 - Training Accuracy: 98.66%
1033
+ Step [2400/13913] - Training Loss: 0.0000 - Training Accuracy: 98.68%
1034
+ Step [2500/13913] - Training Loss: 0.0005 - Training Accuracy: 98.69%
1035
+ Step [2600/13913] - Training Loss: 0.0008 - Training Accuracy: 98.71%
1036
+ Step [2700/13913] - Training Loss: 0.0596 - Training Accuracy: 98.71%
1037
+ Step [2800/13913] - Training Loss: 0.0853 - Training Accuracy: 98.71%
1038
+ Step [2900/13913] - Training Loss: 0.0000 - Training Accuracy: 98.69%
1039
+ Step [3000/13913] - Training Loss: 0.0000 - Training Accuracy: 98.67%
1040
+ Step [3100/13913] - Training Loss: 0.0000 - Training Accuracy: 98.66%
1041
+ Step [3200/13913] - Training Loss: 0.0000 - Training Accuracy: 98.67%
1042
+ Step [3300/13913] - Training Loss: 0.0012 - Training Accuracy: 98.66%
1043
+ Step [3400/13913] - Training Loss: 0.0000 - Training Accuracy: 98.65%
1044
+ Step [3500/13913] - Training Loss: 0.0043 - Training Accuracy: 98.65%
1045
+ Step [3600/13913] - Training Loss: 0.0002 - Training Accuracy: 98.63%
1046
+ Step [3700/13913] - Training Loss: 0.0055 - Training Accuracy: 98.64%
1047
+ Step [3800/13913] - Training Loss: 0.0001 - Training Accuracy: 98.65%
1048
+ Step [3900/13913] - Training Loss: 0.0120 - Training Accuracy: 98.67%
1049
+ Step [4000/13913] - Training Loss: 0.0140 - Training Accuracy: 98.68%
1050
+ Step [4100/13913] - Training Loss: 0.0622 - Training Accuracy: 98.68%
1051
+ Step [4200/13913] - Training Loss: 0.0000 - Training Accuracy: 98.66%
1052
+ Step [4300/13913] - Training Loss: 0.0012 - Training Accuracy: 98.67%
1053
+ Step [4400/13913] - Training Loss: 0.0465 - Training Accuracy: 98.67%
1054
+ Step [4500/13913] - Training Loss: 0.0000 - Training Accuracy: 98.67%
1055
+ Step [4600/13913] - Training Loss: 0.0003 - Training Accuracy: 98.64%
1056
+ Step [4700/13913] - Training Loss: 0.0143 - Training Accuracy: 98.64%
1057
+ Step [4800/13913] - Training Loss: 0.0019 - Training Accuracy: 98.65%
1058
+ Step [4900/13913] - Training Loss: 0.7049 - Training Accuracy: 98.65%
1059
+ Step [5000/13913] - Training Loss: 0.1890 - Training Accuracy: 98.66%
1060
+ Step [5100/13913] - Training Loss: 0.0007 - Training Accuracy: 98.65%
fMRI-foundation-model/src/wandb/run-20241024_030627-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3/files/requirements.txt ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ protobuf==5.28.2
2
+ imageio==2.35.1
3
+ MarkupSafe==3.0.0
4
+ regex==2024.9.11
5
+ matplotlib==3.9.2
6
+ notebook==7.2.2
7
+ debugpy==1.8.6
8
+ aiosignal==1.3.1
9
+ jupyter_core==5.7.2
10
+ torchaudio==2.4.1+cu121
11
+ python-json-logger==2.0.7
12
+ six==1.16.0
13
+ scikit-image==0.24.0
14
+ types-python-dateutil==2.9.0.20241003
15
+ PyYAML==6.0.2
16
+ httpcore==1.0.6
17
+ clip==1.0
18
+ babel==2.16.0
19
+ webcolors==24.8.0
20
+ omegaconf==2.3.0
21
+ webencodings==0.5.1
22
+ kiwisolver==1.4.7
23
+ uri-template==1.3.0
24
+ diffusers==0.23.0
25
+ idna==3.10
26
+ fsspec==2024.9.0
27
+ parso==0.8.4
28
+ setuptools==65.5.0
29
+ tornado==6.4.1
30
+ webdataset==0.2.100
31
+ decord==0.6.0
32
+ nvidia-curand-cu12==10.3.2.106
33
+ ipykernel==6.29.5
34
+ jupyter==1.1.1
35
+ pexpect==4.9.0
36
+ kornia_rs==0.1.5
37
+ iopath==0.1.10
38
+ async-lru==2.0.4
39
+ future==1.0.0
40
+ torchvision==0.19.1+cu121
41
+ botocore==1.34.162
42
+ cycler==0.12.1
43
+ tzdata==2024.2
44
+ jupyter_server_terminals==0.5.3
45
+ click==8.1.7
46
+ einops==0.8.0
47
+ pyzmq==26.2.0
48
+ jupyter_client==8.6.3
49
+ nbconvert==7.16.4
50
+ scikit-learn==1.5.2
51
+ executing==2.1.0
52
+ asttokens==2.4.1
53
+ docker-pycreds==0.4.0
54
+ matplotlib-inline==0.1.7
55
+ overrides==7.7.0
56
+ websocket-client==1.8.0
57
+ nbformat==5.10.4
58
+ elbow==0.1.1
59
+ contourpy==1.3.0
60
+ nvidia-cudnn-cu12==9.1.0.70
61
+ transformers==4.44.2
62
+ gitdb==4.0.11
63
+ jupyterlab_nvdashboard==0.11.0
64
+ lazy_loader==0.4
65
+ jsonpointer==3.0.0
66
+ notebook_shim==0.2.4
67
+ nvidia-nccl-cu12==2.20.5
68
+ ffmpeg-python==0.2.0
69
+ triton==3.0.0
70
+ mistune==3.0.2
71
+ python-dateutil==2.9.0.post0
72
+ beautifulsoup4==4.12.3
73
+ nbclient==0.10.0
74
+ h5py==3.12.1
75
+ ftfy==6.2.3
76
+ zipp==3.20.2
77
+ ptyprocess==0.7.0
78
+ huggingface-hub==0.25.1
79
+ pytz==2024.2
80
+ jupyterlab_pygments==0.3.0
81
+ nvidia-cublas-cu12==12.1.3.1
82
+ pandocfilters==1.5.1
83
+ Jinja2==3.1.4
84
+ arrow==1.3.0
85
+ rpds-py==0.20.0
86
+ jupyter_server==2.14.2
87
+ simplejson==3.19.3
88
+ networkx==3.3
89
+ packaging==24.1
90
+ traitlets==5.14.3
91
+ pandas==2.2.3
92
+ xformers==0.0.22.post7
93
+ lightning-utilities==0.11.7
94
+ tifffile==2024.9.20
95
+ nvidia-cuda-cupti-cu12==12.1.105
96
+ mpmath==1.3.0
97
+ GitPython==3.1.43
98
+ scipy==1.14.1
99
+ jsonschema==4.23.0
100
+ prompt_toolkit==3.0.48
101
+ s3transfer==0.10.2
102
+ multidict==6.1.0
103
+ bleach==6.1.0
104
+ sentry-sdk==2.15.0
105
+ nibabel==5.2.1
106
+ accelerate==1.0.0
107
+ pyarrow==17.0.0
108
+ threadpoolctl==3.5.0
109
+ attrs==24.2.0
110
+ rfc3986-validator==0.1.1
111
+ nvidia-cuda-runtime-cu12==12.1.105
112
+ ipywidgets==8.1.5
113
+ frozenlist==1.4.1
114
+ pycparser==2.22
115
+ jupyterlab_server==2.27.3
116
+ nvidia-cuda-nvrtc-cu12==12.1.105
117
+ yarl==1.13.1
118
+ setproctitle==1.3.3
119
+ isoduration==20.11.0
120
+ Pygments==2.18.0
121
+ jedi==0.19.1
122
+ boto3==1.34.57
123
+ tokenizers==0.19.1
124
+ referencing==0.35.1
125
+ rfc3339-validator==0.1.4
126
+ pillow==10.4.0
127
+ jupyterlab==4.2.5
128
+ stack-data==0.6.3
129
+ h11==0.14.0
130
+ anyio==4.6.0
131
+ nilearn==0.10.4
132
+ nvidia-cusolver-cu12==11.4.5.107
133
+ tinycss2==1.3.0
134
+ defusedxml==0.7.1
135
+ argon2-cffi-bindings==21.2.0
136
+ soupsieve==2.6
137
+ nest-asyncio==1.6.0
138
+ torchmetrics==1.3.0.post0
139
+ tqdm==4.66.5
140
+ cffi==1.17.1
141
+ charset-normalizer==3.3.2
142
+ jsonschema-specifications==2023.12.1
143
+ decorator==5.1.1
144
+ open_clip_torch==2.26.1
145
+ jupyter-events==0.10.0
146
+ smart-open==7.0.5
147
+ antlr4-python3-runtime==4.9.3
148
+ prometheus_client==0.21.0
149
+ kornia==0.7.3
150
+ typing_extensions==4.12.2
151
+ sniffio==1.3.1
152
+ joblib==1.4.2
153
+ comm==0.2.2
154
+ aiohappyeyeballs==2.4.3
155
+ numpy==2.1.2
156
+ braceexpand==0.1.7
157
+ certifi==2024.8.30
158
+ psutil==6.0.0
159
+ pyparsing==3.1.4
160
+ pure_eval==0.2.3
161
+ nvidia-cusparse-cu12==12.1.0.106
162
+ wandb==0.18.3
163
+ urllib3==2.2.3
164
+ smmap==5.0.1
165
+ platformdirs==4.3.6
166
+ torch==2.4.1+cu121
167
+ requests==2.32.3
168
+ json5==0.9.25
169
+ nvidia-nvjitlink-cu12==12.6.77
170
+ jupyterlab_widgets==3.0.13
171
+ lxml==5.3.0
172
+ httpx==0.27.2
173
+ opencv-python==4.6.0.66
174
+ portalocker==2.10.1
175
+ pytorch-lightning==2.0.1
176
+ sympy==1.13.3
177
+ wcwidth==0.2.13
178
+ jmespath==1.0.1
179
+ fqdn==1.5.1
180
+ pynvml==11.5.3
181
+ pip==24.0
182
+ wrapt==1.16.0
183
+ aiohttp==3.10.9
184
+ filelock==3.16.1
185
+ fonttools==4.54.1
186
+ fastjsonschema==2.20.0
187
+ jupyter-console==6.6.3
188
+ widgetsnbextension==4.0.13
189
+ timm==1.0.9
190
+ nvidia-cufft-cu12==11.0.2.54
191
+ ipython==8.28.0
192
+ nvidia-nvtx-cu12==12.1.105
193
+ jupyter-lsp==2.2.5
194
+ safetensors==0.4.5
195
+ terminado==0.18.1
196
+ argon2-cffi==23.1.0
197
+ Send2Trash==1.8.3
198
+ importlib_metadata==8.5.0
fMRI-foundation-model/src/wandb/run-20241024_030627-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3/files/wandb-metadata.json ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "os": "Linux-5.15.0-1058-aws-x86_64-with-glibc2.31",
3
+ "python": "3.11.10",
4
+ "startedAt": "2024-10-24T03:06:27.419523Z",
5
+ "args": [
6
+ "HCPflat_large_gsrFalse_",
7
+ "epoch99.pth"
8
+ ],
9
+ "program": "/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/HCP_downstream_finetune.py",
10
+ "codePath": "src/HCP_downstream_finetune.py",
11
+ "git": {
12
+ "remote": "https://github.com/MedARC-AI/fMRI-foundation-model",
13
+ "commit": "cf8214d4ebe437188b68b4ee5a34c5211a810db0"
14
+ },
15
+ "email": "torrico.villanueva.cesar.kadir@gmail.com",
16
+ "root": "/weka/proj-fmri/ckadirt/fMRI-foundation-model/src",
17
+ "host": "ip-10-0-181-207",
18
+ "username": "ckadirt",
19
+ "executable": "/admin/home-ckadirt/foundation_env/bin/python",
20
+ "codePathLocal": "HCP_downstream_finetune.py",
21
+ "cpu_count": 96,
22
+ "cpu_count_logical": 192,
23
+ "gpu": "[NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3]",
24
+ "gpu_count": 8,
25
+ "disk": {
26
+ "/": {
27
+ "total": "249555763200",
28
+ "used": "184490491904"
29
+ }
30
+ },
31
+ "memory": {
32
+ "total": "2147443412992"
33
+ },
34
+ "cpu": {
35
+ "count": 96,
36
+ "countLogical": 192
37
+ },
38
+ "gpu_nvidia": [
39
+ {
40
+ "name": "NVIDIA H100 80GB HBM3",
41
+ "memoryTotal": "85520809984",
42
+ "cudaCores": 16896,
43
+ "architecture": "Hopper"
44
+ },
45
+ {
46
+ "name": "NVIDIA H100 80GB HBM3",
47
+ "memoryTotal": "85520809984",
48
+ "cudaCores": 16896,
49
+ "architecture": "Hopper"
50
+ },
51
+ {
52
+ "name": "NVIDIA H100 80GB HBM3",
53
+ "memoryTotal": "85520809984",
54
+ "cudaCores": 16896,
55
+ "architecture": "Hopper"
56
+ },
57
+ {
58
+ "name": "NVIDIA H100 80GB HBM3",
59
+ "memoryTotal": "85520809984",
60
+ "cudaCores": 16896,
61
+ "architecture": "Hopper"
62
+ },
63
+ {
64
+ "name": "NVIDIA H100 80GB HBM3",
65
+ "memoryTotal": "85520809984",
66
+ "cudaCores": 16896,
67
+ "architecture": "Hopper"
68
+ },
69
+ {
70
+ "name": "NVIDIA H100 80GB HBM3",
71
+ "memoryTotal": "85520809984",
72
+ "cudaCores": 16896,
73
+ "architecture": "Hopper"
74
+ },
75
+ {
76
+ "name": "NVIDIA H100 80GB HBM3",
77
+ "memoryTotal": "85520809984",
78
+ "cudaCores": 16896,
79
+ "architecture": "Hopper"
80
+ },
81
+ {
82
+ "name": "NVIDIA H100 80GB HBM3",
83
+ "memoryTotal": "85520809984",
84
+ "cudaCores": 16896,
85
+ "architecture": "Hopper"
86
+ }
87
+ ],
88
+ "slurm": {
89
+ "cluster_name": "sagemaker2",
90
+ "conf": "/opt/slurm/etc/slurm.conf",
91
+ "cpus_on_node": "20",
92
+ "gpus_on_node": "1",
93
+ "gpus_per_task": "1",
94
+ "gtids": "0",
95
+ "job_account": "fmri",
96
+ "job_cpus_per_node": "20",
97
+ "job_end_time": "1729782342",
98
+ "job_gid": "1879800513",
99
+ "job_gpus": "5",
100
+ "job_id": "528679",
101
+ "job_name": "finetuneHCP",
102
+ "job_nodelist": "ip-10-0-181-207",
103
+ "job_num_nodes": "1",
104
+ "job_partition": "p5",
105
+ "job_qos": "normal",
106
+ "job_start_time": "1729739142",
107
+ "job_uid": "1879804696",
108
+ "job_user": "ckadirt",
109
+ "jobid": "528679",
110
+ "localid": "0",
111
+ "mem_per_cpu": "11500",
112
+ "nnodes": "1",
113
+ "node_aliases": "(null)",
114
+ "nodeid": "0",
115
+ "nodelist": "ip-10-0-181-207",
116
+ "nprocs": "1",
117
+ "ntasks": "1",
118
+ "ntasks_per_node": "1",
119
+ "prio_process": "0",
120
+ "procid": "0",
121
+ "script_context": "prolog_task",
122
+ "submit_dir": "/weka/proj-fmri/ckadirt/fMRI-foundation-model/src",
123
+ "submit_host": "ip-172-17-12-61",
124
+ "task_pid": "592152",
125
+ "tasks_per_node": "1",
126
+ "topology_addr": "ip-10-0-181-207",
127
+ "topology_addr_pattern": "node",
128
+ "working_cluster": "sagemaker2:ip-172-17-63-161:6817:9984:109"
129
+ },
130
+ "cudaVersion": "12.2"
131
+ }
fMRI-foundation-model/src/wandb/run-20241024_030627-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3/logs/debug-core.log ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {"time":"2024-10-24T03:06:26.789669378Z","level":"INFO","msg":"started logging, with flags","port-filename":"/tmp/tmp5ptgx0lh/port-592198.txt","pid":592198,"debug":false,"disable-analytics":false}
2
+ {"time":"2024-10-24T03:06:26.790082883Z","level":"INFO","msg":"FeatureState","shutdownOnParentExitEnabled":false}
3
+ {"time":"2024-10-24T03:06:26.794365158Z","level":"INFO","msg":"Will exit if parent process dies.","ppid":592198}
4
+ {"time":"2024-10-24T03:06:26.794351487Z","level":"INFO","msg":"server is running","addr":{"IP":"127.0.0.1","Port":43147,"Zone":""}}
5
+ {"time":"2024-10-24T03:06:26.903783392Z","level":"INFO","msg":"connection: ManageConnectionData: new connection created","id":"127.0.0.1:55326"}
6
+ {"time":"2024-10-24T03:06:27.421865307Z","level":"INFO","msg":"handleInformInit: received","streamId":"HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3","id":"127.0.0.1:55326"}
7
+ {"time":"2024-10-24T03:06:27.478326181Z","level":"INFO","msg":"handleInformInit: stream started","streamId":"HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3","id":"127.0.0.1:55326"}
fMRI-foundation-model/src/wandb/run-20241024_030627-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3/logs/debug-internal.log ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"time":"2024-10-24T03:06:27.431516851Z","level":"INFO","msg":"using version","core version":"0.18.3"}
2
+ {"time":"2024-10-24T03:06:27.431534401Z","level":"INFO","msg":"created symlink","path":"/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241024_030627-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3/logs/debug-core.log"}
3
+ {"time":"2024-10-24T03:06:27.439027677Z","level":"ERROR","msg":"dialing: google: could not find default credentials. See https://cloud.google.com/docs/authentication/external/set-up-adc for more information"}
4
+ {"time":"2024-10-24T03:06:27.478294391Z","level":"INFO","msg":"created new stream","id":"HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3"}
5
+ {"time":"2024-10-24T03:06:27.478318761Z","level":"INFO","msg":"stream: started","id":"HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3"}
6
+ {"time":"2024-10-24T03:06:27.478360981Z","level":"INFO","msg":"sender: started","stream_id":{"value":"HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3"}}
7
+ {"time":"2024-10-24T03:06:27.478339891Z","level":"INFO","msg":"handler: started","stream_id":{"value":"HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3"}}
8
+ {"time":"2024-10-24T03:06:27.478333921Z","level":"INFO","msg":"writer: Do: started","stream_id":{"value":"HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3"}}
9
+ {"time":"2024-10-24T03:06:27.998873439Z","level":"INFO","msg":"wandb-core","!BADKEY":null}
10
+ {"time":"2024-10-24T03:06:28.004590282Z","level":"INFO","msg":"Starting system monitor"}
11
+ {"time":"2024-10-24T03:06:28.031657309Z","level":"ERROR","msg":"git repo not found","error":"repository does not exist"}
fMRI-foundation-model/src/wandb/run-20241024_030627-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3/logs/debug.log ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 2024-10-24 03:06:27,407 INFO MainThread:592198 [wandb_setup.py:_flush():79] Current SDK version is 0.18.3
2
+ 2024-10-24 03:06:27,407 INFO MainThread:592198 [wandb_setup.py:_flush():79] Configure stats pid to 592198
3
+ 2024-10-24 03:06:27,407 INFO MainThread:592198 [wandb_setup.py:_flush():79] Loading settings from /admin/home-ckadirt/.config/wandb/settings
4
+ 2024-10-24 03:06:27,407 INFO MainThread:592198 [wandb_setup.py:_flush():79] Loading settings from /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/settings
5
+ 2024-10-24 03:06:27,407 INFO MainThread:592198 [wandb_setup.py:_flush():79] Loading settings from environment variables: {}
6
+ 2024-10-24 03:06:27,407 INFO MainThread:592198 [wandb_setup.py:_flush():79] Applying setup settings: {'mode': None, '_disable_service': None}
7
+ 2024-10-24 03:06:27,407 INFO MainThread:592198 [wandb_setup.py:_flush():79] Inferring run settings from compute environment: {'program_relpath': 'src/HCP_downstream_finetune.py', 'program_abspath': '/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/HCP_downstream_finetune.py', 'program': '/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/HCP_downstream_finetune.py'}
8
+ 2024-10-24 03:06:27,407 INFO MainThread:592198 [wandb_setup.py:_flush():79] Applying login settings: {}
9
+ 2024-10-24 03:06:27,408 INFO MainThread:592198 [wandb_init.py:_log_setup():532] Logging user logs to /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241024_030627-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3/logs/debug.log
10
+ 2024-10-24 03:06:27,408 INFO MainThread:592198 [wandb_init.py:_log_setup():533] Logging internal logs to /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241024_030627-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3/logs/debug-internal.log
11
+ 2024-10-24 03:06:27,408 INFO MainThread:592198 [wandb_init.py:init():617] calling init triggers
12
+ 2024-10-24 03:06:27,408 INFO MainThread:592198 [wandb_init.py:init():624] wandb.init called with sweep_config: {}
13
+ config: {'model_name': 'HCPflat_large_gsrFalse__HCP_FT', 'batch_size': 8, 'learning_rate': 0.0001, 'weight_decay': 1e-05, 'num_epochs': 20, 'seed': 42}
14
+ 2024-10-24 03:06:27,408 INFO MainThread:592198 [wandb_init.py:init():667] starting backend
15
+ 2024-10-24 03:06:27,408 INFO MainThread:592198 [wandb_init.py:init():671] sending inform_init request
16
+ 2024-10-24 03:06:27,418 INFO MainThread:592198 [backend.py:_multiprocessing_setup():104] multiprocessing start_methods=fork,spawn,forkserver, using: spawn
17
+ 2024-10-24 03:06:27,418 INFO MainThread:592198 [wandb_init.py:init():684] backend started and connected
18
+ 2024-10-24 03:06:27,441 INFO MainThread:592198 [wandb_init.py:init():779] updated telemetry
19
+ 2024-10-24 03:06:27,476 INFO MainThread:592198 [wandb_init.py:init():812] communicating run to backend with 90.0 second timeout
20
+ 2024-10-24 03:06:27,982 INFO MainThread:592198 [wandb_init.py:init():863] starting run threads in backend
21
+ 2024-10-24 03:06:28,560 INFO MainThread:592198 [wandb_run.py:_console_start():2465] atexit reg
22
+ 2024-10-24 03:06:28,560 INFO MainThread:592198 [wandb_run.py:_redirect():2313] redirect: wrap_raw
23
+ 2024-10-24 03:06:28,560 INFO MainThread:592198 [wandb_run.py:_redirect():2378] Wrapping output streams.
24
+ 2024-10-24 03:06:28,560 INFO MainThread:592198 [wandb_run.py:_redirect():2403] Redirects installed.
25
+ 2024-10-24 03:06:28,568 INFO MainThread:592198 [wandb_init.py:init():907] run started, returning control to user process
fMRI-foundation-model/src/wandb/run-20241024_030627-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3/run-HCPflat_large_gsrFalse__HCP_FT_de34f7fc-fb8f-4fd0-9cf6-e2d830e622e3.wandb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:55f7a23710fc1aa56a55bd658b8d1d74fe05ee4272d14b27e27e16aa189fe9ce
3
+ size 71237632
fMRI-foundation-model/src/wandb/run-20241024_160745-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427/files/code/src/HCP_downstream_finetune.py ADDED
@@ -0,0 +1,597 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # coding: utf-8
3
+
4
+ # In[1]:
5
+
6
+
7
+ # Import packages and setup gpu configuration.
8
+ # This code block shouldnt need to be adjusted!
9
+ import os
10
+ import sys
11
+ import json
12
+ import yaml
13
+ import numpy as np
14
+ import copy
15
+ import math
16
+ import time
17
+ import random
18
+ from tqdm.auto import tqdm
19
+ import webdataset as wds
20
+ import matplotlib.pyplot as plt
21
+
22
+ import torch
23
+ import torch.nn as nn
24
+ from torchvision import transforms
25
+ import utils
26
+ from mae_utils.flat_models import *
27
+ import h5py
28
+ from mae_utils import flat_models
29
+
30
+ # tf32 data type is faster than standard float32
31
+ torch.backends.cuda.matmul.allow_tf32 = True
32
+ # following fixes a Conv3D CUDNN_NOT_SUPPORTED error
33
+ torch.backends.cudnn.benchmark = True
34
+
35
+ # ## MODEL TO LOAD ##
36
+ if utils.is_interactive():
37
+ model_name = "HCPflat_large_gsrFalse_"
38
+ else:
39
+ model_name = sys.argv[1]
40
+
41
+
42
+ # outdir = os.path.abspath(f'checkpoints/{model_name}')
43
+ outdir = os.path.abspath(f'checkpoints/{model_name}')
44
+
45
+ print("outdir", outdir)
46
+ # Load previous config.yaml if available
47
+ if os.path.exists(f"{outdir}/config.yaml"):
48
+ config = yaml.load(open(f"{outdir}/config.yaml", 'r'), Loader=yaml.FullLoader)
49
+ print(f"Loaded config.yaml from ckpt folder {outdir}")
50
+ # create global variables from the config
51
+ print("\n__CONFIG__")
52
+ for attribute_name in config.keys():
53
+ print(f"{attribute_name} = {config[attribute_name]}")
54
+ globals()[attribute_name] = config[f'{attribute_name}']
55
+ print("\n")
56
+
57
+ world_size = os.getenv('WORLD_SIZE')
58
+ if world_size is None:
59
+ world_size = 1
60
+ else:
61
+ world_size = int(world_size)
62
+ print(f"WORLD_SIZE={world_size}")
63
+
64
+ if utils.is_interactive():
65
+ # Following allows you to change functions in models.py or utils.py and
66
+ # have this notebook automatically update with your revisions
67
+ get_ipython().run_line_magic('load_ext', 'autoreload')
68
+ get_ipython().run_line_magic('autoreload', '2')
69
+
70
+ batch_size = probe_batch_size
71
+ num_epochs = probe_num_epochs
72
+
73
+ data_type = torch.float32 # change depending on your mixed_precision
74
+ global_batch_size = batch_size * world_size
75
+
76
+ device = torch.device('cuda')
77
+
78
+ hcp_flat_path = "/weka/proj-medarc/shared/HCP-Flat"
79
+ # seed = 42
80
+ # num_frames = 16
81
+ # gsr = False
82
+ # num_workers = 10
83
+ # batch_size = 128
84
+ save_ckpt = True
85
+ wandb_log = True
86
+ print("PID of this process =",os.getpid())
87
+ utils.seed_everything(seed)
88
+
89
+
90
+ # In[2]:
91
+
92
+
93
+ if os.getenv('global_pool') == "False":
94
+ global_pool = False
95
+ else:
96
+ global_pool = True
97
+ print(f"global_pool = {global_pool}")
98
+
99
+ try:
100
+ gsr
101
+ except:
102
+ gsr = True
103
+ print("set gsr to True")
104
+ print(f"gsr = {gsr}")
105
+
106
+
107
+ # In[3]:
108
+
109
+
110
+ #### UNCOMMENT THIS TO SAVE THE HCP-FLAT IN HDF5 FORMAT
111
+
112
+
113
+ # from torch.utils.data import default_collate
114
+ # from mae_utils.flat import load_hcp_flat_mask
115
+ # from mae_utils.flat import create_hcp_flat
116
+ # from mae_utils.flat import batch_unmask
117
+ # import mae_utils.visualize as vis
118
+
119
+
120
+ # batch_size = 26
121
+ # print(f"changed batch_size to {batch_size}")
122
+
123
+ # ## Test ##
124
+ # datasets_to_include = "HCP"
125
+ # assert "HCP" in datasets_to_include
126
+ # test_dataset = create_hcp_flat(root=hcp_flat_path,
127
+ # clip_mode="event", frames=num_frames, shuffle=False, gsr=gsr, sub_list = 'test')
128
+ # test_dl = wds.WebLoader(
129
+ # test_dataset.batched(batch_size, partial=False, collation_fn=default_collate),
130
+ # batch_size=None,
131
+ # shuffle=False,
132
+ # num_workers=num_workers,
133
+ # pin_memory=True,
134
+ # )
135
+
136
+ # ## Train ##
137
+ # assert "HCP" in datasets_to_include
138
+ # train_dataset = create_hcp_flat(root=hcp_flat_path,
139
+ # clip_mode="event", frames=num_frames, shuffle=False, gsr=gsr, sub_list = 'train')
140
+ # train_dl = wds.WebLoader(
141
+ # train_dataset.batched(batch_size, partial=False, collation_fn=default_collate),
142
+ # batch_size=None,
143
+ # shuffle=False,
144
+ # num_workers=num_workers,
145
+ # pin_memory=True,
146
+ # )
147
+
148
+ # def flatten_meta(meta_dict):
149
+ # """
150
+ # Flatten the meta dictionary by:
151
+ # - Replacing single-item lists with the item itself.
152
+ # - Converting tensors to scalar numbers.
153
+ # """
154
+ # flattened = {}
155
+ # for key, value in meta_dict.items():
156
+ # if isinstance(value, list):
157
+ # if len(value) == 1:
158
+ # flattened[key] = value[0] # Replace list with its single item
159
+ # else:
160
+ # flattened[key] = value # Keep as is if multiple items
161
+ # elif isinstance(value, torch.Tensor):
162
+ # # Convert tensor to scalar
163
+ # if value.numel() == 1:
164
+ # flattened[key] = value.item()
165
+ # else:
166
+ # flattened[key] = value.tolist() # Convert multi-element tensor to list
167
+ # else:
168
+ # flattened[key] = value # Keep the value as is
169
+ # return flattened
170
+
171
+ # import h5py
172
+ # meta_array = np.array([], dtype=object)
173
+ # # Open an HDF5 file in write mode
174
+ # with h5py.File('train_hcp.hdf5', 'w') as h5f:
175
+ # flatmaps_dset = None
176
+
177
+ # total_samples = 0
178
+
179
+ # for i, batch in tqdm(enumerate(train_dl), total = 120000):
180
+ # images = batch['image'][0]
181
+ # meta = batch['meta']
182
+ # batch_size = images.shape[0]
183
+ # meta_serializable = meta.copy()
184
+
185
+
186
+ # # Step 2: Serialize the dictionary to a JSON string
187
+ # meta_str = json.dumps(flatten_meta(meta_serializable), indent=4)
188
+ # meta_array = np.append(meta_array, meta_str)
189
+ # if flatmaps_dset is None:
190
+ # # Initialize datasets with unlimited (None) maxshape along the first axis
191
+ # flatmaps_shape = (0,) + images.shape[1:]
192
+ # flatmaps_maxshape = (None,) + images.shape[1:]
193
+
194
+ # flatmaps_dset = h5f.create_dataset(
195
+ # 'flatmaps',
196
+ # shape=flatmaps_shape,
197
+ # maxshape=flatmaps_maxshape,
198
+ # dtype=np.float16,
199
+ # chunks=True # Enable chunking for efficient resizing
200
+ # )
201
+
202
+ # # Resize datasets to accommodate new data
203
+ # flatmaps_dset.resize(total_samples + batch_size, axis=0)
204
+
205
+ # # Write data to the datasets
206
+ # flatmaps_dset[total_samples:total_samples + batch_size] = images.numpy().astype(np.float16)
207
+
208
+ # total_samples += batch_size
209
+
210
+ # print(f"Processed {total_samples} samples")
211
+ # np.save('metadata_test_HCP.npy', meta_array)
212
+
213
+
214
+ # import h5py
215
+ # meta_array = np.array([], dtype=object)
216
+ # # Open an HDF5 file in write mode
217
+ # with h5py.File('test_hcp.hdf5', 'w') as h5f:
218
+ # flatmaps_dset = None
219
+
220
+ # total_samples = 0
221
+
222
+ # for i, batch in tqdm(enumerate(test_dl), total = 12000):
223
+ # images = batch['image'][0]
224
+ # meta = batch['meta']
225
+ # batch_size = images.shape[0]
226
+ # meta_serializable = meta.copy()
227
+
228
+
229
+ # # Step 2: Serialize the dictionary to a JSON string
230
+ # meta_str = json.dumps(flatten_meta(meta_serializable), indent=4)
231
+ # meta_array = np.append(meta_array, meta_str)
232
+ # if flatmaps_dset is None:
233
+ # # Initialize datasets with unlimited (None) maxshape along the first axis
234
+ # flatmaps_shape = (0,) + images.shape[1:]
235
+ # flatmaps_maxshape = (None,) + images.shape[1:]
236
+
237
+ # flatmaps_dset = h5f.create_dataset(
238
+ # 'flatmaps',
239
+ # shape=flatmaps_shape,
240
+ # maxshape=flatmaps_maxshape,
241
+ # dtype=np.float16,
242
+ # chunks=True # Enable chunking for efficient resizing
243
+ # )
244
+
245
+ # # Resize datasets to accommodate new data
246
+ # flatmaps_dset.resize(total_samples + batch_size, axis=0)
247
+
248
+ # # Write data to the datasets
249
+ # flatmaps_dset[total_samples:total_samples + batch_size] = images.numpy().astype(np.float16)
250
+
251
+ # total_samples += batch_size
252
+
253
+ # print(f"Processed {total_samples} samples")
254
+ # np.save('metadata_train_HCP.npy', meta_array)
255
+
256
+
257
+ # ### Preparing data
258
+
259
+ # In[4]:
260
+
261
+
262
+ from sklearn.preprocessing import LabelEncoder
263
+
264
+ INCLUDE_CONDS = {
265
+ "fear",
266
+ "neut",
267
+ "math",
268
+ "story",
269
+ "lf",
270
+ "lh",
271
+ "rf",
272
+ "rh",
273
+ "t",
274
+ "match",
275
+ "relation",
276
+ "mental",
277
+ "rnd",
278
+ "0bk_body",
279
+ "2bk_body",
280
+ "0bk_faces",
281
+ "2bk_faces",
282
+ "0bk_places",
283
+ "2bk_places",
284
+ "0bk_tools",
285
+ "2bk_tools",
286
+ }
287
+
288
+ # test_data = []
289
+
290
+ # # Iterate over the DataLoader with a progress bar
291
+ # for sample in tqdm(train_dl, desc="Processing samples"):
292
+ # x = sample['image']
293
+ # y = sample['meta']['trial_type']
294
+ # key = sample['meta']['key']
295
+ # print(x.shape, y, key)
296
+ # break
297
+ # Initialize the label encoder
298
+ label_encoder = LabelEncoder()
299
+ label_encoder.fit(sorted(INCLUDE_CONDS)) # Ensure consistent ordering
300
+
301
+ num_classes = len(label_encoder.classes_)
302
+ print(f"Number of classes: {num_classes}")
303
+
304
+
305
+ # In[5]:
306
+
307
+
308
+ f_train = h5py.File('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/train_hcp.hdf5', 'r')
309
+ flatmaps_train = f_train['flatmaps']
310
+
311
+ f_test = h5py.File('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/test_hcp.hdf5', 'r')
312
+ flatmaps_test = f_test['flatmaps']
313
+
314
+ metadata_train = np.load('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/metadata_train_HCP.npy', allow_pickle=True)
315
+ metadata_test = np.load('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/metadata_test_HCP.npy', allow_pickle=True)
316
+
317
+
318
+ # In[6]:
319
+
320
+
321
+ from torch.utils.data import Dataset, DataLoader
322
+
323
+ class HCPFlatDataset(Dataset):
324
+ def __init__(self, flatmaps, metadata):
325
+ self.flatmaps = flatmaps
326
+ self.metadata = metadata
327
+
328
+ def __len__(self):
329
+ return len(self.metadata)
330
+
331
+ def __getitem__(self, idx):
332
+ return self.flatmaps[idx], json.loads(self.metadata[idx])
333
+ print("Moving datasets to ram")
334
+ # Loading to cpu for faster training, this can take several minutes. Remove this [:] if you want to move one at the time.
335
+ train_dataset = HCPFlatDataset(flatmaps_train, metadata_train)
336
+ train_dl = DataLoader(train_dataset, batch_size=batch_size, shuffle=True, num_workers=num_workers)
337
+
338
+ test_dataset = HCPFlatDataset(flatmaps_test, metadata_test)
339
+ test_dl = DataLoader(test_dataset, batch_size=batch_size, shuffle=False, num_workers=0)
340
+ print("Datasets ready")
341
+
342
+
343
+ # ### Creating and loading Model
344
+
345
+ # In[7]:
346
+
347
+
348
+ from mae_utils.flat import load_hcp_flat_mask
349
+ from mae_utils.flat import create_hcp_flat
350
+ from mae_utils.flat import batch_unmask
351
+ import mae_utils.visualize as vis
352
+
353
+ flat_mask = load_hcp_flat_mask(hcp_flat_path)
354
+
355
+ mae_model = flat_models.mae_vit_large_fmri(
356
+ patch_size=patch_size,
357
+ decoder_embed_dim=decoder_embed_dim,
358
+ t_patch_size=t_patch_size,
359
+ pred_t_dim=pred_t_dim,
360
+ decoder_depth=4,
361
+ cls_embed=cls_embed,
362
+ norm_pix_loss=norm_pix_loss,
363
+ no_qkv_bias=no_qkv_bias,
364
+ sep_pos_embed=sep_pos_embed,
365
+ trunc_init=trunc_init,
366
+ pct_masks_to_decode=pct_masks_to_decode,
367
+ img_mask=flat_mask,
368
+ )
369
+
370
+
371
+ # In[8]:
372
+
373
+
374
+ checkpoint_files = [f for f in os.listdir(outdir) if f.endswith('.pth')]
375
+
376
+ if utils.is_interactive():
377
+ latest_checkpoint = "epoch99.pth"
378
+ else:
379
+ latest_checkpoint = sys.argv[2]
380
+ print(f"latest_checkpoint: {latest_checkpoint}")
381
+
382
+ # Load the checkpoint
383
+ checkpoint_path = os.path.join(outdir, latest_checkpoint)
384
+
385
+ state = torch.load(checkpoint_path)
386
+ mae_model.load_state_dict(state["model_state_dict"], strict=False)
387
+ mae_model.to(device)
388
+
389
+ print(f"\nLoaded checkpoint {latest_checkpoint} from {outdir}\n")
390
+
391
+
392
+ # In[9]:
393
+
394
+
395
+ class LinearClassifier(nn.Module):
396
+ def __init__(self, input_dim, num_classes):
397
+ super(LinearClassifier, self).__init__()
398
+ self.linear = nn.Linear(input_dim, num_classes)
399
+
400
+ def forward(self, x):
401
+ # Flatten the input except for the batch dimension
402
+ x = x.view(x.size(0), -1)
403
+ out = self.linear(x)
404
+ return out # Raw logits
405
+
406
+ # Determine the input dimension from a single sample
407
+ # Assuming images are of shape [1, 16, 144, 320]
408
+ input_dim = np.prod(mae_model(torch.randn(1,1,16,144,320).to(device),global_pool=global_pool, forward_features = True).shape[1:])
409
+ print(f"Input dimension: {input_dim}")
410
+
411
+
412
+ # In[10]:
413
+
414
+
415
+ class FullModel(nn.Module):
416
+ def __init__(self, lc_model, mae_model):
417
+ super(FullModel, self).__init__()
418
+ self.lc_model = lc_model
419
+ self.mae_model = mae_model
420
+
421
+
422
+ def forward(self, x, gsr):
423
+ x = self.mae_model(x, global_pool=global_pool, forward_features = True)
424
+ x = self.lc_model(x)
425
+ return x
426
+
427
+
428
+ # In[11]:
429
+
430
+
431
+ # Initialize the model
432
+ lc_model = LinearClassifier(input_dim=input_dim, num_classes=num_classes)
433
+
434
+ model = FullModel(lc_model, mae_model)
435
+
436
+ # Move the model to the GPU
437
+ model.to(device)
438
+
439
+ # Define loss function
440
+ criterion = nn.CrossEntropyLoss()
441
+
442
+ # Define optimizer with L2 regularization (weight_decay)
443
+ learning_rate = 1e-4
444
+ weight_decay = 3e-5 # Adjust based on your needs
445
+ optimizer = torch.optim.Adam(model.parameters(), lr=learning_rate, weight_decay=weight_decay)
446
+ num_epochs = 20 # Adjust as needed
447
+
448
+
449
+ # ### Data
450
+
451
+ # In[16]:
452
+
453
+
454
+ import uuid
455
+
456
+ myuuid = uuid.uuid4()
457
+ str(myuuid)
458
+
459
+
460
+ # In[17]:
461
+
462
+
463
+ import wandb
464
+
465
+ if utils.is_interactive():
466
+ print("Running in interactive notebook. Disabling W&B and ckpt saving.")
467
+ wandb_log = True
468
+ save_ckpt = True
469
+
470
+ if wandb_log:
471
+ wandb_project = 'fMRI-foundation-model'
472
+ wandb_config = {
473
+ "model_name": model_name+'_HCP_FT',
474
+ "batch_size": batch_size,
475
+ "learning_rate": learning_rate,
476
+ "weight_decay": weight_decay,
477
+ "num_epochs": num_epochs,
478
+ "seed": seed,
479
+ }
480
+ print("wandb_config:\n", wandb_config)
481
+ random_id = str(uuid.uuid4())
482
+ print("wandb_id:", "HCPflat_raw" + f"_{random_id}")
483
+ wandb.init(
484
+ id=model_name+'_HCP_FT' + f"_{random_id}",
485
+ project=wandb_project,
486
+ name=model_name+'_HCP_FT',
487
+ config=wandb_config,
488
+ resume="allow",
489
+ )
490
+
491
+
492
+ # In[13]:
493
+
494
+
495
+ for epoch in range(num_epochs):
496
+ running_train_loss = 0.0
497
+ correct_train = 0
498
+ total_train = 0
499
+ step = 0
500
+
501
+ # with torch.amp.autocast(device_type='cuda'):
502
+ # Training Phase
503
+ model.train()
504
+ for batch in tqdm(train_dl, desc=f"Epoch {epoch+1}/{num_epochs} - Training"):
505
+ optimizer.zero_grad()
506
+ images = batch[0].to(device).float().unsqueeze(1) #fix this # Shape: [batch_size, 1, 16, 144, 320]
507
+ labels = batch[1]['trial_type'] # List of labels
508
+
509
+ encoded_labels = label_encoder.transform(labels)
510
+ encoded_labels = torch.tensor(encoded_labels, dtype=torch.long).to(device) # Shape: [batch_size]
511
+
512
+ # Forward pass
513
+ outputs = model(images, gsr=gsr) # Shape: [num_train_samples, num_classes]
514
+
515
+ # Compute loss
516
+ loss = criterion(outputs, encoded_labels)
517
+
518
+ # Backward pass and optimization
519
+ loss.backward()
520
+ optimizer.step()
521
+
522
+ # Accumulate loss
523
+ running_train_loss += loss.item() * images.size(0)
524
+
525
+
526
+ # Calculate accuracy
527
+ _, predicted = torch.max(outputs, 1)
528
+
529
+ correct_train += (predicted == encoded_labels).sum().item()
530
+ total_train += encoded_labels.size(0)
531
+
532
+ step = step + 1
533
+ if step % 100 == 0:
534
+ print(f"Step [{step}/{len(train_dl)}] - Training Loss: {loss.item():.4f} - Training Accuracy: {100 * correct_train / total_train:.2f}%")
535
+ # thth
536
+
537
+ epoch_train_loss = running_train_loss / total_train if total_train > 0 else 0.0
538
+ train_accuracy = 100 * correct_train / total_train if total_train > 0 else 0.0
539
+
540
+ # Validation Phase
541
+ model.eval()
542
+ running_val_loss = 0.0
543
+ correct_val = 0
544
+ total_val = 0
545
+
546
+ with torch.no_grad():
547
+ for batch in tqdm(test_dl, desc=f"Epoch {epoch+1}/{num_epochs} - Validation"):
548
+
549
+ images = batch[0].to(device).float().unsqueeze(1) #fix this
550
+ labels = batch[1]['trial_type']
551
+
552
+ # Encode labels to integer indices
553
+ encoded_labels = label_encoder.transform(labels)
554
+ encoded_labels = torch.tensor(encoded_labels, dtype=torch.long).to(device)
555
+
556
+
557
+ # Forward pass
558
+ outputs = model(images, gsr=gsr)
559
+
560
+ # Compute loss
561
+ loss = criterion(outputs, encoded_labels)
562
+
563
+ # Accumulate loss
564
+ running_val_loss += loss.item() * images.size(0)
565
+
566
+ # Calculate accuracy
567
+ _, predicted = torch.max(outputs, 1)
568
+ correct_val += (predicted == encoded_labels).sum().item()
569
+ total_val += encoded_labels.size(0)
570
+
571
+
572
+
573
+ epoch_val_loss = running_val_loss / total_val if total_val > 0 else 0.0
574
+ val_accuracy = 100 * correct_val / total_val if total_val > 0 else 0.0
575
+
576
+ print(f"Epoch [{epoch+1}/{num_epochs}] "
577
+ f"- Training Loss: {epoch_train_loss:.4f}, Training Accuracy: {train_accuracy:.2f}% "
578
+ f"- Validation Loss: {epoch_val_loss:.4f}, Validation Accuracy: {val_accuracy:.2f}%")
579
+
580
+ if wandb_log:
581
+ wandb.log({
582
+ "epoch_train_loss": epoch_train_loss,
583
+ "epoch_val_loss": epoch_val_loss,
584
+ "train_accuracy": train_accuracy,
585
+ "val_accuracy": val_accuracy,
586
+ })
587
+ if save_ckpt:
588
+ outdir = os.path.abspath(f'checkpoints/{model_name+"HCP_FT"}')
589
+ os.makedirs(outdir, exist_ok=True)
590
+ print("outdir", outdir)
591
+ # Save model and config
592
+ torch.save(model.state_dict(), f"{outdir}/model.pth")
593
+ with open(f"{outdir}/config.yaml", 'w') as f:
594
+ yaml.dump(wandb_config, f)
595
+ print(f"Saved model and config to {outdir}")
596
+
597
+
fMRI-foundation-model/src/wandb/run-20241024_160745-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427/files/output.log ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Epoch 1/20 - Training: 23%|██▎ | 3199/13913 [18:29<1:01:44, 2.89it/s]
2
+ Step [100/13913] - Training Loss: 1.1363 - Training Accuracy: 60.75%
3
+ Step [200/13913] - Training Loss: 1.5016 - Training Accuracy: 70.94%
4
+ Step [300/13913] - Training Loss: 0.8705 - Training Accuracy: 76.33%
5
+ Step [400/13913] - Training Loss: 1.2598 - Training Accuracy: 79.25%
6
+ Step [500/13913] - Training Loss: 0.0139 - Training Accuracy: 80.85%
7
+ Step [600/13913] - Training Loss: 0.1736 - Training Accuracy: 82.38%
8
+ Step [700/13913] - Training Loss: 0.0036 - Training Accuracy: 83.79%
9
+ Step [800/13913] - Training Loss: 0.0788 - Training Accuracy: 84.44%
10
+ Step [900/13913] - Training Loss: 0.9202 - Training Accuracy: 85.31%
11
+ Step [1000/13913] - Training Loss: 0.8229 - Training Accuracy: 85.79%
12
+ Step [1100/13913] - Training Loss: 0.2083 - Training Accuracy: 86.51%
13
+ Step [1200/13913] - Training Loss: 0.2850 - Training Accuracy: 87.11%
14
+ Step [1300/13913] - Training Loss: 0.4166 - Training Accuracy: 87.33%
15
+ Step [1400/13913] - Training Loss: 0.8600 - Training Accuracy: 87.69%
16
+ Step [1500/13913] - Training Loss: 0.3946 - Training Accuracy: 87.83%
17
+ Step [1600/13913] - Training Loss: 1.0132 - Training Accuracy: 88.22%
18
+ Step [1700/13913] - Training Loss: 0.7683 - Training Accuracy: 88.36%
19
+ Step [1800/13913] - Training Loss: 0.0097 - Training Accuracy: 88.55%
20
+ Step [1900/13913] - Training Loss: 0.7471 - Training Accuracy: 88.74%
21
+ Step [2000/13913] - Training Loss: 0.3663 - Training Accuracy: 88.97%
22
+ Step [2100/13913] - Training Loss: 0.0033 - Training Accuracy: 89.24%
23
+ Step [2200/13913] - Training Loss: 0.4058 - Training Accuracy: 89.39%
24
+ Step [2300/13913] - Training Loss: 0.0131 - Training Accuracy: 89.53%
25
+ Step [2400/13913] - Training Loss: 0.0789 - Training Accuracy: 89.71%
26
+ Step [2500/13913] - Training Loss: 0.0003 - Training Accuracy: 89.94%
27
+ Step [2600/13913] - Training Loss: 0.0043 - Training Accuracy: 89.98%
28
+ Step [2700/13913] - Training Loss: 0.0009 - Training Accuracy: 90.11%
29
+ Step [2800/13913] - Training Loss: 0.0021 - Training Accuracy: 90.21%
30
+ Step [2900/13913] - Training Loss: 0.2056 - Training Accuracy: 90.38%
31
+ Step [3000/13913] - Training Loss: 0.5232 - Training Accuracy: 90.49%
32
+ Step [3100/13913] - Training Loss: 0.1189 - Training Accuracy: 90.55%
33
+ Step [3200/13913] - Training Loss: 0.1305 - Training Accuracy: 90.64%
34
+ Step [3300/13913] - Training Loss: 0.0168 - Training Accuracy: 90.74%
35
+ Step [3400/13913] - Training Loss: 0.0056 - Training Accuracy: 90.85%
36
+ Step [3500/13913] - Training Loss: 0.3247 - Training Accuracy: 90.90%
37
+ Step [3600/13913] - Training Loss: 0.1292 - Training Accuracy: 90.96%
38
+ Step [3700/13913] - Training Loss: 0.0029 - Training Accuracy: 91.03%
39
+ Step [3800/13913] - Training Loss: 0.0006 - Training Accuracy: 91.16%
40
+ Step [3900/13913] - Training Loss: 0.0163 - Training Accuracy: 91.24%
41
+ Step [4000/13913] - Training Loss: 0.0013 - Training Accuracy: 91.31%
fMRI-foundation-model/src/wandb/run-20241024_160745-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427/files/requirements.txt ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ protobuf==5.28.2
2
+ imageio==2.35.1
3
+ MarkupSafe==3.0.0
4
+ regex==2024.9.11
5
+ matplotlib==3.9.2
6
+ notebook==7.2.2
7
+ debugpy==1.8.6
8
+ aiosignal==1.3.1
9
+ jupyter_core==5.7.2
10
+ torchaudio==2.4.1+cu121
11
+ python-json-logger==2.0.7
12
+ six==1.16.0
13
+ scikit-image==0.24.0
14
+ types-python-dateutil==2.9.0.20241003
15
+ PyYAML==6.0.2
16
+ httpcore==1.0.6
17
+ clip==1.0
18
+ babel==2.16.0
19
+ webcolors==24.8.0
20
+ omegaconf==2.3.0
21
+ webencodings==0.5.1
22
+ kiwisolver==1.4.7
23
+ uri-template==1.3.0
24
+ diffusers==0.23.0
25
+ idna==3.10
26
+ fsspec==2024.9.0
27
+ parso==0.8.4
28
+ setuptools==65.5.0
29
+ tornado==6.4.1
30
+ webdataset==0.2.100
31
+ decord==0.6.0
32
+ nvidia-curand-cu12==10.3.2.106
33
+ ipykernel==6.29.5
34
+ jupyter==1.1.1
35
+ pexpect==4.9.0
36
+ kornia_rs==0.1.5
37
+ iopath==0.1.10
38
+ async-lru==2.0.4
39
+ future==1.0.0
40
+ torchvision==0.19.1+cu121
41
+ botocore==1.34.162
42
+ cycler==0.12.1
43
+ tzdata==2024.2
44
+ jupyter_server_terminals==0.5.3
45
+ click==8.1.7
46
+ einops==0.8.0
47
+ pyzmq==26.2.0
48
+ jupyter_client==8.6.3
49
+ nbconvert==7.16.4
50
+ scikit-learn==1.5.2
51
+ executing==2.1.0
52
+ asttokens==2.4.1
53
+ docker-pycreds==0.4.0
54
+ matplotlib-inline==0.1.7
55
+ overrides==7.7.0
56
+ websocket-client==1.8.0
57
+ nbformat==5.10.4
58
+ elbow==0.1.1
59
+ contourpy==1.3.0
60
+ nvidia-cudnn-cu12==9.1.0.70
61
+ transformers==4.44.2
62
+ gitdb==4.0.11
63
+ jupyterlab_nvdashboard==0.11.0
64
+ lazy_loader==0.4
65
+ jsonpointer==3.0.0
66
+ notebook_shim==0.2.4
67
+ nvidia-nccl-cu12==2.20.5
68
+ ffmpeg-python==0.2.0
69
+ triton==3.0.0
70
+ mistune==3.0.2
71
+ python-dateutil==2.9.0.post0
72
+ beautifulsoup4==4.12.3
73
+ nbclient==0.10.0
74
+ h5py==3.12.1
75
+ ftfy==6.2.3
76
+ zipp==3.20.2
77
+ ptyprocess==0.7.0
78
+ huggingface-hub==0.25.1
79
+ pytz==2024.2
80
+ jupyterlab_pygments==0.3.0
81
+ nvidia-cublas-cu12==12.1.3.1
82
+ pandocfilters==1.5.1
83
+ Jinja2==3.1.4
84
+ arrow==1.3.0
85
+ rpds-py==0.20.0
86
+ jupyter_server==2.14.2
87
+ simplejson==3.19.3
88
+ networkx==3.3
89
+ packaging==24.1
90
+ traitlets==5.14.3
91
+ pandas==2.2.3
92
+ xformers==0.0.22.post7
93
+ lightning-utilities==0.11.7
94
+ tifffile==2024.9.20
95
+ nvidia-cuda-cupti-cu12==12.1.105
96
+ mpmath==1.3.0
97
+ GitPython==3.1.43
98
+ scipy==1.14.1
99
+ jsonschema==4.23.0
100
+ prompt_toolkit==3.0.48
101
+ s3transfer==0.10.2
102
+ multidict==6.1.0
103
+ bleach==6.1.0
104
+ sentry-sdk==2.15.0
105
+ nibabel==5.2.1
106
+ accelerate==1.0.0
107
+ pyarrow==17.0.0
108
+ threadpoolctl==3.5.0
109
+ attrs==24.2.0
110
+ rfc3986-validator==0.1.1
111
+ nvidia-cuda-runtime-cu12==12.1.105
112
+ ipywidgets==8.1.5
113
+ frozenlist==1.4.1
114
+ pycparser==2.22
115
+ jupyterlab_server==2.27.3
116
+ nvidia-cuda-nvrtc-cu12==12.1.105
117
+ yarl==1.13.1
118
+ setproctitle==1.3.3
119
+ isoduration==20.11.0
120
+ Pygments==2.18.0
121
+ jedi==0.19.1
122
+ boto3==1.34.57
123
+ tokenizers==0.19.1
124
+ referencing==0.35.1
125
+ rfc3339-validator==0.1.4
126
+ pillow==10.4.0
127
+ jupyterlab==4.2.5
128
+ stack-data==0.6.3
129
+ h11==0.14.0
130
+ anyio==4.6.0
131
+ nilearn==0.10.4
132
+ nvidia-cusolver-cu12==11.4.5.107
133
+ tinycss2==1.3.0
134
+ defusedxml==0.7.1
135
+ argon2-cffi-bindings==21.2.0
136
+ soupsieve==2.6
137
+ nest-asyncio==1.6.0
138
+ torchmetrics==1.3.0.post0
139
+ tqdm==4.66.5
140
+ cffi==1.17.1
141
+ charset-normalizer==3.3.2
142
+ jsonschema-specifications==2023.12.1
143
+ decorator==5.1.1
144
+ open_clip_torch==2.26.1
145
+ jupyter-events==0.10.0
146
+ smart-open==7.0.5
147
+ antlr4-python3-runtime==4.9.3
148
+ prometheus_client==0.21.0
149
+ kornia==0.7.3
150
+ typing_extensions==4.12.2
151
+ sniffio==1.3.1
152
+ joblib==1.4.2
153
+ comm==0.2.2
154
+ aiohappyeyeballs==2.4.3
155
+ numpy==2.1.2
156
+ braceexpand==0.1.7
157
+ certifi==2024.8.30
158
+ psutil==6.0.0
159
+ pyparsing==3.1.4
160
+ pure_eval==0.2.3
161
+ nvidia-cusparse-cu12==12.1.0.106
162
+ wandb==0.18.3
163
+ urllib3==2.2.3
164
+ smmap==5.0.1
165
+ platformdirs==4.3.6
166
+ torch==2.4.1+cu121
167
+ requests==2.32.3
168
+ json5==0.9.25
169
+ nvidia-nvjitlink-cu12==12.6.77
170
+ jupyterlab_widgets==3.0.13
171
+ lxml==5.3.0
172
+ httpx==0.27.2
173
+ opencv-python==4.6.0.66
174
+ portalocker==2.10.1
175
+ pytorch-lightning==2.0.1
176
+ sympy==1.13.3
177
+ wcwidth==0.2.13
178
+ jmespath==1.0.1
179
+ fqdn==1.5.1
180
+ pynvml==11.5.3
181
+ pip==24.0
182
+ wrapt==1.16.0
183
+ aiohttp==3.10.9
184
+ filelock==3.16.1
185
+ fonttools==4.54.1
186
+ fastjsonschema==2.20.0
187
+ jupyter-console==6.6.3
188
+ widgetsnbextension==4.0.13
189
+ timm==1.0.9
190
+ nvidia-cufft-cu12==11.0.2.54
191
+ ipython==8.28.0
192
+ nvidia-nvtx-cu12==12.1.105
193
+ jupyter-lsp==2.2.5
194
+ safetensors==0.4.5
195
+ terminado==0.18.1
196
+ argon2-cffi==23.1.0
197
+ Send2Trash==1.8.3
198
+ importlib_metadata==8.5.0
fMRI-foundation-model/src/wandb/run-20241024_160745-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427/files/wandb-metadata.json ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "os": "Linux-5.15.0-1058-aws-x86_64-with-glibc2.31",
3
+ "python": "3.11.10",
4
+ "startedAt": "2024-10-24T16:07:45.214617Z",
5
+ "args": [
6
+ "HCPflat_large_gsrFalse_",
7
+ "epoch99.pth"
8
+ ],
9
+ "program": "/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/HCP_downstream_finetune.py",
10
+ "codePath": "src/HCP_downstream_finetune.py",
11
+ "git": {
12
+ "remote": "https://github.com/MedARC-AI/fMRI-foundation-model",
13
+ "commit": "cf8214d4ebe437188b68b4ee5a34c5211a810db0"
14
+ },
15
+ "email": "torrico.villanueva.cesar.kadir@gmail.com",
16
+ "root": "/weka/proj-fmri/ckadirt/fMRI-foundation-model/src",
17
+ "host": "ip-10-0-154-245",
18
+ "username": "ckadirt",
19
+ "executable": "/admin/home-ckadirt/foundation_env/bin/python",
20
+ "codePathLocal": "HCP_downstream_finetune.py",
21
+ "cpu_count": 96,
22
+ "cpu_count_logical": 192,
23
+ "gpu": "[NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3]",
24
+ "gpu_count": 8,
25
+ "disk": {
26
+ "/": {
27
+ "total": "249555763200",
28
+ "used": "182174265344"
29
+ }
30
+ },
31
+ "memory": {
32
+ "total": "2147443408896"
33
+ },
34
+ "cpu": {
35
+ "count": 96,
36
+ "countLogical": 192
37
+ },
38
+ "gpu_nvidia": [
39
+ {
40
+ "name": "NVIDIA H100 80GB HBM3",
41
+ "memoryTotal": "85520809984",
42
+ "cudaCores": 16896,
43
+ "architecture": "Hopper"
44
+ },
45
+ {
46
+ "name": "NVIDIA H100 80GB HBM3",
47
+ "memoryTotal": "85520809984",
48
+ "cudaCores": 16896,
49
+ "architecture": "Hopper"
50
+ },
51
+ {
52
+ "name": "NVIDIA H100 80GB HBM3",
53
+ "memoryTotal": "85520809984",
54
+ "cudaCores": 16896,
55
+ "architecture": "Hopper"
56
+ },
57
+ {
58
+ "name": "NVIDIA H100 80GB HBM3",
59
+ "memoryTotal": "85520809984",
60
+ "cudaCores": 16896,
61
+ "architecture": "Hopper"
62
+ },
63
+ {
64
+ "name": "NVIDIA H100 80GB HBM3",
65
+ "memoryTotal": "85520809984",
66
+ "cudaCores": 16896,
67
+ "architecture": "Hopper"
68
+ },
69
+ {
70
+ "name": "NVIDIA H100 80GB HBM3",
71
+ "memoryTotal": "85520809984",
72
+ "cudaCores": 16896,
73
+ "architecture": "Hopper"
74
+ },
75
+ {
76
+ "name": "NVIDIA H100 80GB HBM3",
77
+ "memoryTotal": "85520809984",
78
+ "cudaCores": 16896,
79
+ "architecture": "Hopper"
80
+ },
81
+ {
82
+ "name": "NVIDIA H100 80GB HBM3",
83
+ "memoryTotal": "85520809984",
84
+ "cudaCores": 16896,
85
+ "architecture": "Hopper"
86
+ }
87
+ ],
88
+ "slurm": {
89
+ "cluster_name": "sagemaker2",
90
+ "conf": "/opt/slurm/etc/slurm.conf",
91
+ "cpus_on_node": "20",
92
+ "gpus_on_node": "1",
93
+ "gpus_per_task": "1",
94
+ "gtids": "0",
95
+ "job_account": "fmri",
96
+ "job_cpus_per_node": "20",
97
+ "job_end_time": "1729901244",
98
+ "job_gid": "1879800513",
99
+ "job_gpus": "5",
100
+ "job_id": "528923",
101
+ "job_name": "finetuneHCP",
102
+ "job_nodelist": "ip-10-0-154-245",
103
+ "job_num_nodes": "1",
104
+ "job_partition": "p5",
105
+ "job_qos": "normal",
106
+ "job_start_time": "1729786044",
107
+ "job_uid": "1879804696",
108
+ "job_user": "ckadirt",
109
+ "jobid": "528923",
110
+ "localid": "0",
111
+ "mem_per_cpu": "11500",
112
+ "nnodes": "1",
113
+ "node_aliases": "(null)",
114
+ "nodeid": "0",
115
+ "nodelist": "ip-10-0-154-245",
116
+ "nprocs": "1",
117
+ "ntasks": "1",
118
+ "ntasks_per_node": "1",
119
+ "prio_process": "0",
120
+ "procid": "0",
121
+ "script_context": "prolog_task",
122
+ "submit_dir": "/weka/proj-fmri/ckadirt/fMRI-foundation-model/src",
123
+ "submit_host": "ip-172-17-12-61",
124
+ "task_pid": "2041258",
125
+ "tasks_per_node": "1",
126
+ "topology_addr": "ip-10-0-154-245",
127
+ "topology_addr_pattern": "node",
128
+ "working_cluster": "sagemaker2:ip-172-17-63-161:6817:9984:109"
129
+ },
130
+ "cudaVersion": "12.2"
131
+ }
fMRI-foundation-model/src/wandb/run-20241024_160745-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427/logs/debug-core.log ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {"time":"2024-10-24T16:07:44.564275843Z","level":"INFO","msg":"started logging, with flags","port-filename":"/tmp/tmpfmcbwptu/port-2041298.txt","pid":2041298,"debug":false,"disable-analytics":false}
2
+ {"time":"2024-10-24T16:07:44.564579487Z","level":"INFO","msg":"FeatureState","shutdownOnParentExitEnabled":false}
3
+ {"time":"2024-10-24T16:07:44.56719312Z","level":"INFO","msg":"Will exit if parent process dies.","ppid":2041298}
4
+ {"time":"2024-10-24T16:07:44.56715049Z","level":"INFO","msg":"server is running","addr":{"IP":"127.0.0.1","Port":35041,"Zone":""}}
5
+ {"time":"2024-10-24T16:07:44.754199345Z","level":"INFO","msg":"connection: ManageConnectionData: new connection created","id":"127.0.0.1:54948"}
6
+ {"time":"2024-10-24T16:07:45.214751453Z","level":"INFO","msg":"handleInformInit: received","streamId":"HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427","id":"127.0.0.1:54948"}
7
+ {"time":"2024-10-24T16:07:45.272895072Z","level":"INFO","msg":"handleInformInit: stream started","streamId":"HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427","id":"127.0.0.1:54948"}
fMRI-foundation-model/src/wandb/run-20241024_160745-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427/logs/debug-internal.log ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"time":"2024-10-24T16:07:45.222818576Z","level":"INFO","msg":"using version","core version":"0.18.3"}
2
+ {"time":"2024-10-24T16:07:45.222833706Z","level":"INFO","msg":"created symlink","path":"/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241024_160745-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427/logs/debug-core.log"}
3
+ {"time":"2024-10-24T16:07:45.225039684Z","level":"ERROR","msg":"dialing: google: could not find default credentials. See https://cloud.google.com/docs/authentication/external/set-up-adc for more information"}
4
+ {"time":"2024-10-24T16:07:45.272860641Z","level":"INFO","msg":"created new stream","id":"HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427"}
5
+ {"time":"2024-10-24T16:07:45.272890272Z","level":"INFO","msg":"stream: started","id":"HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427"}
6
+ {"time":"2024-10-24T16:07:45.272903712Z","level":"INFO","msg":"writer: Do: started","stream_id":{"value":"HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427"}}
7
+ {"time":"2024-10-24T16:07:45.272921242Z","level":"INFO","msg":"sender: started","stream_id":{"value":"HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427"}}
8
+ {"time":"2024-10-24T16:07:45.272905012Z","level":"INFO","msg":"handler: started","stream_id":{"value":"HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427"}}
9
+ {"time":"2024-10-24T16:07:45.78228821Z","level":"INFO","msg":"wandb-core","!BADKEY":null}
10
+ {"time":"2024-10-24T16:07:45.786547034Z","level":"INFO","msg":"Starting system monitor"}
11
+ {"time":"2024-10-24T16:07:45.81608275Z","level":"ERROR","msg":"git repo not found","error":"repository does not exist"}
fMRI-foundation-model/src/wandb/run-20241024_160745-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427/logs/debug.log ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 2024-10-24 16:07:45,202 INFO MainThread:2041298 [wandb_setup.py:_flush():79] Current SDK version is 0.18.3
2
+ 2024-10-24 16:07:45,202 INFO MainThread:2041298 [wandb_setup.py:_flush():79] Configure stats pid to 2041298
3
+ 2024-10-24 16:07:45,202 INFO MainThread:2041298 [wandb_setup.py:_flush():79] Loading settings from /admin/home-ckadirt/.config/wandb/settings
4
+ 2024-10-24 16:07:45,202 INFO MainThread:2041298 [wandb_setup.py:_flush():79] Loading settings from /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/settings
5
+ 2024-10-24 16:07:45,202 INFO MainThread:2041298 [wandb_setup.py:_flush():79] Loading settings from environment variables: {}
6
+ 2024-10-24 16:07:45,202 INFO MainThread:2041298 [wandb_setup.py:_flush():79] Applying setup settings: {'mode': None, '_disable_service': None}
7
+ 2024-10-24 16:07:45,202 INFO MainThread:2041298 [wandb_setup.py:_flush():79] Inferring run settings from compute environment: {'program_relpath': 'src/HCP_downstream_finetune.py', 'program_abspath': '/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/HCP_downstream_finetune.py', 'program': '/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/HCP_downstream_finetune.py'}
8
+ 2024-10-24 16:07:45,202 INFO MainThread:2041298 [wandb_setup.py:_flush():79] Applying login settings: {}
9
+ 2024-10-24 16:07:45,203 INFO MainThread:2041298 [wandb_init.py:_log_setup():532] Logging user logs to /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241024_160745-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427/logs/debug.log
10
+ 2024-10-24 16:07:45,203 INFO MainThread:2041298 [wandb_init.py:_log_setup():533] Logging internal logs to /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241024_160745-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427/logs/debug-internal.log
11
+ 2024-10-24 16:07:45,203 INFO MainThread:2041298 [wandb_init.py:init():617] calling init triggers
12
+ 2024-10-24 16:07:45,203 INFO MainThread:2041298 [wandb_init.py:init():624] wandb.init called with sweep_config: {}
13
+ config: {'model_name': 'HCPflat_large_gsrFalse__HCP_FT', 'batch_size': 8, 'learning_rate': 0.0001, 'weight_decay': 3e-05, 'num_epochs': 20, 'seed': 42}
14
+ 2024-10-24 16:07:45,203 INFO MainThread:2041298 [wandb_init.py:init():667] starting backend
15
+ 2024-10-24 16:07:45,203 INFO MainThread:2041298 [wandb_init.py:init():671] sending inform_init request
16
+ 2024-10-24 16:07:45,213 INFO MainThread:2041298 [backend.py:_multiprocessing_setup():104] multiprocessing start_methods=fork,spawn,forkserver, using: spawn
17
+ 2024-10-24 16:07:45,213 INFO MainThread:2041298 [wandb_init.py:init():684] backend started and connected
18
+ 2024-10-24 16:07:45,234 INFO MainThread:2041298 [wandb_init.py:init():779] updated telemetry
19
+ 2024-10-24 16:07:45,287 INFO MainThread:2041298 [wandb_init.py:init():812] communicating run to backend with 90.0 second timeout
20
+ 2024-10-24 16:07:45,766 INFO MainThread:2041298 [wandb_init.py:init():863] starting run threads in backend
21
+ 2024-10-24 16:07:46,086 INFO MainThread:2041298 [wandb_run.py:_console_start():2465] atexit reg
22
+ 2024-10-24 16:07:46,087 INFO MainThread:2041298 [wandb_run.py:_redirect():2313] redirect: wrap_raw
23
+ 2024-10-24 16:07:46,087 INFO MainThread:2041298 [wandb_run.py:_redirect():2378] Wrapping output streams.
24
+ 2024-10-24 16:07:46,087 INFO MainThread:2041298 [wandb_run.py:_redirect():2403] Redirects installed.
25
+ 2024-10-24 16:07:46,089 INFO MainThread:2041298 [wandb_init.py:init():907] run started, returning control to user process
fMRI-foundation-model/src/wandb/run-20241024_160745-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427/run-HCPflat_large_gsrFalse__HCP_FT_f1d2455a-d8d7-4d9d-9f91-58748aebb427.wandb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5c7ddb6bafaaa5c98a02bd4a5250f782426e8e736d62d7171d085b5dd8853437
3
+ size 2359296
fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/files/code/_session_history.ipynb ADDED
@@ -0,0 +1,510 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "3b251ac1",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "# Import packages and setup gpu configuration.\n",
11
+ "# This code block shouldnt need to be adjusted!\n",
12
+ "import os\n",
13
+ "import sys\n",
14
+ "import json\n",
15
+ "import yaml\n",
16
+ "import numpy as np\n",
17
+ "import copy\n",
18
+ "import math\n",
19
+ "import time\n",
20
+ "import random\n",
21
+ "from tqdm.auto import tqdm\n",
22
+ "import webdataset as wds\n",
23
+ "import matplotlib.pyplot as plt\n",
24
+ "\n",
25
+ "import torch\n",
26
+ "import torch.nn as nn\n",
27
+ "from torchvision import transforms\n",
28
+ "import utils\n",
29
+ "from mae_utils.flat_models import *\n",
30
+ "import h5py\n",
31
+ "from mae_utils import flat_models\n",
32
+ "\n",
33
+ "# tf32 data type is faster than standard float32\n",
34
+ "torch.backends.cuda.matmul.allow_tf32 = True\n",
35
+ "# following fixes a Conv3D CUDNN_NOT_SUPPORTED error\n",
36
+ "torch.backends.cudnn.benchmark = True\n",
37
+ "\n",
38
+ "# ## MODEL TO LOAD ##\n",
39
+ "if utils.is_interactive():\n",
40
+ " model_name = \"HCPflat_large_gsrFalse_\"\n",
41
+ "else:\n",
42
+ " model_name = sys.argv[1]\n",
43
+ " \n",
44
+ "\n",
45
+ "# outdir = os.path.abspath(f'checkpoints/{model_name}')\n",
46
+ "outdir = os.path.abspath(f'checkpoints/{model_name}')\n",
47
+ "\n",
48
+ "print(\"outdir\", outdir)\n",
49
+ "# Load previous config.yaml if available\n",
50
+ "if os.path.exists(f\"{outdir}/config.yaml\"):\n",
51
+ " config = yaml.load(open(f\"{outdir}/config.yaml\", 'r'), Loader=yaml.FullLoader)\n",
52
+ " print(f\"Loaded config.yaml from ckpt folder {outdir}\")\n",
53
+ " # create global variables from the config\n",
54
+ " print(\"\\n__CONFIG__\")\n",
55
+ " for attribute_name in config.keys():\n",
56
+ " print(f\"{attribute_name} = {config[attribute_name]}\")\n",
57
+ " globals()[attribute_name] = config[f'{attribute_name}']\n",
58
+ " print(\"\\n\")\n",
59
+ "\n",
60
+ "world_size = os.getenv('WORLD_SIZE')\n",
61
+ "if world_size is None: \n",
62
+ " world_size = 1\n",
63
+ "else:\n",
64
+ " world_size = int(world_size)\n",
65
+ "print(f\"WORLD_SIZE={world_size}\")\n",
66
+ "\n",
67
+ "if utils.is_interactive():\n",
68
+ " # Following allows you to change functions in models.py or utils.py and \n",
69
+ " # have this notebook automatically update with your revisions\n",
70
+ " %load_ext autoreload\n",
71
+ " %autoreload 2\n",
72
+ "\n",
73
+ "batch_size = probe_batch_size\n",
74
+ "num_epochs = probe_num_epochs\n",
75
+ "\n",
76
+ "data_type = torch.float32 # change depending on your mixed_precision\n",
77
+ "global_batch_size = batch_size * world_size\n",
78
+ "\n",
79
+ "device = torch.device('cuda')\n",
80
+ "\n",
81
+ "hcp_flat_path = \"/weka/proj-medarc/shared/HCP-Flat\"\n",
82
+ "# seed = 42\n",
83
+ "# num_frames = 16\n",
84
+ "# gsr = False\n",
85
+ "# num_workers = 10\n",
86
+ "# batch_size = 128\n",
87
+ "save_ckpt = True\n",
88
+ "wandb_log = True\n",
89
+ "print(\"PID of this process =\",os.getpid())\n",
90
+ "utils.seed_everything(seed)"
91
+ ]
92
+ },
93
+ {
94
+ "cell_type": "code",
95
+ "execution_count": 2,
96
+ "id": "eca8380a",
97
+ "metadata": {},
98
+ "outputs": [],
99
+ "source": [
100
+ "if os.getenv('global_pool') == \"False\":\n",
101
+ " global_pool = False\n",
102
+ "else:\n",
103
+ " global_pool = True\n",
104
+ "print(f\"global_pool = {global_pool}\")\n",
105
+ "\n",
106
+ "try:\n",
107
+ " gsr\n",
108
+ "except:\n",
109
+ " gsr = True\n",
110
+ " print(\"set gsr to True\")\n",
111
+ "print(f\"gsr = {gsr}\")"
112
+ ]
113
+ },
114
+ {
115
+ "cell_type": "code",
116
+ "execution_count": 3,
117
+ "id": "e2b114fa",
118
+ "metadata": {},
119
+ "outputs": [],
120
+ "source": [
121
+ "from sklearn.preprocessing import LabelEncoder\n",
122
+ "\n",
123
+ "INCLUDE_CONDS = {\n",
124
+ " \"fear\",\n",
125
+ " \"neut\",\n",
126
+ " \"math\",\n",
127
+ " \"story\",\n",
128
+ " \"lf\",\n",
129
+ " \"lh\",\n",
130
+ " \"rf\",\n",
131
+ " \"rh\",\n",
132
+ " \"t\",\n",
133
+ " \"match\",\n",
134
+ " \"relation\",\n",
135
+ " \"mental\",\n",
136
+ " \"rnd\",\n",
137
+ " \"0bk_body\",\n",
138
+ " \"2bk_body\",\n",
139
+ " \"0bk_faces\",\n",
140
+ " \"2bk_faces\",\n",
141
+ " \"0bk_places\",\n",
142
+ " \"2bk_places\",\n",
143
+ " \"0bk_tools\",\n",
144
+ " \"2bk_tools\",\n",
145
+ "}\n",
146
+ "\n",
147
+ "# test_data = []\n",
148
+ "\n",
149
+ "# # Iterate over the DataLoader with a progress bar\n",
150
+ "# for sample in tqdm(train_dl, desc=\"Processing samples\"):\n",
151
+ "# x = sample['image']\n",
152
+ "# y = sample['meta']['trial_type']\n",
153
+ "# key = sample['meta']['key']\n",
154
+ "# print(x.shape, y, key)\n",
155
+ "# break\n",
156
+ "# Initialize the label encoder\n",
157
+ "label_encoder = LabelEncoder()\n",
158
+ "label_encoder.fit(sorted(INCLUDE_CONDS)) # Ensure consistent ordering\n",
159
+ "\n",
160
+ "num_classes = len(label_encoder.classes_)\n",
161
+ "print(f\"Number of classes: {num_classes}\")"
162
+ ]
163
+ },
164
+ {
165
+ "cell_type": "code",
166
+ "execution_count": 4,
167
+ "id": "1c982221",
168
+ "metadata": {},
169
+ "outputs": [],
170
+ "source": [
171
+ "f_train = h5py.File('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/train_hcp_raw_flatmaps.hdf5', 'r')\n",
172
+ "flatmaps_train = f_train['flatmaps']\n",
173
+ "\n",
174
+ "f_test = h5py.File('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/test_hcp_raw_flatmaps.hdf5', 'r')\n",
175
+ "flatmaps_test = f_test['flatmaps']\n",
176
+ "\n",
177
+ "metadata_train = np.load('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/metadata_train_HCP_raw_flatmaps.npy', allow_pickle=True)\n",
178
+ "metadata_test = np.load('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/metadata_test_HCP_raw_flatmaps.npy', allow_pickle=True)"
179
+ ]
180
+ },
181
+ {
182
+ "cell_type": "code",
183
+ "execution_count": 5,
184
+ "id": "dbfbf855",
185
+ "metadata": {},
186
+ "outputs": [],
187
+ "source": [
188
+ "from torch.utils.data import Dataset, DataLoader\n",
189
+ "\n",
190
+ "class HCPFlatDataset(Dataset):\n",
191
+ " def __init__(self, flatmaps, metadata):\n",
192
+ " self.flatmaps = flatmaps\n",
193
+ " self.metadata = metadata\n",
194
+ "\n",
195
+ " def __len__(self):\n",
196
+ " return len(self.metadata)\n",
197
+ "\n",
198
+ " def __getitem__(self, idx):\n",
199
+ " return self.flatmaps[idx], json.loads(self.metadata[idx])\n",
200
+ "print(\"Creating datasets\")\n",
201
+ "# Loading to cpu for faster training, this can take several minutes. Remove this [:] if you want to move one at the time.\n",
202
+ "train_dataset = HCPFlatDataset(flatmaps_train, metadata_train)\n",
203
+ "train_dl = DataLoader(train_dataset, batch_size=batch_size, shuffle=True, num_workers=num_workers)\n",
204
+ "\n",
205
+ "test_dataset = HCPFlatDataset(flatmaps_test, metadata_test)\n",
206
+ "test_dl = DataLoader(test_dataset, batch_size=batch_size, shuffle=False, num_workers=0)\n",
207
+ "print(\"Datasets ready\")"
208
+ ]
209
+ },
210
+ {
211
+ "cell_type": "code",
212
+ "execution_count": 6,
213
+ "id": "997e9b8d",
214
+ "metadata": {},
215
+ "outputs": [],
216
+ "source": [
217
+ "from mae_utils.flat import load_hcp_flat_mask\n",
218
+ "from mae_utils.flat import create_hcp_flat\n",
219
+ "from mae_utils.flat import batch_unmask\n",
220
+ "import mae_utils.visualize as vis\n",
221
+ "\n",
222
+ "flat_mask = load_hcp_flat_mask(hcp_flat_path)\n",
223
+ "\n",
224
+ "mae_model = flat_models.mae_vit_large_fmri(\n",
225
+ " patch_size=patch_size,\n",
226
+ " decoder_embed_dim=decoder_embed_dim,\n",
227
+ " t_patch_size=t_patch_size,\n",
228
+ " pred_t_dim=pred_t_dim,\n",
229
+ " decoder_depth=4,\n",
230
+ " cls_embed=cls_embed,\n",
231
+ " norm_pix_loss=norm_pix_loss,\n",
232
+ " no_qkv_bias=no_qkv_bias,\n",
233
+ " sep_pos_embed=sep_pos_embed,\n",
234
+ " trunc_init=trunc_init,\n",
235
+ " pct_masks_to_decode=pct_masks_to_decode,\n",
236
+ " img_mask=flat_mask,\n",
237
+ ")"
238
+ ]
239
+ },
240
+ {
241
+ "cell_type": "code",
242
+ "execution_count": 7,
243
+ "id": "de9421fa",
244
+ "metadata": {},
245
+ "outputs": [],
246
+ "source": [
247
+ "checkpoint_files = [f for f in os.listdir(outdir) if f.endswith('.pth')]\n",
248
+ "\n",
249
+ "if utils.is_interactive():\n",
250
+ " latest_checkpoint = \"epoch99.pth\"\n",
251
+ "else:\n",
252
+ " latest_checkpoint = sys.argv[2] \n",
253
+ "print(f\"latest_checkpoint: {latest_checkpoint}\")\n",
254
+ "\n",
255
+ "# Load the checkpoint\n",
256
+ "checkpoint_path = os.path.join(outdir, latest_checkpoint)\n",
257
+ "\n",
258
+ "state = torch.load(checkpoint_path)\n",
259
+ "mae_model.load_state_dict(state[\"model_state_dict\"], strict=False)\n",
260
+ "mae_model.to(device)\n",
261
+ "\n",
262
+ "print(f\"\\nLoaded checkpoint {latest_checkpoint} from {outdir}\\n\")"
263
+ ]
264
+ },
265
+ {
266
+ "cell_type": "code",
267
+ "execution_count": 8,
268
+ "id": "cb8bfc70",
269
+ "metadata": {},
270
+ "outputs": [],
271
+ "source": [
272
+ "class LinearClassifier(nn.Module):\n",
273
+ " def __init__(self, input_dim, num_classes):\n",
274
+ " super(LinearClassifier, self).__init__()\n",
275
+ " self.linear = nn.Linear(input_dim, num_classes)\n",
276
+ " \n",
277
+ " def forward(self, x):\n",
278
+ " # Flatten the input except for the batch dimension\n",
279
+ " x = x.view(x.size(0), -1)\n",
280
+ " out = self.linear(x)\n",
281
+ " return out # Raw logits\n",
282
+ "\n",
283
+ "# Determine the input dimension from a single sample\n",
284
+ "# Assuming images are of shape [1, 16, 144, 320]\n",
285
+ "input_dim = np.prod(mae_model(torch.randn(1,1,16,144,320).to(device),global_pool=global_pool, forward_features = True).shape[1:])\n",
286
+ "print(f\"Input dimension: {input_dim}\")"
287
+ ]
288
+ },
289
+ {
290
+ "cell_type": "code",
291
+ "execution_count": 9,
292
+ "id": "455d9468",
293
+ "metadata": {},
294
+ "outputs": [],
295
+ "source": [
296
+ "class FullModel(nn.Module):\n",
297
+ " def __init__(self, lc_model, mae_model):\n",
298
+ " super(FullModel, self).__init__()\n",
299
+ " self.lc_model = lc_model\n",
300
+ " self.mae_model = mae_model\n",
301
+ " \n",
302
+ " \n",
303
+ " def forward(self, x, gsr):\n",
304
+ " x = self.mae_model(x, global_pool=global_pool, forward_features = True)\n",
305
+ " x = self.lc_model(x)\n",
306
+ " return x"
307
+ ]
308
+ },
309
+ {
310
+ "cell_type": "code",
311
+ "execution_count": 10,
312
+ "id": "c369cb0a",
313
+ "metadata": {},
314
+ "outputs": [],
315
+ "source": [
316
+ "# Initialize the model\n",
317
+ "lc_model = LinearClassifier(input_dim=input_dim, num_classes=num_classes)\n",
318
+ "\n",
319
+ "model = FullModel(lc_model, mae_model)\n",
320
+ "\n",
321
+ "# Move the model to the GPU\n",
322
+ "model.to(device)\n",
323
+ "\n",
324
+ "# Define loss function\n",
325
+ "criterion = nn.CrossEntropyLoss()\n",
326
+ "\n",
327
+ "# Define optimizer with L2 regularization (weight_decay)\n",
328
+ "learning_rate = 1e-4\n",
329
+ "weight_decay = 1e-5 # Adjust based on your needs\n",
330
+ "optimizer = torch.optim.Adam(model.parameters(), lr=learning_rate, weight_decay=weight_decay)\n",
331
+ "num_epochs = 20 # Adjust as needed"
332
+ ]
333
+ },
334
+ {
335
+ "cell_type": "code",
336
+ "execution_count": 11,
337
+ "id": "a94f38d2",
338
+ "metadata": {},
339
+ "outputs": [
340
+ {
341
+ "name": "stdout",
342
+ "output_type": "stream",
343
+ "text": [
344
+ "'427a99e2-fb71-47e7-92ad-a81ab54e58f2'"
345
+ ]
346
+ }
347
+ ],
348
+ "source": [
349
+ "import uuid\n",
350
+ "\n",
351
+ "myuuid = uuid.uuid4()\n",
352
+ "str(myuuid)"
353
+ ]
354
+ },
355
+ {
356
+ "cell_type": "code",
357
+ "execution_count": 12,
358
+ "id": "76663b72",
359
+ "metadata": {},
360
+ "outputs": [
361
+ {
362
+ "data": {
363
+ "text/html": [
364
+ "Tracking run with wandb version 0.18.3"
365
+ ],
366
+ "text/plain": [
367
+ "<IPython.core.display.HTML object>"
368
+ ]
369
+ },
370
+ "metadata": {},
371
+ "output_type": "display_data"
372
+ },
373
+ {
374
+ "data": {
375
+ "text/html": [
376
+ "Run data is saved locally in <code>/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275</code>"
377
+ ],
378
+ "text/plain": [
379
+ "<IPython.core.display.HTML object>"
380
+ ]
381
+ },
382
+ "metadata": {},
383
+ "output_type": "display_data"
384
+ },
385
+ {
386
+ "data": {
387
+ "text/html": [
388
+ "Syncing run <strong><a href='https://stability.wandb.io/ckadirt/fMRI-foundation-model/runs/HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275' target=\"_blank\">HCPflat_large_gsrFalse__HCP_FT</a></strong> to <a href='https://stability.wandb.io/ckadirt/fMRI-foundation-model' target=\"_blank\">Weights & Biases</a> (<a href='https://wandb.me/run' target=\"_blank\">docs</a>)<br/>"
389
+ ],
390
+ "text/plain": [
391
+ "<IPython.core.display.HTML object>"
392
+ ]
393
+ },
394
+ "metadata": {},
395
+ "output_type": "display_data"
396
+ },
397
+ {
398
+ "data": {
399
+ "text/html": [
400
+ " View project at <a href='https://stability.wandb.io/ckadirt/fMRI-foundation-model' target=\"_blank\">https://stability.wandb.io/ckadirt/fMRI-foundation-model</a>"
401
+ ],
402
+ "text/plain": [
403
+ "<IPython.core.display.HTML object>"
404
+ ]
405
+ },
406
+ "metadata": {},
407
+ "output_type": "display_data"
408
+ },
409
+ {
410
+ "data": {
411
+ "text/html": [
412
+ " View run at <a href='https://stability.wandb.io/ckadirt/fMRI-foundation-model/runs/HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275' target=\"_blank\">https://stability.wandb.io/ckadirt/fMRI-foundation-model/runs/HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275</a>"
413
+ ],
414
+ "text/plain": [
415
+ "<IPython.core.display.HTML object>"
416
+ ]
417
+ },
418
+ "metadata": {},
419
+ "output_type": "display_data"
420
+ }
421
+ ],
422
+ "source": [
423
+ "import wandb\n",
424
+ "\n",
425
+ "if utils.is_interactive():\n",
426
+ " print(\"Running in interactive notebook. Disabling W&B and ckpt saving.\")\n",
427
+ " wandb_log = True\n",
428
+ " save_ckpt = True\n",
429
+ "\n",
430
+ "if wandb_log:\n",
431
+ " wandb_project = 'fMRI-foundation-model'\n",
432
+ " wandb_config = {\n",
433
+ " \"model_name\": model_name+'_HCP_FT',\n",
434
+ " \"batch_size\": batch_size,\n",
435
+ " \"learning_rate\": learning_rate,\n",
436
+ " \"weight_decay\": weight_decay,\n",
437
+ " \"num_epochs\": num_epochs,\n",
438
+ " \"seed\": seed,\n",
439
+ " }\n",
440
+ " print(\"wandb_config:\\n\", wandb_config)\n",
441
+ " random_id = str(uuid.uuid4())\n",
442
+ " print(\"wandb_id:\", \"HCPflat_raw\" + f\"_{random_id}\")\n",
443
+ " wandb.init(\n",
444
+ " id=model_name+'_HCP_FT' + f\"_{random_id}\",\n",
445
+ " project=wandb_project,\n",
446
+ " name=model_name+'_HCP_FT',\n",
447
+ " config=wandb_config,\n",
448
+ " resume=\"allow\",\n",
449
+ " )"
450
+ ]
451
+ },
452
+ {
453
+ "cell_type": "code",
454
+ "execution_count": 13,
455
+ "id": "f6e16767",
456
+ "metadata": {},
457
+ "outputs": [],
458
+ "source": [
459
+ "import wandb\n",
460
+ "\n",
461
+ "if utils.is_interactive():\n",
462
+ " print(\"Running in interactive notebook. Disabling W&B and ckpt saving.\")\n",
463
+ " wandb_log = True\n",
464
+ " save_ckpt = False\n",
465
+ "\n",
466
+ "if wandb_log:\n",
467
+ " wandb_project = 'fMRI-foundation-model'\n",
468
+ " wandb_config = {\n",
469
+ " \"model_name\": model_name+'_HCP_FT',\n",
470
+ " \"batch_size\": batch_size,\n",
471
+ " \"learning_rate\": learning_rate,\n",
472
+ " \"weight_decay\": weight_decay,\n",
473
+ " \"num_epochs\": num_epochs,\n",
474
+ " \"seed\": seed,\n",
475
+ " }\n",
476
+ " print(\"wandb_config:\\n\", wandb_config)\n",
477
+ " random_id = str(uuid.uuid4())\n",
478
+ " print(\"wandb_id:\", \"HCPflat_raw\" + f\"_{random_id}\")\n",
479
+ " wandb.init(\n",
480
+ " id=model_name+'_HCP_FT' + f\"_{random_id}\",\n",
481
+ " project=wandb_project,\n",
482
+ " name=model_name+'_HCP_FT',\n",
483
+ " config=wandb_config,\n",
484
+ " resume=\"allow\",\n",
485
+ " )"
486
+ ]
487
+ }
488
+ ],
489
+ "metadata": {
490
+ "kernelspec": {
491
+ "display_name": "Python 3",
492
+ "language": "python",
493
+ "name": "python3"
494
+ },
495
+ "language_info": {
496
+ "codemirror_mode": {
497
+ "name": "ipython",
498
+ "version": 3
499
+ },
500
+ "file_extension": ".py",
501
+ "mimetype": "text/x-python",
502
+ "name": "python",
503
+ "nbconvert_exporter": "python",
504
+ "pygments_lexer": "ipython3",
505
+ "version": "3.11.9"
506
+ }
507
+ },
508
+ "nbformat": 4,
509
+ "nbformat_minor": 5
510
+ }
fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/files/config.yaml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _wandb:
2
+ value:
3
+ cli_version: 0.18.3
4
+ m: []
5
+ python_version: 3.11.9
6
+ session_history: code/_session_history.ipynb
7
+ t:
8
+ "1":
9
+ - 1
10
+ - 5
11
+ - 41
12
+ - 49
13
+ - 53
14
+ - 55
15
+ - 63
16
+ "2":
17
+ - 1
18
+ - 5
19
+ - 41
20
+ - 49
21
+ - 53
22
+ - 55
23
+ - 63
24
+ "3":
25
+ - 2
26
+ - 13
27
+ - 14
28
+ - 16
29
+ - 23
30
+ - 55
31
+ "4": 3.11.9
32
+ "5": 0.18.3
33
+ "8":
34
+ - 1
35
+ - 5
36
+ "12": 0.18.3
37
+ "13": linux-x86_64
38
+ batch_size:
39
+ value: 8
40
+ learning_rate:
41
+ value: 0.0001
42
+ model_name:
43
+ value: HCPflat_large_gsrFalse__HCP_FT
44
+ num_epochs:
45
+ value: 20
46
+ seed:
47
+ value: 42
48
+ weight_decay:
49
+ value: 1e-05
fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/files/output.log ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ Running in interactive notebook. Disabling W&B and ckpt saving.
2
+ wandb_config:
3
+ {'model_name': 'HCPflat_large_gsrFalse__HCP_FT', 'batch_size': 8, 'learning_rate': 0.0001, 'weight_decay': 1e-05, 'num_epochs': 20, 'seed': 42}
4
+ wandb_id: HCPflat_raw_06a43d89-5346-4bb5-ac55-1b000bfb55d9
fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/files/wandb-metadata.json ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "os": "Linux-5.15.0-1058-aws-x86_64-with-glibc2.31",
3
+ "python": "3.11.9",
4
+ "startedAt": "2024-11-26T14:15:16.409076Z",
5
+ "program": "ckadirt/fMRI-foundation-model/src/HCP_downstream_finetune.ipynb",
6
+ "git": {
7
+ "remote": "https://github.com/MedARC-AI/fMRI-foundation-model",
8
+ "commit": "7c9bb03314a9f929bb8f0fc0ce92c85ea1a2e495"
9
+ },
10
+ "email": "torrico.villanueva.cesar.kadir@gmail.com",
11
+ "root": "/weka/proj-fmri/ckadirt/fMRI-foundation-model/src",
12
+ "host": "ip-10-0-135-126",
13
+ "username": "ckadirt",
14
+ "executable": "/admin/home-ckadirt/foundation_env/bin/python",
15
+ "cpu_count": 96,
16
+ "cpu_count_logical": 192,
17
+ "gpu": "[NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3]",
18
+ "gpu_count": 8,
19
+ "disk": {
20
+ "/": {
21
+ "total": "249555763200",
22
+ "used": "184980103168"
23
+ }
24
+ },
25
+ "memory": {
26
+ "total": "2147443412992"
27
+ },
28
+ "cpu": {
29
+ "count": 96,
30
+ "countLogical": 192
31
+ },
32
+ "gpu_nvidia": [
33
+ {
34
+ "name": "NVIDIA H100 80GB HBM3",
35
+ "memoryTotal": "85520809984",
36
+ "cudaCores": 16896,
37
+ "architecture": "Hopper"
38
+ },
39
+ {
40
+ "name": "NVIDIA H100 80GB HBM3",
41
+ "memoryTotal": "85520809984",
42
+ "cudaCores": 16896,
43
+ "architecture": "Hopper"
44
+ },
45
+ {
46
+ "name": "NVIDIA H100 80GB HBM3",
47
+ "memoryTotal": "85520809984",
48
+ "cudaCores": 16896,
49
+ "architecture": "Hopper"
50
+ },
51
+ {
52
+ "name": "NVIDIA H100 80GB HBM3",
53
+ "memoryTotal": "85520809984",
54
+ "cudaCores": 16896,
55
+ "architecture": "Hopper"
56
+ },
57
+ {
58
+ "name": "NVIDIA H100 80GB HBM3",
59
+ "memoryTotal": "85520809984",
60
+ "cudaCores": 16896,
61
+ "architecture": "Hopper"
62
+ },
63
+ {
64
+ "name": "NVIDIA H100 80GB HBM3",
65
+ "memoryTotal": "85520809984",
66
+ "cudaCores": 16896,
67
+ "architecture": "Hopper"
68
+ },
69
+ {
70
+ "name": "NVIDIA H100 80GB HBM3",
71
+ "memoryTotal": "85520809984",
72
+ "cudaCores": 16896,
73
+ "architecture": "Hopper"
74
+ },
75
+ {
76
+ "name": "NVIDIA H100 80GB HBM3",
77
+ "memoryTotal": "85520809984",
78
+ "cudaCores": 16896,
79
+ "architecture": "Hopper"
80
+ }
81
+ ],
82
+ "slurm": {
83
+ "cluster_name": "sagemaker2",
84
+ "conf": "/opt/slurm/etc/slurm.conf",
85
+ "cpu_bind": "quiet,mask_cpu:0x00000000000000003C00FC0000000000000000003C00FC00",
86
+ "cpu_bind_list": "0x00000000000000003C00FC0000000000000000003C00FC00",
87
+ "cpu_bind_type": "mask_cpu:",
88
+ "cpu_bind_verbose": "quiet",
89
+ "cpus_on_node": "20",
90
+ "gpus": "1",
91
+ "gpus_on_node": "1",
92
+ "gtids": "0",
93
+ "job_account": "fmri",
94
+ "job_cpus_per_node": "20",
95
+ "job_end_time": "1732683404",
96
+ "job_gid": "1879800513",
97
+ "job_group": "Domain Users",
98
+ "job_id": "541182",
99
+ "job_name": "bash",
100
+ "job_nodelist": "ip-10-0-135-126",
101
+ "job_num_nodes": "1",
102
+ "job_partition": "p5",
103
+ "job_qos": "idle",
104
+ "job_start_time": "1732629404",
105
+ "job_uid": "1879804696",
106
+ "job_user": "ckadirt",
107
+ "jobid": "541182",
108
+ "launch_node_ipaddr": "172.17.12.61",
109
+ "localid": "0",
110
+ "mpi_type": "pmix_v3",
111
+ "nnodes": "1",
112
+ "nodeid": "0",
113
+ "nodelist": "ip-10-0-135-126",
114
+ "nprocs": "1",
115
+ "ntasks": "1",
116
+ "pmix_mapping_serv": "(vector,(0,1,1))",
117
+ "pmixp_abort_agent_port": "37569",
118
+ "prio_process": "0",
119
+ "procid": "0",
120
+ "pty_port": "34527",
121
+ "pty_win_col": "205",
122
+ "pty_win_row": "21",
123
+ "script_context": "prolog_task",
124
+ "srun_comm_host": "172.17.12.61",
125
+ "srun_comm_port": "42777",
126
+ "step_gpus": "1",
127
+ "step_id": "0",
128
+ "step_launcher_port": "42777",
129
+ "step_nodelist": "ip-10-0-135-126",
130
+ "step_num_nodes": "1",
131
+ "step_num_tasks": "1",
132
+ "step_tasks_per_node": "1",
133
+ "stepid": "0",
134
+ "submit_dir": "/weka/proj-fmri",
135
+ "submit_host": "ip-172-17-12-61",
136
+ "task_pid": "1856467",
137
+ "tasks_per_node": "1",
138
+ "topology_addr": "ip-10-0-135-126",
139
+ "topology_addr_pattern": "node",
140
+ "umask": "0022",
141
+ "working_cluster": "sagemaker2:ip-172-17-63-161:6817:9984:109"
142
+ },
143
+ "cudaVersion": "12.2"
144
+ }
fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/files/wandb-summary.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"_wandb":{"runtime":1}}
fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/logs/debug-core.log ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"time":"2024-11-26T14:15:15.826910446Z","level":"INFO","msg":"started logging, with flags","port-filename":"/tmp/tmpawnk3nqm/port-1863430.txt","pid":1863430,"debug":false,"disable-analytics":false}
2
+ {"time":"2024-11-26T14:15:15.82724423Z","level":"INFO","msg":"FeatureState","shutdownOnParentExitEnabled":false}
3
+ {"time":"2024-11-26T14:15:15.832997851Z","level":"INFO","msg":"Will exit if parent process dies.","ppid":1863430}
4
+ {"time":"2024-11-26T14:15:15.83295411Z","level":"INFO","msg":"server is running","addr":{"IP":"127.0.0.1","Port":42111,"Zone":""}}
5
+ {"time":"2024-11-26T14:15:15.943657315Z","level":"INFO","msg":"connection: ManageConnectionData: new connection created","id":"127.0.0.1:42876"}
6
+ {"time":"2024-11-26T14:15:16.41249604Z","level":"INFO","msg":"handleInformInit: received","streamId":"HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275","id":"127.0.0.1:42876"}
7
+ {"time":"2024-11-26T14:15:16.452884654Z","level":"INFO","msg":"handleInformInit: stream started","streamId":"HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275","id":"127.0.0.1:42876"}
8
+ {"time":"2024-11-26T14:15:28.525648106Z","level":"INFO","msg":"handleInformFinish: finish message received","streamId":"HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275","id":"127.0.0.1:42876"}
9
+ {"time":"2024-11-26T14:15:28.52594631Z","level":"INFO","msg":"handleInformFinish: stream closed","streamId":"HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275","id":"127.0.0.1:42876"}
10
+ {"time":"2024-11-26T14:15:28.573694737Z","level":"INFO","msg":"handleInformInit: received","streamId":"HCPflat_large_gsrFalse__HCP_FT_06a43d89-5346-4bb5-ac55-1b000bfb55d9","id":"127.0.0.1:42876"}
11
+ {"time":"2024-11-26T14:15:28.594206293Z","level":"INFO","msg":"handleInformInit: stream started","streamId":"HCPflat_large_gsrFalse__HCP_FT_06a43d89-5346-4bb5-ac55-1b000bfb55d9","id":"127.0.0.1:42876"}
12
+ {"time":"2024-11-26T14:37:12.211752238Z","level":"INFO","msg":"handleInformFinish: finish message received","streamId":"HCPflat_large_gsrFalse__HCP_FT_06a43d89-5346-4bb5-ac55-1b000bfb55d9","id":"127.0.0.1:42876"}
13
+ {"time":"2024-11-26T14:37:12.212190204Z","level":"INFO","msg":"handleInformFinish: stream closed","streamId":"HCPflat_large_gsrFalse__HCP_FT_06a43d89-5346-4bb5-ac55-1b000bfb55d9","id":"127.0.0.1:42876"}
14
+ {"time":"2024-11-26T14:37:12.303091089Z","level":"INFO","msg":"handleInformInit: received","streamId":"HCPflat_large_gsrFalse__HCP_FT_79bf330c-a53f-43d5-86dd-b4bb676b9b78","id":"127.0.0.1:42876"}
15
+ {"time":"2024-11-26T14:37:12.332059235Z","level":"INFO","msg":"handleInformInit: stream started","streamId":"HCPflat_large_gsrFalse__HCP_FT_79bf330c-a53f-43d5-86dd-b4bb676b9b78","id":"127.0.0.1:42876"}
16
+ {"time":"2024-11-26T22:09:54.413039355Z","level":"INFO","msg":"Parent process exited, terminating service process."}
fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/logs/debug-internal.log ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"time":"2024-11-26T14:15:16.415628583Z","level":"INFO","msg":"using version","core version":"0.18.3"}
2
+ {"time":"2024-11-26T14:15:16.415654704Z","level":"INFO","msg":"created symlink","path":"/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/logs/debug-core.log"}
3
+ {"time":"2024-11-26T14:15:16.427775113Z","level":"ERROR","msg":"dialing: google: could not find default credentials. See https://cloud.google.com/docs/authentication/external/set-up-adc for more information"}
4
+ {"time":"2024-11-26T14:15:16.452803943Z","level":"INFO","msg":"created new stream","id":"HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275"}
5
+ {"time":"2024-11-26T14:15:16.452877374Z","level":"INFO","msg":"stream: started","id":"HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275"}
6
+ {"time":"2024-11-26T14:15:16.452943455Z","level":"INFO","msg":"sender: started","stream_id":{"value":"HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275"}}
7
+ {"time":"2024-11-26T14:15:16.452925124Z","level":"INFO","msg":"handler: started","stream_id":{"value":"HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275"}}
8
+ {"time":"2024-11-26T14:15:16.452906964Z","level":"INFO","msg":"writer: Do: started","stream_id":{"value":"HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275"}}
9
+ {"time":"2024-11-26T14:15:16.94334406Z","level":"INFO","msg":"wandb-core","!BADKEY":null}
10
+ {"time":"2024-11-26T14:15:16.945008253Z","level":"INFO","msg":"Starting system monitor"}
11
+ {"time":"2024-11-26T14:15:16.945029183Z","level":"WARN","msg":"handleCodeSave: program relative path is empty"}
12
+ {"time":"2024-11-26T14:15:16.945324567Z","level":"ERROR","msg":"git repo not found","error":"repository does not exist"}
13
+ {"time":"2024-11-26T14:15:17.544206827Z","level":"INFO","msg":"Pausing system monitor"}
14
+ {"time":"2024-11-26T14:15:25.711690366Z","level":"INFO","msg":"Resuming system monitor"}
15
+ {"time":"2024-11-26T14:15:25.864375168Z","level":"INFO","msg":"Stopping system monitor"}
16
+ {"time":"2024-11-26T14:15:25.880375861Z","level":"INFO","msg":"Stopped system monitor"}
17
+ {"time":"2024-11-26T14:15:27.240930623Z","level":"INFO","msg":"fileTransfer: Close: file transfer manager closed"}
18
+ {"time":"2024-11-26T14:15:28.525809828Z","level":"INFO","msg":"stream: closing","id":"HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275"}
19
+ {"time":"2024-11-26T14:15:28.525840959Z","level":"INFO","msg":"handler: closed","stream_id":{"value":"HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275"}}
20
+ {"time":"2024-11-26T14:15:28.525863569Z","level":"INFO","msg":"writer: Close: closed","stream_id":{"value":"HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275"}}
21
+ {"time":"2024-11-26T14:15:28.525873079Z","level":"INFO","msg":"sender: closed","stream_id":{"value":"HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275"}}
22
+ {"time":"2024-11-26T14:15:28.52593536Z","level":"INFO","msg":"stream: closed","id":"HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275"}
23
+ {"time":"2024-11-26T14:15:30.868165585Z","level":"ERROR","msg":"monitor: gpu: timeout waiting for process to exit"}
fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/logs/debug.log ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 2024-11-26 14:15:16,398 INFO MainThread:1863430 [wandb_setup.py:_flush():79] Current SDK version is 0.18.3
2
+ 2024-11-26 14:15:16,398 INFO MainThread:1863430 [wandb_setup.py:_flush():79] Configure stats pid to 1863430
3
+ 2024-11-26 14:15:16,398 INFO MainThread:1863430 [wandb_setup.py:_flush():79] Loading settings from /admin/home-ckadirt/.config/wandb/settings
4
+ 2024-11-26 14:15:16,398 INFO MainThread:1863430 [wandb_setup.py:_flush():79] Loading settings from /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/settings
5
+ 2024-11-26 14:15:16,398 INFO MainThread:1863430 [wandb_setup.py:_flush():79] Loading settings from environment variables: {}
6
+ 2024-11-26 14:15:16,398 INFO MainThread:1863430 [wandb_setup.py:_flush():79] Applying setup settings: {'mode': None, '_disable_service': None}
7
+ 2024-11-26 14:15:16,399 INFO MainThread:1863430 [wandb_setup.py:_flush():79] Inferring run settings from compute environment: {'program': '<python with no main file>'}
8
+ 2024-11-26 14:15:16,399 INFO MainThread:1863430 [wandb_setup.py:_flush():79] Applying login settings: {}
9
+ 2024-11-26 14:15:16,399 INFO MainThread:1863430 [wandb_init.py:_log_setup():532] Logging user logs to /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/logs/debug.log
10
+ 2024-11-26 14:15:16,399 INFO MainThread:1863430 [wandb_init.py:_log_setup():533] Logging internal logs to /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/logs/debug-internal.log
11
+ 2024-11-26 14:15:16,400 INFO MainThread:1863430 [wandb_init.py:_jupyter_setup():478] configuring jupyter hooks <wandb.sdk.wandb_init._WandbInit object at 0x7fea4c91d250>
12
+ 2024-11-26 14:15:16,401 INFO MainThread:1863430 [wandb_init.py:init():617] calling init triggers
13
+ 2024-11-26 14:15:16,401 INFO MainThread:1863430 [wandb_init.py:init():624] wandb.init called with sweep_config: {}
14
+ config: {'model_name': 'HCPflat_large_gsrFalse__HCP_FT', 'batch_size': 8, 'learning_rate': 0.0001, 'weight_decay': 1e-05, 'num_epochs': 20, 'seed': 42}
15
+ 2024-11-26 14:15:16,401 INFO MainThread:1863430 [wandb_init.py:init():667] starting backend
16
+ 2024-11-26 14:15:16,402 INFO MainThread:1863430 [wandb_init.py:init():671] sending inform_init request
17
+ 2024-11-26 14:15:16,407 INFO MainThread:1863430 [backend.py:_multiprocessing_setup():104] multiprocessing start_methods=fork,spawn,forkserver, using: spawn
18
+ 2024-11-26 14:15:16,408 INFO MainThread:1863430 [wandb_init.py:init():684] backend started and connected
19
+ 2024-11-26 14:15:16,433 INFO MainThread:1863430 [wandb_run.py:_label_probe_notebook():1346] probe notebook
20
+ 2024-11-26 14:15:16,434 INFO MainThread:1863430 [wandb_run.py:_label_probe_notebook():1356] Unable to probe notebook: 'NoneType' object has no attribute 'get'
21
+ 2024-11-26 14:15:16,435 INFO MainThread:1863430 [wandb_init.py:init():779] updated telemetry
22
+ 2024-11-26 14:15:16,468 INFO MainThread:1863430 [wandb_init.py:init():812] communicating run to backend with 90.0 second timeout
23
+ 2024-11-26 14:15:16,938 INFO MainThread:1863430 [wandb_init.py:init():863] starting run threads in backend
24
+ 2024-11-26 14:15:17,502 INFO MainThread:1863430 [wandb_run.py:_console_start():2465] atexit reg
25
+ 2024-11-26 14:15:17,502 INFO MainThread:1863430 [wandb_run.py:_redirect():2313] redirect: wrap_raw
26
+ 2024-11-26 14:15:17,502 INFO MainThread:1863430 [wandb_run.py:_redirect():2378] Wrapping output streams.
27
+ 2024-11-26 14:15:17,502 INFO MainThread:1863430 [wandb_run.py:_redirect():2403] Redirects installed.
28
+ 2024-11-26 14:15:17,514 INFO MainThread:1863430 [wandb_init.py:init():907] run started, returning control to user process
29
+ 2024-11-26 14:15:17,519 INFO MainThread:1863430 [jupyter.py:_save_ipynb():398] looking for notebook: ckadirt/fMRI-foundation-model/src/HCP_downstream_finetune.ipynb
30
+ 2024-11-26 14:15:17,520 INFO MainThread:1863430 [wandb_init.py:_pause_backend():443] pausing backend
31
+ 2024-11-26 14:15:25,710 INFO MainThread:1863430 [wandb_init.py:_resume_backend():448] resuming backend
32
+ 2024-11-26 14:15:25,764 INFO MainThread:1863430 [wandb_setup.py:_flush():79] Current SDK version is 0.18.3
33
+ 2024-11-26 14:15:25,765 INFO MainThread:1863430 [wandb_setup.py:_flush():79] Configure stats pid to 1863430
34
+ 2024-11-26 14:15:25,765 INFO MainThread:1863430 [wandb_setup.py:_flush():79] Loading settings from /admin/home-ckadirt/.config/wandb/settings
35
+ 2024-11-26 14:15:25,766 INFO MainThread:1863430 [wandb_setup.py:_flush():79] Loading settings from /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/settings
36
+ 2024-11-26 14:15:25,766 INFO MainThread:1863430 [wandb_setup.py:_flush():79] Loading settings from environment variables: {}
37
+ 2024-11-26 14:15:25,766 INFO MainThread:1863430 [wandb_setup.py:_flush():79] Applying setup settings: {'mode': None, '_disable_service': None}
38
+ 2024-11-26 14:15:25,766 INFO MainThread:1863430 [wandb_setup.py:_flush():79] Inferring run settings from compute environment: {'program': '<python with no main file>'}
39
+ 2024-11-26 14:15:25,766 INFO MainThread:1863430 [wandb_setup.py:_flush():79] Applying login settings: {}
40
+ 2024-11-26 14:15:25,766 INFO MainThread:1863430 [wandb_init.py:_log_setup():532] Logging user logs to /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241126_141525-HCPflat_large_gsrFalse__HCP_FT_06a43d89-5346-4bb5-ac55-1b000bfb55d9/logs/debug.log
41
+ 2024-11-26 14:15:25,767 INFO MainThread:1863430 [wandb_init.py:_log_setup():533] Logging internal logs to /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241126_141525-HCPflat_large_gsrFalse__HCP_FT_06a43d89-5346-4bb5-ac55-1b000bfb55d9/logs/debug-internal.log
42
+ 2024-11-26 14:15:25,768 INFO MainThread:1863430 [wandb_init.py:init():617] calling init triggers
43
+ 2024-11-26 14:15:25,768 INFO MainThread:1863430 [wandb_init.py:init():624] wandb.init called with sweep_config: {}
44
+ config: {'model_name': 'HCPflat_large_gsrFalse__HCP_FT', 'batch_size': 8, 'learning_rate': 0.0001, 'weight_decay': 1e-05, 'num_epochs': 20, 'seed': 42}
45
+ 2024-11-26 14:15:25,768 INFO MainThread:1863430 [wandb_init.py:init():642] re-initializing run, found existing run on stack: HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275
46
+ 2024-11-26 14:15:25,774 INFO MainThread:1863430 [wandb_run.py:_finish():2164] finishing run ckadirt/fMRI-foundation-model/HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275
47
+ 2024-11-26 14:15:25,850 INFO MainThread:1863430 [jupyter.py:save_history():488] saving 13 cells to _session_history.ipynb
48
+ 2024-11-26 14:15:25,850 INFO MainThread:1863430 [wandb_run.py:_config_callback():1394] config_cb ('_wandb', 'session_history') code/_session_history.ipynb None
49
+ 2024-11-26 14:15:25,863 INFO MainThread:1863430 [jupyter.py:_save_ipynb():398] looking for notebook: ckadirt/fMRI-foundation-model/src/HCP_downstream_finetune.ipynb
50
+ 2024-11-26 14:15:25,863 INFO MainThread:1863430 [wandb_init.py:_jupyter_teardown():460] cleaning up jupyter logic
51
+ 2024-11-26 14:15:25,863 INFO MainThread:1863430 [wandb_run.py:_atexit_cleanup():2428] got exitcode: 0
52
+ 2024-11-26 14:15:25,863 INFO MainThread:1863430 [wandb_run.py:_restore():2410] restore
53
+ 2024-11-26 14:15:25,864 INFO MainThread:1863430 [wandb_run.py:_restore():2416] restore done
54
+ 2024-11-26 14:15:28,512 INFO MainThread:1863430 [wandb_run.py:_footer_history_summary_info():4049] rendering history
55
+ 2024-11-26 14:15:28,512 INFO MainThread:1863430 [wandb_run.py:_footer_history_summary_info():4081] rendering summary
56
+ 2024-11-26 14:15:28,522 INFO MainThread:1863430 [wandb_run.py:_footer_sync_info():4008] logging synced files
fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/run-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275.wandb ADDED
Binary file (3.1 kB). View file
 
fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275/tmp/code/_session_history.ipynb ADDED
@@ -0,0 +1,510 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "3b251ac1",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "# Import packages and setup gpu configuration.\n",
11
+ "# This code block shouldnt need to be adjusted!\n",
12
+ "import os\n",
13
+ "import sys\n",
14
+ "import json\n",
15
+ "import yaml\n",
16
+ "import numpy as np\n",
17
+ "import copy\n",
18
+ "import math\n",
19
+ "import time\n",
20
+ "import random\n",
21
+ "from tqdm.auto import tqdm\n",
22
+ "import webdataset as wds\n",
23
+ "import matplotlib.pyplot as plt\n",
24
+ "\n",
25
+ "import torch\n",
26
+ "import torch.nn as nn\n",
27
+ "from torchvision import transforms\n",
28
+ "import utils\n",
29
+ "from mae_utils.flat_models import *\n",
30
+ "import h5py\n",
31
+ "from mae_utils import flat_models\n",
32
+ "\n",
33
+ "# tf32 data type is faster than standard float32\n",
34
+ "torch.backends.cuda.matmul.allow_tf32 = True\n",
35
+ "# following fixes a Conv3D CUDNN_NOT_SUPPORTED error\n",
36
+ "torch.backends.cudnn.benchmark = True\n",
37
+ "\n",
38
+ "# ## MODEL TO LOAD ##\n",
39
+ "if utils.is_interactive():\n",
40
+ " model_name = \"HCPflat_large_gsrFalse_\"\n",
41
+ "else:\n",
42
+ " model_name = sys.argv[1]\n",
43
+ " \n",
44
+ "\n",
45
+ "# outdir = os.path.abspath(f'checkpoints/{model_name}')\n",
46
+ "outdir = os.path.abspath(f'checkpoints/{model_name}')\n",
47
+ "\n",
48
+ "print(\"outdir\", outdir)\n",
49
+ "# Load previous config.yaml if available\n",
50
+ "if os.path.exists(f\"{outdir}/config.yaml\"):\n",
51
+ " config = yaml.load(open(f\"{outdir}/config.yaml\", 'r'), Loader=yaml.FullLoader)\n",
52
+ " print(f\"Loaded config.yaml from ckpt folder {outdir}\")\n",
53
+ " # create global variables from the config\n",
54
+ " print(\"\\n__CONFIG__\")\n",
55
+ " for attribute_name in config.keys():\n",
56
+ " print(f\"{attribute_name} = {config[attribute_name]}\")\n",
57
+ " globals()[attribute_name] = config[f'{attribute_name}']\n",
58
+ " print(\"\\n\")\n",
59
+ "\n",
60
+ "world_size = os.getenv('WORLD_SIZE')\n",
61
+ "if world_size is None: \n",
62
+ " world_size = 1\n",
63
+ "else:\n",
64
+ " world_size = int(world_size)\n",
65
+ "print(f\"WORLD_SIZE={world_size}\")\n",
66
+ "\n",
67
+ "if utils.is_interactive():\n",
68
+ " # Following allows you to change functions in models.py or utils.py and \n",
69
+ " # have this notebook automatically update with your revisions\n",
70
+ " %load_ext autoreload\n",
71
+ " %autoreload 2\n",
72
+ "\n",
73
+ "batch_size = probe_batch_size\n",
74
+ "num_epochs = probe_num_epochs\n",
75
+ "\n",
76
+ "data_type = torch.float32 # change depending on your mixed_precision\n",
77
+ "global_batch_size = batch_size * world_size\n",
78
+ "\n",
79
+ "device = torch.device('cuda')\n",
80
+ "\n",
81
+ "hcp_flat_path = \"/weka/proj-medarc/shared/HCP-Flat\"\n",
82
+ "# seed = 42\n",
83
+ "# num_frames = 16\n",
84
+ "# gsr = False\n",
85
+ "# num_workers = 10\n",
86
+ "# batch_size = 128\n",
87
+ "save_ckpt = True\n",
88
+ "wandb_log = True\n",
89
+ "print(\"PID of this process =\",os.getpid())\n",
90
+ "utils.seed_everything(seed)"
91
+ ]
92
+ },
93
+ {
94
+ "cell_type": "code",
95
+ "execution_count": 2,
96
+ "id": "eca8380a",
97
+ "metadata": {},
98
+ "outputs": [],
99
+ "source": [
100
+ "if os.getenv('global_pool') == \"False\":\n",
101
+ " global_pool = False\n",
102
+ "else:\n",
103
+ " global_pool = True\n",
104
+ "print(f\"global_pool = {global_pool}\")\n",
105
+ "\n",
106
+ "try:\n",
107
+ " gsr\n",
108
+ "except:\n",
109
+ " gsr = True\n",
110
+ " print(\"set gsr to True\")\n",
111
+ "print(f\"gsr = {gsr}\")"
112
+ ]
113
+ },
114
+ {
115
+ "cell_type": "code",
116
+ "execution_count": 3,
117
+ "id": "e2b114fa",
118
+ "metadata": {},
119
+ "outputs": [],
120
+ "source": [
121
+ "from sklearn.preprocessing import LabelEncoder\n",
122
+ "\n",
123
+ "INCLUDE_CONDS = {\n",
124
+ " \"fear\",\n",
125
+ " \"neut\",\n",
126
+ " \"math\",\n",
127
+ " \"story\",\n",
128
+ " \"lf\",\n",
129
+ " \"lh\",\n",
130
+ " \"rf\",\n",
131
+ " \"rh\",\n",
132
+ " \"t\",\n",
133
+ " \"match\",\n",
134
+ " \"relation\",\n",
135
+ " \"mental\",\n",
136
+ " \"rnd\",\n",
137
+ " \"0bk_body\",\n",
138
+ " \"2bk_body\",\n",
139
+ " \"0bk_faces\",\n",
140
+ " \"2bk_faces\",\n",
141
+ " \"0bk_places\",\n",
142
+ " \"2bk_places\",\n",
143
+ " \"0bk_tools\",\n",
144
+ " \"2bk_tools\",\n",
145
+ "}\n",
146
+ "\n",
147
+ "# test_data = []\n",
148
+ "\n",
149
+ "# # Iterate over the DataLoader with a progress bar\n",
150
+ "# for sample in tqdm(train_dl, desc=\"Processing samples\"):\n",
151
+ "# x = sample['image']\n",
152
+ "# y = sample['meta']['trial_type']\n",
153
+ "# key = sample['meta']['key']\n",
154
+ "# print(x.shape, y, key)\n",
155
+ "# break\n",
156
+ "# Initialize the label encoder\n",
157
+ "label_encoder = LabelEncoder()\n",
158
+ "label_encoder.fit(sorted(INCLUDE_CONDS)) # Ensure consistent ordering\n",
159
+ "\n",
160
+ "num_classes = len(label_encoder.classes_)\n",
161
+ "print(f\"Number of classes: {num_classes}\")"
162
+ ]
163
+ },
164
+ {
165
+ "cell_type": "code",
166
+ "execution_count": 4,
167
+ "id": "1c982221",
168
+ "metadata": {},
169
+ "outputs": [],
170
+ "source": [
171
+ "f_train = h5py.File('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/train_hcp_raw_flatmaps.hdf5', 'r')\n",
172
+ "flatmaps_train = f_train['flatmaps']\n",
173
+ "\n",
174
+ "f_test = h5py.File('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/test_hcp_raw_flatmaps.hdf5', 'r')\n",
175
+ "flatmaps_test = f_test['flatmaps']\n",
176
+ "\n",
177
+ "metadata_train = np.load('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/metadata_train_HCP_raw_flatmaps.npy', allow_pickle=True)\n",
178
+ "metadata_test = np.load('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/metadata_test_HCP_raw_flatmaps.npy', allow_pickle=True)"
179
+ ]
180
+ },
181
+ {
182
+ "cell_type": "code",
183
+ "execution_count": 5,
184
+ "id": "dbfbf855",
185
+ "metadata": {},
186
+ "outputs": [],
187
+ "source": [
188
+ "from torch.utils.data import Dataset, DataLoader\n",
189
+ "\n",
190
+ "class HCPFlatDataset(Dataset):\n",
191
+ " def __init__(self, flatmaps, metadata):\n",
192
+ " self.flatmaps = flatmaps\n",
193
+ " self.metadata = metadata\n",
194
+ "\n",
195
+ " def __len__(self):\n",
196
+ " return len(self.metadata)\n",
197
+ "\n",
198
+ " def __getitem__(self, idx):\n",
199
+ " return self.flatmaps[idx], json.loads(self.metadata[idx])\n",
200
+ "print(\"Creating datasets\")\n",
201
+ "# Loading to cpu for faster training, this can take several minutes. Remove this [:] if you want to move one at the time.\n",
202
+ "train_dataset = HCPFlatDataset(flatmaps_train, metadata_train)\n",
203
+ "train_dl = DataLoader(train_dataset, batch_size=batch_size, shuffle=True, num_workers=num_workers)\n",
204
+ "\n",
205
+ "test_dataset = HCPFlatDataset(flatmaps_test, metadata_test)\n",
206
+ "test_dl = DataLoader(test_dataset, batch_size=batch_size, shuffle=False, num_workers=0)\n",
207
+ "print(\"Datasets ready\")"
208
+ ]
209
+ },
210
+ {
211
+ "cell_type": "code",
212
+ "execution_count": 6,
213
+ "id": "997e9b8d",
214
+ "metadata": {},
215
+ "outputs": [],
216
+ "source": [
217
+ "from mae_utils.flat import load_hcp_flat_mask\n",
218
+ "from mae_utils.flat import create_hcp_flat\n",
219
+ "from mae_utils.flat import batch_unmask\n",
220
+ "import mae_utils.visualize as vis\n",
221
+ "\n",
222
+ "flat_mask = load_hcp_flat_mask(hcp_flat_path)\n",
223
+ "\n",
224
+ "mae_model = flat_models.mae_vit_large_fmri(\n",
225
+ " patch_size=patch_size,\n",
226
+ " decoder_embed_dim=decoder_embed_dim,\n",
227
+ " t_patch_size=t_patch_size,\n",
228
+ " pred_t_dim=pred_t_dim,\n",
229
+ " decoder_depth=4,\n",
230
+ " cls_embed=cls_embed,\n",
231
+ " norm_pix_loss=norm_pix_loss,\n",
232
+ " no_qkv_bias=no_qkv_bias,\n",
233
+ " sep_pos_embed=sep_pos_embed,\n",
234
+ " trunc_init=trunc_init,\n",
235
+ " pct_masks_to_decode=pct_masks_to_decode,\n",
236
+ " img_mask=flat_mask,\n",
237
+ ")"
238
+ ]
239
+ },
240
+ {
241
+ "cell_type": "code",
242
+ "execution_count": 7,
243
+ "id": "de9421fa",
244
+ "metadata": {},
245
+ "outputs": [],
246
+ "source": [
247
+ "checkpoint_files = [f for f in os.listdir(outdir) if f.endswith('.pth')]\n",
248
+ "\n",
249
+ "if utils.is_interactive():\n",
250
+ " latest_checkpoint = \"epoch99.pth\"\n",
251
+ "else:\n",
252
+ " latest_checkpoint = sys.argv[2] \n",
253
+ "print(f\"latest_checkpoint: {latest_checkpoint}\")\n",
254
+ "\n",
255
+ "# Load the checkpoint\n",
256
+ "checkpoint_path = os.path.join(outdir, latest_checkpoint)\n",
257
+ "\n",
258
+ "state = torch.load(checkpoint_path)\n",
259
+ "mae_model.load_state_dict(state[\"model_state_dict\"], strict=False)\n",
260
+ "mae_model.to(device)\n",
261
+ "\n",
262
+ "print(f\"\\nLoaded checkpoint {latest_checkpoint} from {outdir}\\n\")"
263
+ ]
264
+ },
265
+ {
266
+ "cell_type": "code",
267
+ "execution_count": 8,
268
+ "id": "cb8bfc70",
269
+ "metadata": {},
270
+ "outputs": [],
271
+ "source": [
272
+ "class LinearClassifier(nn.Module):\n",
273
+ " def __init__(self, input_dim, num_classes):\n",
274
+ " super(LinearClassifier, self).__init__()\n",
275
+ " self.linear = nn.Linear(input_dim, num_classes)\n",
276
+ " \n",
277
+ " def forward(self, x):\n",
278
+ " # Flatten the input except for the batch dimension\n",
279
+ " x = x.view(x.size(0), -1)\n",
280
+ " out = self.linear(x)\n",
281
+ " return out # Raw logits\n",
282
+ "\n",
283
+ "# Determine the input dimension from a single sample\n",
284
+ "# Assuming images are of shape [1, 16, 144, 320]\n",
285
+ "input_dim = np.prod(mae_model(torch.randn(1,1,16,144,320).to(device),global_pool=global_pool, forward_features = True).shape[1:])\n",
286
+ "print(f\"Input dimension: {input_dim}\")"
287
+ ]
288
+ },
289
+ {
290
+ "cell_type": "code",
291
+ "execution_count": 9,
292
+ "id": "455d9468",
293
+ "metadata": {},
294
+ "outputs": [],
295
+ "source": [
296
+ "class FullModel(nn.Module):\n",
297
+ " def __init__(self, lc_model, mae_model):\n",
298
+ " super(FullModel, self).__init__()\n",
299
+ " self.lc_model = lc_model\n",
300
+ " self.mae_model = mae_model\n",
301
+ " \n",
302
+ " \n",
303
+ " def forward(self, x, gsr):\n",
304
+ " x = self.mae_model(x, global_pool=global_pool, forward_features = True)\n",
305
+ " x = self.lc_model(x)\n",
306
+ " return x"
307
+ ]
308
+ },
309
+ {
310
+ "cell_type": "code",
311
+ "execution_count": 10,
312
+ "id": "c369cb0a",
313
+ "metadata": {},
314
+ "outputs": [],
315
+ "source": [
316
+ "# Initialize the model\n",
317
+ "lc_model = LinearClassifier(input_dim=input_dim, num_classes=num_classes)\n",
318
+ "\n",
319
+ "model = FullModel(lc_model, mae_model)\n",
320
+ "\n",
321
+ "# Move the model to the GPU\n",
322
+ "model.to(device)\n",
323
+ "\n",
324
+ "# Define loss function\n",
325
+ "criterion = nn.CrossEntropyLoss()\n",
326
+ "\n",
327
+ "# Define optimizer with L2 regularization (weight_decay)\n",
328
+ "learning_rate = 1e-4\n",
329
+ "weight_decay = 1e-5 # Adjust based on your needs\n",
330
+ "optimizer = torch.optim.Adam(model.parameters(), lr=learning_rate, weight_decay=weight_decay)\n",
331
+ "num_epochs = 20 # Adjust as needed"
332
+ ]
333
+ },
334
+ {
335
+ "cell_type": "code",
336
+ "execution_count": 11,
337
+ "id": "a94f38d2",
338
+ "metadata": {},
339
+ "outputs": [
340
+ {
341
+ "name": "stdout",
342
+ "output_type": "stream",
343
+ "text": [
344
+ "'427a99e2-fb71-47e7-92ad-a81ab54e58f2'"
345
+ ]
346
+ }
347
+ ],
348
+ "source": [
349
+ "import uuid\n",
350
+ "\n",
351
+ "myuuid = uuid.uuid4()\n",
352
+ "str(myuuid)"
353
+ ]
354
+ },
355
+ {
356
+ "cell_type": "code",
357
+ "execution_count": 12,
358
+ "id": "76663b72",
359
+ "metadata": {},
360
+ "outputs": [
361
+ {
362
+ "data": {
363
+ "text/html": [
364
+ "Tracking run with wandb version 0.18.3"
365
+ ],
366
+ "text/plain": [
367
+ "<IPython.core.display.HTML object>"
368
+ ]
369
+ },
370
+ "metadata": {},
371
+ "output_type": "display_data"
372
+ },
373
+ {
374
+ "data": {
375
+ "text/html": [
376
+ "Run data is saved locally in <code>/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241126_141516-HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275</code>"
377
+ ],
378
+ "text/plain": [
379
+ "<IPython.core.display.HTML object>"
380
+ ]
381
+ },
382
+ "metadata": {},
383
+ "output_type": "display_data"
384
+ },
385
+ {
386
+ "data": {
387
+ "text/html": [
388
+ "Syncing run <strong><a href='https://stability.wandb.io/ckadirt/fMRI-foundation-model/runs/HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275' target=\"_blank\">HCPflat_large_gsrFalse__HCP_FT</a></strong> to <a href='https://stability.wandb.io/ckadirt/fMRI-foundation-model' target=\"_blank\">Weights & Biases</a> (<a href='https://wandb.me/run' target=\"_blank\">docs</a>)<br/>"
389
+ ],
390
+ "text/plain": [
391
+ "<IPython.core.display.HTML object>"
392
+ ]
393
+ },
394
+ "metadata": {},
395
+ "output_type": "display_data"
396
+ },
397
+ {
398
+ "data": {
399
+ "text/html": [
400
+ " View project at <a href='https://stability.wandb.io/ckadirt/fMRI-foundation-model' target=\"_blank\">https://stability.wandb.io/ckadirt/fMRI-foundation-model</a>"
401
+ ],
402
+ "text/plain": [
403
+ "<IPython.core.display.HTML object>"
404
+ ]
405
+ },
406
+ "metadata": {},
407
+ "output_type": "display_data"
408
+ },
409
+ {
410
+ "data": {
411
+ "text/html": [
412
+ " View run at <a href='https://stability.wandb.io/ckadirt/fMRI-foundation-model/runs/HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275' target=\"_blank\">https://stability.wandb.io/ckadirt/fMRI-foundation-model/runs/HCPflat_large_gsrFalse__HCP_FT_72f5af42-9465-4e84-8949-8372cb087275</a>"
413
+ ],
414
+ "text/plain": [
415
+ "<IPython.core.display.HTML object>"
416
+ ]
417
+ },
418
+ "metadata": {},
419
+ "output_type": "display_data"
420
+ }
421
+ ],
422
+ "source": [
423
+ "import wandb\n",
424
+ "\n",
425
+ "if utils.is_interactive():\n",
426
+ " print(\"Running in interactive notebook. Disabling W&B and ckpt saving.\")\n",
427
+ " wandb_log = True\n",
428
+ " save_ckpt = True\n",
429
+ "\n",
430
+ "if wandb_log:\n",
431
+ " wandb_project = 'fMRI-foundation-model'\n",
432
+ " wandb_config = {\n",
433
+ " \"model_name\": model_name+'_HCP_FT',\n",
434
+ " \"batch_size\": batch_size,\n",
435
+ " \"learning_rate\": learning_rate,\n",
436
+ " \"weight_decay\": weight_decay,\n",
437
+ " \"num_epochs\": num_epochs,\n",
438
+ " \"seed\": seed,\n",
439
+ " }\n",
440
+ " print(\"wandb_config:\\n\", wandb_config)\n",
441
+ " random_id = str(uuid.uuid4())\n",
442
+ " print(\"wandb_id:\", \"HCPflat_raw\" + f\"_{random_id}\")\n",
443
+ " wandb.init(\n",
444
+ " id=model_name+'_HCP_FT' + f\"_{random_id}\",\n",
445
+ " project=wandb_project,\n",
446
+ " name=model_name+'_HCP_FT',\n",
447
+ " config=wandb_config,\n",
448
+ " resume=\"allow\",\n",
449
+ " )"
450
+ ]
451
+ },
452
+ {
453
+ "cell_type": "code",
454
+ "execution_count": 13,
455
+ "id": "f6e16767",
456
+ "metadata": {},
457
+ "outputs": [],
458
+ "source": [
459
+ "import wandb\n",
460
+ "\n",
461
+ "if utils.is_interactive():\n",
462
+ " print(\"Running in interactive notebook. Disabling W&B and ckpt saving.\")\n",
463
+ " wandb_log = True\n",
464
+ " save_ckpt = False\n",
465
+ "\n",
466
+ "if wandb_log:\n",
467
+ " wandb_project = 'fMRI-foundation-model'\n",
468
+ " wandb_config = {\n",
469
+ " \"model_name\": model_name+'_HCP_FT',\n",
470
+ " \"batch_size\": batch_size,\n",
471
+ " \"learning_rate\": learning_rate,\n",
472
+ " \"weight_decay\": weight_decay,\n",
473
+ " \"num_epochs\": num_epochs,\n",
474
+ " \"seed\": seed,\n",
475
+ " }\n",
476
+ " print(\"wandb_config:\\n\", wandb_config)\n",
477
+ " random_id = str(uuid.uuid4())\n",
478
+ " print(\"wandb_id:\", \"HCPflat_raw\" + f\"_{random_id}\")\n",
479
+ " wandb.init(\n",
480
+ " id=model_name+'_HCP_FT' + f\"_{random_id}\",\n",
481
+ " project=wandb_project,\n",
482
+ " name=model_name+'_HCP_FT',\n",
483
+ " config=wandb_config,\n",
484
+ " resume=\"allow\",\n",
485
+ " )"
486
+ ]
487
+ }
488
+ ],
489
+ "metadata": {
490
+ "kernelspec": {
491
+ "display_name": "Python 3",
492
+ "language": "python",
493
+ "name": "python3"
494
+ },
495
+ "language_info": {
496
+ "codemirror_mode": {
497
+ "name": "ipython",
498
+ "version": 3
499
+ },
500
+ "file_extension": ".py",
501
+ "mimetype": "text/x-python",
502
+ "name": "python",
503
+ "nbconvert_exporter": "python",
504
+ "pygments_lexer": "ipython3",
505
+ "version": "3.11.9"
506
+ }
507
+ },
508
+ "nbformat": 4,
509
+ "nbformat_minor": 5
510
+ }
fMRI-foundation-model/src/wandb/run-20241126_220105-HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de/files/code/src/HCP_downstream_raw_flatmaps.py ADDED
@@ -0,0 +1,1138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # coding: utf-8
3
+
4
+ # In[2]:
5
+
6
+
7
+ # Import packages and setup gpu configuration.
8
+ # This code block shouldnt need to be adjusted!
9
+ import os
10
+ import sys
11
+ import json
12
+ import yaml
13
+ import numpy as np
14
+ import copy
15
+ import math
16
+ import time
17
+ import random
18
+ from tqdm.auto import tqdm
19
+ import webdataset as wds
20
+ import matplotlib.pyplot as plt
21
+ import pandas as pd
22
+
23
+ import torch
24
+ import torch.nn as nn
25
+ from torchvision import transforms
26
+ import utils
27
+ from mae_utils.flat_models import *
28
+ import h5py
29
+ from typing import List, Dict, Any, Tuple
30
+ from sklearn.preprocessing import StandardScaler
31
+ import argparse
32
+
33
+ # tf32 data type is faster than standard float32
34
+ torch.backends.cuda.matmul.allow_tf32 = True
35
+ # following fixes a Conv3D CUDNN_NOT_SUPPORTED error
36
+ torch.backends.cudnn.benchmark = True
37
+
38
+ # ## MODEL TO LOAD ##
39
+ # model_name = "HCPflat_large_gsrFalse_"
40
+ # parquet_folder = "epoch99"
41
+
42
+ # # outdir = os.path.abspath(f'checkpoints/{model_name}')
43
+ # outdir = os.path.abspath(f'checkpoints/{model_name}')
44
+
45
+ # print("outdir", outdir)
46
+ # # Load previous config.yaml if available
47
+ # if os.path.exists(f"{outdir}/config.yaml"):
48
+ # config = yaml.load(open(f"{outdir}/config.yaml", 'r'), Loader=yaml.FullLoader)
49
+ # print(f"Loaded config.yaml from ckpt folder {outdir}")
50
+ # # create global variables from the config
51
+ # print("\n__CONFIG__")
52
+ # for attribute_name in config.keys():
53
+ # print(f"{attribute_name} = {config[attribute_name]}")
54
+ # globals()[attribute_name] = config[f'{attribute_name}']
55
+ # print("\n")
56
+
57
+ # world_size = os.getenv('WORLD_SIZE')
58
+ # if world_size is None:
59
+ # world_size = 1
60
+ # else:
61
+ # world_size = int(world_size)
62
+ # print(f"WORLD_SIZE={world_size}")
63
+
64
+ # if utils.is_interactive():
65
+ # # Following allows you to change functions in models.py or utils.py and
66
+ # # have this notebook automatically update with your revisions
67
+ # %load_ext autoreload
68
+ # %autoreload 2
69
+
70
+ # batch_size = probe_batch_size
71
+ # num_epochs = probe_num_epochs
72
+
73
+ # data_type = torch.float32 # change depending on your mixed_precision
74
+ # global_batch_size = batch_size * world_size
75
+
76
+ device = torch.device('cuda')
77
+
78
+ # hcp_flat_path = "/weka/proj-medarc/shared/HCP-Flat"
79
+ # seed = 42
80
+ num_frames = 16
81
+ gsr = False
82
+ # num_workers = 5
83
+ batch_size = 128
84
+ # target = 'sex' # This can be 'trial_type' 'age' 'sex'
85
+
86
+ print("PID of this process =",os.getpid())
87
+
88
+
89
+ # In[3]:
90
+
91
+
92
+ # if running this interactively, can specify jupyter_args here for argparser to use
93
+ if utils.is_interactive():
94
+ model_name_suffix = "testing"
95
+ print("model_name_suffix:", model_name_suffix)
96
+
97
+ # global_batch_size and batch_size should already be defined in the 2nd cell block
98
+ jupyter_args = f"--hcp_flat_path=/weka/proj-medarc/shared/HCP-Flat \
99
+ --target=sex \
100
+ --model_suffix={model_name_suffix} \
101
+ --batch_size={batch_size} \
102
+ --max_lr=3e-4 --num_epochs=20 --no-save_ckpt --no-wandb_log --num_workers=10 \
103
+ --weight_decay=1e-5"
104
+ # --multisubject_ckpt=../train_logs/multisubject_subj01_1024_24bs_nolow
105
+
106
+ print(jupyter_args)
107
+ jupyter_args = jupyter_args.split()
108
+
109
+ from IPython.display import clear_output # function to clear print outputs in cell
110
+ get_ipython().run_line_magic('load_ext', 'autoreload')
111
+ # this allows you to change functions in models.py or utils.py and have this notebook automatically update with your revisions
112
+ get_ipython().run_line_magic('autoreload', '2')
113
+
114
+
115
+ # In[4]:
116
+
117
+
118
+ parser = argparse.ArgumentParser(description="Model Training Configuration")
119
+ parser.add_argument(
120
+ "--model_suffix", type=str, default="Testing_flat",
121
+ help="name of model, used for ckpt saving and wandb logging (if enabled)",
122
+ )
123
+ parser.add_argument(
124
+ "--hcp_flat_path", type=str, default=os.getcwd(),
125
+ help="Path to where NSD data is stored / where to download it to",
126
+ )
127
+ parser.add_argument(
128
+ "--batch_size", type=int, default=128,
129
+ help="Batch size can be increased by 10x if only training retreival submodule and not diffusion prior",
130
+ )
131
+ parser.add_argument(
132
+ "--wandb_log",action=argparse.BooleanOptionalAction,default=False,
133
+ help="whether to log to wandb",
134
+ )
135
+ parser.add_argument(
136
+ "--num_epochs",type=int,default=150,
137
+ help="number of epochs of training",
138
+ )
139
+ parser.add_argument(
140
+ "--lr_scheduler_type",type=str,default='cycle',choices=['cycle','linear'],
141
+ )
142
+ parser.add_argument(
143
+ "--save_ckpt",action=argparse.BooleanOptionalAction,default=True,
144
+ )
145
+ parser.add_argument(
146
+ "--seed",type=int,default=42,
147
+ )
148
+ parser.add_argument(
149
+ "--max_lr",type=float,default=3e-4,
150
+ )
151
+ parser.add_argument(
152
+ "--target",type=str,default='trial_type',choices=['trial_type','sex','age'],
153
+ )
154
+ parser.add_argument(
155
+ "--num_workers",type=int,default=10,
156
+ )
157
+ parser.add_argument(
158
+ "--weight_decay",type=float,default=1e-5,
159
+ )
160
+
161
+ if utils.is_interactive():
162
+ args = parser.parse_args(jupyter_args)
163
+ else:
164
+ args = parser.parse_args()
165
+
166
+ print(f"------ ARGS ------- \n {args}")
167
+
168
+ # create global variables without the args prefix
169
+ for attribute_name in vars(args).keys():
170
+ globals()[attribute_name] = getattr(args, attribute_name)
171
+
172
+ # seed all random functions
173
+ utils.seed_everything(seed)
174
+
175
+
176
+ # In[15]:
177
+
178
+
179
+ #### UNCOMMENT THIS TO SAVE THE HCP-FLAT IN HDF5 FORMAT
180
+
181
+
182
+ # from torch.utils.data import default_collate
183
+ # from mae_utils.flat import load_hcp_flat_mask
184
+ # from mae_utils.flat import create_hcp_flat
185
+ # from mae_utils.flat import batch_unmask
186
+ # import mae_utils.visualize as vis
187
+
188
+
189
+ # batch_size = 26
190
+ # print(f"changed batch_size to {batch_size}")
191
+
192
+ # ## Test ##
193
+ # datasets_to_include = "HCP"
194
+ # assert "HCP" in datasets_to_include
195
+ # test_dataset = create_hcp_flat(root=hcp_flat_path,
196
+ # clip_mode="event", frames=num_frames, shuffle=False, gsr=gsr, sub_list = 'test')
197
+ # test_dl = wds.WebLoader(
198
+ # test_dataset.batched(batch_size, partial=False, collation_fn=default_collate),
199
+ # batch_size=None,
200
+ # shuffle=False,
201
+ # num_workers=num_workers,
202
+ # pin_memory=True,
203
+ # )
204
+
205
+ # ## Train ##
206
+ # assert "HCP" in datasets_to_include
207
+ # train_dataset = create_hcp_flat(root=hcp_flat_path,
208
+ # clip_mode="event", frames=num_frames, shuffle=False, gsr=gsr, sub_list = 'train')
209
+ # train_dl = wds.WebLoader(
210
+ # train_dataset.batched(batch_size, partial=False, collation_fn=default_collate),
211
+ # batch_size=None,
212
+ # shuffle=False,
213
+ # num_workers=num_workers,
214
+ # pin_memory=True,
215
+ # )
216
+
217
+ # def flatten_meta(meta_dict):
218
+ # """
219
+ # Flatten the meta dictionary by:
220
+ # - Replacing single-item lists with the item itself.
221
+ # - Converting tensors to scalar numbers.
222
+ # """
223
+ # flattened = {}
224
+ # for key, value in meta_dict.items():
225
+ # if isinstance(value, list):
226
+ # if len(value) == 1:
227
+ # flattened[key] = value[0] # Replace list with its single item
228
+ # else:
229
+ # flattened[key] = value # Keep as is if multiple items
230
+ # elif isinstance(value, torch.Tensor):
231
+ # # Convert tensor to scalar
232
+ # if value.numel() == 1:
233
+ # flattened[key] = value.item()
234
+ # else:
235
+ # flattened[key] = value.tolist() # Convert multi-element tensor to list
236
+ # else:
237
+ # flattened[key] = value # Keep the value as is
238
+ # return flattened
239
+
240
+ # import h5py
241
+ # meta_array = np.array([], dtype=object)
242
+ # # Open an HDF5 file in write mode
243
+ # with h5py.File('train_hcp_raw_flatmaps.hdf5', 'w') as h5f:
244
+ # flatmaps_dset = None
245
+
246
+ # total_samples = 0
247
+
248
+ # for i, batch in tqdm(enumerate(train_dl), total = 120000):
249
+ # images = batch['image'][0]
250
+ # meta = batch['meta']
251
+ # batch_size = images.shape[0]
252
+ # meta_serializable = meta.copy()
253
+
254
+
255
+ # # Step 2: Serialize the dictionary to a JSON string
256
+ # meta_str = json.dumps(flatten_meta(meta_serializable), indent=4)
257
+ # meta_array = np.append(meta_array, meta_str)
258
+ # if flatmaps_dset is None:
259
+ # # Initialize datasets with unlimited (None) maxshape along the first axis
260
+ # flatmaps_shape = (0,) + images.shape[1:]
261
+ # flatmaps_maxshape = (None,) + images.shape[1:]
262
+
263
+ # flatmaps_dset = h5f.create_dataset(
264
+ # 'flatmaps',
265
+ # shape=flatmaps_shape,
266
+ # maxshape=flatmaps_maxshape,
267
+ # dtype=np.float16,
268
+ # chunks=True # Enable chunking for efficient resizing
269
+ # )
270
+
271
+ # # Resize datasets to accommodate new data
272
+ # flatmaps_dset.resize(total_samples + batch_size, axis=0)
273
+
274
+ # # Write data to the datasets
275
+ # flatmaps_dset[total_samples:total_samples + batch_size] = images.numpy().astype(np.float16)
276
+
277
+ # total_samples += batch_size
278
+
279
+ # print(f"Processed {total_samples} samples")
280
+ # np.save('metadata_test_HCP_raw_flatmaps.npy', meta_array)
281
+
282
+
283
+ # import h5py
284
+ # meta_array = np.array([], dtype=object)
285
+ # # Open an HDF5 file in write mode
286
+ # with h5py.File('test_hcp_raw_flatmaps.hdf5', 'w') as h5f:
287
+ # flatmaps_dset = None
288
+
289
+ # total_samples = 0
290
+
291
+ # for i, batch in tqdm(enumerate(test_dl), total = 12000):
292
+ # images = batch['image'][0]
293
+ # meta = batch['meta']
294
+ # batch_size = images.shape[0]
295
+ # meta_serializable = meta.copy()
296
+
297
+
298
+ # # Step 2: Serialize the dictionary to a JSON string
299
+ # meta_str = json.dumps(flatten_meta(meta_serializable), indent=4)
300
+ # meta_array = np.append(meta_array, meta_str)
301
+ # if flatmaps_dset is None:
302
+ # # Initialize datasets with unlimited (None) maxshape along the first axis
303
+ # flatmaps_shape = (0,) + images.shape[1:]
304
+ # flatmaps_maxshape = (None,) + images.shape[1:]
305
+
306
+ # flatmaps_dset = h5f.create_dataset(
307
+ # 'flatmaps',
308
+ # shape=flatmaps_shape,
309
+ # maxshape=flatmaps_maxshape,
310
+ # dtype=np.float16,
311
+ # chunks=True # Enable chunking for efficient resizing
312
+ # )
313
+
314
+ # # Resize datasets to accommodate new data
315
+ # flatmaps_dset.resize(total_samples + batch_size, axis=0)
316
+
317
+ # # Write data to the datasets
318
+ # flatmaps_dset[total_samples:total_samples + batch_size] = images.numpy().astype(np.float16)
319
+
320
+ # total_samples += batch_size
321
+
322
+ # print(f"Processed {total_samples} samples")
323
+ # np.save('metadata_train_HCP_raw_flatmaps.npy', meta_array)
324
+
325
+
326
+ # ### Data
327
+
328
+ # In[4]:
329
+
330
+
331
+ f_train = h5py.File('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/train_hcp_raw_flatmaps.hdf5', 'r')
332
+ flatmaps_train = f_train['flatmaps']
333
+
334
+ f_test = h5py.File('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/test_hcp_raw_flatmaps.hdf5', 'r')
335
+ flatmaps_test = f_test['flatmaps']
336
+
337
+ metadata_train = np.load('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/metadata_train_HCP_raw_flatmaps.npy', allow_pickle=True)
338
+ metadata_test = np.load('/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/metadata_test_HCP_raw_flatmaps.npy', allow_pickle=True)
339
+
340
+
341
+ # In[18]:
342
+
343
+
344
+ # import argparse
345
+ # import json
346
+ # import os
347
+ # import pickle
348
+ # from pathlib import Path
349
+
350
+ # import pandas as pd
351
+ # import numpy as np
352
+ # from sklearn.decomposition import PCA
353
+ # from sklearn.linear_model import LogisticRegressionCV
354
+ # from sklearn.model_selection import train_test_split
355
+ # from sklearn.preprocessing import LabelEncoder
356
+
357
+ # target = "trial_type"
358
+ # print(f"Target: {target}")
359
+
360
+ # # train_features = pd.read_parquet(f"{outdir}/{parquet_folder}/HCP/train.parquet")
361
+ # # test_features = pd.read_parquet(f"{outdir}/{parquet_folder}/HCP_/test.parquet")
362
+
363
+ # # print(f"train: {train_features.shape}, test: {test_features.shape}")
364
+ # # print(f"test: {test_features.shape}")
365
+
366
+ # X_train = np.array(flatmaps_train[0:5000])
367
+ # # flatten the flatmaps
368
+ # X_train = X_train.reshape(X_train.shape[0], -1)
369
+ # X_test = np.array(flatmaps_test[0:1000])
370
+ # X_test = X_test.reshape(X_test.shape[0], -1)
371
+
372
+ # print(f"X_train: {X_train.shape}, X_test: {X_test.shape}")
373
+ # print(f"X_test: {X_test.shape}")
374
+
375
+
376
+ # # if target == "task":
377
+ # # labels_train = train_features["task"].str.rstrip("1234").values
378
+ # # labels_test = test_features["task"].str.rstrip("1234").values
379
+ # # elif target == "trial_type":
380
+ # # labels_train = train_features["trial_type"].values
381
+ # # labels_test = test_features["trial_type"].values
382
+
383
+ # labels_train = [json.loads(string)['trial_type'] for string in metadata_train[0:5000]]
384
+ # labels_test = [json.loads(string)['trial_type'] for string in metadata_test[0:1000]]
385
+
386
+ # label_enc = LabelEncoder()
387
+ # y_train = label_enc.fit_transform(labels_train)
388
+ # y_test = label_enc.transform(labels_test)
389
+
390
+ # print(f"classes ({len(label_enc.classes_)}): {label_enc.classes_}")
391
+ # print(
392
+ # f"\ny_train: {y_train.shape} {y_train[:20]}\n"
393
+ # f"y_test: {y_test.shape} {y_test[:20]}"
394
+ # )
395
+ # # del train_features, test_features
396
+
397
+ # train_ind, val_ind = train_test_split(
398
+ # np.arange(len(X_train)), train_size=0.9, random_state=42
399
+ # )
400
+ # print(
401
+ # f"\ntrain_ind: {len(train_ind)} {train_ind[:10]}\n"
402
+ # f"val_ind: {len(val_ind)} {val_ind[:10]}"
403
+ # )
404
+ # X_train, X_val = X_train[train_ind], X_train[val_ind]
405
+ # y_train, y_val = y_train[train_ind], y_train[val_ind]
406
+
407
+ # print("Fitting PCA projection")
408
+ # pca = PCA(n_components=384, whiten=True, svd_solver="randomized")
409
+ # pca.fit(X_train)
410
+
411
+ # X_train = pca.transform(X_train)
412
+ # X_val = pca.transform(X_val)
413
+ # X_test = pca.transform(X_test)
414
+
415
+ # print("Fitting logistic regression")
416
+ # clf = LogisticRegressionCV()
417
+ # clf.fit(X_train, y_train)
418
+
419
+ # train_acc = clf.score(X_train, y_train)
420
+ # val_acc = clf.score(X_val, y_val)
421
+ # test_acc = clf.score(X_test, y_test)
422
+
423
+ # result = {
424
+ # "target": target,
425
+ # "train_acc": train_acc,
426
+ # "val_acc": val_acc,
427
+ # "test_acc": test_acc,
428
+ # }
429
+ # print(f"Done:\n{json.dumps(result)}")
430
+ # with open(f"{outdir}/{parquet_folder}/HCP/downstream.json", 'w') as out_json:
431
+ # json.dump(result, out_json)
432
+
433
+
434
+ # ### Create the dataloader
435
+
436
+ # In[19]:
437
+
438
+
439
+ from torch.utils.data import Dataset, DataLoader
440
+
441
+ class HCPFlatDataset(Dataset):
442
+ def __init__(self, flatmaps, metadata):
443
+ self.flatmaps = flatmaps
444
+ self.metadata = metadata
445
+
446
+ def __len__(self):
447
+ return len(self.metadata)
448
+
449
+ def __getitem__(self, idx):
450
+ return self.flatmaps[idx], json.loads(self.metadata[idx])
451
+
452
+ # Loading to cpu for faster training, this can take several minutes. Remove this [:] if you want to move one at the time.
453
+ train_dataset = HCPFlatDataset(flatmaps_train, metadata_train)
454
+ train_dl = DataLoader(train_dataset, batch_size=batch_size, shuffle=True, num_workers=10)
455
+
456
+ test_dataset = HCPFlatDataset(flatmaps_test, metadata_test)
457
+ test_dl = DataLoader(test_dataset, batch_size=batch_size, shuffle=False, num_workers=0)
458
+
459
+
460
+ # ### Load subject information
461
+
462
+ # In[20]:
463
+
464
+
465
+ # open the file containing subject information
466
+ if target == "age" or target == "sex":
467
+ subject_information_HCP_path = os.path.join(hcp_flat_path, "subjects_data_restricted.csv")
468
+ try:
469
+ subject_information_HCP = pd.read_csv(subject_information_HCP_path)
470
+ except:
471
+ try:
472
+ subject_information_HCP = pd.read_csv('./unrestricted_clane9_4_23_2024_13_28_14.csv')
473
+ except:
474
+ assert False, "Subject information file not found"
475
+
476
+ ###### This is for unrestricted
477
+ # age_related_columns = [
478
+ # 'Age', 'PicSeq_AgeAdj', 'CardSort_AgeAdj', 'Flanker_AgeAdj',
479
+ # 'ReadEng_AgeAdj', 'PicVocab_AgeAdj', 'ProcSpeed_AgeAdj',
480
+ # 'CogFluidComp_AgeAdj', 'CogEarlyComp_AgeAdj', 'CogTotalComp_AgeAdj',
481
+ # 'CogCrystalComp_AgeAdj', 'Endurance_AgeAdj', 'Dexterity_AgeAdj',
482
+ # 'Strength_AgeAdj', 'Odor_AgeAdj', 'Taste_AgeAdj'
483
+ # ]
484
+
485
+ # sex_related_columns = [
486
+ # 'Gender'
487
+ # ]
488
+
489
+ ###### This is for restricted
490
+ gender_related_columns = [
491
+ 'Gender'
492
+ ]
493
+
494
+ age_related_columns = [
495
+ 'Age_in_Yrs',
496
+ 'Menstrual_AgeBegan',
497
+ 'Menstrual_AgeIrreg',
498
+ 'Menstrual_AgeStop',
499
+ 'SSAGA_Alc_Age_1st_Use',
500
+ 'SSAGA_TB_Age_1st_Cig',
501
+ 'SSAGA_Mj_Age_1st_Use',
502
+ 'Endurance_AgeAdj',
503
+ 'Dexterity_AgeAdj',
504
+ 'Strength_AgeAdj',
505
+ 'PicSeq_AgeAdj',
506
+ 'CardSort_AgeAdj',
507
+ 'Flanker_AgeAdj',
508
+ 'ReadEng_AgeAdj',
509
+ 'PicVocab_AgeAdj',
510
+ 'ProcSpeed_AgeAdj',
511
+ 'Odor_AgeAdj',
512
+ 'Taste_AgeAdj'
513
+ ]
514
+
515
+ # # show the first few rows of the subject information
516
+ # subject_information_HCP[age_related_columns + sex_related_columns].head()
517
+
518
+ # Handle missing values (e.g., impute with mean)
519
+ mean_age = subject_information_HCP['Age_in_Yrs'].mean()
520
+
521
+ # Initialize the scaler
522
+ scaler = StandardScaler()
523
+
524
+ # Perform z-score normalization
525
+ subject_information_HCP['Age_in_Yrs_z'] = scaler.fit_transform(subject_information_HCP[['Age_in_Yrs']])
526
+
527
+
528
+
529
+ def get_label_unrestricted(subject_id: List[str], target: str, method_for_age: str = 'mean') -> List:
530
+ """
531
+ Get the label for the given subject id and target.
532
+
533
+ For sex 0 is F and 1 is M
534
+ """
535
+
536
+ # convert to list of ints
537
+ subject_id = [int(x) for x in subject_id]
538
+
539
+ if target == "age":
540
+ age_array = []
541
+ for subject in subject_id:
542
+ c_age = subject_information_HCP[subject_information_HCP['Subject'] == subject]['Age'].values
543
+ # if the subject is not in the subject information file trigger an error
544
+ if len(c_age) == 0:
545
+ assert False, f"Subject {subject} not found in subject information file"
546
+ if len(c_age) > 1:
547
+ print(f"Warning: Multiple entries for subject {subject}")
548
+
549
+ c_age = c_age[0].split('-')
550
+ if len(c_age) < 2:
551
+ c_age = c_age[0].split('+')
552
+ age_array.append(int(c_age[0]))
553
+ else:
554
+ if method_for_age == 'mean':
555
+ age_array.append(np.mean([int(x) for x in c_age]))
556
+ elif method_for_age == 'min':
557
+ age_array.append(np.min([int(x) for x in c_age]))
558
+ elif method_for_age == 'max':
559
+ age_array.append(np.max([int(x) for x in c_age]))
560
+ else:
561
+ assert False, f"Method {method_for_age} not recognized"
562
+
563
+ return np.array(age_array)
564
+
565
+ elif target == 'sex':
566
+ sex_array = []
567
+ for subject in subject_id:
568
+ c_sex = subject_information_HCP[subject_information_HCP['Subject'] == subject]['Gender'].values
569
+ # if the subject is not in the subject information file trigger an error
570
+ if len(c_sex) == 0:
571
+ assert False, f"Subject {subject} not found in subject information file"
572
+ if len(c_sex) > 1:
573
+ print(f"Warning: Multiple entries for subject {subject}")
574
+ sex_array.append(int(c_sex[0] == 'M'))
575
+ return sex_array
576
+
577
+ def get_label_restricted(subject_id: List[str], target: str, normalized: bool = True) -> List:
578
+ """
579
+ Get the label for the given subject id and target.
580
+
581
+ For sex 0 is F and 1 is M
582
+ """
583
+
584
+ # convert to list of ints
585
+ subject_id = [int(x) for x in subject_id]
586
+
587
+ if target == "age":
588
+ age_array = []
589
+ for subject in subject_id:
590
+ c_age = subject_information_HCP[subject_information_HCP['Subject'] == subject]['Age_in_Yrs' if not normalized else 'Age_in_Yrs_z'].values
591
+ # if the subject is not in the subject information file trigger an error
592
+ if len(c_age) == 0:
593
+ assert False, f"Subject {subject} not found in subject information file"
594
+ if len(c_age) > 1:
595
+ print(f"Warning: Multiple entries for subject {subject}")
596
+
597
+ age_array.append(np.int8(c_age[0]))
598
+
599
+ return np.array(age_array)
600
+
601
+ elif target == 'sex':
602
+ sex_array = []
603
+ for subject in subject_id:
604
+ c_sex = subject_information_HCP[subject_information_HCP['Subject'] == subject]['Gender'].values
605
+ # if the subject is not in the subject information file trigger an error
606
+ if len(c_sex) == 0:
607
+ assert False, f"Subject {subject} not found in subject information file"
608
+ if len(c_sex) > 1:
609
+ print(f"Warning: Multiple entries for subject {subject}")
610
+ sex_array.append(int(c_sex[0] == 'M'))
611
+ return sex_array
612
+
613
+
614
+ # In[21]:
615
+
616
+
617
+ from sklearn.preprocessing import LabelEncoder
618
+
619
+ if target == "trial_type":
620
+
621
+ INCLUDE_CONDS = {
622
+ "fear",
623
+ "neut",
624
+ "math",
625
+ "story",
626
+ "lf",
627
+ "lh",
628
+ "rf",
629
+ "rh",
630
+ "t",
631
+ "match",
632
+ "relation",
633
+ "mental",
634
+ "rnd",
635
+ "0bk_body",
636
+ "2bk_body",
637
+ "0bk_faces",
638
+ "2bk_faces",
639
+ "0bk_places",
640
+ "2bk_places",
641
+ "0bk_tools",
642
+ "2bk_tools",
643
+ }
644
+
645
+ # test_data = []
646
+
647
+ # # Iterate over the DataLoader with a progress bar
648
+ # for sample in tqdm(train_dl, desc="Processing samples"):
649
+ # x = sample['image']
650
+ # y = sample['meta']['trial_type']
651
+ # key = sample['meta']['key']
652
+ # print(x.shape, y, key)
653
+ # break
654
+ # Initialize the label encoder
655
+ label_encoder = LabelEncoder()
656
+ label_encoder.fit(sorted(INCLUDE_CONDS)) # Ensure consistent ordering
657
+
658
+ num_classes = len(label_encoder.classes_)
659
+ print(f"Number of classes: {num_classes}")
660
+
661
+
662
+ # In[22]:
663
+
664
+
665
+ # for sample in tqdm(train_dl):
666
+ # x = sample[0]
667
+ # subject_id = sample[1]['sub']
668
+
669
+ # # benchmark time
670
+ # start = time.time()
671
+ # y = get_label(subject_id, 'age')
672
+ # end = time.time()
673
+ # print(f"Time taken: {end - start}")
674
+ # print(x.shape, y, subject_id, torch.Tensor(y).shape)
675
+ # break
676
+
677
+
678
+ # ### Create pytorch model
679
+
680
+ # In[23]:
681
+
682
+
683
+ class LinearClassifier(nn.Module):
684
+ def __init__(self, input_dim, num_classes):
685
+ super(LinearClassifier, self).__init__()
686
+ self.linear = nn.Linear(input_dim, num_classes)
687
+
688
+ def forward(self, x):
689
+ # Flatten the input except for the batch dimension
690
+ x = x.view(x.size(0), -1)
691
+ out = self.linear(x)
692
+ return out # Raw logits
693
+
694
+ # Determine the input dimension from a single sample
695
+ # Assuming images are of shape [1, 16, 144, 320]
696
+ sample_batch = next(iter(train_dl))
697
+ sample_image = sample_batch[0][0] # Shape: [1, 16, 144, 320]
698
+ input_dim = sample_image.view(-1).size(0)
699
+ print(f"Input dimension: {input_dim}")
700
+
701
+
702
+ # In[24]:
703
+
704
+
705
+ # Initialize the model
706
+
707
+ if target == "trial_type":
708
+ model = LinearClassifier(input_dim=input_dim, num_classes=num_classes)
709
+ criterion = nn.CrossEntropyLoss()
710
+
711
+ elif target == "age":
712
+ model = LinearClassifier(input_dim=input_dim, num_classes=1)
713
+ criterion = nn.MSELoss()
714
+
715
+ elif target == "sex":
716
+ model = LinearClassifier(input_dim=input_dim, num_classes=1)
717
+ criterion = nn.BCEWithLogitsLoss()
718
+
719
+ # Move the model to GPU if available
720
+ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
721
+ model.to(device)
722
+
723
+ # import schedulefree
724
+ # optimizer = schedulefree.AdamWScheduleFree(model.parameters(), lr=learning_rate, weight_decay=weight_decay)
725
+ optimizer = torch.optim.AdamW(model.parameters(), lr=max_lr, weight_decay=weight_decay)
726
+
727
+ num_iterations_per_epoch = math.ceil(flatmaps_train.shape[0]/batch_size)
728
+
729
+ if lr_scheduler_type == 'linear':
730
+ lr_scheduler = torch.optim.lr_scheduler.LinearLR(
731
+ optimizer,
732
+ total_iters=int(np.floor(num_epochs*num_iterations_per_epoch)),
733
+ last_epoch=-1
734
+ )
735
+ elif lr_scheduler_type == 'cycle':
736
+ total_steps=int(np.floor(num_epochs*num_iterations_per_epoch))
737
+ print("total_steps", total_steps)
738
+ lr_scheduler = torch.optim.lr_scheduler.OneCycleLR(
739
+ optimizer,
740
+ max_lr=max_lr,
741
+ total_steps=total_steps,
742
+ final_div_factor=1000,
743
+ last_epoch=-1, pct_start=2/num_epochs
744
+ )
745
+
746
+
747
+ # ### Wandb logging
748
+
749
+ # In[25]:
750
+
751
+
752
+ import wandb
753
+ import uuid
754
+
755
+ myuuid = uuid.uuid4()
756
+ str(myuuid)
757
+ if utils.is_interactive():
758
+ print("Running in interactive notebook. Disabling W&B and ckpt saving.")
759
+ wandb_log = False
760
+ save_ckpt = False
761
+
762
+ if wandb_log:
763
+ wandb_project = 'fMRI-foundation-model'
764
+ wandb_config = {
765
+ "model_name": f"HCPflat_raw_{target}",
766
+ "batch_size": batch_size,
767
+ "weight_decay": weight_decay,
768
+ "num_epochs": num_epochs,
769
+ "seed": seed,
770
+ "lr_scheduler_type": lr_scheduler_type,
771
+ "save_ckpt": save_ckpt,
772
+ "seed": seed,
773
+ "max_lr": max_lr,
774
+ "target": target,
775
+ "num_workers": num_workers,
776
+ "weight_decay": weight_decay
777
+ }
778
+ print("wandb_config:\n", wandb_config)
779
+ random_id = random.randint(0, 100000)
780
+ wandb_id = "HCPflat_raw" + f"_{model_suffix}_{target}_{myuuid}"
781
+ print("wandb_id:", wandb_id)
782
+ wandb.init(
783
+ id=wandb_id,
784
+ project=wandb_project,
785
+ name="HCPflat_raw"+ f"_{model_suffix}_{target}",
786
+ config=wandb_config,
787
+ resume="allow",
788
+ )
789
+
790
+
791
+ # ### Training loop
792
+
793
+ # In[26]:
794
+
795
+
796
+ for epoch in range(num_epochs):
797
+ running_train_loss = 0.0
798
+ correct_train = 0
799
+ mse_age_train = 0.0
800
+ total_train = 0
801
+ step = 0
802
+
803
+ # Training Phase
804
+ model.train()
805
+ optimizer.zero_grad() # Reset gradients before starting training
806
+
807
+ for batch in tqdm(train_dl, desc=f"Epoch {epoch+1}/{num_epochs} - Training"):
808
+ optimizer.zero_grad()
809
+ images = batch[0].to(device).float() # Shape: [batch_size, 1, 16, 144, 320]
810
+
811
+ # Prepare labels based on target type
812
+ if target == "trial_type":
813
+ labels = batch[1]['trial_type'] # List of labels
814
+ labels = label_encoder.transform(labels)
815
+ labels = torch.tensor(labels, dtype=torch.long).to(device) # Shape: [batch_size]
816
+ elif target == "age":
817
+ labels = get_label_restricted(batch[1]['sub'], 'age')
818
+ labels = torch.tensor(labels, dtype=torch.float).to(device) # Shape: [batch_size]
819
+ elif target == "sex":
820
+ labels = get_label_restricted(batch[1]['sub'], 'sex')
821
+ labels = torch.tensor(labels, dtype=torch.float).to(device) # Shape: [batch_size]
822
+ labels = labels.unsqueeze(1)
823
+ # Forward pass
824
+ outputs = model(images) # Output shape depends on the target
825
+
826
+ # Compute loss
827
+ if target in ["trial_type", "sex"]:
828
+ # For classification, ensure outputs are logits
829
+ loss = criterion(outputs, labels)
830
+ elif target == "age":
831
+ # For regression, ensure outputs are single values
832
+ loss = criterion(outputs.squeeze(), labels)
833
+
834
+ # Backward pass and optimization
835
+ loss.backward()
836
+ optimizer.step()
837
+
838
+ # Accumulate loss
839
+ running_train_loss += loss.item() * images.size(0)
840
+
841
+ # Calculate and accumulate metrics
842
+ if target == "trial_type":
843
+ _, predicted = torch.max(outputs, 1)
844
+ correct_train += (predicted == labels).sum().item()
845
+ elif target == "age":
846
+ mse_age_train += torch.sum((outputs.squeeze() - labels) ** 2).item()
847
+ elif target == "sex":
848
+ threshold = 0.5
849
+ predicted = (torch.sigmoid(outputs) > threshold).float()
850
+ correct_train += (predicted == labels).sum().item()
851
+
852
+ total_train += labels.size(0)
853
+ step += 1
854
+
855
+ # Print intermediate metrics every 100 steps
856
+ if step % 100 == 0:
857
+ if target in ["trial_type", "sex"]:
858
+ current_accuracy = 100 * correct_train / total_train if total_train > 0 else 0.0
859
+ print(f"Step [{step}/{len(train_dl)}] - Training Loss: {loss.item():.4f} - Training Accuracy: {current_accuracy:.2f}%")
860
+ elif target == "age":
861
+ current_mse = mse_age_train / total_train if total_train > 0 else 0.0
862
+ print(f"Step [{step}/{len(train_dl)}] - Training Loss: {loss.item():.4f} - Training MSE: {current_mse:.4f}")
863
+
864
+ if lr_scheduler_type is not None:
865
+ lr_scheduler.step()
866
+
867
+ # Calculate epoch-level metrics
868
+ epoch_train_loss = running_train_loss / total_train if total_train > 0 else 0.0
869
+
870
+ if target in ["trial_type", "sex"]:
871
+ train_accuracy = 100 * correct_train / total_train if total_train > 0 else 0.0
872
+ elif target == "age":
873
+ train_mse = mse_age_train / total_train if total_train > 0 else 0.0
874
+
875
+ # Validation Phase
876
+ model.eval()
877
+ running_val_loss = 0.0
878
+ correct_val = 0
879
+ mse_age_val = 0.0
880
+ total_val = 0
881
+
882
+ with torch.no_grad():
883
+ for batch in tqdm(test_dl, desc=f"Epoch {epoch+1}/{num_epochs} - Validation"):
884
+ images = batch[0].to(device).float() # Removed unsqueeze(1) unless specifically needed
885
+
886
+ # Prepare labels based on target type
887
+ if target == "trial_type":
888
+ labels = batch[1]['trial_type'] # List of labels
889
+ labels = label_encoder.transform(labels)
890
+ labels = torch.tensor(labels, dtype=torch.long).to(device) # Shape: [batch_size]
891
+ elif target == "age":
892
+ labels = get_label_restricted(batch[1]['sub'], 'age')
893
+ labels = torch.tensor(labels, dtype=torch.float).to(device) # Shape: [batch_size]
894
+ elif target == "sex":
895
+ labels = get_label_restricted(batch[1]['sub'], 'sex')
896
+ labels = torch.tensor(labels, dtype=torch.float).to(device) # Shape: [batch_size]
897
+
898
+ labels = labels.unsqueeze(1)
899
+
900
+ # Forward pass
901
+ outputs = model(images)
902
+
903
+ # Compute loss
904
+ if target in ["trial_type", "sex"]:
905
+ loss = criterion(outputs, labels)
906
+ elif target == "age":
907
+ loss = criterion(outputs.squeeze(), labels)
908
+
909
+ # Accumulate loss
910
+ running_val_loss += loss.item() * images.size(0)
911
+
912
+ # Calculate and accumulate metrics
913
+ if target == "trial_type":
914
+ _, predicted = torch.max(outputs, 1)
915
+ correct_val += (predicted == labels).sum().item()
916
+ elif target == "age":
917
+ mse_age_val += torch.sum((outputs.squeeze() - labels) ** 2).item()
918
+ elif target == "sex":
919
+ threshold = 0.5
920
+ predicted = (torch.sigmoid(outputs) > threshold).float()
921
+ correct_val += (predicted == labels).sum().item()
922
+
923
+ total_val += labels.size(0)
924
+
925
+ # Calculate epoch-level validation metrics
926
+ epoch_val_loss = running_val_loss / total_val if total_val > 0 else 0.0
927
+
928
+ if target in ["trial_type", "sex"]:
929
+ val_accuracy = 100 * correct_val / total_val if total_val > 0 else 0.0
930
+ elif target == "age":
931
+ val_mse = mse_age_val / total_val if total_val > 0 else 0.0
932
+
933
+ # Print epoch-level metrics
934
+ if target in ["trial_type", "sex"]:
935
+ print(f"Epoch [{epoch+1}/{num_epochs}] "
936
+ f"- Training Loss: {epoch_train_loss:.4f}, Training Accuracy: {train_accuracy:.2f}% "
937
+ f"- Validation Loss: {epoch_val_loss:.4f}, Validation Accuracy: {val_accuracy:.2f}%")
938
+ elif target == "age":
939
+ print(f"Epoch [{epoch+1}/{num_epochs}] "
940
+ f"- Training Loss: {epoch_train_loss:.4f}, Training MSE: {train_mse:.4f} "
941
+ f"- Validation Loss: {epoch_val_loss:.4f}, Validation MSE: {val_mse:.4f}")
942
+
943
+ # Log metrics with wandb
944
+ if wandb_log:
945
+ log_dict = {
946
+ "epoch_train_loss": epoch_train_loss,
947
+ "epoch_val_loss": epoch_val_loss,
948
+ }
949
+ if target in ["trial_type", "sex"]:
950
+ log_dict.update({
951
+ f"train_accuracy_{target}": train_accuracy,
952
+ f"val_accuracy_{target}": val_accuracy,
953
+ })
954
+ elif target == "age":
955
+ log_dict.update({
956
+ f"train_mse_{target}": train_mse,
957
+ f"val_mse_{target}": val_mse,
958
+ })
959
+ wandb.log(log_dict)
960
+
961
+ # Save checkpoint if required
962
+ if save_ckpt:
963
+ outdir = os.path.abspath(f'checkpoints/{"HCPflat_raw"+ f"_{model_suffix}_{target}"}_{random_id}')
964
+ os.makedirs(outdir, exist_ok=True)
965
+ print("Saving checkpoint to:", outdir)
966
+ # Save model state
967
+ torch.save(model.state_dict(), os.path.join(outdir, "model.pth"))
968
+ # Save configuration
969
+ with open(os.path.join(outdir, "config.yaml"), 'w') as f:
970
+ yaml.dump(wandb_config, f)
971
+ print(f"Model and config saved to {outdir}")
972
+
973
+
974
+ # In[15]:
975
+
976
+
977
+ # if target == 'trial_type':
978
+ # key = 'trial_type'
979
+ # elif target == 'sex' or target == 'age':
980
+ # key = 'sub'
981
+
982
+ # y_train = [json.loads(metadata_train[i])[key] for i in range(0,2000)]
983
+ # y_val = [json.loads(metadata_train[i])[key] for i in range(10000,11000)]
984
+ # y_test = [json.loads(metadata_test[i])[key] for i in range(0,1000)]
985
+
986
+
987
+ # In[7]:
988
+
989
+
990
+
991
+
992
+
993
+ # In[16]:
994
+
995
+
996
+ # X_train = flatmaps_train[0:2000]
997
+ # X_val = flatmaps_train[10000:11000]
998
+ # X_test = flatmaps_test[0:1000]
999
+
1000
+ # y_test = get_label_restricted(y_test, target = 'sex')
1001
+ # y_train = get_label_restricted(y_train, target = 'sex')
1002
+ # y_val = get_label_restricted(y_val, target = 'sex')
1003
+
1004
+ # # y_train = label_encoder.transform(y_train)
1005
+ # # y_val = label_encoder.transform(y_val)
1006
+ # # y_test = label_encoder.transform(y_test)
1007
+
1008
+
1009
+ # In[17]:
1010
+
1011
+
1012
+ # X_train, X_val, X_test = X_train.reshape(X_train.shape[0],-1), X_val.reshape(X_val.shape[0],-1), X_test.reshape(X_test.shape[0],-1)
1013
+
1014
+
1015
+ # In[18]:
1016
+
1017
+
1018
+ # X_train.shape
1019
+
1020
+
1021
+ # In[19]:
1022
+
1023
+
1024
+ # import numpy as np
1025
+ # import matplotlib.pyplot as plt
1026
+ # from sklearn.preprocessing import StandardScaler
1027
+ # from sklearn.decomposition import PCA
1028
+ # from sklearn.linear_model import LogisticRegressionCV
1029
+ # from sklearn.metrics import accuracy_score
1030
+
1031
+ # # Supongamos que ya tienes tus datos divididos:
1032
+ # # X_train, y_train, X_val, y_val, X_test, y_test
1033
+
1034
+ # # 1. Estandarizar los Datos
1035
+ # print("Estandarizando los datos...")
1036
+ # scaler = StandardScaler()
1037
+ # X_train_scaled = scaler.fit_transform(X_train)
1038
+ # X_val_scaled = scaler.transform(X_val)
1039
+ # X_test_scaled = scaler.transform(X_test)
1040
+
1041
+ # # 2. Aplicar PCA
1042
+ # print("Aplicando PCA...")
1043
+ # # Decidir el número de componentes. Por ejemplo, mantener el 95% de la varianza.
1044
+ # pca = PCA(n_components=0.95, svd_solver='full') # 'full' para compatibilidad
1045
+ # X_train_pca = pca.fit_transform(X_train_scaled)
1046
+ # X_val_pca = pca.transform(X_val_scaled)
1047
+ # X_test_pca = pca.transform(X_test_scaled)
1048
+
1049
+ # print(f"Número de componentes seleccionados: {pca.n_components_}")
1050
+
1051
+ # # Opcional: Visualizar la varianza explicada
1052
+ # cumulative_variance = np.cumsum(pca.explained_variance_ratio_)
1053
+ # plt.figure(figsize=(8, 5))
1054
+ # plt.plot(range(1, len(cumulative_variance) + 1), cumulative_variance, marker='o', linestyle='--')
1055
+ # plt.xlabel('Número de Componentes')
1056
+ # plt.ylabel('Varianza Acumulada')
1057
+ # plt.title('Varianza Explicada por PCA')
1058
+ # plt.grid(True)
1059
+ # plt.show()
1060
+
1061
+ # # 3. Entrenar el Modelo de Regresión Logística con Validación Cruzada
1062
+ # print("Entrenando el modelo de Regresión Logística con PCA...")
1063
+ # clf = LogisticRegressionCV(max_iter=100, cv=5, scoring='accuracy', n_jobs=-1)
1064
+ # clf.fit(X_train_pca, y_train)
1065
+
1066
+ # # 4. Evaluar el Modelo
1067
+ # print("Calculando precisión...")
1068
+
1069
+ # # Precisión en entrenamiento
1070
+ # y_train_pred = clf.predict(X_train_pca)
1071
+ # train_acc = accuracy_score(y_train, y_train_pred)
1072
+
1073
+ # # Precisión en validación
1074
+ # y_val_pred = clf.predict(X_val_pca)
1075
+ # val_acc = accuracy_score(y_val, y_val_pred)
1076
+
1077
+ # # Precisión en prueba
1078
+ # y_test_pred = clf.predict(X_test_pca)
1079
+ # test_acc = accuracy_score(y_test, y_test_pred)
1080
+
1081
+ # print(f"Precisión en entrenamiento: {train_acc:.4f}")
1082
+ # print(f"Precisión en validación: {val_acc:.4f}")
1083
+ # print(f"Precisión en prueba: {test_acc:.4f}")
1084
+
1085
+
1086
+ # In[33]:
1087
+
1088
+
1089
+ # X_train_scaled.shape
1090
+
1091
+
1092
+ # In[16]:
1093
+
1094
+
1095
+ # from sklearn.linear_model import LogisticRegressionCV, Ridge
1096
+ # print("fitting")
1097
+ # clf = LogisticRegressionCV(max_iter=100)
1098
+ # clf.fit(X_train, y_train)
1099
+ # print("calculating accuracy")
1100
+ # train_acc = clf.score(X_train, y_train)
1101
+ # val_acc = clf.score(X_val, y_val)
1102
+ # test_acc = clf.score(X_test, y_test)
1103
+
1104
+
1105
+ # In[ ]:
1106
+
1107
+
1108
+ # print(train_acc, val_acc, test_acc)
1109
+
1110
+
1111
+ # In[ ]:
1112
+
1113
+
1114
+ ### AGE
1115
+ # Sklearn No pca just 1k examples: 1.0 0.534 0.5066666666666667
1116
+ # Sklearn Pca 1800 features, 2k examples 1.0000 0.5130 0.4590
1117
+ # All data pytorch 0.93 no_val 0.55
1118
+
1119
+
1120
+ ### TRIAL TYPE
1121
+ # Sklearn No pca just 1k examples: 1.0 0.61 0.63
1122
+ # Sklearn Pca 500 features, 2k examples 1.0000 ~0.73 ~0.73
1123
+ # All data pytorch 0.9911 no_val 0.94
1124
+
1125
+
1126
+ # In[46]:
1127
+
1128
+
1129
+ # a = model.linear.weight[0][10:20]
1130
+ # a
1131
+
1132
+
1133
+ # In[22]:
1134
+
1135
+
1136
+ # loss = criterion(outputs, labels.unsqueeze(1))
1137
+ # loss
1138
+
fMRI-foundation-model/src/wandb/run-20241126_220105-HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de/files/output.log ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Epoch 1/20 - Training: 0%| | 0/870 [00:00<?, ?it/s]/admin/home-ckadirt/foundation_env/lib/python3.11/site-packages/torch/nn/modules/loss.py:538: UserWarning: Using a target size (torch.Size([128, 1])) that is different to the input size (torch.Size([128])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size.
2
+ return F.mse_loss(input, target, reduction=self.reduction)
3
+ Epoch 1/20 - Training: 100%|█████████▉| 869/870 [05:54<00:00, 4.68it/s]/admin/home-ckadirt/foundation_env/lib/python3.11/site-packages/torch/nn/modules/loss.py:538: UserWarning: Using a target size (torch.Size([70, 1])) that is different to the input size (torch.Size([70])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size.
4
+ Step [100/870] - Training Loss: 0.7004 - Training MSE: 98.7605
5
+ Step [200/870] - Training Loss: 0.9553 - Training MSE: 104.1519
6
+ Step [300/870] - Training Loss: 1.9018 - Training MSE: 129.4920
7
+ Step [400/870] - Training Loss: 5.3471 - Training MSE: 222.5458
8
+ Step [500/870] - Training Loss: 15.9923 - Training MSE: 460.4371
9
+ Step [600/870] - Training Loss: 32.0503 - Training MSE: 927.5124
10
+ Step [700/870] - Training Loss: 70.9650 - Training MSE: 1574.1360
11
+ Step [800/870] - Training Loss: 80.0552 - Training MSE: 2592.0538
12
+ return F.mse_loss(input, target, reduction=self.reduction)
13
+ Epoch 1/20 - Training: 100%|██████████| 870/870 [05:54<00:00, 2.46it/s]
14
+ Epoch 1/20 - Validation: 73%|███████▎ | 69/95 [01:52<00:44, 1.70s/it]
fMRI-foundation-model/src/wandb/run-20241126_220105-HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de/files/requirements.txt ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ protobuf==5.28.2
2
+ imageio==2.35.1
3
+ MarkupSafe==3.0.0
4
+ regex==2024.9.11
5
+ matplotlib==3.9.2
6
+ notebook==7.2.2
7
+ debugpy==1.8.6
8
+ aiosignal==1.3.1
9
+ jupyter_core==5.7.2
10
+ torchaudio==2.4.1+cu121
11
+ python-json-logger==2.0.7
12
+ six==1.16.0
13
+ scikit-image==0.24.0
14
+ types-python-dateutil==2.9.0.20241003
15
+ PyYAML==6.0.2
16
+ httpcore==1.0.6
17
+ clip==1.0
18
+ babel==2.16.0
19
+ webcolors==24.8.0
20
+ omegaconf==2.3.0
21
+ webencodings==0.5.1
22
+ kiwisolver==1.4.7
23
+ uri-template==1.3.0
24
+ diffusers==0.23.0
25
+ idna==3.10
26
+ fsspec==2024.9.0
27
+ parso==0.8.4
28
+ setuptools==65.5.0
29
+ tornado==6.4.1
30
+ webdataset==0.2.100
31
+ decord==0.6.0
32
+ nvidia-curand-cu12==10.3.2.106
33
+ ipykernel==6.29.5
34
+ jupyter==1.1.1
35
+ pexpect==4.9.0
36
+ kornia_rs==0.1.5
37
+ iopath==0.1.10
38
+ async-lru==2.0.4
39
+ future==1.0.0
40
+ torchvision==0.19.1+cu121
41
+ botocore==1.34.162
42
+ cycler==0.12.1
43
+ tzdata==2024.2
44
+ jupyter_server_terminals==0.5.3
45
+ click==8.1.7
46
+ einops==0.8.0
47
+ pyzmq==26.2.0
48
+ jupyter_client==8.6.3
49
+ nbconvert==7.16.4
50
+ scikit-learn==1.5.2
51
+ executing==2.1.0
52
+ asttokens==2.4.1
53
+ docker-pycreds==0.4.0
54
+ matplotlib-inline==0.1.7
55
+ overrides==7.7.0
56
+ websocket-client==1.8.0
57
+ nbformat==5.10.4
58
+ elbow==0.1.1
59
+ contourpy==1.3.0
60
+ nvidia-cudnn-cu12==9.1.0.70
61
+ transformers==4.44.2
62
+ gitdb==4.0.11
63
+ jupyterlab_nvdashboard==0.11.0
64
+ lazy_loader==0.4
65
+ jsonpointer==3.0.0
66
+ notebook_shim==0.2.4
67
+ nvidia-nccl-cu12==2.20.5
68
+ ffmpeg-python==0.2.0
69
+ triton==3.0.0
70
+ mistune==3.0.2
71
+ python-dateutil==2.9.0.post0
72
+ beautifulsoup4==4.12.3
73
+ nbclient==0.10.0
74
+ h5py==3.12.1
75
+ ftfy==6.2.3
76
+ zipp==3.20.2
77
+ ptyprocess==0.7.0
78
+ huggingface-hub==0.25.1
79
+ pytz==2024.2
80
+ jupyterlab_pygments==0.3.0
81
+ nvidia-cublas-cu12==12.1.3.1
82
+ pandocfilters==1.5.1
83
+ Jinja2==3.1.4
84
+ arrow==1.3.0
85
+ rpds-py==0.20.0
86
+ jupyter_server==2.14.2
87
+ simplejson==3.19.3
88
+ networkx==3.3
89
+ packaging==24.1
90
+ traitlets==5.14.3
91
+ pandas==2.2.3
92
+ xformers==0.0.22.post7
93
+ lightning-utilities==0.11.7
94
+ tifffile==2024.9.20
95
+ nvidia-cuda-cupti-cu12==12.1.105
96
+ mpmath==1.3.0
97
+ GitPython==3.1.43
98
+ scipy==1.14.1
99
+ jsonschema==4.23.0
100
+ prompt_toolkit==3.0.48
101
+ s3transfer==0.10.2
102
+ multidict==6.1.0
103
+ bleach==6.1.0
104
+ sentry-sdk==2.15.0
105
+ nibabel==5.2.1
106
+ accelerate==1.0.0
107
+ pyarrow==17.0.0
108
+ threadpoolctl==3.5.0
109
+ attrs==24.2.0
110
+ rfc3986-validator==0.1.1
111
+ nvidia-cuda-runtime-cu12==12.1.105
112
+ ipywidgets==8.1.5
113
+ frozenlist==1.4.1
114
+ pycparser==2.22
115
+ jupyterlab_server==2.27.3
116
+ nvidia-cuda-nvrtc-cu12==12.1.105
117
+ yarl==1.13.1
118
+ setproctitle==1.3.3
119
+ isoduration==20.11.0
120
+ Pygments==2.18.0
121
+ jedi==0.19.1
122
+ boto3==1.34.57
123
+ tokenizers==0.19.1
124
+ referencing==0.35.1
125
+ rfc3339-validator==0.1.4
126
+ pillow==10.4.0
127
+ jupyterlab==4.2.5
128
+ stack-data==0.6.3
129
+ h11==0.14.0
130
+ anyio==4.6.0
131
+ nilearn==0.10.4
132
+ nvidia-cusolver-cu12==11.4.5.107
133
+ tinycss2==1.3.0
134
+ defusedxml==0.7.1
135
+ argon2-cffi-bindings==21.2.0
136
+ soupsieve==2.6
137
+ nest-asyncio==1.6.0
138
+ torchmetrics==1.3.0.post0
139
+ tqdm==4.66.5
140
+ cffi==1.17.1
141
+ charset-normalizer==3.3.2
142
+ jsonschema-specifications==2023.12.1
143
+ decorator==5.1.1
144
+ open_clip_torch==2.26.1
145
+ jupyter-events==0.10.0
146
+ smart-open==7.0.5
147
+ antlr4-python3-runtime==4.9.3
148
+ prometheus_client==0.21.0
149
+ kornia==0.7.3
150
+ typing_extensions==4.12.2
151
+ sniffio==1.3.1
152
+ joblib==1.4.2
153
+ comm==0.2.2
154
+ aiohappyeyeballs==2.4.3
155
+ numpy==2.1.2
156
+ braceexpand==0.1.7
157
+ certifi==2024.8.30
158
+ psutil==6.0.0
159
+ pyparsing==3.1.4
160
+ pure_eval==0.2.3
161
+ nvidia-cusparse-cu12==12.1.0.106
162
+ wandb==0.18.3
163
+ urllib3==2.2.3
164
+ smmap==5.0.1
165
+ platformdirs==4.3.6
166
+ torch==2.4.1+cu121
167
+ requests==2.32.3
168
+ json5==0.9.25
169
+ nvidia-nvjitlink-cu12==12.6.77
170
+ jupyterlab_widgets==3.0.13
171
+ lxml==5.3.0
172
+ httpx==0.27.2
173
+ opencv-python==4.6.0.66
174
+ portalocker==2.10.1
175
+ pytorch-lightning==2.0.1
176
+ sympy==1.13.3
177
+ wcwidth==0.2.13
178
+ jmespath==1.0.1
179
+ fqdn==1.5.1
180
+ pynvml==11.5.3
181
+ schedulefree==1.3
182
+ pip==24.0
183
+ wrapt==1.16.0
184
+ aiohttp==3.10.9
185
+ filelock==3.16.1
186
+ fonttools==4.54.1
187
+ fastjsonschema==2.20.0
188
+ jupyter-console==6.6.3
189
+ widgetsnbextension==4.0.13
190
+ timm==1.0.9
191
+ nvidia-cufft-cu12==11.0.2.54
192
+ ipython==8.28.0
193
+ nvidia-nvtx-cu12==12.1.105
194
+ jupyter-lsp==2.2.5
195
+ safetensors==0.4.5
196
+ terminado==0.18.1
197
+ argon2-cffi==23.1.0
198
+ Send2Trash==1.8.3
199
+ importlib_metadata==8.5.0
fMRI-foundation-model/src/wandb/run-20241126_220105-HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de/files/wandb-metadata.json ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "os": "Linux-5.15.0-1058-aws-x86_64-with-glibc2.31",
3
+ "python": "3.11.9",
4
+ "startedAt": "2024-11-26T22:01:05.831548Z",
5
+ "args": [
6
+ "--hcp_flat_path=/weka/proj-medarc/shared/HCP-Flat",
7
+ "--target=age",
8
+ "--model_suffix=beta",
9
+ "--batch_size=128",
10
+ "--max_lr=1e-3",
11
+ "--num_epochs=20",
12
+ "--no-save_ckpt",
13
+ "--wandb_log",
14
+ "--num_workers=15",
15
+ "--weight_decay=1e-5"
16
+ ],
17
+ "program": "/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/HCP_downstream_raw_flatmaps.py",
18
+ "codePath": "src/HCP_downstream_raw_flatmaps.py",
19
+ "git": {
20
+ "remote": "https://github.com/MedARC-AI/fMRI-foundation-model",
21
+ "commit": "7c9bb03314a9f929bb8f0fc0ce92c85ea1a2e495"
22
+ },
23
+ "email": "torrico.villanueva.cesar.kadir@gmail.com",
24
+ "root": "/weka/proj-fmri/ckadirt/fMRI-foundation-model/src",
25
+ "host": "ip-10-0-136-5",
26
+ "username": "ckadirt",
27
+ "executable": "/admin/home-ckadirt/foundation_env/bin/python",
28
+ "codePathLocal": "HCP_downstream_raw_flatmaps.py",
29
+ "cpu_count": 96,
30
+ "cpu_count_logical": 192,
31
+ "gpu": "[NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3, NVIDIA H100 80GB HBM3]",
32
+ "gpu_count": 8,
33
+ "disk": {
34
+ "/": {
35
+ "total": "249555763200",
36
+ "used": "186247274496"
37
+ }
38
+ },
39
+ "memory": {
40
+ "total": "2147443384320"
41
+ },
42
+ "cpu": {
43
+ "count": 96,
44
+ "countLogical": 192
45
+ },
46
+ "gpu_nvidia": [
47
+ {
48
+ "name": "NVIDIA H100 80GB HBM3",
49
+ "memoryTotal": "85520809984",
50
+ "cudaCores": 16896,
51
+ "architecture": "Hopper"
52
+ },
53
+ {
54
+ "name": "NVIDIA H100 80GB HBM3",
55
+ "memoryTotal": "85520809984",
56
+ "cudaCores": 16896,
57
+ "architecture": "Hopper"
58
+ },
59
+ {
60
+ "name": "NVIDIA H100 80GB HBM3",
61
+ "memoryTotal": "85520809984",
62
+ "cudaCores": 16896,
63
+ "architecture": "Hopper"
64
+ },
65
+ {
66
+ "name": "NVIDIA H100 80GB HBM3",
67
+ "memoryTotal": "85520809984",
68
+ "cudaCores": 16896,
69
+ "architecture": "Hopper"
70
+ },
71
+ {
72
+ "name": "NVIDIA H100 80GB HBM3",
73
+ "memoryTotal": "85520809984",
74
+ "cudaCores": 16896,
75
+ "architecture": "Hopper"
76
+ },
77
+ {
78
+ "name": "NVIDIA H100 80GB HBM3",
79
+ "memoryTotal": "85520809984",
80
+ "cudaCores": 16896,
81
+ "architecture": "Hopper"
82
+ },
83
+ {
84
+ "name": "NVIDIA H100 80GB HBM3",
85
+ "memoryTotal": "85520809984",
86
+ "cudaCores": 16896,
87
+ "architecture": "Hopper"
88
+ },
89
+ {
90
+ "name": "NVIDIA H100 80GB HBM3",
91
+ "memoryTotal": "85520809984",
92
+ "cudaCores": 16896,
93
+ "architecture": "Hopper"
94
+ }
95
+ ],
96
+ "slurm": {
97
+ "cluster_name": "sagemaker2",
98
+ "conf": "/opt/slurm/etc/slurm.conf",
99
+ "cpus_on_node": "20",
100
+ "gpus_on_node": "1",
101
+ "gpus_per_task": "1",
102
+ "gtids": "0",
103
+ "job_account": "fmri",
104
+ "job_cpus_per_node": "20",
105
+ "job_end_time": "1732773637",
106
+ "job_gid": "1879800513",
107
+ "job_gpus": "7",
108
+ "job_id": "541290",
109
+ "job_name": "HCPflat_sex",
110
+ "job_nodelist": "ip-10-0-136-5",
111
+ "job_num_nodes": "1",
112
+ "job_partition": "p5",
113
+ "job_qos": "idle",
114
+ "job_start_time": "1732658437",
115
+ "job_uid": "1879804696",
116
+ "job_user": "ckadirt",
117
+ "jobid": "541290",
118
+ "localid": "0",
119
+ "mem_per_cpu": "11500",
120
+ "nnodes": "1",
121
+ "node_aliases": "(null)",
122
+ "nodeid": "0",
123
+ "nodelist": "ip-10-0-136-5",
124
+ "nprocs": "1",
125
+ "ntasks": "1",
126
+ "ntasks_per_node": "1",
127
+ "prio_process": "0",
128
+ "procid": "0",
129
+ "script_context": "prolog_task",
130
+ "submit_dir": "/weka/proj-fmri/ckadirt/fMRI-foundation-model/src",
131
+ "submit_host": "ip-172-17-12-61",
132
+ "task_pid": "1101161",
133
+ "tasks_per_node": "1",
134
+ "topology_addr": "ip-10-0-136-5",
135
+ "topology_addr_pattern": "node",
136
+ "working_cluster": "sagemaker2:ip-172-17-63-161:6817:9984:109"
137
+ },
138
+ "cudaVersion": "12.2"
139
+ }
fMRI-foundation-model/src/wandb/run-20241126_220105-HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de/logs/debug-core.log ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {"time":"2024-11-26T22:01:05.4507916Z","level":"INFO","msg":"started logging, with flags","port-filename":"/tmp/tmpvpzu9lxn/port-1101409.txt","pid":1101409,"debug":false,"disable-analytics":false}
2
+ {"time":"2024-11-26T22:01:05.451090737Z","level":"INFO","msg":"FeatureState","shutdownOnParentExitEnabled":false}
3
+ {"time":"2024-11-26T22:01:05.457104139Z","level":"INFO","msg":"Will exit if parent process dies.","ppid":1101409}
4
+ {"time":"2024-11-26T22:01:05.45712152Z","level":"INFO","msg":"server is running","addr":{"IP":"127.0.0.1","Port":33369,"Zone":""}}
5
+ {"time":"2024-11-26T22:01:05.480708473Z","level":"INFO","msg":"connection: ManageConnectionData: new connection created","id":"127.0.0.1:40396"}
6
+ {"time":"2024-11-26T22:01:05.835627765Z","level":"INFO","msg":"handleInformInit: received","streamId":"HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de","id":"127.0.0.1:40396"}
7
+ {"time":"2024-11-26T22:01:05.866239966Z","level":"INFO","msg":"handleInformInit: stream started","streamId":"HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de","id":"127.0.0.1:40396"}
fMRI-foundation-model/src/wandb/run-20241126_220105-HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de/logs/debug-internal.log ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"time":"2024-11-26T22:01:05.838729376Z","level":"INFO","msg":"using version","core version":"0.18.3"}
2
+ {"time":"2024-11-26T22:01:05.838745897Z","level":"INFO","msg":"created symlink","path":"/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241126_220105-HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de/logs/debug-core.log"}
3
+ {"time":"2024-11-26T22:01:05.850612032Z","level":"ERROR","msg":"dialing: google: could not find default credentials. See https://cloud.google.com/docs/authentication/external/set-up-adc for more information"}
4
+ {"time":"2024-11-26T22:01:05.866205644Z","level":"INFO","msg":"created new stream","id":"HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de"}
5
+ {"time":"2024-11-26T22:01:05.866234015Z","level":"INFO","msg":"stream: started","id":"HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de"}
6
+ {"time":"2024-11-26T22:01:05.866262597Z","level":"INFO","msg":"handler: started","stream_id":{"value":"HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de"}}
7
+ {"time":"2024-11-26T22:01:05.866269227Z","level":"INFO","msg":"sender: started","stream_id":{"value":"HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de"}}
8
+ {"time":"2024-11-26T22:01:05.866248866Z","level":"INFO","msg":"writer: Do: started","stream_id":{"value":"HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de"}}
9
+ {"time":"2024-11-26T22:01:06.26520456Z","level":"INFO","msg":"wandb-core","!BADKEY":null}
10
+ {"time":"2024-11-26T22:01:06.267725369Z","level":"INFO","msg":"Starting system monitor"}
11
+ {"time":"2024-11-26T22:01:06.273701719Z","level":"ERROR","msg":"git repo not found","error":"repository does not exist"}
fMRI-foundation-model/src/wandb/run-20241126_220105-HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de/logs/debug.log ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 2024-11-26 22:01:05,828 INFO MainThread:1101409 [wandb_setup.py:_flush():79] Current SDK version is 0.18.3
2
+ 2024-11-26 22:01:05,828 INFO MainThread:1101409 [wandb_setup.py:_flush():79] Configure stats pid to 1101409
3
+ 2024-11-26 22:01:05,828 INFO MainThread:1101409 [wandb_setup.py:_flush():79] Loading settings from /admin/home-ckadirt/.config/wandb/settings
4
+ 2024-11-26 22:01:05,829 INFO MainThread:1101409 [wandb_setup.py:_flush():79] Loading settings from /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/settings
5
+ 2024-11-26 22:01:05,829 INFO MainThread:1101409 [wandb_setup.py:_flush():79] Loading settings from environment variables: {}
6
+ 2024-11-26 22:01:05,829 INFO MainThread:1101409 [wandb_setup.py:_flush():79] Applying setup settings: {'mode': None, '_disable_service': None}
7
+ 2024-11-26 22:01:05,829 INFO MainThread:1101409 [wandb_setup.py:_flush():79] Inferring run settings from compute environment: {'program_relpath': 'src/HCP_downstream_raw_flatmaps.py', 'program_abspath': '/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/HCP_downstream_raw_flatmaps.py', 'program': '/weka/proj-fmri/ckadirt/fMRI-foundation-model/src/HCP_downstream_raw_flatmaps.py'}
8
+ 2024-11-26 22:01:05,829 INFO MainThread:1101409 [wandb_setup.py:_flush():79] Applying login settings: {}
9
+ 2024-11-26 22:01:05,829 INFO MainThread:1101409 [wandb_init.py:_log_setup():532] Logging user logs to /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241126_220105-HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de/logs/debug.log
10
+ 2024-11-26 22:01:05,829 INFO MainThread:1101409 [wandb_init.py:_log_setup():533] Logging internal logs to /weka/proj-fmri/ckadirt/fMRI-foundation-model/src/wandb/run-20241126_220105-HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de/logs/debug-internal.log
11
+ 2024-11-26 22:01:05,829 INFO MainThread:1101409 [wandb_init.py:init():617] calling init triggers
12
+ 2024-11-26 22:01:05,829 INFO MainThread:1101409 [wandb_init.py:init():624] wandb.init called with sweep_config: {}
13
+ config: {'model_name': 'HCPflat_raw_age', 'batch_size': 128, 'weight_decay': 1e-05, 'num_epochs': 20, 'seed': 42, 'lr_scheduler_type': 'cycle', 'save_ckpt': False, 'max_lr': 0.001, 'target': 'age', 'num_workers': 15}
14
+ 2024-11-26 22:01:05,829 INFO MainThread:1101409 [wandb_init.py:init():667] starting backend
15
+ 2024-11-26 22:01:05,829 INFO MainThread:1101409 [wandb_init.py:init():671] sending inform_init request
16
+ 2024-11-26 22:01:05,831 INFO MainThread:1101409 [backend.py:_multiprocessing_setup():104] multiprocessing start_methods=fork,spawn,forkserver, using: spawn
17
+ 2024-11-26 22:01:05,831 INFO MainThread:1101409 [wandb_init.py:init():684] backend started and connected
18
+ 2024-11-26 22:01:05,837 INFO MainThread:1101409 [wandb_init.py:init():779] updated telemetry
19
+ 2024-11-26 22:01:05,848 INFO MainThread:1101409 [wandb_init.py:init():812] communicating run to backend with 90.0 second timeout
20
+ 2024-11-26 22:01:06,260 INFO MainThread:1101409 [wandb_init.py:init():863] starting run threads in backend
21
+ 2024-11-26 22:01:06,714 INFO MainThread:1101409 [wandb_run.py:_console_start():2465] atexit reg
22
+ 2024-11-26 22:01:06,714 INFO MainThread:1101409 [wandb_run.py:_redirect():2313] redirect: wrap_raw
23
+ 2024-11-26 22:01:06,714 INFO MainThread:1101409 [wandb_run.py:_redirect():2378] Wrapping output streams.
24
+ 2024-11-26 22:01:06,715 INFO MainThread:1101409 [wandb_run.py:_redirect():2403] Redirects installed.
25
+ 2024-11-26 22:01:06,721 INFO MainThread:1101409 [wandb_init.py:init():907] run started, returning control to user process
fMRI-foundation-model/src/wandb/run-20241126_220105-HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de/run-HCPflat_raw_beta_age_7cc4d250-ac94-488c-bec4-39b422ee70de.wandb ADDED
Binary file (590 kB). View file