generated from pypa/sampleproject
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Include sleepnet and refactoring
- Loading branch information
Showing
21 changed files
with
1,114 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
include tox.ini | ||
recursive-include tests *.py | ||
recursive-include assets *.jpg | ||
recursive-include assets *.jpg *.lzma | ||
recursive-include src *.yaml | ||
exclude src/asleep/models *.mdl | ||
recursive-exclude src/asleep/torch_hub_cache * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import os | ||
from src.asleep.models import CNNLSTM, weight_init | ||
import torch | ||
|
||
dependencies = ["torch"] | ||
|
||
|
||
def sleepnet(pretrained=True, my_device="cpu", class_num=2, lstm_nn_size=128, | ||
dropout_p=0.5, bi_lstm=True, lstm_layer=1): | ||
model = CNNLSTM( | ||
num_classes=class_num, | ||
model_device=my_device, | ||
lstm_nn_size=lstm_nn_size, | ||
dropout_p=dropout_p, | ||
bidrectional=bi_lstm, | ||
lstm_layer=lstm_layer, | ||
) | ||
weight_init(model) | ||
|
||
if pretrained: | ||
checkpoint = 'https://download.pytorch.org/models/resnet18-5c106cde.pth' | ||
model.load_state_dict(torch.hub.load_state_dict_from_url(checkpoint, | ||
progress=True, | ||
map_location=torch.device(my_device))) | ||
model.to(my_device, dtype=torch.float) | ||
return model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
defaults: | ||
- model: baseline | ||
- data: vm_data | ||
- _self_ | ||
|
||
gpu: 0 | ||
num_epoch: 200 | ||
multi_gpu: false | ||
gpu_ids: [0, 1, 2, 3] # if more than one gpu | ||
verbose: false | ||
patience: 10 | ||
deployment: false | ||
num_split: 5 | ||
test_size: 0.2 | ||
validation_fold: -1 # validation fold < num_split used for cnn cv | ||
isDebug: false | ||
train_master: false | ||
specific_fold: -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
defaults: | ||
- model: cnn_lstm_eval | ||
- data: deployment | ||
- _self_ | ||
|
||
gpu: -1 | ||
num_epoch: 200 | ||
multi_gpu: false | ||
gpu_ids: [0, 1, 2, 3] # if more than one gpu | ||
verbose: false | ||
patience: 10 | ||
deployment: true | ||
num_split: 5 | ||
test_size: 0.2 | ||
validation_fold: -1 # validation fold < num_split used for cnn cv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
data_root: /Users/hangy/data | ||
X_zip_path: "${data.data_root}/X.npy.gz" | ||
X_path: "${data.data_root}/X.npy" | ||
PID_path: "${data.data_root}/npid.npy" | ||
subject_file: "" | ||
y_pred_path: "${data.data_root}/y_pred.npy" | ||
y_prob_path: "${data.data_root}/pred_prob.npy" | ||
pid_pred_path: "${data.data_root}/PID_pred.npy" | ||
use_gen2: False | ||
context_path: "${data.data_root}/context.pkl" | ||
log_path: /home/cxx579/raine/logs | ||
win_length: 1 | ||
meta_data_size: 0 | ||
test_ratio: 0.2 | ||
val_ratio: 0.2 | ||
num_classes: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
learning_rate: 0.0001 | ||
isSmall: false | ||
name: "baseline_WinLen${data.win_length}_BiDi${data.isBidirectional}_Meta${data.meta_data_size}_Aug${augment}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
deployment: false | ||
deployment_path: "/home/cxx579/raine/predictions" | ||
# eval_weight_path: "/data/UKBB/final_models/sleepnet_12_16.mdl" | ||
isSmall: false | ||
bi_lstm: True | ||
lstm_nn_size: 1024 | ||
lstm_layer: 2 | ||
batch_size: 2 # indicate the number of subjects for cnnlstm | ||
model_name: 'cnn_lstm' | ||
dropout_p: 0 | ||
multi_task: false | ||
augment: 'cnn_lstm' |
Oops, something went wrong.