-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_experiments.py
70 lines (64 loc) · 1.87 KB
/
run_experiments.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import os
from dotenv import load_dotenv
import sys
import wandb
sys.path.insert(0,'../')
from libs.ssl_dataloader import *
from libs.ssl_model import *
from libs.ssl_utils import *
if __name__ == '__main__':
load_dotenv()
WANDB_API_KEY = os.environ['WANDB_API_KEY']
seed = 0
x_params = {
'sfreq': 128,
'window': 20,
'preprocess': False,
}
train_params={
'num_epochs': 100,
'batch_size': 64,
'print_every': 1,
'learning_rate': 0.00001,
'num_workers': 12,
}
task_params={
'task': 'RelativePositioning',
'sfreq': 128,
'win': 0.5,
'tau_pos': 10,
'tau_neg': 10,
'n_samples': 1,
'seed': seed
}
# combine all the parameters into a single config dict for logging
config = {**x_params, **train_params, **task_params}
dataset = HBNRestBIDSDataset(
data_dir = "/mnt/nemar/openneuro/ds004186",
x_params = x_params,
random_seed=seed,
)
config['dataset'] = 'ds004186'
model = VGGSSL()
config['model'] = 'VGGSSL'
wandb.init(
# Set the project where this run will be logged
project="ssl-hbn-rest",
# id="relative-positioning-with-multiprocess-dataloader",
# We pass a run name (otherwise it’ll be randomly assigned, like sunshine-lollypop-10)
# name=f"experiment_{run}",
# Track hyperparameters and run metadata
config=config,
# resume="allow",
)
trainer = Trainer(
dataset=dataset,
model=model,
train_params=train_params,
task_params=task_params,
wandb=wandb,
seed=seed,
)
config['seed'] = seed
trainer.train()
# trainer.train(checkpoint='/home/dung/eeg-ssl/wandb/run-20241016_111351-relative-positioning-with-multiprocess-dataloader/files/checkpoint_epoch-9')