IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

test_trainloop.py 1.0KB

il y a 4 ans
il y a 4 ans
123456789101112131415161718192021222324252627282930313233343536373839
  1. from icosagon.data import Data
  2. from icosagon.trainprep import prepare_training, \
  3. TrainValTest
  4. from icosagon.model import Model
  5. from icosagon.trainloop import TrainLoop
  6. import torch
  7. def test_train_loop_01():
  8. d = Data()
  9. d.add_node_type('Dummy', 10)
  10. fam = d.add_relation_family('Dummy-Dummy', 0, 0, False)
  11. fam.add_relation_type('Dummy Rel', torch.rand(10, 10).round())
  12. prep_d = prepare_training(d, TrainValTest(.8, .1, .1))
  13. m = Model(prep_d)
  14. loop = TrainLoop(m)
  15. assert loop.model == m
  16. assert loop.lr == 0.001
  17. assert loop.loss == torch.nn.functional.binary_cross_entropy_with_logits
  18. assert loop.batch_size == 100
  19. def test_train_loop_02():
  20. d = Data()
  21. d.add_node_type('Dummy', 10)
  22. fam = d.add_relation_family('Dummy-Dummy', 0, 0, False)
  23. fam.add_relation_type('Dummy Rel', torch.rand(10, 10).round())
  24. prep_d = prepare_training(d, TrainValTest(.8, .1, .1))
  25. m = Model(prep_d)
  26. loop = TrainLoop(m)
  27. loop.run_epoch()