-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Protgnn update #19
Protgnn update #19
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Надо переписать обучение посредством вызова хуков (before_batch, after_batch, before_epoch, after_epoch, early_stopping).
e7053aa
to
bb02ce0
Compare
src/models_builder/gnn_models.py
Outdated
early_stop_count = 0 | ||
best_prots = prot_layer.prototype_graphs | ||
# data_indices = train_loader.dataset.indices | ||
def train_complete(self, gen_dataset, steps=None, pbar=None, metrics=None, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
train_complete его наличие кажется необязательным
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Если train_complete нужен только, чтобы early_stooping запустить после after_epoch, то необходимо просто переписать early_stooping, а не train_complete
src/models_builder/gnn_models.py
Outdated
loss.backward() | ||
torch.nn.utils.clip_grad_value_(self.gnn.parameters(), clip_value=2.0) | ||
self.optimizer.step() | ||
return loss | ||
|
||
def run_model(self, gen_dataset, mask='test', out='answers'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run_model его наличие кажется необязательным. (Скорее всего дублирует код родительского класса, если так, то надо убрать)
self.early_stop_count = 0 | ||
self.gnn.best_prots = self.prot_layer.prototype_graphs | ||
self.best_acc = 0.0 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Также проверить evaluate_model его наличие кажется необязательным. (Скорее всего дублирует код родительского класса, если так, то надо убрать)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All right
Fix ProtGNN train due to new train procedure. Tested on back and tested on front - got reasonable prots and acc.