Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- scripts/.ipynb_checkpoints/ViViT-checkpoint.ipynb +829 -0
- scripts/.ipynb_checkpoints/VideoMAE-checkpoint.ipynb +713 -0
- scripts/.ipynb_checkpoints/run_self_influence-checkpoint.sh +13 -0
- scripts/.ipynb_checkpoints/soup_caformer_b36-checkpoint.sh +15 -0
- scripts/.ipynb_checkpoints/soup_caformer_m36-checkpoint.sh +17 -0
- scripts/.ipynb_checkpoints/soup_caformer_s36-checkpoint.sh +12 -0
- scripts/.ipynb_checkpoints/soup_coatnet_0-merged_4_15-checkpoint.sh +12 -0
- scripts/.ipynb_checkpoints/soup_coatnet_0_co_teaching-checkpoint.sh +12 -0
- scripts/.ipynb_checkpoints/soup_coatnet_0_random-checkpoint.sh +12 -0
- scripts/.ipynb_checkpoints/soup_coatnet_2-merged_4_15-checkpoint.sh +12 -0
- scripts/.ipynb_checkpoints/soup_coatnet_2_random-checkpoint.sh +12 -0
- scripts/.ipynb_checkpoints/soup_convnext_base-checkpoint.sh +15 -0
- scripts/.ipynb_checkpoints/soup_convnext_small-checkpoint.sh +15 -0
- scripts/.ipynb_checkpoints/soup_convnext_tiny-checkpoint.sh +15 -0
- scripts/.ipynb_checkpoints/soup_eva02_base-checkpoint.sh +13 -0
- scripts/.ipynb_checkpoints/soup_eva02_large-checkpoint.sh +16 -0
- scripts/.ipynb_checkpoints/soup_eva02_small-checkpoint.sh +16 -0
- scripts/.ipynb_checkpoints/soup_focalnet_base_srf-checkpoint.sh +15 -0
- scripts/.ipynb_checkpoints/soup_focalnet_small_lrf-checkpoint.sh +15 -0
- scripts/.ipynb_checkpoints/soup_focalnet_small_srf-checkpoint.sh +15 -0
- scripts/.ipynb_checkpoints/soup_hgnetv2_b6_ssld_stage2-checkpoint.sh +15 -0
- scripts/.ipynb_checkpoints/soup_maxvit_base-checkpoint.sh +15 -0
- scripts/.ipynb_checkpoints/soup_swin-checkpoint.sh +14 -0
- scripts/.ipynb_checkpoints/soup_tiny_vit_21m-checkpoint.sh +15 -0
- scripts/.ipynb_checkpoints/soup_vit_base-checkpoint.sh +15 -0
- scripts/.ipynb_checkpoints/soup_vit_base_laion2b-checkpoint.sh +15 -0
- scripts/.ipynb_checkpoints/test_caformer_b36-checkpoint.sh +10 -0
- scripts/.ipynb_checkpoints/test_caformer_m36-checkpoint.sh +12 -0
- scripts/.ipynb_checkpoints/test_caformer_s36-checkpoint.sh +10 -0
- scripts/.ipynb_checkpoints/test_coatnet_0-checkpoint.sh +10 -0
- scripts/.ipynb_checkpoints/test_coatnet_0-merged_4_15-checkpoint.sh +10 -0
- scripts/.ipynb_checkpoints/test_coatnet_0_co_teaching-checkpoint.sh +10 -0
- scripts/.ipynb_checkpoints/test_coatnet_0_random-checkpoint.sh +10 -0
- scripts/.ipynb_checkpoints/test_coatnet_2-merged_4_15-checkpoint.sh +10 -0
- scripts/.ipynb_checkpoints/test_coatnet_2_random-checkpoint.sh +10 -0
- scripts/.ipynb_checkpoints/test_convnext_base-checkpoint.sh +10 -0
- scripts/.ipynb_checkpoints/test_convnext_femto-checkpoint.sh +10 -0
- scripts/.ipynb_checkpoints/test_convnext_large-checkpoint.sh +10 -0
- scripts/.ipynb_checkpoints/test_convnext_nano-checkpoint.sh +10 -0
- scripts/.ipynb_checkpoints/test_convnext_pico-checkpoint.sh +10 -0
- scripts/.ipynb_checkpoints/test_convnext_small-checkpoint.sh +10 -0
- scripts/.ipynb_checkpoints/test_convnext_tiny-checkpoint.sh +10 -0
- scripts/.ipynb_checkpoints/test_convnext_v2_large-checkpoint.sh +10 -0
- scripts/.ipynb_checkpoints/test_convnext_xlarge-checkpoint.sh +10 -0
- scripts/.ipynb_checkpoints/test_convnext_xxlarge-checkpoint.sh +10 -0
- scripts/.ipynb_checkpoints/test_eva02_base-checkpoint.sh +10 -0
- scripts/.ipynb_checkpoints/test_eva02_large-checkpoint.sh +10 -0
- scripts/.ipynb_checkpoints/test_eva02_small-checkpoint.sh +10 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
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 1,
|
| 6 |
+
"id": "18122027-63d4-45bc-a155-11d941da97b9",
|
| 7 |
+
"metadata": {},
|
| 8 |
+
"outputs": [],
|
| 9 |
+
"source": [
|
| 10 |
+
"DATASET_PATH = \"/media/khmt/HDD1/TQKhang/datasets/xarac\""
|
| 11 |
+
]
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"cell_type": "code",
|
| 15 |
+
"execution_count": 2,
|
| 16 |
+
"id": "bc5b5096-93dd-4661-bd32-e1c66a3facfc",
|
| 17 |
+
"metadata": {},
|
| 18 |
+
"outputs": [],
|
| 19 |
+
"source": [
|
| 20 |
+
"%load_ext autoreload\n",
|
| 21 |
+
"%autoreload 2"
|
| 22 |
+
]
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"cell_type": "code",
|
| 26 |
+
"execution_count": 3,
|
| 27 |
+
"id": "59965104-6b47-4bd4-ae52-9924a91feed3",
|
| 28 |
+
"metadata": {},
|
| 29 |
+
"outputs": [
|
| 30 |
+
{
|
| 31 |
+
"name": "stderr",
|
| 32 |
+
"output_type": "stream",
|
| 33 |
+
"text": [
|
| 34 |
+
"/home/khmt/anaconda3/envs/tqkhang-vivit/lib/python3.7/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
|
| 35 |
+
" from .autonotebook import tqdm as notebook_tqdm\n"
|
| 36 |
+
]
|
| 37 |
+
}
|
| 38 |
+
],
|
| 39 |
+
"source": [
|
| 40 |
+
"from torch.optim import AdamW\n",
|
| 41 |
+
"from video_transformers import VideoModel\n",
|
| 42 |
+
"from video_transformers.backbones.transformers import TransformersBackbone\n",
|
| 43 |
+
"from video_transformers.backbones.timm import TimmBackbone\n",
|
| 44 |
+
"from video_transformers.data import VideoDataModule\n",
|
| 45 |
+
"from video_transformers.heads import LinearHead\n",
|
| 46 |
+
"from video_transformers.trainer import trainer_factory"
|
| 47 |
+
]
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"cell_type": "code",
|
| 51 |
+
"execution_count": 4,
|
| 52 |
+
"id": "2f5c18af-5a5a-4e6d-91dd-446123218792",
|
| 53 |
+
"metadata": {
|
| 54 |
+
"scrolled": true
|
| 55 |
+
},
|
| 56 |
+
"outputs": [
|
| 57 |
+
{
|
| 58 |
+
"name": "stderr",
|
| 59 |
+
"output_type": "stream",
|
| 60 |
+
"text": [
|
| 61 |
+
"Some weights of the model checkpoint at facebook/timesformer-base-finetuned-k400 were not used when initializing TimesformerModel: ['classifier.weight', 'classifier.bias']\n",
|
| 62 |
+
"- This IS expected if you are initializing TimesformerModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).\n",
|
| 63 |
+
"- This IS NOT expected if you are initializing TimesformerModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).\n",
|
| 64 |
+
"/home/khmt/anaconda3/envs/tqkhang-vivit/lib/python3.7/site-packages/transformers/models/videomae/feature_extraction_videomae.py:31: FutureWarning: The class VideoMAEFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please use VideoMAEImageProcessor instead.\n",
|
| 65 |
+
" FutureWarning,\n"
|
| 66 |
+
]
|
| 67 |
+
}
|
| 68 |
+
],
|
| 69 |
+
"source": [
|
| 70 |
+
"backbone = TransformersBackbone(\"facebook/timesformer-base-finetuned-k400\", num_unfrozen_stages=1)"
|
| 71 |
+
]
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"cell_type": "code",
|
| 75 |
+
"execution_count": 5,
|
| 76 |
+
"id": "04eb1ed9-0497-48d0-a72e-7223939f257b",
|
| 77 |
+
"metadata": {},
|
| 78 |
+
"outputs": [],
|
| 79 |
+
"source": [
|
| 80 |
+
"datamodule = VideoDataModule(\n",
|
| 81 |
+
" train_root=\"/media/khmt/HDD1/TQKhang/datasets/xarac/train\",\n",
|
| 82 |
+
" val_root=\"/media/khmt/HDD1/TQKhang/datasets/xarac/val\",\n",
|
| 83 |
+
" test_root=\"/media/khmt/HDD1/TQKhang/datasets/xarac/val\",\n",
|
| 84 |
+
" batch_size=4,\n",
|
| 85 |
+
" num_workers=4,\n",
|
| 86 |
+
" num_timesteps=8,\n",
|
| 87 |
+
" preprocess_input_size=224,\n",
|
| 88 |
+
" preprocess_clip_duration=1,\n",
|
| 89 |
+
" preprocess_means=backbone.mean,\n",
|
| 90 |
+
" preprocess_stds=backbone.std,\n",
|
| 91 |
+
" preprocess_min_short_side=256,\n",
|
| 92 |
+
" preprocess_max_short_side=320,\n",
|
| 93 |
+
" preprocess_horizontal_flip_p=0.5,\n",
|
| 94 |
+
")"
|
| 95 |
+
]
|
| 96 |
+
},
|
| 97 |
+
{
|
| 98 |
+
"cell_type": "code",
|
| 99 |
+
"execution_count": 6,
|
| 100 |
+
"id": "12b51c8e-8420-456a-96fb-a185165c990a",
|
| 101 |
+
"metadata": {},
|
| 102 |
+
"outputs": [
|
| 103 |
+
{
|
| 104 |
+
"data": {
|
| 105 |
+
"text/plain": [
|
| 106 |
+
"2"
|
| 107 |
+
]
|
| 108 |
+
},
|
| 109 |
+
"execution_count": 6,
|
| 110 |
+
"metadata": {},
|
| 111 |
+
"output_type": "execute_result"
|
| 112 |
+
}
|
| 113 |
+
],
|
| 114 |
+
"source": [
|
| 115 |
+
"datamodule.num_classes"
|
| 116 |
+
]
|
| 117 |
+
},
|
| 118 |
+
{
|
| 119 |
+
"cell_type": "code",
|
| 120 |
+
"execution_count": 7,
|
| 121 |
+
"id": "a6189aca-e28c-4147-8efc-fae604663d14",
|
| 122 |
+
"metadata": {},
|
| 123 |
+
"outputs": [],
|
| 124 |
+
"source": [
|
| 125 |
+
"head = LinearHead(hidden_size=backbone.num_features, num_classes=datamodule.num_classes)\n",
|
| 126 |
+
"model = VideoModel(backbone, head)"
|
| 127 |
+
]
|
| 128 |
+
},
|
| 129 |
+
{
|
| 130 |
+
"cell_type": "code",
|
| 131 |
+
"execution_count": 8,
|
| 132 |
+
"id": "f3ed0a1e-d90c-49b1-a213-55815d0cdf15",
|
| 133 |
+
"metadata": {
|
| 134 |
+
"scrolled": true
|
| 135 |
+
},
|
| 136 |
+
"outputs": [
|
| 137 |
+
{
|
| 138 |
+
"data": {
|
| 139 |
+
"text/plain": [
|
| 140 |
+
"VideoModel(\n",
|
| 141 |
+
" (backbone): TransformersBackbone(\n",
|
| 142 |
+
" (model): TimesformerModel(\n",
|
| 143 |
+
" (embeddings): TimesformerEmbeddings(\n",
|
| 144 |
+
" (patch_embeddings): TimesformerPatchEmbeddings(\n",
|
| 145 |
+
" (projection): Conv2d(3, 768, kernel_size=(16, 16), stride=(16, 16))\n",
|
| 146 |
+
" )\n",
|
| 147 |
+
" (pos_drop): Dropout(p=0.0, inplace=False)\n",
|
| 148 |
+
" (time_drop): Dropout(p=0.0, inplace=False)\n",
|
| 149 |
+
" )\n",
|
| 150 |
+
" (encoder): TimesformerEncoder(\n",
|
| 151 |
+
" (layer): ModuleList(\n",
|
| 152 |
+
" (0): TimesformerLayer(\n",
|
| 153 |
+
" (drop_path): Identity()\n",
|
| 154 |
+
" (attention): TimeSformerAttention(\n",
|
| 155 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 156 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 157 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 158 |
+
" )\n",
|
| 159 |
+
" (output): TimesformerSelfOutput(\n",
|
| 160 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 161 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 162 |
+
" )\n",
|
| 163 |
+
" )\n",
|
| 164 |
+
" (intermediate): TimesformerIntermediate(\n",
|
| 165 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 166 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 167 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 168 |
+
" )\n",
|
| 169 |
+
" (output): TimesformerOutput(\n",
|
| 170 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 171 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 172 |
+
" )\n",
|
| 173 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 174 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 175 |
+
" (temporal_layernorm): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 176 |
+
" (temporal_attention): TimeSformerAttention(\n",
|
| 177 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 178 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 179 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 180 |
+
" )\n",
|
| 181 |
+
" (output): TimesformerSelfOutput(\n",
|
| 182 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 183 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 184 |
+
" )\n",
|
| 185 |
+
" )\n",
|
| 186 |
+
" (temporal_dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 187 |
+
" )\n",
|
| 188 |
+
" (1): TimesformerLayer(\n",
|
| 189 |
+
" (drop_path): Identity()\n",
|
| 190 |
+
" (attention): TimeSformerAttention(\n",
|
| 191 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 192 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 193 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 194 |
+
" )\n",
|
| 195 |
+
" (output): TimesformerSelfOutput(\n",
|
| 196 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 197 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 198 |
+
" )\n",
|
| 199 |
+
" )\n",
|
| 200 |
+
" (intermediate): TimesformerIntermediate(\n",
|
| 201 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 202 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 203 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 204 |
+
" )\n",
|
| 205 |
+
" (output): TimesformerOutput(\n",
|
| 206 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 207 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 208 |
+
" )\n",
|
| 209 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 210 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 211 |
+
" (temporal_layernorm): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 212 |
+
" (temporal_attention): TimeSformerAttention(\n",
|
| 213 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 214 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 215 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 216 |
+
" )\n",
|
| 217 |
+
" (output): TimesformerSelfOutput(\n",
|
| 218 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 219 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 220 |
+
" )\n",
|
| 221 |
+
" )\n",
|
| 222 |
+
" (temporal_dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 223 |
+
" )\n",
|
| 224 |
+
" (2): TimesformerLayer(\n",
|
| 225 |
+
" (drop_path): Identity()\n",
|
| 226 |
+
" (attention): TimeSformerAttention(\n",
|
| 227 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 228 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 229 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 230 |
+
" )\n",
|
| 231 |
+
" (output): TimesformerSelfOutput(\n",
|
| 232 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 233 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 234 |
+
" )\n",
|
| 235 |
+
" )\n",
|
| 236 |
+
" (intermediate): TimesformerIntermediate(\n",
|
| 237 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 238 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 239 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 240 |
+
" )\n",
|
| 241 |
+
" (output): TimesformerOutput(\n",
|
| 242 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 243 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 244 |
+
" )\n",
|
| 245 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 246 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 247 |
+
" (temporal_layernorm): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 248 |
+
" (temporal_attention): TimeSformerAttention(\n",
|
| 249 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 250 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 251 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 252 |
+
" )\n",
|
| 253 |
+
" (output): TimesformerSelfOutput(\n",
|
| 254 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 255 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 256 |
+
" )\n",
|
| 257 |
+
" )\n",
|
| 258 |
+
" (temporal_dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 259 |
+
" )\n",
|
| 260 |
+
" (3): TimesformerLayer(\n",
|
| 261 |
+
" (drop_path): Identity()\n",
|
| 262 |
+
" (attention): TimeSformerAttention(\n",
|
| 263 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 264 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 265 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 266 |
+
" )\n",
|
| 267 |
+
" (output): TimesformerSelfOutput(\n",
|
| 268 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 269 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 270 |
+
" )\n",
|
| 271 |
+
" )\n",
|
| 272 |
+
" (intermediate): TimesformerIntermediate(\n",
|
| 273 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 274 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 275 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 276 |
+
" )\n",
|
| 277 |
+
" (output): TimesformerOutput(\n",
|
| 278 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 279 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 280 |
+
" )\n",
|
| 281 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 282 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 283 |
+
" (temporal_layernorm): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 284 |
+
" (temporal_attention): TimeSformerAttention(\n",
|
| 285 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 286 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 287 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 288 |
+
" )\n",
|
| 289 |
+
" (output): TimesformerSelfOutput(\n",
|
| 290 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 291 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 292 |
+
" )\n",
|
| 293 |
+
" )\n",
|
| 294 |
+
" (temporal_dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 295 |
+
" )\n",
|
| 296 |
+
" (4): TimesformerLayer(\n",
|
| 297 |
+
" (drop_path): Identity()\n",
|
| 298 |
+
" (attention): TimeSformerAttention(\n",
|
| 299 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 300 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 301 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 302 |
+
" )\n",
|
| 303 |
+
" (output): TimesformerSelfOutput(\n",
|
| 304 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 305 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 306 |
+
" )\n",
|
| 307 |
+
" )\n",
|
| 308 |
+
" (intermediate): TimesformerIntermediate(\n",
|
| 309 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 310 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 311 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 312 |
+
" )\n",
|
| 313 |
+
" (output): TimesformerOutput(\n",
|
| 314 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 315 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 316 |
+
" )\n",
|
| 317 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 318 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 319 |
+
" (temporal_layernorm): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 320 |
+
" (temporal_attention): TimeSformerAttention(\n",
|
| 321 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 322 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 323 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 324 |
+
" )\n",
|
| 325 |
+
" (output): TimesformerSelfOutput(\n",
|
| 326 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 327 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 328 |
+
" )\n",
|
| 329 |
+
" )\n",
|
| 330 |
+
" (temporal_dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 331 |
+
" )\n",
|
| 332 |
+
" (5): TimesformerLayer(\n",
|
| 333 |
+
" (drop_path): Identity()\n",
|
| 334 |
+
" (attention): TimeSformerAttention(\n",
|
| 335 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 336 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 337 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 338 |
+
" )\n",
|
| 339 |
+
" (output): TimesformerSelfOutput(\n",
|
| 340 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 341 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 342 |
+
" )\n",
|
| 343 |
+
" )\n",
|
| 344 |
+
" (intermediate): TimesformerIntermediate(\n",
|
| 345 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 346 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 347 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 348 |
+
" )\n",
|
| 349 |
+
" (output): TimesformerOutput(\n",
|
| 350 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 351 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 352 |
+
" )\n",
|
| 353 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 354 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 355 |
+
" (temporal_layernorm): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 356 |
+
" (temporal_attention): TimeSformerAttention(\n",
|
| 357 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 358 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 359 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 360 |
+
" )\n",
|
| 361 |
+
" (output): TimesformerSelfOutput(\n",
|
| 362 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 363 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 364 |
+
" )\n",
|
| 365 |
+
" )\n",
|
| 366 |
+
" (temporal_dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 367 |
+
" )\n",
|
| 368 |
+
" (6): TimesformerLayer(\n",
|
| 369 |
+
" (drop_path): Identity()\n",
|
| 370 |
+
" (attention): TimeSformerAttention(\n",
|
| 371 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 372 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 373 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 374 |
+
" )\n",
|
| 375 |
+
" (output): TimesformerSelfOutput(\n",
|
| 376 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 377 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 378 |
+
" )\n",
|
| 379 |
+
" )\n",
|
| 380 |
+
" (intermediate): TimesformerIntermediate(\n",
|
| 381 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 382 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 383 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 384 |
+
" )\n",
|
| 385 |
+
" (output): TimesformerOutput(\n",
|
| 386 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 387 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 388 |
+
" )\n",
|
| 389 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 390 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 391 |
+
" (temporal_layernorm): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 392 |
+
" (temporal_attention): TimeSformerAttention(\n",
|
| 393 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 394 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 395 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 396 |
+
" )\n",
|
| 397 |
+
" (output): TimesformerSelfOutput(\n",
|
| 398 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 399 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 400 |
+
" )\n",
|
| 401 |
+
" )\n",
|
| 402 |
+
" (temporal_dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 403 |
+
" )\n",
|
| 404 |
+
" (7): TimesformerLayer(\n",
|
| 405 |
+
" (drop_path): Identity()\n",
|
| 406 |
+
" (attention): TimeSformerAttention(\n",
|
| 407 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 408 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 409 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 410 |
+
" )\n",
|
| 411 |
+
" (output): TimesformerSelfOutput(\n",
|
| 412 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 413 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 414 |
+
" )\n",
|
| 415 |
+
" )\n",
|
| 416 |
+
" (intermediate): TimesformerIntermediate(\n",
|
| 417 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 418 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 419 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 420 |
+
" )\n",
|
| 421 |
+
" (output): TimesformerOutput(\n",
|
| 422 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 423 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 424 |
+
" )\n",
|
| 425 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 426 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 427 |
+
" (temporal_layernorm): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 428 |
+
" (temporal_attention): TimeSformerAttention(\n",
|
| 429 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 430 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 431 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 432 |
+
" )\n",
|
| 433 |
+
" (output): TimesformerSelfOutput(\n",
|
| 434 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 435 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 436 |
+
" )\n",
|
| 437 |
+
" )\n",
|
| 438 |
+
" (temporal_dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 439 |
+
" )\n",
|
| 440 |
+
" (8): TimesformerLayer(\n",
|
| 441 |
+
" (drop_path): Identity()\n",
|
| 442 |
+
" (attention): TimeSformerAttention(\n",
|
| 443 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 444 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 445 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 446 |
+
" )\n",
|
| 447 |
+
" (output): TimesformerSelfOutput(\n",
|
| 448 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 449 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 450 |
+
" )\n",
|
| 451 |
+
" )\n",
|
| 452 |
+
" (intermediate): TimesformerIntermediate(\n",
|
| 453 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 454 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 455 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 456 |
+
" )\n",
|
| 457 |
+
" (output): TimesformerOutput(\n",
|
| 458 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 459 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 460 |
+
" )\n",
|
| 461 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 462 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 463 |
+
" (temporal_layernorm): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 464 |
+
" (temporal_attention): TimeSformerAttention(\n",
|
| 465 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 466 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 467 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 468 |
+
" )\n",
|
| 469 |
+
" (output): TimesformerSelfOutput(\n",
|
| 470 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 471 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 472 |
+
" )\n",
|
| 473 |
+
" )\n",
|
| 474 |
+
" (temporal_dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 475 |
+
" )\n",
|
| 476 |
+
" (9): TimesformerLayer(\n",
|
| 477 |
+
" (drop_path): Identity()\n",
|
| 478 |
+
" (attention): TimeSformerAttention(\n",
|
| 479 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 480 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 481 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 482 |
+
" )\n",
|
| 483 |
+
" (output): TimesformerSelfOutput(\n",
|
| 484 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 485 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 486 |
+
" )\n",
|
| 487 |
+
" )\n",
|
| 488 |
+
" (intermediate): TimesformerIntermediate(\n",
|
| 489 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 490 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 491 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 492 |
+
" )\n",
|
| 493 |
+
" (output): TimesformerOutput(\n",
|
| 494 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 495 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 496 |
+
" )\n",
|
| 497 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 498 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 499 |
+
" (temporal_layernorm): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 500 |
+
" (temporal_attention): TimeSformerAttention(\n",
|
| 501 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 502 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 503 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 504 |
+
" )\n",
|
| 505 |
+
" (output): TimesformerSelfOutput(\n",
|
| 506 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 507 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 508 |
+
" )\n",
|
| 509 |
+
" )\n",
|
| 510 |
+
" (temporal_dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 511 |
+
" )\n",
|
| 512 |
+
" (10): TimesformerLayer(\n",
|
| 513 |
+
" (drop_path): Identity()\n",
|
| 514 |
+
" (attention): TimeSformerAttention(\n",
|
| 515 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 516 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 517 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 518 |
+
" )\n",
|
| 519 |
+
" (output): TimesformerSelfOutput(\n",
|
| 520 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 521 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 522 |
+
" )\n",
|
| 523 |
+
" )\n",
|
| 524 |
+
" (intermediate): TimesformerIntermediate(\n",
|
| 525 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 526 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 527 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 528 |
+
" )\n",
|
| 529 |
+
" (output): TimesformerOutput(\n",
|
| 530 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 531 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 532 |
+
" )\n",
|
| 533 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 534 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 535 |
+
" (temporal_layernorm): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 536 |
+
" (temporal_attention): TimeSformerAttention(\n",
|
| 537 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 538 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 539 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 540 |
+
" )\n",
|
| 541 |
+
" (output): TimesformerSelfOutput(\n",
|
| 542 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 543 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 544 |
+
" )\n",
|
| 545 |
+
" )\n",
|
| 546 |
+
" (temporal_dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 547 |
+
" )\n",
|
| 548 |
+
" (11): TimesformerLayer(\n",
|
| 549 |
+
" (drop_path): Identity()\n",
|
| 550 |
+
" (attention): TimeSformerAttention(\n",
|
| 551 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 552 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 553 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 554 |
+
" )\n",
|
| 555 |
+
" (output): TimesformerSelfOutput(\n",
|
| 556 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 557 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 558 |
+
" )\n",
|
| 559 |
+
" )\n",
|
| 560 |
+
" (intermediate): TimesformerIntermediate(\n",
|
| 561 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 562 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 563 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 564 |
+
" )\n",
|
| 565 |
+
" (output): TimesformerOutput(\n",
|
| 566 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 567 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 568 |
+
" )\n",
|
| 569 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 570 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 571 |
+
" (temporal_layernorm): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 572 |
+
" (temporal_attention): TimeSformerAttention(\n",
|
| 573 |
+
" (attention): TimesformerSelfAttention(\n",
|
| 574 |
+
" (qkv): Linear(in_features=768, out_features=2304, bias=True)\n",
|
| 575 |
+
" (attn_drop): Dropout(p=0.0, inplace=False)\n",
|
| 576 |
+
" )\n",
|
| 577 |
+
" (output): TimesformerSelfOutput(\n",
|
| 578 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 579 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 580 |
+
" )\n",
|
| 581 |
+
" )\n",
|
| 582 |
+
" (temporal_dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 583 |
+
" )\n",
|
| 584 |
+
" )\n",
|
| 585 |
+
" )\n",
|
| 586 |
+
" (layernorm): LayerNorm((768,), eps=1e-06, elementwise_affine=True)\n",
|
| 587 |
+
" )\n",
|
| 588 |
+
" )\n",
|
| 589 |
+
" (head): LinearHead(\n",
|
| 590 |
+
" (linear): Linear(in_features=768, out_features=2, bias=True)\n",
|
| 591 |
+
" )\n",
|
| 592 |
+
")"
|
| 593 |
+
]
|
| 594 |
+
},
|
| 595 |
+
"execution_count": 8,
|
| 596 |
+
"metadata": {},
|
| 597 |
+
"output_type": "execute_result"
|
| 598 |
+
}
|
| 599 |
+
],
|
| 600 |
+
"source": [
|
| 601 |
+
"model"
|
| 602 |
+
]
|
| 603 |
+
},
|
| 604 |
+
{
|
| 605 |
+
"cell_type": "code",
|
| 606 |
+
"execution_count": 9,
|
| 607 |
+
"id": "a9d97e70-f539-4f34-8859-f69f1033a57e",
|
| 608 |
+
"metadata": {},
|
| 609 |
+
"outputs": [],
|
| 610 |
+
"source": [
|
| 611 |
+
"optimizer = AdamW(model.parameters(), lr=1e-4)\n",
|
| 612 |
+
"\n",
|
| 613 |
+
"Trainer = trainer_factory(\"single_label_classification\")\n",
|
| 614 |
+
"trainer = Trainer(datamodule, model, optimizer=optimizer, max_epochs=10, \n",
|
| 615 |
+
" mixed_precision=\"fp16\")"
|
| 616 |
+
]
|
| 617 |
+
},
|
| 618 |
+
{
|
| 619 |
+
"cell_type": "code",
|
| 620 |
+
"execution_count": 10,
|
| 621 |
+
"id": "552054ca-55bd-4692-90ae-5f36b1c4d030",
|
| 622 |
+
"metadata": {
|
| 623 |
+
"scrolled": true
|
| 624 |
+
},
|
| 625 |
+
"outputs": [
|
| 626 |
+
{
|
| 627 |
+
"name": "stdout",
|
| 628 |
+
"output_type": "stream",
|
| 629 |
+
"text": [
|
| 630 |
+
"Trainable parameteres: 10045442\n",
|
| 631 |
+
"Total parameteres: 121260290\n"
|
| 632 |
+
]
|
| 633 |
+
},
|
| 634 |
+
{
|
| 635 |
+
"name": "stderr",
|
| 636 |
+
"output_type": "stream",
|
| 637 |
+
"text": [
|
| 638 |
+
"Epoch 0 (Done) : 100%|█████████████████████████████████████████████████████████████████████████████| 168/168 [01:13<00:00, 2.30 batch/s, loss=0.6949, val/f1=0.488, train/f1=0.504]\n",
|
| 639 |
+
"Epoch 1 (Done) : 100%|█████████████████████████████████████████████████████████████████████████████| 168/168 [01:13<00:00, 2.29 batch/s, loss=0.5825, val/f1=0.738, train/f1=0.711]\n",
|
| 640 |
+
"Epoch 2 (Done) : 100%|█████████████████████████████████████████████████████████████████████████████| 168/168 [01:15<00:00, 2.23 batch/s, loss=0.4997, val/f1=0.755, train/f1=0.794]\n",
|
| 641 |
+
"Epoch 3 (Done) : 100%|█████████████████████████████████████████████████████████████████████████████| 168/168 [01:16<00:00, 2.20 batch/s, loss=0.5583, val/f1=0.744, train/f1=0.813]\n",
|
| 642 |
+
"Epoch 4 (Done) : 100%|█████████████████████████████████████████████████████████████████████████████| 168/168 [01:16<00:00, 2.20 batch/s, loss=0.5624, val/f1=0.711, train/f1=0.846]\n",
|
| 643 |
+
"Epoch 5 (Done) : 100%|█████████████████████████████████████████████████████████████████████████████| 168/168 [01:16<00:00, 2.18 batch/s, loss=0.5908, val/f1=0.735, train/f1=0.857]\n",
|
| 644 |
+
"Epoch 6 (Done) : 100%|█████████████████████████████████████████████████████████████████████████████| 168/168 [01:17<00:00, 2.17 batch/s, loss=0.5492, val/f1=0.743, train/f1=0.846]\n",
|
| 645 |
+
"Epoch 7 (Done) : 100%|█████████████████████████████████████████████████████████████████████████████| 168/168 [01:16<00:00, 2.19 batch/s, loss=0.5395, val/f1=0.752, train/f1=0.879]\n",
|
| 646 |
+
"Epoch 8 (Done) : 100%|█████████████████████████████████████████████████████████████████████████████| 168/168 [01:16<00:00, 2.21 batch/s, loss=0.5304, val/f1=0.741, train/f1=0.886]\n",
|
| 647 |
+
"Epoch 9 (Done) : 100%|█████████████████████████████████████████████████████████████████████████████| 168/168 [01:16<00:00, 2.20 batch/s, loss=0.5423, val/f1=0.758, train/f1=0.910]\n"
|
| 648 |
+
]
|
| 649 |
+
}
|
| 650 |
+
],
|
| 651 |
+
"source": [
|
| 652 |
+
"trainer.fit()"
|
| 653 |
+
]
|
| 654 |
+
},
|
| 655 |
+
{
|
| 656 |
+
"cell_type": "code",
|
| 657 |
+
"execution_count": 11,
|
| 658 |
+
"id": "7f378e22-d85b-4714-981e-4b68c3fdeb73",
|
| 659 |
+
"metadata": {},
|
| 660 |
+
"outputs": [
|
| 661 |
+
{
|
| 662 |
+
"data": {
|
| 663 |
+
"text/plain": [
|
| 664 |
+
"['khongxarac', 'xarac']"
|
| 665 |
+
]
|
| 666 |
+
},
|
| 667 |
+
"execution_count": 11,
|
| 668 |
+
"metadata": {},
|
| 669 |
+
"output_type": "execute_result"
|
| 670 |
+
}
|
| 671 |
+
],
|
| 672 |
+
"source": [
|
| 673 |
+
"datamodule.labels"
|
| 674 |
+
]
|
| 675 |
+
},
|
| 676 |
+
{
|
| 677 |
+
"cell_type": "code",
|
| 678 |
+
"execution_count": 12,
|
| 679 |
+
"id": "ef16f8e1-6ad1-446a-a817-b01d4259e60b",
|
| 680 |
+
"metadata": {},
|
| 681 |
+
"outputs": [
|
| 682 |
+
{
|
| 683 |
+
"data": {
|
| 684 |
+
"text/plain": [
|
| 685 |
+
"{'num_timesteps': 8,\n",
|
| 686 |
+
" 'input_size': 224,\n",
|
| 687 |
+
" 'means': [0.45, 0.45, 0.45],\n",
|
| 688 |
+
" 'stds': [0.225, 0.225, 0.225],\n",
|
| 689 |
+
" 'min_short_side': 256,\n",
|
| 690 |
+
" 'max_short_side': 320,\n",
|
| 691 |
+
" 'horizontal_flip_p': 0.5,\n",
|
| 692 |
+
" 'clip_duration': 1}"
|
| 693 |
+
]
|
| 694 |
+
},
|
| 695 |
+
"execution_count": 12,
|
| 696 |
+
"metadata": {},
|
| 697 |
+
"output_type": "execute_result"
|
| 698 |
+
}
|
| 699 |
+
],
|
| 700 |
+
"source": [
|
| 701 |
+
"datamodule.preprocessor_config"
|
| 702 |
+
]
|
| 703 |
+
},
|
| 704 |
+
{
|
| 705 |
+
"cell_type": "code",
|
| 706 |
+
"execution_count": 13,
|
| 707 |
+
"id": "8e9c61dc-8c52-4280-8a02-becadafd304b",
|
| 708 |
+
"metadata": {},
|
| 709 |
+
"outputs": [],
|
| 710 |
+
"source": [
|
| 711 |
+
"import os, glob\n",
|
| 712 |
+
"from pathlib import Path\n",
|
| 713 |
+
"from tqdm import tqdm\n",
|
| 714 |
+
"from sklearn.metrics import accuracy_score, f1_score, classification_report, confusion_matrix"
|
| 715 |
+
]
|
| 716 |
+
},
|
| 717 |
+
{
|
| 718 |
+
"cell_type": "code",
|
| 719 |
+
"execution_count": 14,
|
| 720 |
+
"id": "a215c096-f988-4cb8-a5bd-7d320cc0d86b",
|
| 721 |
+
"metadata": {},
|
| 722 |
+
"outputs": [],
|
| 723 |
+
"source": [
|
| 724 |
+
"test_loader = datamodule.test_dataloader\n",
|
| 725 |
+
"class_names = datamodule.labels"
|
| 726 |
+
]
|
| 727 |
+
},
|
| 728 |
+
{
|
| 729 |
+
"cell_type": "code",
|
| 730 |
+
"execution_count": 15,
|
| 731 |
+
"id": "ba8fa1bc-3796-4076-ab46-ab1cbb44ce66",
|
| 732 |
+
"metadata": {},
|
| 733 |
+
"outputs": [
|
| 734 |
+
{
|
| 735 |
+
"name": "stderr",
|
| 736 |
+
"output_type": "stream",
|
| 737 |
+
"text": [
|
| 738 |
+
"Testing: 32it [00:12, 2.47it/s] \n"
|
| 739 |
+
]
|
| 740 |
+
}
|
| 741 |
+
],
|
| 742 |
+
"source": [
|
| 743 |
+
"import torch\n",
|
| 744 |
+
"model.eval()\n",
|
| 745 |
+
"y_true, y_pred = [], []\n",
|
| 746 |
+
"with torch.no_grad():\n",
|
| 747 |
+
" for batch in tqdm(test_loader, desc=\"Testing\"):\n",
|
| 748 |
+
" inputs = batch[\"video\"].to(\"cuda\")\n",
|
| 749 |
+
" labels = batch[\"label\"].to(\"cuda\")\n",
|
| 750 |
+
" outputs = model(inputs)\n",
|
| 751 |
+
" probabilities = torch.nn.functional.softmax(outputs, dim=1)\n",
|
| 752 |
+
" predictions = probabilities.argmax(dim=-1)\n",
|
| 753 |
+
" y_true.extend(labels.cpu().tolist())\n",
|
| 754 |
+
" y_pred.extend(predictions.cpu().tolist())"
|
| 755 |
+
]
|
| 756 |
+
},
|
| 757 |
+
{
|
| 758 |
+
"cell_type": "code",
|
| 759 |
+
"execution_count": 16,
|
| 760 |
+
"id": "6fbcc06f-d230-4c46-9cd8-c2aa83aeca19",
|
| 761 |
+
"metadata": {},
|
| 762 |
+
"outputs": [
|
| 763 |
+
{
|
| 764 |
+
"name": "stdout",
|
| 765 |
+
"output_type": "stream",
|
| 766 |
+
"text": [
|
| 767 |
+
"Accuracy: 0.7692 | F1-macro: 0.7608\n",
|
| 768 |
+
" precision recall f1-score support\n",
|
| 769 |
+
"\n",
|
| 770 |
+
" khongxarac 0.79 0.82 0.81 68\n",
|
| 771 |
+
" xarac 0.74 0.69 0.72 49\n",
|
| 772 |
+
"\n",
|
| 773 |
+
" accuracy 0.77 117\n",
|
| 774 |
+
" macro avg 0.76 0.76 0.76 117\n",
|
| 775 |
+
"weighted avg 0.77 0.77 0.77 117\n",
|
| 776 |
+
"\n",
|
| 777 |
+
"Confusion matrix:\n",
|
| 778 |
+
" [[56 12]\n",
|
| 779 |
+
" [15 34]]\n"
|
| 780 |
+
]
|
| 781 |
+
}
|
| 782 |
+
],
|
| 783 |
+
"source": [
|
| 784 |
+
"acc = accuracy_score(y_true, y_pred)\n",
|
| 785 |
+
"f1m = f1_score(y_true, y_pred, average=\"macro\")\n",
|
| 786 |
+
"print(f\"Accuracy: {acc:.4f} | F1-macro: {f1m:.4f}\")\n",
|
| 787 |
+
"print(classification_report(y_true, y_pred, target_names=class_names))\n",
|
| 788 |
+
"print(\"Confusion matrix:\\n\", confusion_matrix(y_true, y_pred))"
|
| 789 |
+
]
|
| 790 |
+
},
|
| 791 |
+
{
|
| 792 |
+
"cell_type": "code",
|
| 793 |
+
"execution_count": null,
|
| 794 |
+
"id": "0b78a3c0-72ef-4207-bb66-03a8a3b02782",
|
| 795 |
+
"metadata": {},
|
| 796 |
+
"outputs": [],
|
| 797 |
+
"source": []
|
| 798 |
+
},
|
| 799 |
+
{
|
| 800 |
+
"cell_type": "code",
|
| 801 |
+
"execution_count": null,
|
| 802 |
+
"id": "7acdbc58-f8c8-4841-84c5-78fbe837f4fb",
|
| 803 |
+
"metadata": {},
|
| 804 |
+
"outputs": [],
|
| 805 |
+
"source": []
|
| 806 |
+
}
|
| 807 |
+
],
|
| 808 |
+
"metadata": {
|
| 809 |
+
"kernelspec": {
|
| 810 |
+
"display_name": "TQKhang-ViViT",
|
| 811 |
+
"language": "python",
|
| 812 |
+
"name": "tqkhang-vivit"
|
| 813 |
+
},
|
| 814 |
+
"language_info": {
|
| 815 |
+
"codemirror_mode": {
|
| 816 |
+
"name": "ipython",
|
| 817 |
+
"version": 3
|
| 818 |
+
},
|
| 819 |
+
"file_extension": ".py",
|
| 820 |
+
"mimetype": "text/x-python",
|
| 821 |
+
"name": "python",
|
| 822 |
+
"nbconvert_exporter": "python",
|
| 823 |
+
"pygments_lexer": "ipython3",
|
| 824 |
+
"version": "3.7.16"
|
| 825 |
+
}
|
| 826 |
+
},
|
| 827 |
+
"nbformat": 4,
|
| 828 |
+
"nbformat_minor": 5
|
| 829 |
+
}
|
scripts/.ipynb_checkpoints/VideoMAE-checkpoint.ipynb
ADDED
|
@@ -0,0 +1,713 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 1,
|
| 6 |
+
"id": "18122027-63d4-45bc-a155-11d941da97b9",
|
| 7 |
+
"metadata": {},
|
| 8 |
+
"outputs": [],
|
| 9 |
+
"source": [
|
| 10 |
+
"DATASET_PATH = \"/media/khmt/HDD1/TQKhang/datasets/xarac\""
|
| 11 |
+
]
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"cell_type": "code",
|
| 15 |
+
"execution_count": 2,
|
| 16 |
+
"id": "bc5b5096-93dd-4661-bd32-e1c66a3facfc",
|
| 17 |
+
"metadata": {},
|
| 18 |
+
"outputs": [],
|
| 19 |
+
"source": [
|
| 20 |
+
"%load_ext autoreload\n",
|
| 21 |
+
"%autoreload 2"
|
| 22 |
+
]
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"cell_type": "code",
|
| 26 |
+
"execution_count": 3,
|
| 27 |
+
"id": "59965104-6b47-4bd4-ae52-9924a91feed3",
|
| 28 |
+
"metadata": {},
|
| 29 |
+
"outputs": [
|
| 30 |
+
{
|
| 31 |
+
"name": "stderr",
|
| 32 |
+
"output_type": "stream",
|
| 33 |
+
"text": [
|
| 34 |
+
"/home/khmt/anaconda3/envs/tqkhang-vivit/lib/python3.7/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
|
| 35 |
+
" from .autonotebook import tqdm as notebook_tqdm\n"
|
| 36 |
+
]
|
| 37 |
+
}
|
| 38 |
+
],
|
| 39 |
+
"source": [
|
| 40 |
+
"from torch.optim import AdamW\n",
|
| 41 |
+
"from video_transformers import VideoModel\n",
|
| 42 |
+
"from video_transformers.backbones.transformers import TransformersBackbone\n",
|
| 43 |
+
"from video_transformers.backbones.timm import TimmBackbone\n",
|
| 44 |
+
"from video_transformers.data import VideoDataModule\n",
|
| 45 |
+
"from video_transformers.heads import LinearHead\n",
|
| 46 |
+
"from video_transformers.trainer import trainer_factory"
|
| 47 |
+
]
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"cell_type": "code",
|
| 51 |
+
"execution_count": 5,
|
| 52 |
+
"id": "2f5c18af-5a5a-4e6d-91dd-446123218792",
|
| 53 |
+
"metadata": {
|
| 54 |
+
"scrolled": true
|
| 55 |
+
},
|
| 56 |
+
"outputs": [
|
| 57 |
+
{
|
| 58 |
+
"name": "stderr",
|
| 59 |
+
"output_type": "stream",
|
| 60 |
+
"text": [
|
| 61 |
+
"Downloading: 22.9kB [00:00, 10.8MB/s]\n",
|
| 62 |
+
"Downloading: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 346M/346M [00:29<00:00, 11.9MB/s]\n",
|
| 63 |
+
"Some weights of the model checkpoint at MCG-NJU/videomae-base-finetuned-kinetics were not used when initializing VideoMAEModel: ['fc_norm.weight', 'fc_norm.bias', 'classifier.bias', 'classifier.weight']\n",
|
| 64 |
+
"- This IS expected if you are initializing VideoMAEModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).\n",
|
| 65 |
+
"- This IS NOT expected if you are initializing VideoMAEModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).\n",
|
| 66 |
+
"Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 271/271 [00:00<00:00, 220kB/s]\n",
|
| 67 |
+
"/home/khmt/anaconda3/envs/tqkhang-vivit/lib/python3.7/site-packages/transformers/models/videomae/feature_extraction_videomae.py:31: FutureWarning: The class VideoMAEFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please use VideoMAEImageProcessor instead.\n",
|
| 68 |
+
" FutureWarning,\n"
|
| 69 |
+
]
|
| 70 |
+
}
|
| 71 |
+
],
|
| 72 |
+
"source": [
|
| 73 |
+
"backbone = TransformersBackbone(\"MCG-NJU/videomae-base-finetuned-kinetics\", num_unfrozen_stages=1)"
|
| 74 |
+
]
|
| 75 |
+
},
|
| 76 |
+
{
|
| 77 |
+
"cell_type": "code",
|
| 78 |
+
"execution_count": 12,
|
| 79 |
+
"id": "04eb1ed9-0497-48d0-a72e-7223939f257b",
|
| 80 |
+
"metadata": {},
|
| 81 |
+
"outputs": [],
|
| 82 |
+
"source": [
|
| 83 |
+
"datamodule = VideoDataModule(\n",
|
| 84 |
+
" train_root=\"/media/khmt/HDD1/TQKhang/datasets/xarac/train\",\n",
|
| 85 |
+
" val_root=\"/media/khmt/HDD1/TQKhang/datasets/xarac/val\",\n",
|
| 86 |
+
" test_root=\"/media/khmt/HDD1/TQKhang/datasets/xarac/val\",\n",
|
| 87 |
+
" batch_size=4,\n",
|
| 88 |
+
" num_workers=4,\n",
|
| 89 |
+
" num_timesteps=16,\n",
|
| 90 |
+
" preprocess_input_size=224,\n",
|
| 91 |
+
" preprocess_clip_duration=1,\n",
|
| 92 |
+
" preprocess_means=backbone.mean,\n",
|
| 93 |
+
" preprocess_stds=backbone.std,\n",
|
| 94 |
+
" preprocess_min_short_side=256,\n",
|
| 95 |
+
" preprocess_max_short_side=320,\n",
|
| 96 |
+
" preprocess_horizontal_flip_p=0.5,\n",
|
| 97 |
+
")"
|
| 98 |
+
]
|
| 99 |
+
},
|
| 100 |
+
{
|
| 101 |
+
"cell_type": "code",
|
| 102 |
+
"execution_count": 13,
|
| 103 |
+
"id": "12b51c8e-8420-456a-96fb-a185165c990a",
|
| 104 |
+
"metadata": {},
|
| 105 |
+
"outputs": [
|
| 106 |
+
{
|
| 107 |
+
"data": {
|
| 108 |
+
"text/plain": [
|
| 109 |
+
"2"
|
| 110 |
+
]
|
| 111 |
+
},
|
| 112 |
+
"execution_count": 13,
|
| 113 |
+
"metadata": {},
|
| 114 |
+
"output_type": "execute_result"
|
| 115 |
+
}
|
| 116 |
+
],
|
| 117 |
+
"source": [
|
| 118 |
+
"datamodule.num_classes"
|
| 119 |
+
]
|
| 120 |
+
},
|
| 121 |
+
{
|
| 122 |
+
"cell_type": "code",
|
| 123 |
+
"execution_count": 14,
|
| 124 |
+
"id": "a6189aca-e28c-4147-8efc-fae604663d14",
|
| 125 |
+
"metadata": {},
|
| 126 |
+
"outputs": [],
|
| 127 |
+
"source": [
|
| 128 |
+
"head = LinearHead(hidden_size=backbone.num_features, num_classes=datamodule.num_classes)\n",
|
| 129 |
+
"model = VideoModel(backbone, head)"
|
| 130 |
+
]
|
| 131 |
+
},
|
| 132 |
+
{
|
| 133 |
+
"cell_type": "code",
|
| 134 |
+
"execution_count": 15,
|
| 135 |
+
"id": "f3ed0a1e-d90c-49b1-a213-55815d0cdf15",
|
| 136 |
+
"metadata": {
|
| 137 |
+
"scrolled": true
|
| 138 |
+
},
|
| 139 |
+
"outputs": [
|
| 140 |
+
{
|
| 141 |
+
"data": {
|
| 142 |
+
"text/plain": [
|
| 143 |
+
"VideoModel(\n",
|
| 144 |
+
" (backbone): TransformersBackbone(\n",
|
| 145 |
+
" (model): VideoMAEModel(\n",
|
| 146 |
+
" (embeddings): VideoMAEEmbeddings(\n",
|
| 147 |
+
" (patch_embeddings): VideoMAEPatchEmbeddings(\n",
|
| 148 |
+
" (projection): Conv3d(3, 768, kernel_size=(2, 16, 16), stride=(2, 16, 16))\n",
|
| 149 |
+
" )\n",
|
| 150 |
+
" )\n",
|
| 151 |
+
" (encoder): VideoMAEEncoder(\n",
|
| 152 |
+
" (layer): ModuleList(\n",
|
| 153 |
+
" (0): VideoMAELayer(\n",
|
| 154 |
+
" (attention): VideoMAEAttention(\n",
|
| 155 |
+
" (attention): VideoMAESelfAttention(\n",
|
| 156 |
+
" (query): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 157 |
+
" (key): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 158 |
+
" (value): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 159 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 160 |
+
" )\n",
|
| 161 |
+
" (output): VideoMAESelfOutput(\n",
|
| 162 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 163 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 164 |
+
" )\n",
|
| 165 |
+
" )\n",
|
| 166 |
+
" (intermediate): VideoMAEIntermediate(\n",
|
| 167 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 168 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 169 |
+
" )\n",
|
| 170 |
+
" (output): VideoMAEOutput(\n",
|
| 171 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 172 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 173 |
+
" )\n",
|
| 174 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 175 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 176 |
+
" )\n",
|
| 177 |
+
" (1): VideoMAELayer(\n",
|
| 178 |
+
" (attention): VideoMAEAttention(\n",
|
| 179 |
+
" (attention): VideoMAESelfAttention(\n",
|
| 180 |
+
" (query): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 181 |
+
" (key): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 182 |
+
" (value): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 183 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 184 |
+
" )\n",
|
| 185 |
+
" (output): VideoMAESelfOutput(\n",
|
| 186 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 187 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 188 |
+
" )\n",
|
| 189 |
+
" )\n",
|
| 190 |
+
" (intermediate): VideoMAEIntermediate(\n",
|
| 191 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 192 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 193 |
+
" )\n",
|
| 194 |
+
" (output): VideoMAEOutput(\n",
|
| 195 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 196 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 197 |
+
" )\n",
|
| 198 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 199 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 200 |
+
" )\n",
|
| 201 |
+
" (2): VideoMAELayer(\n",
|
| 202 |
+
" (attention): VideoMAEAttention(\n",
|
| 203 |
+
" (attention): VideoMAESelfAttention(\n",
|
| 204 |
+
" (query): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 205 |
+
" (key): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 206 |
+
" (value): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 207 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 208 |
+
" )\n",
|
| 209 |
+
" (output): VideoMAESelfOutput(\n",
|
| 210 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 211 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 212 |
+
" )\n",
|
| 213 |
+
" )\n",
|
| 214 |
+
" (intermediate): VideoMAEIntermediate(\n",
|
| 215 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 216 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 217 |
+
" )\n",
|
| 218 |
+
" (output): VideoMAEOutput(\n",
|
| 219 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 220 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 221 |
+
" )\n",
|
| 222 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 223 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 224 |
+
" )\n",
|
| 225 |
+
" (3): VideoMAELayer(\n",
|
| 226 |
+
" (attention): VideoMAEAttention(\n",
|
| 227 |
+
" (attention): VideoMAESelfAttention(\n",
|
| 228 |
+
" (query): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 229 |
+
" (key): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 230 |
+
" (value): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 231 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 232 |
+
" )\n",
|
| 233 |
+
" (output): VideoMAESelfOutput(\n",
|
| 234 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 235 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 236 |
+
" )\n",
|
| 237 |
+
" )\n",
|
| 238 |
+
" (intermediate): VideoMAEIntermediate(\n",
|
| 239 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 240 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 241 |
+
" )\n",
|
| 242 |
+
" (output): VideoMAEOutput(\n",
|
| 243 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 244 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 245 |
+
" )\n",
|
| 246 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 247 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 248 |
+
" )\n",
|
| 249 |
+
" (4): VideoMAELayer(\n",
|
| 250 |
+
" (attention): VideoMAEAttention(\n",
|
| 251 |
+
" (attention): VideoMAESelfAttention(\n",
|
| 252 |
+
" (query): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 253 |
+
" (key): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 254 |
+
" (value): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 255 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 256 |
+
" )\n",
|
| 257 |
+
" (output): VideoMAESelfOutput(\n",
|
| 258 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 259 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 260 |
+
" )\n",
|
| 261 |
+
" )\n",
|
| 262 |
+
" (intermediate): VideoMAEIntermediate(\n",
|
| 263 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 264 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 265 |
+
" )\n",
|
| 266 |
+
" (output): VideoMAEOutput(\n",
|
| 267 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 268 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 269 |
+
" )\n",
|
| 270 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 271 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 272 |
+
" )\n",
|
| 273 |
+
" (5): VideoMAELayer(\n",
|
| 274 |
+
" (attention): VideoMAEAttention(\n",
|
| 275 |
+
" (attention): VideoMAESelfAttention(\n",
|
| 276 |
+
" (query): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 277 |
+
" (key): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 278 |
+
" (value): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 279 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 280 |
+
" )\n",
|
| 281 |
+
" (output): VideoMAESelfOutput(\n",
|
| 282 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 283 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 284 |
+
" )\n",
|
| 285 |
+
" )\n",
|
| 286 |
+
" (intermediate): VideoMAEIntermediate(\n",
|
| 287 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 288 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 289 |
+
" )\n",
|
| 290 |
+
" (output): VideoMAEOutput(\n",
|
| 291 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 292 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 293 |
+
" )\n",
|
| 294 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 295 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 296 |
+
" )\n",
|
| 297 |
+
" (6): VideoMAELayer(\n",
|
| 298 |
+
" (attention): VideoMAEAttention(\n",
|
| 299 |
+
" (attention): VideoMAESelfAttention(\n",
|
| 300 |
+
" (query): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 301 |
+
" (key): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 302 |
+
" (value): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 303 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 304 |
+
" )\n",
|
| 305 |
+
" (output): VideoMAESelfOutput(\n",
|
| 306 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 307 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 308 |
+
" )\n",
|
| 309 |
+
" )\n",
|
| 310 |
+
" (intermediate): VideoMAEIntermediate(\n",
|
| 311 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 312 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 313 |
+
" )\n",
|
| 314 |
+
" (output): VideoMAEOutput(\n",
|
| 315 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 316 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 317 |
+
" )\n",
|
| 318 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 319 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 320 |
+
" )\n",
|
| 321 |
+
" (7): VideoMAELayer(\n",
|
| 322 |
+
" (attention): VideoMAEAttention(\n",
|
| 323 |
+
" (attention): VideoMAESelfAttention(\n",
|
| 324 |
+
" (query): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 325 |
+
" (key): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 326 |
+
" (value): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 327 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 328 |
+
" )\n",
|
| 329 |
+
" (output): VideoMAESelfOutput(\n",
|
| 330 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 331 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 332 |
+
" )\n",
|
| 333 |
+
" )\n",
|
| 334 |
+
" (intermediate): VideoMAEIntermediate(\n",
|
| 335 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 336 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 337 |
+
" )\n",
|
| 338 |
+
" (output): VideoMAEOutput(\n",
|
| 339 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 340 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 341 |
+
" )\n",
|
| 342 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 343 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 344 |
+
" )\n",
|
| 345 |
+
" (8): VideoMAELayer(\n",
|
| 346 |
+
" (attention): VideoMAEAttention(\n",
|
| 347 |
+
" (attention): VideoMAESelfAttention(\n",
|
| 348 |
+
" (query): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 349 |
+
" (key): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 350 |
+
" (value): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 351 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 352 |
+
" )\n",
|
| 353 |
+
" (output): VideoMAESelfOutput(\n",
|
| 354 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 355 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 356 |
+
" )\n",
|
| 357 |
+
" )\n",
|
| 358 |
+
" (intermediate): VideoMAEIntermediate(\n",
|
| 359 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 360 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 361 |
+
" )\n",
|
| 362 |
+
" (output): VideoMAEOutput(\n",
|
| 363 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 364 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 365 |
+
" )\n",
|
| 366 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 367 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 368 |
+
" )\n",
|
| 369 |
+
" (9): VideoMAELayer(\n",
|
| 370 |
+
" (attention): VideoMAEAttention(\n",
|
| 371 |
+
" (attention): VideoMAESelfAttention(\n",
|
| 372 |
+
" (query): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 373 |
+
" (key): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 374 |
+
" (value): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 375 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 376 |
+
" )\n",
|
| 377 |
+
" (output): VideoMAESelfOutput(\n",
|
| 378 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 379 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 380 |
+
" )\n",
|
| 381 |
+
" )\n",
|
| 382 |
+
" (intermediate): VideoMAEIntermediate(\n",
|
| 383 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 384 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 385 |
+
" )\n",
|
| 386 |
+
" (output): VideoMAEOutput(\n",
|
| 387 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 388 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 389 |
+
" )\n",
|
| 390 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 391 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 392 |
+
" )\n",
|
| 393 |
+
" (10): VideoMAELayer(\n",
|
| 394 |
+
" (attention): VideoMAEAttention(\n",
|
| 395 |
+
" (attention): VideoMAESelfAttention(\n",
|
| 396 |
+
" (query): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 397 |
+
" (key): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 398 |
+
" (value): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 399 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 400 |
+
" )\n",
|
| 401 |
+
" (output): VideoMAESelfOutput(\n",
|
| 402 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 403 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 404 |
+
" )\n",
|
| 405 |
+
" )\n",
|
| 406 |
+
" (intermediate): VideoMAEIntermediate(\n",
|
| 407 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 408 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 409 |
+
" )\n",
|
| 410 |
+
" (output): VideoMAEOutput(\n",
|
| 411 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 412 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 413 |
+
" )\n",
|
| 414 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 415 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 416 |
+
" )\n",
|
| 417 |
+
" (11): VideoMAELayer(\n",
|
| 418 |
+
" (attention): VideoMAEAttention(\n",
|
| 419 |
+
" (attention): VideoMAESelfAttention(\n",
|
| 420 |
+
" (query): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 421 |
+
" (key): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 422 |
+
" (value): Linear(in_features=768, out_features=768, bias=False)\n",
|
| 423 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 424 |
+
" )\n",
|
| 425 |
+
" (output): VideoMAESelfOutput(\n",
|
| 426 |
+
" (dense): Linear(in_features=768, out_features=768, bias=True)\n",
|
| 427 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 428 |
+
" )\n",
|
| 429 |
+
" )\n",
|
| 430 |
+
" (intermediate): VideoMAEIntermediate(\n",
|
| 431 |
+
" (dense): Linear(in_features=768, out_features=3072, bias=True)\n",
|
| 432 |
+
" (intermediate_act_fn): GELUActivation()\n",
|
| 433 |
+
" )\n",
|
| 434 |
+
" (output): VideoMAEOutput(\n",
|
| 435 |
+
" (dense): Linear(in_features=3072, out_features=768, bias=True)\n",
|
| 436 |
+
" (dropout): Dropout(p=0.0, inplace=False)\n",
|
| 437 |
+
" )\n",
|
| 438 |
+
" (layernorm_before): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 439 |
+
" (layernorm_after): LayerNorm((768,), eps=1e-12, elementwise_affine=True)\n",
|
| 440 |
+
" )\n",
|
| 441 |
+
" )\n",
|
| 442 |
+
" )\n",
|
| 443 |
+
" )\n",
|
| 444 |
+
" )\n",
|
| 445 |
+
" (head): LinearHead(\n",
|
| 446 |
+
" (linear): Linear(in_features=768, out_features=2, bias=True)\n",
|
| 447 |
+
" )\n",
|
| 448 |
+
")"
|
| 449 |
+
]
|
| 450 |
+
},
|
| 451 |
+
"execution_count": 15,
|
| 452 |
+
"metadata": {},
|
| 453 |
+
"output_type": "execute_result"
|
| 454 |
+
}
|
| 455 |
+
],
|
| 456 |
+
"source": [
|
| 457 |
+
"model"
|
| 458 |
+
]
|
| 459 |
+
},
|
| 460 |
+
{
|
| 461 |
+
"cell_type": "code",
|
| 462 |
+
"execution_count": 16,
|
| 463 |
+
"id": "a9d97e70-f539-4f34-8859-f69f1033a57e",
|
| 464 |
+
"metadata": {},
|
| 465 |
+
"outputs": [],
|
| 466 |
+
"source": [
|
| 467 |
+
"optimizer = AdamW(model.parameters(), lr=1e-4)\n",
|
| 468 |
+
"\n",
|
| 469 |
+
"Trainer = trainer_factory(\"single_label_classification\")\n",
|
| 470 |
+
"trainer = Trainer(datamodule, model, optimizer=optimizer, max_epochs=10, \n",
|
| 471 |
+
" mixed_precision=\"fp16\")"
|
| 472 |
+
]
|
| 473 |
+
},
|
| 474 |
+
{
|
| 475 |
+
"cell_type": "code",
|
| 476 |
+
"execution_count": 17,
|
| 477 |
+
"id": "552054ca-55bd-4692-90ae-5f36b1c4d030",
|
| 478 |
+
"metadata": {
|
| 479 |
+
"scrolled": true
|
| 480 |
+
},
|
| 481 |
+
"outputs": [
|
| 482 |
+
{
|
| 483 |
+
"name": "stdout",
|
| 484 |
+
"output_type": "stream",
|
| 485 |
+
"text": [
|
| 486 |
+
"Trainable parameteres: 7088642\n",
|
| 487 |
+
"Total parameteres: 86227202\n"
|
| 488 |
+
]
|
| 489 |
+
},
|
| 490 |
+
{
|
| 491 |
+
"name": "stderr",
|
| 492 |
+
"output_type": "stream",
|
| 493 |
+
"text": [
|
| 494 |
+
"Epoch 0 (Done) : 100%|███████████���█████████████████████████████████████████████████████████████████| 168/168 [01:27<00:00, 1.92 batch/s, loss=0.9388, val/f1=0.483, train/f1=0.471]\n",
|
| 495 |
+
"Epoch 1 (Done) : 100%|█████████████████████████████████████████████████████████████████████████████| 168/168 [01:27<00:00, 1.91 batch/s, loss=0.5735, val/f1=0.755, train/f1=0.696]\n",
|
| 496 |
+
"Epoch 2 (Done) : 100%|█████████████████████████████████████████████████████████████████████████████| 168/168 [01:28<00:00, 1.89 batch/s, loss=0.5928, val/f1=0.727, train/f1=0.802]\n",
|
| 497 |
+
"Epoch 3 (Done) : 100%|█████████████████████████████████████████████████████████████████████████████| 168/168 [01:29<00:00, 1.87 batch/s, loss=0.5903, val/f1=0.737, train/f1=0.822]\n",
|
| 498 |
+
"Epoch 4 (Done) : 100%|█████████████████████████████████████████████████████████████████████████████| 168/168 [01:30<00:00, 1.86 batch/s, loss=0.5391, val/f1=0.769, train/f1=0.855]\n",
|
| 499 |
+
"Epoch 5 (Done) : 100%|█████████████████████████████████████████████████████████████████████████████| 168/168 [01:30<00:00, 1.85 batch/s, loss=0.6027, val/f1=0.767, train/f1=0.884]\n",
|
| 500 |
+
"Epoch 6 (Done) : 100%|█████████████████████████████████████████████████████████████████████████████| 168/168 [01:30<00:00, 1.85 batch/s, loss=0.5935, val/f1=0.754, train/f1=0.887]\n",
|
| 501 |
+
"Epoch 7 (Done) : 100%|█████████████████████████████████████████████████████████████████████████████| 168/168 [01:29<00:00, 1.87 batch/s, loss=0.5759, val/f1=0.740, train/f1=0.892]\n",
|
| 502 |
+
"Epoch 8 (Done) : 100%|█████████████████████████████████████████████████████████████████████████████| 168/168 [01:29<00:00, 1.88 batch/s, loss=0.6144, val/f1=0.746, train/f1=0.921]\n",
|
| 503 |
+
"Epoch 9 (Done) : 100%|█████████████████████████████████████████████████████████████████████████████| 168/168 [01:30<00:00, 1.85 batch/s, loss=0.5750, val/f1=0.740, train/f1=0.923]\n"
|
| 504 |
+
]
|
| 505 |
+
}
|
| 506 |
+
],
|
| 507 |
+
"source": [
|
| 508 |
+
"trainer.fit()"
|
| 509 |
+
]
|
| 510 |
+
},
|
| 511 |
+
{
|
| 512 |
+
"cell_type": "code",
|
| 513 |
+
"execution_count": 18,
|
| 514 |
+
"id": "7f378e22-d85b-4714-981e-4b68c3fdeb73",
|
| 515 |
+
"metadata": {},
|
| 516 |
+
"outputs": [
|
| 517 |
+
{
|
| 518 |
+
"data": {
|
| 519 |
+
"text/plain": [
|
| 520 |
+
"['khongxarac', 'xarac']"
|
| 521 |
+
]
|
| 522 |
+
},
|
| 523 |
+
"execution_count": 18,
|
| 524 |
+
"metadata": {},
|
| 525 |
+
"output_type": "execute_result"
|
| 526 |
+
}
|
| 527 |
+
],
|
| 528 |
+
"source": [
|
| 529 |
+
"datamodule.labels"
|
| 530 |
+
]
|
| 531 |
+
},
|
| 532 |
+
{
|
| 533 |
+
"cell_type": "code",
|
| 534 |
+
"execution_count": 19,
|
| 535 |
+
"id": "ef16f8e1-6ad1-446a-a817-b01d4259e60b",
|
| 536 |
+
"metadata": {},
|
| 537 |
+
"outputs": [
|
| 538 |
+
{
|
| 539 |
+
"data": {
|
| 540 |
+
"text/plain": [
|
| 541 |
+
"{'num_timesteps': 16,\n",
|
| 542 |
+
" 'input_size': 224,\n",
|
| 543 |
+
" 'means': [0.485, 0.456, 0.406],\n",
|
| 544 |
+
" 'stds': [0.229, 0.224, 0.225],\n",
|
| 545 |
+
" 'min_short_side': 256,\n",
|
| 546 |
+
" 'max_short_side': 320,\n",
|
| 547 |
+
" 'horizontal_flip_p': 0.5,\n",
|
| 548 |
+
" 'clip_duration': 1}"
|
| 549 |
+
]
|
| 550 |
+
},
|
| 551 |
+
"execution_count": 19,
|
| 552 |
+
"metadata": {},
|
| 553 |
+
"output_type": "execute_result"
|
| 554 |
+
}
|
| 555 |
+
],
|
| 556 |
+
"source": [
|
| 557 |
+
"datamodule.preprocessor_config"
|
| 558 |
+
]
|
| 559 |
+
},
|
| 560 |
+
{
|
| 561 |
+
"cell_type": "code",
|
| 562 |
+
"execution_count": 20,
|
| 563 |
+
"id": "8e9c61dc-8c52-4280-8a02-becadafd304b",
|
| 564 |
+
"metadata": {},
|
| 565 |
+
"outputs": [],
|
| 566 |
+
"source": [
|
| 567 |
+
"import os, glob\n",
|
| 568 |
+
"from pathlib import Path\n",
|
| 569 |
+
"from tqdm import tqdm\n",
|
| 570 |
+
"from sklearn.metrics import accuracy_score, f1_score, classification_report, confusion_matrix"
|
| 571 |
+
]
|
| 572 |
+
},
|
| 573 |
+
{
|
| 574 |
+
"cell_type": "code",
|
| 575 |
+
"execution_count": 21,
|
| 576 |
+
"id": "a215c096-f988-4cb8-a5bd-7d320cc0d86b",
|
| 577 |
+
"metadata": {},
|
| 578 |
+
"outputs": [],
|
| 579 |
+
"source": [
|
| 580 |
+
"test_loader = datamodule.test_dataloader\n",
|
| 581 |
+
"class_names = datamodule.labels"
|
| 582 |
+
]
|
| 583 |
+
},
|
| 584 |
+
{
|
| 585 |
+
"cell_type": "code",
|
| 586 |
+
"execution_count": 26,
|
| 587 |
+
"id": "ba8fa1bc-3796-4076-ab46-ab1cbb44ce66",
|
| 588 |
+
"metadata": {},
|
| 589 |
+
"outputs": [
|
| 590 |
+
{
|
| 591 |
+
"name": "stderr",
|
| 592 |
+
"output_type": "stream",
|
| 593 |
+
"text": [
|
| 594 |
+
"Testing: 0%| | 0/30 [00:00<?, ?it/s]Exception ignored in: <function _MultiProcessingDataLoaderIter.__del__ at 0x75ce96bc04d0>\n",
|
| 595 |
+
"Traceback (most recent call last):\n",
|
| 596 |
+
" File \"/home/khmt/anaconda3/envs/tqkhang-vivit/lib/python3.7/site-packages/torch/utils/data/dataloader.py\", line 1358, in __del__\n",
|
| 597 |
+
" self._shutdown_workers()\n",
|
| 598 |
+
" File \"/home/khmt/anaconda3/envs/tqkhang-vivit/lib/python3.7/site-packages/torch/utils/data/dataloader.py\", line 1341, in _shutdown_workers\n",
|
| 599 |
+
" if w.is_alive():\n",
|
| 600 |
+
" File \"/home/khmt/anaconda3/envs/tqkhang-vivit/lib/python3.7/multiprocessing/process.py\", line 151, in is_alive\n",
|
| 601 |
+
" assert self._parent_pid == os.getpid(), 'can only test a child process'\n",
|
| 602 |
+
"AssertionError: can only test a child process\n",
|
| 603 |
+
"Exception ignored in: <function _MultiProcessingDataLoaderIter.__del__ at 0x75ce96bc04d0>\n",
|
| 604 |
+
"Traceback (most recent call last):\n",
|
| 605 |
+
" File \"/home/khmt/anaconda3/envs/tqkhang-vivit/lib/python3.7/site-packages/torch/utils/data/dataloader.py\", line 1358, in __del__\n",
|
| 606 |
+
" self._shutdown_workers()\n",
|
| 607 |
+
" File \"/home/khmt/anaconda3/envs/tqkhang-vivit/lib/python3.7/site-packages/torch/utils/data/dataloader.py\", line 1341, in _shutdown_workers\n",
|
| 608 |
+
" if w.is_alive():\n",
|
| 609 |
+
" File \"/home/khmt/anaconda3/envs/tqkhang-vivit/lib/python3.7/multiprocessing/process.py\", line 151, in is_alive\n",
|
| 610 |
+
" assert self._parent_pid == os.getpid(), 'can only test a child process'\n",
|
| 611 |
+
"AssertionError: can only test a child process\n",
|
| 612 |
+
"Exception ignored in: <function _MultiProcessingDataLoaderIter.__del__ at 0x75ce96bc04d0>\n",
|
| 613 |
+
"Traceback (most recent call last):\n",
|
| 614 |
+
" File \"/home/khmt/anaconda3/envs/tqkhang-vivit/lib/python3.7/site-packages/torch/utils/data/dataloader.py\", line 1358, in __del__\n",
|
| 615 |
+
" self._shutdown_workers()\n",
|
| 616 |
+
" File \"/home/khmt/anaconda3/envs/tqkhang-vivit/lib/python3.7/site-packages/torch/utils/data/dataloader.py\", line 1341, in _shutdown_workers\n",
|
| 617 |
+
" if w.is_alive():\n",
|
| 618 |
+
" File \"/home/khmt/anaconda3/envs/tqkhang-vivit/lib/python3.7/multiprocessing/process.py\", line 151, in is_alive\n",
|
| 619 |
+
" assert self._parent_pid == os.getpid(), 'can only test a child process'\n",
|
| 620 |
+
"AssertionError: can only test a child process\n",
|
| 621 |
+
"Exception ignored in: <function _MultiProcessingDataLoaderIter.__del__ at 0x75ce96bc04d0>\n",
|
| 622 |
+
"Traceback (most recent call last):\n",
|
| 623 |
+
" File \"/home/khmt/anaconda3/envs/tqkhang-vivit/lib/python3.7/site-packages/torch/utils/data/dataloader.py\", line 1358, in __del__\n",
|
| 624 |
+
" self._shutdown_workers()\n",
|
| 625 |
+
" File \"/home/khmt/anaconda3/envs/tqkhang-vivit/lib/python3.7/site-packages/torch/utils/data/dataloader.py\", line 1341, in _shutdown_workers\n",
|
| 626 |
+
" if w.is_alive():\n",
|
| 627 |
+
" File \"/home/khmt/anaconda3/envs/tqkhang-vivit/lib/python3.7/multiprocessing/process.py\", line 151, in is_alive\n",
|
| 628 |
+
" assert self._parent_pid == os.getpid(), 'can only test a child process'\n",
|
| 629 |
+
"AssertionError: can only test a child process\n",
|
| 630 |
+
"Testing: 32it [00:15, 2.06it/s] \n"
|
| 631 |
+
]
|
| 632 |
+
}
|
| 633 |
+
],
|
| 634 |
+
"source": [
|
| 635 |
+
"import torch\n",
|
| 636 |
+
"model.eval()\n",
|
| 637 |
+
"y_true, y_pred = [], []\n",
|
| 638 |
+
"with torch.no_grad():\n",
|
| 639 |
+
" for batch in tqdm(test_loader, desc=\"Testing\"):\n",
|
| 640 |
+
" inputs = batch[\"video\"].to(\"cuda\")\n",
|
| 641 |
+
" labels = batch[\"label\"].to(\"cuda\")\n",
|
| 642 |
+
" outputs = model(inputs)\n",
|
| 643 |
+
" probabilities = torch.nn.functional.softmax(outputs, dim=1)\n",
|
| 644 |
+
" predictions = probabilities.argmax(dim=-1)\n",
|
| 645 |
+
" y_true.extend(labels.cpu().tolist())\n",
|
| 646 |
+
" y_pred.extend(predictions.cpu().tolist())"
|
| 647 |
+
]
|
| 648 |
+
},
|
| 649 |
+
{
|
| 650 |
+
"cell_type": "code",
|
| 651 |
+
"execution_count": 27,
|
| 652 |
+
"id": "6fbcc06f-d230-4c46-9cd8-c2aa83aeca19",
|
| 653 |
+
"metadata": {},
|
| 654 |
+
"outputs": [
|
| 655 |
+
{
|
| 656 |
+
"name": "stdout",
|
| 657 |
+
"output_type": "stream",
|
| 658 |
+
"text": [
|
| 659 |
+
"Accuracy: 0.7607 | F1-macro: 0.7426\n",
|
| 660 |
+
" precision recall f1-score support\n",
|
| 661 |
+
"\n",
|
| 662 |
+
" khongxarac 0.75 0.88 0.81 68\n",
|
| 663 |
+
" xarac 0.78 0.59 0.67 49\n",
|
| 664 |
+
"\n",
|
| 665 |
+
" accuracy 0.76 117\n",
|
| 666 |
+
" macro avg 0.77 0.74 0.74 117\n",
|
| 667 |
+
"weighted avg 0.76 0.76 0.75 117\n",
|
| 668 |
+
"\n",
|
| 669 |
+
"Confusion matrix:\n",
|
| 670 |
+
" [[60 8]\n",
|
| 671 |
+
" [20 29]]\n"
|
| 672 |
+
]
|
| 673 |
+
}
|
| 674 |
+
],
|
| 675 |
+
"source": [
|
| 676 |
+
"acc = accuracy_score(y_true, y_pred)\n",
|
| 677 |
+
"f1m = f1_score(y_true, y_pred, average=\"macro\")\n",
|
| 678 |
+
"print(f\"Accuracy: {acc:.4f} | F1-macro: {f1m:.4f}\")\n",
|
| 679 |
+
"print(classification_report(y_true, y_pred, target_names=class_names))\n",
|
| 680 |
+
"print(\"Confusion matrix:\\n\", confusion_matrix(y_true, y_pred))"
|
| 681 |
+
]
|
| 682 |
+
},
|
| 683 |
+
{
|
| 684 |
+
"cell_type": "code",
|
| 685 |
+
"execution_count": null,
|
| 686 |
+
"id": "0b78a3c0-72ef-4207-bb66-03a8a3b02782",
|
| 687 |
+
"metadata": {},
|
| 688 |
+
"outputs": [],
|
| 689 |
+
"source": []
|
| 690 |
+
}
|
| 691 |
+
],
|
| 692 |
+
"metadata": {
|
| 693 |
+
"kernelspec": {
|
| 694 |
+
"display_name": "TQKhang-ViViT",
|
| 695 |
+
"language": "python",
|
| 696 |
+
"name": "tqkhang-vivit"
|
| 697 |
+
},
|
| 698 |
+
"language_info": {
|
| 699 |
+
"codemirror_mode": {
|
| 700 |
+
"name": "ipython",
|
| 701 |
+
"version": 3
|
| 702 |
+
},
|
| 703 |
+
"file_extension": ".py",
|
| 704 |
+
"mimetype": "text/x-python",
|
| 705 |
+
"name": "python",
|
| 706 |
+
"nbconvert_exporter": "python",
|
| 707 |
+
"pygments_lexer": "ipython3",
|
| 708 |
+
"version": "3.7.16"
|
| 709 |
+
}
|
| 710 |
+
},
|
| 711 |
+
"nbformat": 4,
|
| 712 |
+
"nbformat_minor": 5
|
| 713 |
+
}
|
scripts/.ipynb_checkpoints/run_self_influence-checkpoint.sh
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-01_16-22-06-caformer_s36/f1/model_epoch_16_f1_0.7191.pth'
|
| 4 |
+
|
| 5 |
+
python -m soups.self_influence \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "${CHECKPOINTS_DIR}" \
|
| 8 |
+
--device cpu \
|
| 9 |
+
--output_file self_influence_results/_test.json \
|
| 10 |
+
--model timm/caformer_s36.sail_in22k_ft_in1k \
|
| 11 |
+
--dataset_dir data/ich-split-renamed \
|
| 12 |
+
--eval_batch_size 16 \
|
| 13 |
+
--num_workers 8
|
scripts/.ipynb_checkpoints/soup_caformer_b36-checkpoint.sh
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-19_19-37-23-caformer_m36-one_cycle_lr'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/caformer_b36.sail_in22k_ft_in1k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--pruned_soup \
|
| 12 |
+
--pruned_soup_num_iters 64 \
|
| 13 |
+
--greedy_soup_comparison_metric f1 \
|
| 14 |
+
--dataset_dir data/ich-split-renamed \
|
| 15 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_caformer_m36-checkpoint.sh
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-19_19-37-23-caformer_m36-one_cycle_lr'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path '/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-19_19-37-23-caformer_m36-one_cycle_lr/f1-top8' \
|
| 8 |
+
'/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-19_19-37-23-caformer_m36-one_cycle_lr/loss-top8' \
|
| 9 |
+
'/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-19_19-37-23-caformer_m36-one_cycle_lr/accuracy-top8' \
|
| 10 |
+
--model timm/caformer_m36.sail_in22k_ft_in1k \
|
| 11 |
+
--uniform_soup \
|
| 12 |
+
--greedy_soup \
|
| 13 |
+
--pruned_soup \
|
| 14 |
+
--pruned_soup_num_iters 64 \
|
| 15 |
+
--greedy_soup_comparison_metric f1 \
|
| 16 |
+
--dataset_dir data/ich-split-renamed \
|
| 17 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_caformer_s36-checkpoint.sh
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-01_16-22-06-caformer_s36/f1'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/caformer_s36.sail_in22k_ft_in1k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--dataset_dir data/ich-split-renamed \
|
| 12 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_coatnet_0-merged_4_15-checkpoint.sh
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-08-26_20-43-44-coatnet_0_merged_4_15/loss'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/coatnet_0_rw_224.sw_in1k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--dataset_dir data/ich-split-renamed-merged-4-15 \
|
| 12 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_coatnet_0_co_teaching-checkpoint.sh
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-08-23_15-36-45-coatnet_0_co_teaching_forget_0_2/model_1_loss'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/coatnet_0_rw_224.sw_in1k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--dataset_dir data/ich-split-renamed \
|
| 12 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_coatnet_0_random-checkpoint.sh
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-08-23_10-38-52-coatnet_0_random/accuracy'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/coatnet_0_rw_224.sw_in1k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--dataset_dir data/ich-split-renamed \
|
| 12 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_coatnet_2-merged_4_15-checkpoint.sh
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-08-26_20-57-11-coatnet_2_merged_4_15/loss'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/coatnet_2_rw_224.sw_in12k_ft_in1k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--dataset_dir data/ich-split-renamed-merged-4-15 \
|
| 12 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_coatnet_2_random-checkpoint.sh
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-08-23_10-41-55-coatnet_2_random/accuracy'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/coatnet_2_rw_224.sw_in12k_ft_in1k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--dataset_dir data/ich-split-renamed \
|
| 12 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_convnext_base-checkpoint.sh
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-10_16-27-06-convnext_base'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/convnext_base.fb_in22k_ft_in1k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--pruned_soup \
|
| 12 |
+
--pruned_soup_num_iters 64 \
|
| 13 |
+
--greedy_soup_comparison_metric f1 \
|
| 14 |
+
--dataset_dir data/ich-split-renamed \
|
| 15 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_convnext_small-checkpoint.sh
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-10_14-54-53-convnext_small'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/convnext_small.in12k_ft_in1k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--pruned_soup \
|
| 12 |
+
--pruned_soup_num_iters 64 \
|
| 13 |
+
--greedy_soup_comparison_metric f1 \
|
| 14 |
+
--dataset_dir data/ich-split-renamed \
|
| 15 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_convnext_tiny-checkpoint.sh
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-10_15-23-36-convnext_tiny'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/convnext_tiny.in12k_ft_in1k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--pruned_soup \
|
| 12 |
+
--pruned_soup_num_iters 64 \
|
| 13 |
+
--greedy_soup_comparison_metric f1 \
|
| 14 |
+
--dataset_dir data/ich-split-renamed \
|
| 15 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_eva02_base-checkpoint.sh
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-02_00-11-46-eva02_base/accuracy'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/eva02_base_patch14_224.mim_in22k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--greedy_soup_comparison_metric f1 \
|
| 12 |
+
--dataset_dir data/ich-split-renamed \
|
| 13 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_eva02_large-checkpoint.sh
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-02_01-21-34-eva02_large'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/eva02_large_patch14_224.mim_in22k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--pruned_soup \
|
| 12 |
+
--pruned_soup_num_iters 64 \
|
| 13 |
+
--greedy_soup_comparison_metric f1 \
|
| 14 |
+
--eval_batch_size 4 \
|
| 15 |
+
--dataset_dir data/ich-split-renamed \
|
| 16 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_eva02_small-checkpoint.sh
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-20_14-45-41-eva02_small-reproduced'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/eva02_small_patch14_224.mim_in22k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--pruned_soup \
|
| 12 |
+
--pruned_soup_num_iters 64 \
|
| 13 |
+
--remove_duplicate_checkpoints \
|
| 14 |
+
--greedy_soup_comparison_metric f1 \
|
| 15 |
+
--dataset_dir data/ich-split-renamed \
|
| 16 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_focalnet_base_srf-checkpoint.sh
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-10_14-12-59-focalnet_base_srf/accuracy'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/focalnet_base_srf.ms_in1k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--pruned_soup \
|
| 12 |
+
--pruned_soup_num_iters 64 \
|
| 13 |
+
--greedy_soup_comparison_metric f1 \
|
| 14 |
+
--dataset_dir data/ich-split-renamed \
|
| 15 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_focalnet_small_lrf-checkpoint.sh
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-10_14-43-07-focalnet_small_lrf/accuracy'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/focalnet_small_lrf.ms_in1k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--pruned_soup \
|
| 12 |
+
--pruned_soup_num_iters 64 \
|
| 13 |
+
--greedy_soup_comparison_metric f1 \
|
| 14 |
+
--dataset_dir data/ich-split-renamed \
|
| 15 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_focalnet_small_srf-checkpoint.sh
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-02_10-13-09-focalnet_small_srf/accuracy'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/focalnet_small_srf.ms_in1k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--pruned_soup \
|
| 12 |
+
--pruned_soup_num_iters 64 \
|
| 13 |
+
--greedy_soup_comparison_metric f1 \
|
| 14 |
+
--dataset_dir data/ich-split-renamed \
|
| 15 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_hgnetv2_b6_ssld_stage2-checkpoint.sh
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-19_11-57-53-hgnetv2_b6.ssld_stage2_ft_in1k-one_cycle_lr'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/hgnetv2_b6.ssld_stage2_ft_in1k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--pruned_soup \
|
| 12 |
+
--pruned_soup_num_iters 64 \
|
| 13 |
+
--greedy_soup_comparison_metric f1 \
|
| 14 |
+
--dataset_dir data/ich-split-renamed \
|
| 15 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_maxvit_base-checkpoint.sh
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-01_15-07-03-maxvit_base'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/maxvit_base_tf_224.in1k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--pruned_soup \
|
| 12 |
+
--pruned_soup_num_iters 64 \
|
| 13 |
+
--greedy_soup_comparison_metric f1 \
|
| 14 |
+
--dataset_dir data/ich-split-renamed \
|
| 15 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_swin-checkpoint.sh
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-08-31_11-32-23-swin'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path '/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-08-31_11-32-23-swin/accuracy' '/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-08-31_11-32-23-swin/f1' '/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-08-31_11-32-23-swin/loss' \
|
| 8 |
+
--model timm/swin_base_patch4_window7_224.ms_in22k_ft_in1k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--pruned_soup \
|
| 12 |
+
--pruned_soup_num_iters 64 \
|
| 13 |
+
--dataset_dir data/ich-split-renamed \
|
| 14 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_tiny_vit_21m-checkpoint.sh
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-01_13-56-39-tiny_vit_21m_dist'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/tiny_vit_21m_224.dist_in22k_ft_in1k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--pruned_soup \
|
| 12 |
+
--pruned_soup_num_iters 64 \
|
| 13 |
+
--greedy_soup_comparison_metric f1 \
|
| 14 |
+
--dataset_dir data/ich-split-renamed \
|
| 15 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_vit_base-checkpoint.sh
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-17_20-27-15-vit_base'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/vit_base_patch16_224.augreg2_in21k_ft_in1k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--pruned_soup \
|
| 12 |
+
--pruned_soup_num_iters 64 \
|
| 13 |
+
--greedy_soup_comparison_metric f1 \
|
| 14 |
+
--dataset_dir data/ich-split-renamed \
|
| 15 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/soup_vit_base_laion2b-checkpoint.sh
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-17_20-07-52-vit_base_laion2b'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_with_model_soups \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/vit_base_patch16_clip_224.laion2b_ft_in1k \
|
| 9 |
+
--uniform_soup \
|
| 10 |
+
--greedy_soup \
|
| 11 |
+
--pruned_soup \
|
| 12 |
+
--pruned_soup_num_iters 64 \
|
| 13 |
+
--greedy_soup_comparison_metric f1 \
|
| 14 |
+
--dataset_dir data/ich-split-renamed \
|
| 15 |
+
--output_dir "${CHECKPOINTS_DIR}/soups_results"
|
scripts/.ipynb_checkpoints/test_caformer_b36-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-14_09-18-13-caformer_b36-seed_7-one_cycle_lr'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/caformer_b36.sail_in22k_ft_in1k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_caformer_m36-checkpoint.sh
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-19_19-37-23-caformer_m36-one_cycle_lr'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_paths '/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-19_19-37-23-caformer_m36-one_cycle_lr/f1-top8' \
|
| 8 |
+
'/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-19_19-37-23-caformer_m36-one_cycle_lr/accuracy-top8' \
|
| 9 |
+
'/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-19_19-37-23-caformer_m36-one_cycle_lr/loss-top8' \
|
| 10 |
+
--model timm/caformer_m36.sail_in22k_ft_in1k \
|
| 11 |
+
--dataset_dir data/ich-split-renamed \
|
| 12 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_caformer_s36-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='//home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-01_16-22-06-caformer_s36'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoints_dir "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/caformer_s36.sail_in22k_ft_in1k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_coatnet_0-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-08-31_11-30-41-coatnet_0_filtered_1000'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoints_dir "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/coatnet_0_rw_224.sw_in1k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_coatnet_0-merged_4_15-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-08-26_20-43-44-coatnet_0_merged_4_15'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoints_dir "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/coatnet_0_rw_224.sw_in1k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed-merged-4-15 \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_coatnet_0_co_teaching-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-08-23_15-36-45-coatnet_0_co_teaching_forget_0_2/model_1'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoints_dir "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/coatnet_0_rw_224.sw_in1k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_coatnet_0_random-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-08-23_10-38-52-coatnet_0_random'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoints_dir "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/coatnet_0_rw_224.sw_in1k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_coatnet_2-merged_4_15-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-08-26_20-57-11-coatnet_2_merged_4_15'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoints_dir "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/coatnet_2_rw_224.sw_in12k_ft_in1k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed-merged-4-15 \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_coatnet_2_random-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-08-23_10-41-55-coatnet_2_random'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoints_dir "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/coatnet_2_rw_224.sw_in12k_ft_in1k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_convnext_base-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-10_16-27-06-convnext_base'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoints_dir "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/convnext_base.fb_in22k_ft_in1k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_convnext_femto-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-10_15-31-58-convnext_femto'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoints_dir "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/convnext_femto.d1_in1k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_convnext_large-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-11_16-47-37-convnext_large6'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoints_dir "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/convnext_large.fb_in22k_ft_in1k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_convnext_nano-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-10_14-49-36-convnext_nano'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoints_dir "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/convnext_nano.in12k_ft_in1k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_convnext_pico-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-10_15-24-36-convnext_pico'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoints_dir "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/convnext_pico.d1_in1k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_convnext_small-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-10_14-54-53-convnext_small'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoints_dir "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/convnext_small.in12k_ft_in1k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_convnext_tiny-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-10_15-23-36-convnext_tiny'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoints_dir "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/convnext_tiny.in12k_ft_in1k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_convnext_v2_large-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync2/2025-09-11_17-25-36-convnext_v2_large'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoints_dir "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/convnextv2_large.fcmae_ft_in22k_in1k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_convnext_xlarge-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync2/2025-09-11_11-58-22-convnext_xlarge'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoints_dir "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/convnext_xlarge.fb_in22k_ft_in1k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_convnext_xxlarge-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync2/2025-09-11_13-53-47-convnext_xxlarge'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoints_dir "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/convnext_xxlarge.clip_laion2b_soup_ft_in1k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_eva02_base-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-02_00-11-46-eva02_base'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoints_dir "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/eva02_base_patch14_224.mim_in22k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_eva02_large-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-14_00-21-30-eva02_large-one_cycle_lr'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoints_dir "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/eva02_large_patch14_224.mim_in22k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_eva02_small-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/home/khmt/Documents/TQKhangT/mthien/soups/checkpoints-sync/2025-09-20_14-45-41-eva02_small-reproduced'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_paths "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/eva02_small_patch14_224.mim_in22k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_focalnet_base_srf-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/media/khmt/HDD1/TQKhang/mthien/soups/checkpoints/2025-09-10_14-12-59-focalnet_base_srf'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/focalnet_base_srf.ms_in1k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|
scripts/.ipynb_checkpoints/test_focalnet_small_lrf-checkpoint.sh
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
CHECKPOINTS_DIR='/media/khmt/HDD1/TQKhang/mthien/soups/checkpoints/2025-09-10_14-43-07-focalnet_small_lrf'
|
| 4 |
+
|
| 5 |
+
python -m soups.run_test_multiple_checkpoints \
|
| 6 |
+
--seed 42 \
|
| 7 |
+
--checkpoint_path "$CHECKPOINTS_DIR" \
|
| 8 |
+
--model timm/focalnet_small_lrf.ms_in1k \
|
| 9 |
+
--dataset_dir data/ich-split-renamed \
|
| 10 |
+
--output_file "${CHECKPOINTS_DIR}/test_results.json"
|