-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathkernel_template.py
More file actions
31 lines (23 loc) · 798 Bytes
/
kernel_template.py
File metadata and controls
31 lines (23 loc) · 798 Bytes
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
import gzip
import base64
import os
from pathlib import Path
from typing import Dict
EXPERIMENT_NAME = 'corr_noisy_007'
KERNEL_MODE = "predict" # "train" or "predict"
# this is base64 encoded source code
file_data: Dict = {file_data}
for path, encoded in file_data.items():
print(path)
path = Path(path)
path.parent.mkdir(parents=True, exist_ok=True)
path.write_bytes(gzip.decompress(base64.b64decode(encoded)))
def run(command):
os.system('export PYTHONPATH=${PYTHONPATH}:/kaggle/working && '
f'export MODE={KERNEL_MODE} && ' + command)
run('python make_folds.py')
if KERNEL_MODE == "train":
run(f'python train_folds.py --experiment {EXPERIMENT_NAME}')
else:
run(f'python predict_folds.py --experiment {EXPERIMENT_NAME}')
run('rm -rf argus src')