warprec 2.2.4__tar.gz → 2.2.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (290) hide show
  1. {warprec-2.2.4 → warprec-2.2.5}/PKG-INFO +1 -1
  2. {warprec-2.2.4 → warprec-2.2.5}/pyproject.toml +1 -1
  3. {warprec-2.2.4 → warprec-2.2.5}/warprec/common/run_state.py +4 -0
  4. {warprec-2.2.4 → warprec-2.2.5}/warprec/pipelines/common.py +28 -1
  5. {warprec-2.2.4 → warprec-2.2.5}/warprec/pipelines/swarm.py +110 -43
  6. {warprec-2.2.4 → warprec-2.2.5}/warprec/pipelines/train.py +144 -82
  7. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/base_recommender.py +39 -1
  8. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/graph_utils.py +6 -2
  9. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/trainer/objectives.py +27 -8
  10. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/trainer/trainer.py +122 -42
  11. {warprec-2.2.4 → warprec-2.2.5}/LICENSE +0 -0
  12. {warprec-2.2.4 → warprec-2.2.5}/README.md +0 -0
  13. {warprec-2.2.4 → warprec-2.2.5}/warprec/__init__.py +0 -0
  14. {warprec-2.2.4 → warprec-2.2.5}/warprec/common/__init__.py +0 -0
  15. {warprec-2.2.4 → warprec-2.2.5}/warprec/common/initialize.py +0 -0
  16. {warprec-2.2.4 → warprec-2.2.5}/warprec/common/std_logs.py +0 -0
  17. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/__init__.py +0 -0
  18. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/dataset.py +0 -0
  19. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/entities/__init__.py +0 -0
  20. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/entities/common.py +0 -0
  21. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/entities/context.py +0 -0
  22. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/entities/interactions.py +0 -0
  23. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/entities/knowledge.py +0 -0
  24. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/entities/multimodal.py +0 -0
  25. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/entities/sessions.py +0 -0
  26. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/entities/train_structures/__init__.py +0 -0
  27. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/entities/train_structures/custom_collate_fn.py +0 -0
  28. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/entities/train_structures/interaction_structures.py +0 -0
  29. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/entities/train_structures/session_structures.py +0 -0
  30. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/entities/transactions.py +0 -0
  31. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/eval_loaders.py +0 -0
  32. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/filtering.py +0 -0
  33. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/ranking.py +0 -0
  34. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/reader/__init__.py +0 -0
  35. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/reader/azureblob_reader.py +0 -0
  36. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/reader/base_reader.py +0 -0
  37. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/reader/local_reader.py +0 -0
  38. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/schema.py +0 -0
  39. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/splitting/__init__.py +0 -0
  40. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/splitting/splitter.py +0 -0
  41. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/splitting/strategies.py +0 -0
  42. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/stash.py +0 -0
  43. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/timing.py +0 -0
  44. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/writer/__init__.py +0 -0
  45. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/writer/azureblob_writer.py +0 -0
  46. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/writer/base_writer.py +0 -0
  47. {warprec-2.2.4 → warprec-2.2.5}/warprec/data/writer/local_writer.py +0 -0
  48. {warprec-2.2.4 → warprec-2.2.5}/warprec/errors.py +0 -0
  49. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/__init__.py +0 -0
  50. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/evaluator.py +0 -0
  51. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/factory.py +0 -0
  52. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/__init__.py +0 -0
  53. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/accuracy/__init__.py +0 -0
  54. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/accuracy/auc.py +0 -0
  55. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/accuracy/f1.py +0 -0
  56. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/accuracy/gauc.py +0 -0
  57. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/accuracy/hit_rate.py +0 -0
  58. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/accuracy/lauc.py +0 -0
  59. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/accuracy/logloss.py +0 -0
  60. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/accuracy/map.py +0 -0
  61. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/accuracy/mar.py +0 -0
  62. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/accuracy/mrr.py +0 -0
  63. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/accuracy/ndcg.py +0 -0
  64. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/accuracy/precision.py +0 -0
  65. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/accuracy/recall.py +0 -0
  66. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/base_metric.py +0 -0
  67. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/bias/__init__.py +0 -0
  68. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/bias/aclt.py +0 -0
  69. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/bias/aplt.py +0 -0
  70. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/bias/arp.py +0 -0
  71. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/bias/long_tail.py +0 -0
  72. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/bias/pop_reo.py +0 -0
  73. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/bias/pop_rsp.py +0 -0
  74. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/coverage/__init__.py +0 -0
  75. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/coverage/item_coverage.py +0 -0
  76. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/coverage/numretrieved.py +0 -0
  77. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/coverage/user_coverage.py +0 -0
  78. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/coverage/user_coverage_at_n.py +0 -0
  79. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/debiased/__init__.py +0 -0
  80. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/debiased/base.py +0 -0
  81. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/debiased/dcg.py +0 -0
  82. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/debiased/recall.py +0 -0
  83. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/diversity/__init__.py +0 -0
  84. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/diversity/gini_index.py +0 -0
  85. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/diversity/shannon_entropy.py +0 -0
  86. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/diversity/srecall.py +0 -0
  87. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/fairness/__init__.py +0 -0
  88. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/fairness/biasdisparitybd.py +0 -0
  89. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/fairness/biasdisparitybr.py +0 -0
  90. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/fairness/biasdisparitybs.py +0 -0
  91. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/fairness/itemmadranking.py +0 -0
  92. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/fairness/itemmadrating.py +0 -0
  93. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/fairness/reo.py +0 -0
  94. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/fairness/rsp.py +0 -0
  95. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/fairness/usermadranking.py +0 -0
  96. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/fairness/usermadrating.py +0 -0
  97. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/multiobjective/__init__.py +0 -0
  98. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/multiobjective/euclideandistance.py +0 -0
  99. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/multiobjective/hypervolume.py +0 -0
  100. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/novelty/__init__.py +0 -0
  101. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/novelty/efd.py +0 -0
  102. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/novelty/epc.py +0 -0
  103. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/novelty/novelty_profile.py +0 -0
  104. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/rating/__init__.py +0 -0
  105. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/rating/mae.py +0 -0
  106. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/rating/mse.py +0 -0
  107. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/metrics/rating/rmse.py +0 -0
  108. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/propensity.py +0 -0
  109. {warprec-2.2.4 → warprec-2.2.5}/warprec/evaluation/statistical_significance.py +0 -0
  110. {warprec-2.2.4 → warprec-2.2.5}/warprec/pipelines/__init__.py +0 -0
  111. {warprec-2.2.4 → warprec-2.2.5}/warprec/pipelines/design.py +0 -0
  112. {warprec-2.2.4 → warprec-2.2.5}/warprec/pipelines/estimate.py +0 -0
  113. {warprec-2.2.4 → warprec-2.2.5}/warprec/pipelines/eval.py +0 -0
  114. {warprec-2.2.4 → warprec-2.2.5}/warprec/pipelines/remotes/__init__.py +0 -0
  115. {warprec-2.2.4 → warprec-2.2.5}/warprec/pipelines/remotes/data.py +0 -0
  116. {warprec-2.2.4 → warprec-2.2.5}/warprec/pipelines/remotes/ml.py +0 -0
  117. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/__init__.py +0 -0
  118. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/callbacks.py +0 -0
  119. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/__init__.py +0 -0
  120. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/__init__.py +0 -0
  121. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/cdae.py +0 -0
  122. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/diffrec.py +0 -0
  123. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/ease.py +0 -0
  124. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/elsa.py +0 -0
  125. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/macridvae.py +0 -0
  126. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/multidae.py +0 -0
  127. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/multivae.py +0 -0
  128. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/autoencoder/sansa.py +0 -0
  129. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/__init__.py +0 -0
  130. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/dgcf.py +0 -0
  131. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/egcf.py +0 -0
  132. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/esigcf.py +0 -0
  133. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/gcmc.py +0 -0
  134. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/lightccf.py +0 -0
  135. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/lightgcl.py +0 -0
  136. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/lightgcn.py +0 -0
  137. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/lightgcnpp.py +0 -0
  138. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/lightgode.py +0 -0
  139. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/macrgcn.py +0 -0
  140. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/mixrec.py +0 -0
  141. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/ngcf.py +0 -0
  142. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/paac.py +0 -0
  143. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/popdcl.py +0 -0
  144. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/recdcl.py +0 -0
  145. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/rp3beta.py +0 -0
  146. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/sgcl.py +0 -0
  147. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/sgl.py +0 -0
  148. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/simgcl.py +0 -0
  149. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/simrec.py +0 -0
  150. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/ultragcn.py +0 -0
  151. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/graph_based/xsimgcl.py +0 -0
  152. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/knn/__init__.py +0 -0
  153. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/knn/itemknn.py +0 -0
  154. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/knn/itemknntd.py +0 -0
  155. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/knn/userknn.py +0 -0
  156. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/knn/userknntd.py +0 -0
  157. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/__init__.py +0 -0
  158. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/admmslim.py +0 -0
  159. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/bpr.py +0 -0
  160. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/fism.py +0 -0
  161. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/ials.py +0 -0
  162. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/ials2008.py +0 -0
  163. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/macrmf.py +0 -0
  164. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/latent_factor/slim.py +0 -0
  165. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/neural/__init__.py +0 -0
  166. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/neural/convncf.py +0 -0
  167. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/neural/neumf.py +0 -0
  168. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/collaborative_filtering_recommender/neural/twotower.py +0 -0
  169. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/content_based_recommender/__init__.py +0 -0
  170. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/content_based_recommender/vsm.py +0 -0
  171. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/context_aware_recommender/__init__.py +0 -0
  172. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/context_aware_recommender/afm.py +0 -0
  173. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/context_aware_recommender/dcn.py +0 -0
  174. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/context_aware_recommender/dcnv2.py +0 -0
  175. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/context_aware_recommender/deepfm.py +0 -0
  176. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/context_aware_recommender/fm.py +0 -0
  177. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/context_aware_recommender/nfm.py +0 -0
  178. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/context_aware_recommender/wideanddeep.py +0 -0
  179. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/context_aware_recommender/xdeepfm.py +0 -0
  180. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/hybrid_recommender/__init__.py +0 -0
  181. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/hybrid_recommender/addease.py +0 -0
  182. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/hybrid_recommender/attributeitemknn.py +0 -0
  183. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/hybrid_recommender/attributeuserknn.py +0 -0
  184. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/hybrid_recommender/cease.py +0 -0
  185. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/knowledge_aware_recommender/__init__.py +0 -0
  186. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/knowledge_aware_recommender/cke.py +0 -0
  187. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/knowledge_aware_recommender/kahfm.py +0 -0
  188. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/knowledge_aware_recommender/kgat.py +0 -0
  189. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/knowledge_aware_recommender/kgcn.py +0 -0
  190. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/knowledge_aware_recommender/kgflex.py +0 -0
  191. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/knowledge_aware_recommender/kgin.py +0 -0
  192. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/knowledge_aware_recommender/knowledge_utils.py +0 -0
  193. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/knowledge_aware_recommender/ripplenet.py +0 -0
  194. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/layers.py +0 -0
  195. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/losses.py +0 -0
  196. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/lr_scheduler_wrapper.py +0 -0
  197. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/multimodal_recommender/__init__.py +0 -0
  198. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/multimodal_recommender/bm3.py +0 -0
  199. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/multimodal_recommender/freedom.py +0 -0
  200. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/multimodal_recommender/lattice.py +0 -0
  201. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/multimodal_recommender/mgcn.py +0 -0
  202. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/multimodal_recommender/mmgcn.py +0 -0
  203. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/multimodal_recommender/multimodal_utils.py +0 -0
  204. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/multimodal_recommender/vbpr.py +0 -0
  205. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/optimizer_wrapper.py +0 -0
  206. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/proxy.py +0 -0
  207. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/reranking/__init__.py +0 -0
  208. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/reranking/base.py +0 -0
  209. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/reranking/calibration.py +0 -0
  210. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/reranking/factory.py +0 -0
  211. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/reranking/mmr.py +0 -0
  212. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/sequential_recommender/__init__.py +0 -0
  213. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/sequential_recommender/bert4rec.py +0 -0
  214. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/sequential_recommender/bsarec.py +0 -0
  215. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/sequential_recommender/caser.py +0 -0
  216. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/sequential_recommender/cl4srec.py +0 -0
  217. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/sequential_recommender/core.py +0 -0
  218. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/sequential_recommender/duorec.py +0 -0
  219. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/sequential_recommender/esasrec.py +0 -0
  220. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/sequential_recommender/fossil.py +0 -0
  221. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/sequential_recommender/gru4rec.py +0 -0
  222. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/sequential_recommender/gsasrec.py +0 -0
  223. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/sequential_recommender/lightsans.py +0 -0
  224. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/sequential_recommender/linrec.py +0 -0
  225. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/sequential_recommender/narm.py +0 -0
  226. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/sequential_recommender/sasrec.py +0 -0
  227. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/sequential_recommender/stan.py +0 -0
  228. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/similarities.py +0 -0
  229. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/trainer/__init__.py +0 -0
  230. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/trainer/dashboard_callbacks.py +0 -0
  231. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/trainer/emissions.py +0 -0
  232. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/trainer/logger_callbacks.py +0 -0
  233. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/trainer/runtime.py +0 -0
  234. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/trainer/scheduler_wrapper.py +0 -0
  235. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/trainer/search_algorithm_wrapper.py +0 -0
  236. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/trainer/timing.py +0 -0
  237. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/unpersonalized_recommender/__init__.py +0 -0
  238. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/unpersonalized_recommender/pop.py +0 -0
  239. {warprec-2.2.4 → warprec-2.2.5}/warprec/recommenders/unpersonalized_recommender/random.py +0 -0
  240. {warprec-2.2.4 → warprec-2.2.5}/warprec/run.py +0 -0
  241. {warprec-2.2.4 → warprec-2.2.5}/warprec/serve.py +0 -0
  242. {warprec-2.2.4 → warprec-2.2.5}/warprec/serving/__init__.py +0 -0
  243. {warprec-2.2.4 → warprec-2.2.5}/warprec/serving/api.py +0 -0
  244. {warprec-2.2.4 → warprec-2.2.5}/warprec/serving/app.py +0 -0
  245. {warprec-2.2.4 → warprec-2.2.5}/warprec/serving/catalogue.py +0 -0
  246. {warprec-2.2.4 → warprec-2.2.5}/warprec/serving/context.py +0 -0
  247. {warprec-2.2.4 → warprec-2.2.5}/warprec/serving/deployments.py +0 -0
  248. {warprec-2.2.4 → warprec-2.2.5}/warprec/serving/errors.py +0 -0
  249. {warprec-2.2.4 → warprec-2.2.5}/warprec/serving/mcp.py +0 -0
  250. {warprec-2.2.4 → warprec-2.2.5}/warprec/serving/payload.py +0 -0
  251. {warprec-2.2.4 → warprec-2.2.5}/warprec/serving/schemas.py +0 -0
  252. {warprec-2.2.4 → warprec-2.2.5}/warprec/serving/servable.py +0 -0
  253. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/__init__.py +0 -0
  254. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/callback.py +0 -0
  255. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/__init__.py +0 -0
  256. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/common.py +0 -0
  257. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/config.py +0 -0
  258. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/dashboard_configuration.py +0 -0
  259. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/estimate_configuration.py +0 -0
  260. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/evaluation_configuration.py +0 -0
  261. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/general_configuration.py +0 -0
  262. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/model_configuration.py +0 -0
  263. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/reader_configuration.py +0 -0
  264. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/recommender_model_config/__init__.py +0 -0
  265. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/recommender_model_config/collaborative_filtering_config/__init__.py +0 -0
  266. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/recommender_model_config/collaborative_filtering_config/autoencoder_config.py +0 -0
  267. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/recommender_model_config/collaborative_filtering_config/graph_based_config.py +0 -0
  268. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/recommender_model_config/collaborative_filtering_config/knn_config.py +0 -0
  269. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/recommender_model_config/collaborative_filtering_config/latent_factor_config.py +0 -0
  270. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/recommender_model_config/collaborative_filtering_config/neural_config.py +0 -0
  271. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/recommender_model_config/content_based_config.py +0 -0
  272. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/recommender_model_config/context_aware_config.py +0 -0
  273. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/recommender_model_config/hybrid_config.py +0 -0
  274. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/recommender_model_config/knowledge_aware_config.py +0 -0
  275. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/recommender_model_config/multimodal_config.py +0 -0
  276. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/recommender_model_config/sequential_model_config.py +0 -0
  277. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/recommender_model_config/unpersonalized_config.py +0 -0
  278. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/rerank_configuration.py +0 -0
  279. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/run_configuration.py +0 -0
  280. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/search_space_wrapper.py +0 -0
  281. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/serving_configuration.py +0 -0
  282. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/splitter_configuration.py +0 -0
  283. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/training_configuration.py +0 -0
  284. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/config/writer_configuration.py +0 -0
  285. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/enums.py +0 -0
  286. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/helpers.py +0 -0
  287. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/logger/__init__.py +0 -0
  288. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/logger/logger.py +0 -0
  289. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/pause.py +0 -0
  290. {warprec-2.2.4 → warprec-2.2.5}/warprec/utils/registry.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: warprec
3
- Version: 2.2.4
3
+ Version: 2.2.5
4
4
  Summary: Unifying Academic Rigor and Industrial Scale for Responsible, Reproducible, and Efficient Recommendation
5
5
  Author: MarcoWV
6
6
  Author-email: marco.avolio@wideverse.com
@@ -61,7 +61,7 @@ warprec = "warprec.run:main"
61
61
  "warprec.serve" = "warprec.serve:main"
62
62
 
63
63
  [tool.poetry]
64
- version = "2.2.4"
64
+ version = "2.2.5"
65
65
 
66
66
  [tool.poetry.dependencies]
67
67
  python = "^3.12"
@@ -60,6 +60,9 @@ class ModelStatus(str, Enum):
60
60
  that follow it did not all complete.
61
61
  - COMPLETED: Every stage for this model finished and was written.
62
62
  - FAILED: Hyperparameter optimization produced no usable model.
63
+ - FAILED_LOAD: Hyperparameter optimization finished, but its best model
64
+ could not be built from the result. Resuming the run tries again
65
+ without repeating the search.
63
66
  """
64
67
 
65
68
  PENDING = "pending"
@@ -67,6 +70,7 @@ class ModelStatus(str, Enum):
67
70
  HPO_COMPLETED = "hpo_completed"
68
71
  COMPLETED = "completed"
69
72
  FAILED = "failed"
73
+ FAILED_LOAD = "failed_load"
70
74
 
71
75
 
72
76
  @dataclass
@@ -5,7 +5,12 @@ from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple
5
5
 
6
6
  import ray
7
7
 
8
- from warprec.errors import ClusterError, ConfigurationError, RunStateError
8
+ from warprec.errors import (
9
+ CheckpointError,
10
+ ClusterError,
11
+ ConfigurationError,
12
+ RunStateError,
13
+ )
9
14
  import warprec
10
15
  from warprec.common import (
11
16
  RunState,
@@ -429,6 +434,28 @@ def write_model_outputs(
429
434
  )
430
435
 
431
436
 
437
+ def raise_failed_loads(model_names: List[str], run_name: str) -> None:
438
+ """End a run whose searches finished but some best models could not be built.
439
+
440
+ The run goes on to the other models first, and the searches are recorded,
441
+ so resuming it builds those models again without repeating them.
442
+
443
+ Args:
444
+ model_names (List[str]): The models whose best model could not be built.
445
+ run_name (str): The name of the run.
446
+
447
+ Raises:
448
+ CheckpointError: When any model is listed.
449
+ """
450
+ if not model_names:
451
+ return
452
+ raise CheckpointError(
453
+ f"The best model of {', '.join(model_names)} could not be built from its "
454
+ "finished search; the error is logged above. Run the same command again "
455
+ f"with run.name set to '{run_name}' to build it without searching again."
456
+ )
457
+
458
+
432
459
  def report_statistical_significance(
433
460
  context: PipelineContext, model_results: dict, models: list
434
461
  ) -> None:
@@ -1,10 +1,12 @@
1
1
  import time
2
+ from dataclasses import dataclass, field, replace
2
3
  from typing import TYPE_CHECKING, Callable, Dict, Any, Optional, List, Tuple
3
4
 
4
5
  import ray
5
6
  from ray import tune
6
7
 
7
8
  from warprec.common import (
9
+ ModelState,
8
10
  ModelStatus,
9
11
  log_evaluation,
10
12
  reconcile_model_state,
@@ -19,6 +21,7 @@ from warprec.pipelines.common import (
19
21
  measure_emissions,
20
22
  model_timing_row,
21
23
  prepare_datasets,
24
+ raise_failed_loads,
22
25
  report_statistical_significance,
23
26
  write_model_outputs,
24
27
  )
@@ -26,15 +29,15 @@ from warprec.pipelines.remotes import (
26
29
  remote_evaluation_and_timing,
27
30
  remote_generate_recs,
28
31
  )
29
- from warprec.pipelines.train import single_split_flow, multiple_fold_validation_flow
30
- from warprec.recommenders.trainer import Trainer
32
+ from warprec.pipelines.train import build_best_model, resolve_model_outcome
33
+ from warprec.recommenders.trainer import Trainer, TrainingOutcome
31
34
  from warprec.recommenders.base_recommender import Recommender
32
35
  from warprec.utils.callback import WarpRecCallback
33
36
  from warprec.utils.config import (
34
37
  TrainConfiguration,
35
38
  )
36
39
  from warprec.utils.pause import PauseController
37
- from warprec.utils.helpers import model_param_from_dict
40
+ from warprec.utils.helpers import load_custom_modules, model_param_from_dict
38
41
  from warprec.utils.logger import logger
39
42
 
40
43
  if TYPE_CHECKING:
@@ -57,6 +60,30 @@ TUNE_HOOKS = (
57
60
  )
58
61
 
59
62
 
63
+ @dataclass
64
+ class SwarmModelResult:
65
+ """What the task running one model of a swarm hands back to the driver.
66
+
67
+ Attributes:
68
+ model_name (str): The name of the model.
69
+ outcome (TrainingOutcome): The outcome of its search, without the model.
70
+ model (Optional[Recommender]): The best model, when it was built.
71
+ load_error (Optional[str]): Why the best model could not be built, when
72
+ the search completed but building it failed.
73
+ results (Dict): The evaluation results of the best model.
74
+ model_params (Dict): The best parameters and training iteration.
75
+ timing_report (Dict): The row of the time report.
76
+ """
77
+
78
+ model_name: str
79
+ outcome: TrainingOutcome
80
+ model: Optional[Recommender] = None
81
+ load_error: Optional[str] = None
82
+ results: Dict = field(default_factory=dict)
83
+ model_params: Dict = field(default_factory=dict)
84
+ timing_report: Dict = field(default_factory=dict)
85
+
86
+
60
87
  class HookMailbox:
61
88
  """Holds the Ray Tune hook calls the model tasks forward, until delivered.
62
89
 
@@ -308,6 +335,7 @@ def _swarm_models( # noqa: PLR0912, PLR0915
308
335
  writer_timestamp=context.state.writer_timestamp,
309
336
  resumable=model_name in resumable_models,
310
337
  emissions=emissions,
338
+ model_state=context.state.model_state(model_name),
311
339
  ) # type: ignore[call-arg]
312
340
  futures.append(future)
313
341
 
@@ -359,25 +387,42 @@ def _swarm_models( # noqa: PLR0912, PLR0915
359
387
  # Final result logging of driver
360
388
  logger.msg("Swarming completed. Aggregating and saving results.")
361
389
 
362
- for (
363
- model_name,
364
- best_model,
365
- results,
366
- model_params,
367
- timing_report,
368
- ray_report,
369
- ) in completed_models:
370
- if best_model is None:
371
- status = ray_report.get("status", "failed") if ray_report else "failed"
390
+ failed_loads: List[str] = []
391
+ for completed in completed_models:
392
+ model_name = completed.model_name
393
+ outcome = completed.outcome
394
+ model_state = context.state.model_state(model_name)
395
+ if outcome.interrupted or outcome.failed:
372
396
  logger.attention(f"HPO for {model_name} returned no valid model.")
373
- context.state.model_state(model_name).status = (
374
- ModelStatus.INTERRUPTED
375
- if status == "interrupted"
376
- else ModelStatus.FAILED
397
+ model_state.status = (
398
+ ModelStatus.INTERRUPTED if outcome.interrupted else ModelStatus.FAILED
377
399
  )
378
400
  context.state_store.save(context.state)
379
401
  continue
380
402
 
403
+ # The search finished: recorded whether or not its best model was built,
404
+ # so that resuming the run builds it again without searching again
405
+ model_state.status = ModelStatus.HPO_COMPLETED
406
+ model_state.best_params = outcome.best_params
407
+ model_state.best_iter = outcome.best_iter
408
+ model_state.best_checkpoint_path = outcome.best_checkpoint_path
409
+ model_state.ray_report = outcome.report
410
+ if completed.model is None:
411
+ logger.negative(
412
+ f"The best model of {model_name} could not be built: "
413
+ f"{completed.load_error}"
414
+ )
415
+ model_state.status = ModelStatus.FAILED_LOAD
416
+ context.state_store.save(context.state)
417
+ failed_loads.append(model_name)
418
+ continue
419
+ context.state_store.save(context.state)
420
+
421
+ best_model = completed.model
422
+ results = completed.results
423
+ model_params = completed.model_params
424
+ timing_report = completed.timing_report
425
+
381
426
  # Callbacks
382
427
  context.callback.on_training_complete(model=best_model)
383
428
  context.callback.on_evaluation_complete(
@@ -408,7 +453,6 @@ def _swarm_models( # noqa: PLR0912, PLR0915
408
453
  model_results[model_name] = results
409
454
  context.state_store.save_eval_results(model_name, results)
410
455
 
411
- model_state = context.state.model_state(model_name)
412
456
  model_state.status = ModelStatus.COMPLETED
413
457
  model_state.timing = timing_report
414
458
  context.state_store.save(context.state)
@@ -433,6 +477,8 @@ def _swarm_models( # noqa: PLR0912, PLR0915
433
477
 
434
478
  logger.positive("Experiment swarming concluded. WarpRec is shutting down.")
435
479
 
480
+ raise_failed_loads(failed_loads, context.run_name)
481
+
436
482
 
437
483
  @ray.remote(num_cpus=0.05) # Zero-Resource Orchestrator
438
484
  def remote_model_pipeline( # noqa: PLR0913
@@ -448,7 +494,8 @@ def remote_model_pipeline( # noqa: PLR0913
448
494
  writer_timestamp: Optional[str] = None,
449
495
  resumable: bool = False,
450
496
  emissions: Optional["EmissionsSettings"] = None,
451
- ) -> Tuple[str, Optional[Recommender], Dict, Dict, Dict, Dict]:
497
+ model_state: Optional[ModelState] = None,
498
+ ) -> SwarmModelResult:
452
499
  """Orchestrates the entire lifecycle of a single model in parallel.
453
500
 
454
501
  This task acts as a lightweight manager. It launches HPO, Retraining,
@@ -472,19 +519,19 @@ def remote_model_pipeline( # noqa: PLR0913
472
519
  experiment this model left behind.
473
520
  emissions (Optional[EmissionsSettings]): The run's CodeCarbon
474
521
  measurement, or None when the run is not measured.
522
+ model_state (Optional[ModelState]): What the run state records of the
523
+ model, so that a search it finished is not run again.
475
524
 
476
525
  Returns:
477
- Tuple[str, Optional[Recommender], Dict, Dict, Dict, Dict]: A tuple containing:
478
- - str: Model name.
479
- - Optional[Recommender]: Best model trained.
480
- - results (Dict): Evaluation results.
481
- - model_params (Dict): Best parameters found.
482
- - timing_report (Dict): Timing statistics.
483
- - ray_report (Dict): HPO report.
526
+ SwarmModelResult: The outcome of the search and, when its best model
527
+ was built, the model, its results and its time report row.
484
528
  """
485
529
 
486
530
  model_exploration_start_time = time.time()
487
531
 
532
+ # The search names its trials after the model, so it has to be registered here
533
+ load_custom_modules(config.general.custom_modules)
534
+
488
535
  # Retrieve storage path for Ray results
489
536
  # based on the writer configuration
490
537
  storage_path = config.get_storage_path()
@@ -502,23 +549,36 @@ def remote_model_pipeline( # noqa: PLR0913
502
549
  emissions=emissions,
503
550
  )
504
551
 
505
- # Run the HPO
506
- if val_dataset is not None:
507
- # CASE 2: Train/Validation/Test
508
- outcome = single_split_flow(model_name, params, val_dataset, trainer, config)
509
- elif len(fold_dataset) > 0:
510
- # CASE 3: Cross-validation
511
- outcome = multiple_fold_validation_flow(
512
- model_name, params, main_dataset, fold_dataset, trainer, config
513
- )
514
- else:
515
- # CASE 1: Train/Test
516
- outcome = single_split_flow(model_name, params, main_dataset, trainer, config)
552
+ # Run the HPO, unless the run state records it finished
553
+ outcome = resolve_model_outcome(
554
+ model_name,
555
+ params,
556
+ trainer,
557
+ config,
558
+ main_dataset,
559
+ val_dataset,
560
+ fold_dataset,
561
+ model_state or ModelState(),
562
+ )
563
+ if outcome.interrupted or outcome.failed:
564
+ return SwarmModelResult(model_name=model_name, outcome=outcome)
517
565
 
518
- if outcome.interrupted or outcome.failed or outcome.model is None:
519
- # The last element reports the status so that the driver can tell an
520
- # interrupted model from a failed one.
521
- return model_name, None, {}, {}, {}, {"status": outcome.status}
566
+ try:
567
+ outcome = build_best_model(
568
+ model_name,
569
+ params,
570
+ outcome,
571
+ trainer,
572
+ config,
573
+ main_dataset,
574
+ cross_validated=val_dataset is None and len(fold_dataset) > 0,
575
+ )
576
+ except Exception as e:
577
+ return SwarmModelResult(
578
+ model_name=model_name,
579
+ outcome=outcome,
580
+ load_error=f"{type(e).__name__}: {e}",
581
+ )
522
582
 
523
583
  best_model = outcome.model
524
584
  ray_report = outcome.report
@@ -595,4 +655,11 @@ def remote_model_pipeline( # noqa: PLR0913
595
655
  data_times=data_times,
596
656
  )
597
657
 
598
- return model_name, best_model, results, model_params, timing_report, ray_report
658
+ return SwarmModelResult(
659
+ model_name=model_name,
660
+ outcome=replace(outcome, model=None),
661
+ model=best_model,
662
+ results=results,
663
+ model_params=model_params,
664
+ timing_report=timing_report,
665
+ )
@@ -1,4 +1,6 @@
1
1
  import time
2
+ from dataclasses import replace
3
+ from pathlib import Path
2
4
  from typing import TYPE_CHECKING, List, Optional, Dict, Any
3
5
 
4
6
  import ray
@@ -17,6 +19,7 @@ from warprec.pipelines.common import (
17
19
  measure_emissions,
18
20
  model_timing_row,
19
21
  prepare_datasets,
22
+ raise_failed_loads,
20
23
  report_statistical_significance,
21
24
  write_model_outputs,
22
25
  )
@@ -54,9 +57,9 @@ def resolve_model_outcome(
54
57
  """Produces the training outcome for one model, reusing saved state if possible.
55
58
 
56
59
  When the run state records that hyperparameter optimization already finished
57
- for this model, the best model is rebuilt from its checkpoint instead of
58
- running the sweep again. Cross-validated runs produce no single best
59
- checkpoint, so they fall through to a normal run of the flow.
60
+ for this model, its result is reused instead of running the sweep again,
61
+ whether or not its best model could be built then. The outcome carries no
62
+ model: 'build_best_model' builds it.
60
63
 
61
64
  Args:
62
65
  model_name (str): The name of the model.
@@ -72,34 +75,25 @@ def resolve_model_outcome(
72
75
  TrainingOutcome: The outcome of the optimization for this model.
73
76
  """
74
77
  if (
75
- model_state.status == ModelStatus.HPO_COMPLETED
76
- and model_state.best_checkpoint_path
78
+ model_state.status in (ModelStatus.HPO_COMPLETED, ModelStatus.FAILED_LOAD)
77
79
  and model_state.best_params is not None
78
80
  ):
79
- logger.msg(
80
- f"Reusing the completed hyperparameter search for {model_name} "
81
- f"from {model_state.best_checkpoint_path}."
82
- )
83
- try:
84
- model = trainer.load_best_model(
85
- model_name,
86
- model_state.best_checkpoint_path,
87
- model_state.best_params,
88
- main_dataset,
89
- )
81
+ # A cross-validated search keeps no checkpoint: its best model is
82
+ # retrained from the parameters
83
+ checkpoint = model_state.best_checkpoint_path
84
+ if len(fold_dataset) > 0 or (checkpoint and _checkpoint_exists(checkpoint)):
85
+ logger.msg(f"Reusing the completed hyperparameter search for {model_name}.")
90
86
  return TrainingOutcome(
91
87
  status="completed",
92
- model=model,
93
88
  best_params=model_state.best_params,
94
89
  report=model_state.ray_report,
95
90
  best_iter=model_state.best_iter,
96
- best_checkpoint_path=model_state.best_checkpoint_path,
97
- )
98
- except (FileNotFoundError, OSError, RuntimeError, KeyError) as e:
99
- logger.attention(
100
- f"Could not rebuild {model_name} from its saved checkpoint ({e}). "
101
- "The hyperparameter search will run again."
91
+ best_checkpoint_path=checkpoint,
102
92
  )
93
+ logger.attention(
94
+ f"The best checkpoint of {model_name}, {checkpoint}, no longer exists. "
95
+ "The hyperparameter search will run again."
96
+ )
103
97
 
104
98
  if val_dataset is not None:
105
99
  # CASE 2: Train/Validation/Test
@@ -107,12 +101,104 @@ def resolve_model_outcome(
107
101
  if len(fold_dataset) > 0:
108
102
  # CASE 3: Cross-validation
109
103
  return multiple_fold_validation_flow(
110
- model_name, params, main_dataset, fold_dataset, trainer, config
104
+ model_name, params, fold_dataset, trainer, config
111
105
  )
112
106
  # CASE 1: Train/Test
113
107
  return single_split_flow(model_name, params, main_dataset, trainer, config)
114
108
 
115
109
 
110
+ def _checkpoint_exists(checkpoint_path: str) -> bool:
111
+ """Whether a trial checkpoint is still where the search left it.
112
+
113
+ A closed-form model has none: it is refitted from its parameters.
114
+
115
+ Args:
116
+ checkpoint_path (str): The checkpoint directory, or 'None'.
117
+
118
+ Returns:
119
+ bool: True when there is nothing to find or it was found.
120
+ """
121
+ return checkpoint_path == "None" or Path(checkpoint_path).exists()
122
+
123
+
124
+ def build_best_model(
125
+ model_name: str,
126
+ params: RecomModel,
127
+ outcome: TrainingOutcome,
128
+ trainer: Trainer,
129
+ config: TrainConfiguration,
130
+ main_dataset: Dataset,
131
+ cross_validated: bool,
132
+ ) -> TrainingOutcome:
133
+ """Builds the best model of a finished search.
134
+
135
+ It is loaded from the best trial's checkpoint, refitted when closed-form,
136
+ or, after cross-validation, retrained on the main split.
137
+
138
+ Args:
139
+ model_name (str): The name of the model.
140
+ params (RecomModel): The parameters of the model.
141
+ outcome (TrainingOutcome): The completed outcome of its search.
142
+ trainer (Trainer): The trainer that ran the search.
143
+ config (TrainConfiguration): The configuration file.
144
+ main_dataset (Dataset): The main dataset which represents train/test split.
145
+ cross_validated (bool): Whether the search ran over folds.
146
+
147
+ Returns:
148
+ TrainingOutcome: The outcome, carrying the model and its parameter counts.
149
+ """
150
+ if not cross_validated:
151
+ model = trainer.load_best_model(
152
+ model_name,
153
+ outcome.best_checkpoint_path,
154
+ outcome.best_params,
155
+ main_dataset,
156
+ )
157
+ return replace(
158
+ outcome,
159
+ model=model,
160
+ report={**outcome.report, **trainer.parameter_counts(model)},
161
+ )
162
+
163
+ general_device = config.general.device
164
+ model_device = params.optimization.device
165
+ device = general_device if model_device is None else model_device
166
+
167
+ logger.msg(f"Delegating {model_name} model retraining to Ray cluster")
168
+
169
+ # Retrieve resources to request correct node from cluster
170
+ num_cpus = params.optimization.cpu_per_trial
171
+ num_gpus = params.optimization.gpu_per_trial
172
+ custom_res = params.optimization.custom_resources_per_trial or {}
173
+ label_selector = params.optimization.label_selector or {}
174
+
175
+ # Offload the retraining to a worker node
176
+ best_model, retrain_report, iterations = ray.get(
177
+ remote_model_retraining.options(
178
+ num_cpus=num_cpus,
179
+ num_gpus=num_gpus,
180
+ resources=custom_res if custom_res else None,
181
+ label_selector=label_selector if label_selector else None,
182
+ ).remote(
183
+ model_name=model_name,
184
+ best_params=outcome.best_params,
185
+ main_dataset=main_dataset,
186
+ params=params,
187
+ custom_modules=config.general.custom_modules,
188
+ device=device,
189
+ seed=params.optimization.properties.seed,
190
+ ) # type: ignore[call-arg]
191
+ )
192
+
193
+ # Merge the parameter counts into the main report
194
+ return replace(
195
+ outcome,
196
+ model=best_model,
197
+ report={**outcome.report, **retrain_report},
198
+ best_iter=iterations,
199
+ )
200
+
201
+
116
202
  def train_pipeline(path: str):
117
203
  """Main function to start the experiment.
118
204
 
@@ -159,6 +245,7 @@ def _train_models( # noqa: PLR0912, PLR0915
159
245
  model_timing_report = []
160
246
 
161
247
  paused = False
248
+ failed_loads: List[str] = []
162
249
 
163
250
  with PauseController(enabled=config.run.pause_on_signal) as pause:
164
251
  try:
@@ -233,7 +320,7 @@ def _train_models( # noqa: PLR0912, PLR0915
233
320
  pause.request_pause()
234
321
  pause.check()
235
322
 
236
- if outcome.failed or outcome.model is None:
323
+ if outcome.failed:
237
324
  logger.attention(
238
325
  f"Hyperparameter optimization for {model_name} returned no valid model."
239
326
  )
@@ -241,19 +328,39 @@ def _train_models( # noqa: PLR0912, PLR0915
241
328
  context.state_store.save(context.state)
242
329
  continue
243
330
 
244
- best_model = outcome.model
245
- ray_report = outcome.report
246
- best_iter = outcome.best_iter
247
-
248
- # Record that the search finished, so that a pause during the stages
249
- # that follow does not cost the sweep.
331
+ # Record that the search finished before its best model is built,
332
+ # so that neither a pause nor a failure to build it costs the sweep
250
333
  model_state.status = ModelStatus.HPO_COMPLETED
251
334
  model_state.best_params = outcome.best_params
252
335
  model_state.best_iter = outcome.best_iter
253
336
  model_state.best_checkpoint_path = outcome.best_checkpoint_path
254
- model_state.ray_report = ray_report
337
+ model_state.ray_report = outcome.report
255
338
  context.state_store.save(context.state)
256
339
 
340
+ try:
341
+ outcome = build_best_model(
342
+ model_name,
343
+ params,
344
+ outcome,
345
+ trainer,
346
+ config,
347
+ main_dataset,
348
+ cross_validated=val_dataset is None and len(fold_dataset) > 0,
349
+ )
350
+ except Exception as e:
351
+ logger.negative(
352
+ f"The best model of {model_name} could not be built: "
353
+ f"{type(e).__name__}: {e}"
354
+ )
355
+ model_state.status = ModelStatus.FAILED_LOAD
356
+ context.state_store.save(context.state)
357
+ failed_loads.append(model_name)
358
+ continue
359
+
360
+ best_model = outcome.model
361
+ ray_report = outcome.report
362
+ best_iter = outcome.best_iter
363
+
257
364
  model_exploration_total_time = (
258
365
  time.time() - model_exploration_start_time
259
366
  )
@@ -390,6 +497,8 @@ def _train_models( # noqa: PLR0912, PLR0915
390
497
  report_statistical_significance(context, model_results, models)
391
498
  logger.positive("All experiments concluded. WarpRec is shutting down.")
392
499
 
500
+ raise_failed_loads(failed_loads, context.run_name)
501
+
393
502
 
394
503
  def single_split_flow(
395
504
  model_name: str,
@@ -450,7 +559,6 @@ def single_split_flow(
450
559
  def multiple_fold_validation_flow(
451
560
  model_name: str,
452
561
  params: RecomModel,
453
- main_dataset: Dataset,
454
562
  val_datasets: List[Dataset],
455
563
  trainer: Trainer,
456
564
  config: TrainConfiguration,
@@ -460,15 +568,14 @@ def multiple_fold_validation_flow(
460
568
  Args:
461
569
  model_name (str): Name of the model to optimize.
462
570
  params (RecomModel): The parameter used to train the model.
463
- main_dataset (Dataset): The main dataset which represents train/test split.
464
571
  val_datasets (List[Dataset]): The validation datasets which represents train/val splits.
465
572
  The list can contain n folds of train/val splits.
466
573
  trainer (Trainer): The trainer instance used to optimize the model.
467
574
  config (TrainConfiguration): The configuration file.
468
575
 
469
576
  Returns:
470
- TrainingOutcome: The outcome of the optimization for this model, carrying
471
- the model retrained on the main data split.
577
+ TrainingOutcome: The outcome of the optimization for this model, without
578
+ a model: 'build_best_model' retrains it on the main data split.
472
579
  """
473
580
  # Check for device
474
581
  general_device = config.general.device
@@ -478,7 +585,6 @@ def multiple_fold_validation_flow(
478
585
  # Retrieve common params
479
586
  validation_score = config.evaluation.validation_metric
480
587
  desired_training_it = params.optimization.properties.desired_training_it
481
- seed = params.optimization.properties.seed
482
588
 
483
589
  # Evaluation on report
484
590
  eval_config = config.evaluation
@@ -497,7 +603,7 @@ def multiple_fold_validation_flow(
497
603
  )
498
604
 
499
605
  # Start HPO phase on validation folds
500
- outcome = trainer.train_multiple_fold(
606
+ return trainer.train_multiple_fold(
501
607
  model_name,
502
608
  params,
503
609
  val_datasets,
@@ -507,47 +613,3 @@ def multiple_fold_validation_flow(
507
613
  desired_training_it=desired_training_it,
508
614
  ray_verbose=config.general.ray_verbose,
509
615
  )
510
-
511
- # Check in case the HPO was paused or failed
512
- if outcome.interrupted or outcome.failed:
513
- return outcome
514
-
515
- best_params = outcome.best_params
516
-
517
- logger.msg(f"Delegating {model_name} model retraining to Ray cluster")
518
-
519
- # Retrieve resources to request correct node from cluster
520
- num_cpus = params.optimization.cpu_per_trial
521
- num_gpus = params.optimization.gpu_per_trial
522
- custom_res = params.optimization.custom_resources_per_trial or {}
523
- label_selector = params.optimization.label_selector or {}
524
-
525
- # Offload the retraining to a worker node
526
- best_model, retrain_report, iterations = ray.get(
527
- remote_model_retraining.options(
528
- num_cpus=num_cpus,
529
- num_gpus=num_gpus,
530
- resources=custom_res if custom_res else None,
531
- label_selector=label_selector if label_selector else None,
532
- ).remote(
533
- model_name=model_name,
534
- best_params=best_params,
535
- main_dataset=main_dataset,
536
- params=params,
537
- custom_modules=config.general.custom_modules,
538
- device=device,
539
- seed=seed,
540
- ) # type: ignore[call-arg]
541
- )
542
-
543
- # Merge the parameter counts into the main report
544
- report = dict(outcome.report)
545
- report.update(retrain_report)
546
-
547
- return TrainingOutcome(
548
- status="completed",
549
- model=best_model,
550
- best_params=best_params,
551
- report=report,
552
- best_iter=iterations,
553
- )