Commit 3ccce6cd authored by Verena Praher's avatar Verena Praher

Add evaluate_models.py

parent e2682ad2
# from models.shared_stuff import BasePtlModel
from pytorch_lightning import Trainer
from test_tube import Experiment, HyperOptArgumentParser
from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint
import os
from models.resnet import Network
def run_test(hparams):
# expt_path = '/home/shreyan/PROJECTS/mediaeval_emotion_2019/verena/d24d6_resnet34'
# expt_path = '/home/shreyan/PROJECTS/mediaeval_emotion_2019/verena/d24d6_resnet34'
expt_path = '/home/verena/experiments/moodwalk/runs/d24d6 - resnet34'
checkpoint_callback = ModelCheckpoint(
filepath=os.path.join(expt_path, 'best.ckpt'),
save_best_only=True,
verbose=True,
monitor='val_loss',
mode='min'
)
exp = Experiment()
trainer = Trainer(experiment=exp, checkpoint_callback=checkpoint_callback, gpus=[0], distributed_backend=None)
model = Network(hparams, 56)
trainer.test(model=model)
if __name__=='__main__':
parent_parser = HyperOptArgumentParser(strategy='grid_search', add_help=False)
parent_parser.add_argument('--experiment_name', type=str,
default='pt_lightning_exp_a', help='test tube exp name')
parser = Network.add_model_specific_args(parent_parser)
hyperparams = parser.parse_args()
run_test(hyperparams)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment