torch-molecule 0.1.0.dev2__tar.gz → 0.1.1__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 (155) hide show
  1. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/PKG-INFO +19 -19
  2. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/README.md +18 -15
  3. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/pyproject.toml +1 -4
  4. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/gnn/modeling_gnn.py +11 -9
  5. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/smiles_transformer/modeling_transformer.py +0 -1
  6. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule.egg-info/PKG-INFO +19 -19
  7. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule.egg-info/SOURCES.txt +0 -1
  8. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule.egg-info/requires.txt +0 -3
  9. torch_molecule-0.1.0.dev2/tests/test_io.py +0 -319
  10. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/LICENSE +0 -0
  11. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/setup.cfg +0 -0
  12. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/__init__.py +0 -0
  13. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/base/__init__.py +0 -0
  14. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/base/base.py +0 -0
  15. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/base/encoder.py +0 -0
  16. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/base/generator.py +0 -0
  17. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/base/old_encoder.py +0 -0
  18. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/base/old_predictor.py +0 -0
  19. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/base/old_predictor2.py +0 -0
  20. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/base/predictor.py +0 -0
  21. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/attrmask/__init__.py +0 -0
  22. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/attrmask/model.py +0 -0
  23. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/attrmask/modeling_attrmask.py +0 -0
  24. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/constant.py +0 -0
  25. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/contextpred/__init__.py +0 -0
  26. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/contextpred/model.py +0 -0
  27. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/contextpred/modeling_contextpred.py +0 -0
  28. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/contextpred/utils.py +0 -0
  29. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/edgepred/__init__.py +0 -0
  30. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/edgepred/model.py +0 -0
  31. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/edgepred/modeling_edgepred.py +0 -0
  32. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/graphmae/__init__.py +0 -0
  33. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/graphmae/dataloader.py +0 -0
  34. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/graphmae/model.py +0 -0
  35. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/graphmae/modeling_graphmae.py +0 -0
  36. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/infograph/__init__.py +0 -0
  37. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/infograph/loss_function.py +0 -0
  38. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/infograph/model.py +0 -0
  39. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/infograph/modeling_infograph.py +0 -0
  40. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/infograph/module.py +0 -0
  41. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/moama/__init__.py +0 -0
  42. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/moama/model.py +0 -0
  43. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/moama/modeling_moama.py +0 -0
  44. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/moama/utils.py +0 -0
  45. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/pretrained/__init__.py +0 -0
  46. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/pretrained/modeling_pretrained.py +0 -0
  47. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/supervised/__init__.py +0 -0
  48. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/supervised/model.py +0 -0
  49. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/encoder/supervised/modeling_supervised.py +0 -0
  50. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/digress/__init__.py +0 -0
  51. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/digress/diffusion.py +0 -0
  52. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/digress/modeling_digress.py +0 -0
  53. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/digress/transformer.py +0 -0
  54. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/digress/utils.py +0 -0
  55. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/gdss/__init__.py +0 -0
  56. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/gdss/layers.py +0 -0
  57. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/gdss/model.py +0 -0
  58. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/gdss/modeling_gdss.py +0 -0
  59. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/gdss/sde.py +0 -0
  60. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/gdss/solver.py +0 -0
  61. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/gdss/toremove/ScoreNetworkA.py +0 -0
  62. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/gdss/toremove/ScoreNetworkX.py +0 -0
  63. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/gdss/utils.py +0 -0
  64. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/graph_dit/__init__.py +0 -0
  65. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/graph_dit/diffusion.py +0 -0
  66. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/graph_dit/modeling_graph_dit.py +0 -0
  67. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/graph_dit/transformer.py +0 -0
  68. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/graph_dit/utils.py +0 -0
  69. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/graph_ga/__init__.py +0 -0
  70. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/graph_ga/crossover.py +0 -0
  71. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/graph_ga/modeling_graph_ga.py +0 -0
  72. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/graph_ga/mutate.py +0 -0
  73. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/graph_ga/oracle.py +0 -0
  74. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/jtvae/__init__.py +0 -0
  75. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/jtvae/jtnn/chemutils.py +0 -0
  76. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/jtvae/jtnn/datautils.py +0 -0
  77. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/jtvae/jtnn/jtmpn.py +0 -0
  78. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/jtvae/jtnn/jtnn_dec.py +0 -0
  79. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/jtvae/jtnn/jtnn_enc.py +0 -0
  80. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/jtvae/jtnn/mol_tree.py +0 -0
  81. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/jtvae/jtnn/mpn.py +0 -0
  82. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/jtvae/jtnn/nnutils.py +0 -0
  83. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/jtvae/jtnn/vocab.py +0 -0
  84. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/jtvae/jtnn_vae.py +0 -0
  85. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/jtvae/modeling_jtvae.py +0 -0
  86. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/lstm/__init__.py +0 -0
  87. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/lstm/action_sampler.py +0 -0
  88. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/lstm/lstm.py +0 -0
  89. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/lstm/modeling_lstm.py +0 -0
  90. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/lstm/smiles_char_dict.py +0 -0
  91. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/lstm/utils.py +0 -0
  92. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/molgpt/__init__.py +0 -0
  93. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/molgpt/dataset.py +0 -0
  94. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/molgpt/gpt.py +0 -0
  95. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/molgpt/modeling_molgpt.py +0 -0
  96. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/generator/pretrained/modeling_pretrained.py +0 -0
  97. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/nn/__init__.py +0 -0
  98. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/nn/attention.py +0 -0
  99. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/nn/embedder.py +0 -0
  100. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/nn/gnn.py +0 -0
  101. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/nn/mlp.py +0 -0
  102. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/bfgnn/__init__.py +0 -0
  103. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/bfgnn/model.py +0 -0
  104. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/bfgnn/modeling_bfgnn.py +0 -0
  105. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/dir/__init__.py +0 -0
  106. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/dir/model.py +0 -0
  107. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/dir/modeling_dir.py +0 -0
  108. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/dir/utils.py +0 -0
  109. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/gnn/__init__.py +0 -0
  110. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/gnn/model.py +0 -0
  111. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/gnn/old_modeling_gnn.py +0 -0
  112. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/grea/__init__.py +0 -0
  113. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/grea/model.py +0 -0
  114. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/grea/modeling_grea.py +0 -0
  115. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/grea/old1_features.py +0 -0
  116. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/grea/old1_modeling_grea.py +0 -0
  117. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/grea/utils.py +0 -0
  118. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/grin/__init__.py +0 -0
  119. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/grin/model.py +0 -0
  120. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/grin/modeling_grin.py +0 -0
  121. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/irm/__init__.py +0 -0
  122. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/irm/model.py +0 -0
  123. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/irm/modeling_irm.py +0 -0
  124. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/lstm/__init__.py +0 -0
  125. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/lstm/model.py +0 -0
  126. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/lstm/modeling_lstm.py +0 -0
  127. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/lstm/token_from_smiles.py +0 -0
  128. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/old_modeling_graph.py +0 -0
  129. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/rpgnn/__init__.py +0 -0
  130. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/rpgnn/model.py +0 -0
  131. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/rpgnn/modeling_rpgnn.py +0 -0
  132. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/sgir/__init__.py +0 -0
  133. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/sgir/modeling_sgir.py +0 -0
  134. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/sgir/strategy.py +0 -0
  135. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/smiles_transformer/__init__.py +0 -0
  136. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/smiles_transformer/model.py +0 -0
  137. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/ssr/__init__.py +0 -0
  138. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/ssr/model.py +0 -0
  139. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/ssr/modeling_ssr.py +0 -0
  140. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/predictor/ssr/utils.py +0 -0
  141. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/utils/__init__.py +0 -0
  142. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/utils/checker.py +0 -0
  143. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/utils/checkpoint.py +0 -0
  144. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/utils/format.py +0 -0
  145. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/utils/generic/metrics.py +0 -0
  146. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/utils/generic/pseudo_tasks.py +0 -0
  147. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/utils/generic/weights.py +0 -0
  148. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/utils/graph/features.py +0 -0
  149. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/utils/graph/graph_from_smiles.py +0 -0
  150. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/utils/graph/graph_to_smiles.py +0 -0
  151. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/utils/hf.py +0 -0
  152. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule/utils/search.py +0 -0
  153. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule.egg-info/dependency_links.txt +0 -0
  154. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule.egg-info/not-zip-safe +0 -0
  155. {torch_molecule-0.1.0.dev2 → torch_molecule-0.1.1}/torch_molecule.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: torch_molecule
3
- Version: 0.1.0.dev2
3
+ Version: 0.1.1
4
4
  Summary: Deep learning packages for molecular discovery with a simple sklearn-style interface
5
5
  Author-email: Gang Liu <gliu7@nd.edu>
6
6
  License: MIT
@@ -16,12 +16,9 @@ License-File: LICENSE
16
16
  Requires-Dist: torch>=2.2.0
17
17
  Requires-Dist: torch-geometric>=2.6.1
18
18
  Requires-Dist: numpy
19
- Requires-Dist: pandas>=2.2.3
20
- Requires-Dist: click
21
19
  Requires-Dist: huggingface_hub>=0.22.2
22
20
  Requires-Dist: joblib>=1.3.2
23
21
  Requires-Dist: networkx>=3.2.1
24
- Requires-Dist: PyYAML>=6.0.2
25
22
  Requires-Dist: rdkit>=2023.9.5
26
23
  Requires-Dist: scikit_learn>=1.4.1.post1
27
24
  Requires-Dist: scipy>=1.14.1
@@ -55,8 +52,6 @@ Dynamic: license-file
55
52
 
56
53
  `torch-molecule` is a package under active development that facilitates molecular discovery through deep learning, featuring a user-friendly, `sklearn`-style interface. It includes model checkpoints for efficient deployment and benchmarking across a range of molecular tasks. Currently, the package focuses on three main components: **Predictive Models**, **Generative Models**, and **Representation Models**. See the [List of Supported Models](#list-of-supported-models) section for all available models.
57
54
 
58
- > **Note**: This project is in active development, and features may change.
59
-
60
55
  ## Installation
61
56
 
62
57
  1. **Create a Conda environment**:
@@ -65,26 +60,25 @@ Dynamic: license-file
65
60
  conda activate torch_molecule
66
61
  ```
67
62
 
68
- 2. **Install `torch_molecule` from GitHub**:
63
+ 2. **Install using pip (0.1.0)**:
69
64
 
70
- Clone the repository:
71
65
  ```bash
72
- git clone https://github.com/liugangcode/torch-molecule
66
+ pip install torch-molecule
73
67
  ```
74
68
 
75
- Install the requirements:
76
- ```bash
77
- pip install -r requirements.txt
78
- ```
69
+ 3. **Install from source for the latest version**:
70
+
71
+ Clone the repository:
79
72
 
80
- Editable install:
81
73
  ```bash
82
- pip install -e .
74
+ git clone https://github.com/liugangcode/torch-molecule
75
+ cd torch-molecule
83
76
  ```
84
77
 
85
- 3. **Install `torch_molecule` from PyPI** (Legacy):
78
+ Install:
79
+
86
80
  ```bash
87
- pip install -i https://test.pypi.org/simple/ torch-molecule
81
+ pip install .
88
82
  ```
89
83
 
90
84
  ### Additional Packages
@@ -95,6 +89,12 @@ Dynamic: license-file
95
89
  | BFGNNMolecularPredictor | torch-scatter |
96
90
  | GRINMolecularPredictor | torch-scatter |
97
91
 
92
+ **For models that require `torch-scatter`: Install using the following command: `pip install torch-scatter -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html`, e.g.,
93
+
94
+ > `pip install torch-scatter -f https://data.pyg.org/whl/torch-2.7.1+cu128.html`
95
+
96
+ **For models that require `transformers`:** `pip install transformers`
97
+
98
98
  ## Usage
99
99
 
100
100
  Refer to the `tests` folder for more use cases.
@@ -236,8 +236,8 @@ See the structure of `torch_molecule` with the command `tree -L 2 torch_molecule
236
236
  2. **Generative Models**: Done: Graph DiT, GraphGA, DiGress, GDS, MolGPT TODO: more
237
237
  3. **Representation Models**: Done: MoAMa, AttrMasking, ContextPred, EdgePred. Many pretrained models from HF. TODO: checkpoints, more
238
238
 
239
- ## Acknowledgements
239
+ > **Note**: This project is in active development, and features may change.
240
240
 
241
- This project is under active development, and some features may change over time.
241
+ ## Acknowledgements
242
242
 
243
243
  The project template was adapted from [https://github.com/lwaekfjlk/python-project-template](https://github.com/lwaekfjlk/python-project-template). We thank the authors for their contribution to the open-source community.
@@ -19,8 +19,6 @@
19
19
 
20
20
  `torch-molecule` is a package under active development that facilitates molecular discovery through deep learning, featuring a user-friendly, `sklearn`-style interface. It includes model checkpoints for efficient deployment and benchmarking across a range of molecular tasks. Currently, the package focuses on three main components: **Predictive Models**, **Generative Models**, and **Representation Models**. See the [List of Supported Models](#list-of-supported-models) section for all available models.
21
21
 
22
- > **Note**: This project is in active development, and features may change.
23
-
24
22
  ## Installation
25
23
 
26
24
  1. **Create a Conda environment**:
@@ -29,26 +27,25 @@
29
27
  conda activate torch_molecule
30
28
  ```
31
29
 
32
- 2. **Install `torch_molecule` from GitHub**:
30
+ 2. **Install using pip (0.1.0)**:
33
31
 
34
- Clone the repository:
35
32
  ```bash
36
- git clone https://github.com/liugangcode/torch-molecule
33
+ pip install torch-molecule
37
34
  ```
38
35
 
39
- Install the requirements:
40
- ```bash
41
- pip install -r requirements.txt
42
- ```
36
+ 3. **Install from source for the latest version**:
37
+
38
+ Clone the repository:
43
39
 
44
- Editable install:
45
40
  ```bash
46
- pip install -e .
41
+ git clone https://github.com/liugangcode/torch-molecule
42
+ cd torch-molecule
47
43
  ```
48
44
 
49
- 3. **Install `torch_molecule` from PyPI** (Legacy):
45
+ Install:
46
+
50
47
  ```bash
51
- pip install -i https://test.pypi.org/simple/ torch-molecule
48
+ pip install .
52
49
  ```
53
50
 
54
51
  ### Additional Packages
@@ -59,6 +56,12 @@
59
56
  | BFGNNMolecularPredictor | torch-scatter |
60
57
  | GRINMolecularPredictor | torch-scatter |
61
58
 
59
+ **For models that require `torch-scatter`: Install using the following command: `pip install torch-scatter -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html`, e.g.,
60
+
61
+ > `pip install torch-scatter -f https://data.pyg.org/whl/torch-2.7.1+cu128.html`
62
+
63
+ **For models that require `transformers`:** `pip install transformers`
64
+
62
65
  ## Usage
63
66
 
64
67
  Refer to the `tests` folder for more use cases.
@@ -200,8 +203,8 @@ See the structure of `torch_molecule` with the command `tree -L 2 torch_molecule
200
203
  2. **Generative Models**: Done: Graph DiT, GraphGA, DiGress, GDS, MolGPT TODO: more
201
204
  3. **Representation Models**: Done: MoAMa, AttrMasking, ContextPred, EdgePred. Many pretrained models from HF. TODO: checkpoints, more
202
205
 
203
- ## Acknowledgements
206
+ > **Note**: This project is in active development, and features may change.
204
207
 
205
- This project is under active development, and some features may change over time.
208
+ ## Acknowledgements
206
209
 
207
210
  The project template was adapted from [https://github.com/lwaekfjlk/python-project-template](https://github.com/lwaekfjlk/python-project-template). We thank the authors for their contribution to the open-source community.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "torch_molecule"
7
- version = "0.1.0.dev2"
7
+ version = "0.1.1"
8
8
  description = "Deep learning packages for molecular discovery with a simple sklearn-style interface"
9
9
  authors = [{name = "Gang Liu", email = "gliu7@nd.edu"}]
10
10
  readme = "README.md"
@@ -19,12 +19,9 @@ dependencies = [
19
19
  "torch>=2.2.0",
20
20
  "torch-geometric>=2.6.1",
21
21
  "numpy",
22
- "pandas>=2.2.3",
23
- "click",
24
22
  "huggingface_hub>=0.22.2",
25
23
  "joblib>=1.3.2",
26
24
  "networkx>=3.2.1",
27
- "PyYAML>=6.0.2",
28
25
  "rdkit>=2023.9.5",
29
26
  "scikit_learn>=1.4.1.post1",
30
27
  "scipy>=1.14.1",
@@ -317,7 +317,7 @@ class GNNMolecularPredictor(BaseMolecularPredictor):
317
317
  y_val: Optional[Union[List, np.ndarray]] = None,
318
318
  X_unlbl: Optional[List[str]] = None,
319
319
  search_parameters: Optional[Dict[str, ParameterSpec]] = None,
320
- n_trials: int = 10,
320
+ n_trials: int = 10,
321
321
  ) -> "GNNMolecularPredictor":
322
322
  """Automatically find the best hyperparameters using Optuna optimization."""
323
323
  import optuna
@@ -565,19 +565,17 @@ class GNNMolecularPredictor(BaseMolecularPredictor):
565
565
  best_eval = current_eval
566
566
  best_state_dict = self.model.state_dict()
567
567
  cnt_wait = 0
568
+ if self.verbose:
569
+ print(
570
+ f"Better result found at Epoch {epoch}: Loss = {np.mean(train_losses):.4f}, "
571
+ f"{self.evaluate_name} = {best_eval:.4f}"
572
+ )
568
573
  else:
569
574
  cnt_wait += 1
570
575
  if cnt_wait > self.patience:
571
576
  if self.verbose:
572
577
  print(f"Early stopping triggered after {epoch} epochs")
573
578
  break
574
-
575
- if self.verbose and epoch % 10 == 0:
576
- print(
577
- f"Epoch {epoch}: Loss = {np.mean(train_losses):.4f}, "
578
- f"{self.evaluate_name} = {current_eval:.4f}, "
579
- f"Best {self.evaluate_name} = {best_eval:.4f}"
580
- )
581
579
 
582
580
  # Restore best model
583
581
  if best_state_dict is not None:
@@ -621,7 +619,11 @@ class GNNMolecularPredictor(BaseMolecularPredictor):
621
619
  self.model.eval()
622
620
  predictions = []
623
621
  with torch.no_grad():
624
- for batch in tqdm(loader, disable=not self.verbose):
622
+ if self.verbose:
623
+ iterator = tqdm(loader, desc="Predicting")
624
+ else:
625
+ iterator = loader
626
+ for batch in iterator:
625
627
  batch = batch.to(self.device)
626
628
  out = self.model(batch)
627
629
  predictions.append(out["prediction"].cpu().numpy())
@@ -240,7 +240,6 @@ class SMILESTransformerMolecularPredictor(LSTMMolecularPredictor):
240
240
  mode='min' if not self.evaluate_higher_better else 'max',
241
241
  factor=self.scheduler_factor,
242
242
  patience=self.scheduler_patience,
243
- verbose=self.verbose
244
243
  )
245
244
 
246
245
  return optimizer, scheduler
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: torch_molecule
3
- Version: 0.1.0.dev2
3
+ Version: 0.1.1
4
4
  Summary: Deep learning packages for molecular discovery with a simple sklearn-style interface
5
5
  Author-email: Gang Liu <gliu7@nd.edu>
6
6
  License: MIT
@@ -16,12 +16,9 @@ License-File: LICENSE
16
16
  Requires-Dist: torch>=2.2.0
17
17
  Requires-Dist: torch-geometric>=2.6.1
18
18
  Requires-Dist: numpy
19
- Requires-Dist: pandas>=2.2.3
20
- Requires-Dist: click
21
19
  Requires-Dist: huggingface_hub>=0.22.2
22
20
  Requires-Dist: joblib>=1.3.2
23
21
  Requires-Dist: networkx>=3.2.1
24
- Requires-Dist: PyYAML>=6.0.2
25
22
  Requires-Dist: rdkit>=2023.9.5
26
23
  Requires-Dist: scikit_learn>=1.4.1.post1
27
24
  Requires-Dist: scipy>=1.14.1
@@ -55,8 +52,6 @@ Dynamic: license-file
55
52
 
56
53
  `torch-molecule` is a package under active development that facilitates molecular discovery through deep learning, featuring a user-friendly, `sklearn`-style interface. It includes model checkpoints for efficient deployment and benchmarking across a range of molecular tasks. Currently, the package focuses on three main components: **Predictive Models**, **Generative Models**, and **Representation Models**. See the [List of Supported Models](#list-of-supported-models) section for all available models.
57
54
 
58
- > **Note**: This project is in active development, and features may change.
59
-
60
55
  ## Installation
61
56
 
62
57
  1. **Create a Conda environment**:
@@ -65,26 +60,25 @@ Dynamic: license-file
65
60
  conda activate torch_molecule
66
61
  ```
67
62
 
68
- 2. **Install `torch_molecule` from GitHub**:
63
+ 2. **Install using pip (0.1.0)**:
69
64
 
70
- Clone the repository:
71
65
  ```bash
72
- git clone https://github.com/liugangcode/torch-molecule
66
+ pip install torch-molecule
73
67
  ```
74
68
 
75
- Install the requirements:
76
- ```bash
77
- pip install -r requirements.txt
78
- ```
69
+ 3. **Install from source for the latest version**:
70
+
71
+ Clone the repository:
79
72
 
80
- Editable install:
81
73
  ```bash
82
- pip install -e .
74
+ git clone https://github.com/liugangcode/torch-molecule
75
+ cd torch-molecule
83
76
  ```
84
77
 
85
- 3. **Install `torch_molecule` from PyPI** (Legacy):
78
+ Install:
79
+
86
80
  ```bash
87
- pip install -i https://test.pypi.org/simple/ torch-molecule
81
+ pip install .
88
82
  ```
89
83
 
90
84
  ### Additional Packages
@@ -95,6 +89,12 @@ Dynamic: license-file
95
89
  | BFGNNMolecularPredictor | torch-scatter |
96
90
  | GRINMolecularPredictor | torch-scatter |
97
91
 
92
+ **For models that require `torch-scatter`: Install using the following command: `pip install torch-scatter -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html`, e.g.,
93
+
94
+ > `pip install torch-scatter -f https://data.pyg.org/whl/torch-2.7.1+cu128.html`
95
+
96
+ **For models that require `transformers`:** `pip install transformers`
97
+
98
98
  ## Usage
99
99
 
100
100
  Refer to the `tests` folder for more use cases.
@@ -236,8 +236,8 @@ See the structure of `torch_molecule` with the command `tree -L 2 torch_molecule
236
236
  2. **Generative Models**: Done: Graph DiT, GraphGA, DiGress, GDS, MolGPT TODO: more
237
237
  3. **Representation Models**: Done: MoAMa, AttrMasking, ContextPred, EdgePred. Many pretrained models from HF. TODO: checkpoints, more
238
238
 
239
- ## Acknowledgements
239
+ > **Note**: This project is in active development, and features may change.
240
240
 
241
- This project is under active development, and some features may change over time.
241
+ ## Acknowledgements
242
242
 
243
243
  The project template was adapted from [https://github.com/lwaekfjlk/python-project-template](https://github.com/lwaekfjlk/python-project-template). We thank the authors for their contribution to the open-source community.
@@ -1,7 +1,6 @@
1
1
  LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
- tests/test_io.py
5
4
  torch_molecule/__init__.py
6
5
  torch_molecule.egg-info/PKG-INFO
7
6
  torch_molecule.egg-info/SOURCES.txt
@@ -1,12 +1,9 @@
1
1
  torch>=2.2.0
2
2
  torch-geometric>=2.6.1
3
3
  numpy
4
- pandas>=2.2.3
5
- click
6
4
  huggingface_hub>=0.22.2
7
5
  joblib>=1.3.2
8
6
  networkx>=3.2.1
9
- PyYAML>=6.0.2
10
7
  rdkit>=2023.9.5
11
8
  scikit_learn>=1.4.1.post1
12
9
  scipy>=1.14.1
@@ -1,319 +0,0 @@
1
- import numpy as np
2
- import os
3
- import shutil
4
- from pathlib import Path
5
- from torch_molecule import (
6
- GNNMolecularPredictor,
7
- GREAMolecularPredictor,
8
- SGIRMolecularPredictor,
9
- SupervisedMolecularEncoder
10
- )
11
- from unittest.mock import patch, MagicMock
12
- import torch
13
- from huggingface_hub import HfApi
14
- import json
15
-
16
- # Test data
17
- SMILES_LIST = [
18
- 'CNC[C@H]1OCc2cnnn2CCCC(=O)N([C@H](C)CO)C[C@@H]1C',
19
- 'CNC[C@@H]1OCc2cnnn2CCCC(=O)N([C@H](C)CO)C[C@H]1C',
20
- ]
21
- CLASSIFICATION_PROPERTIES = np.array([0, 1])
22
- REGRESSION_PROPERTIES = np.array([1.2, 2.3])
23
-
24
- def setup_test_directory():
25
- """Create and return test directory path."""
26
- test_dir = Path("test_model_checkpoints")
27
- if test_dir.exists():
28
- shutil.rmtree(test_dir)
29
- test_dir.mkdir()
30
- return test_dir
31
-
32
- def cleanup_test_directory(test_dir):
33
- """Clean up test directory."""
34
- if test_dir.exists():
35
- shutil.rmtree(test_dir)
36
-
37
- def test_local_save_load():
38
- """Test local save and load functionality for all models."""
39
- print("\n=== Testing Local Save/Load ===")
40
-
41
- test_dir = setup_test_directory()
42
-
43
- models = {
44
- 'gnn': (GNNMolecularPredictor(num_task=1, task_type="classification"), CLASSIFICATION_PROPERTIES),
45
- 'grea': (GREAMolecularPredictor(num_task=1, task_type="classification"), CLASSIFICATION_PROPERTIES),
46
- 'sgir': (SGIRMolecularPredictor(num_task=1, task_type="regression"), REGRESSION_PROPERTIES),
47
- }
48
-
49
- for model_name, (model, properties) in models.items():
50
- print(f"\nTesting {model_name.upper()} model:")
51
-
52
- # Test save_to_local and load_from_local
53
- save_path = test_dir / f"{model_name}_local.pt"
54
- try:
55
- # Fit and save model
56
- model.fit(SMILES_LIST, properties, X_unlbl=SMILES_LIST)
57
- model.save_to_local(str(save_path))
58
- print(f"✓ Successfully saved model to {save_path}")
59
-
60
- # Load model
61
- new_model = type(model)(num_task=1, task_type=model.task_type)
62
- new_model.load_from_local(str(save_path))
63
- print("✓ Successfully loaded model")
64
-
65
- # Verify loaded model works
66
- predictions = new_model.predict(SMILES_LIST)
67
- print("✓ Successfully made predictions with loaded model")
68
-
69
- except Exception as e:
70
- print(f"✗ Error in local save/load test: {str(e)}")
71
-
72
- cleanup_test_directory(test_dir)
73
-
74
- def test_generic_save_load():
75
- """Test generic save and load methods."""
76
- print("\n=== Testing Generic Save/Load Interface ===")
77
-
78
- test_dir = setup_test_directory()
79
-
80
- # Test with GNN model as example
81
- model = GNNMolecularPredictor(num_task=1, task_type="classification")
82
- model.fit(SMILES_LIST, CLASSIFICATION_PROPERTIES)
83
-
84
- # Test local path
85
- local_path = test_dir / "generic_local.pt"
86
- try:
87
- # Test save method
88
- model.save(path=str(local_path))
89
- print("✓ Successfully saved model using generic save")
90
-
91
- # Test load method
92
- new_model = GNNMolecularPredictor(num_task=1, task_type="classification")
93
- new_model.load(path=str(local_path))
94
- print("✓ Successfully loaded model using generic load")
95
-
96
- except Exception as e:
97
- print(f"✗ Error in generic save/load test: {str(e)}")
98
-
99
- cleanup_test_directory(test_dir)
100
-
101
- def test_huggingface_interface():
102
- """Test Hugging Face interface with mocked upload/download."""
103
- print("\n=== Testing Hugging Face Interface ===")
104
-
105
- test_dir = setup_test_directory()
106
-
107
- # Test with GREA model as example
108
- model = GREAMolecularPredictor(
109
- num_task=1,
110
- task_type="regression",
111
- gamma=0.8,
112
- num_layer=2,
113
- hidden_size=64,
114
- batch_size=4,
115
- epochs=2,
116
- verbose=False,
117
- model_name='GREA_TEST'
118
- )
119
-
120
- # Fit model with sample data
121
- model.fit(SMILES_LIST, REGRESSION_PROPERTIES)
122
-
123
- # Mock data for testing
124
- repo_id = "liuganghuggingface/test-torch-molecule"
125
- metrics = {
126
- "mse": 0.123,
127
- "r2": 0.456
128
- }
129
-
130
- # Test HF save interface
131
- with patch('huggingface_hub.HfApi') as mock_hf_api, \
132
- patch('torch.save') as mock_torch_save, \
133
- patch('json.dump') as mock_json_dump, \
134
- patch('builtins.open', create=True) as mock_open:
135
-
136
- # Mock HF API methods
137
- mock_api_instance = mock_hf_api.return_value
138
- mock_api_instance.create_repo = MagicMock()
139
- mock_api_instance.upload_file = MagicMock()
140
-
141
- try:
142
- # Test model upload
143
- model.save_to_hf(
144
- repo_id=repo_id,
145
- metrics=metrics,
146
- commit_message="Test upload",
147
- private=False
148
- )
149
-
150
- # Verify repo creation
151
- mock_api_instance.create_repo.assert_called_once_with(
152
- repo_id=repo_id,
153
- private=False,
154
- exist_ok=True
155
- )
156
-
157
- # Verify model state was saved
158
- mock_torch_save.assert_called()
159
-
160
- # Verify metadata and metrics were saved
161
- mock_json_dump.assert_called()
162
-
163
- print("✓ Successfully tested model upload to HF")
164
-
165
- except Exception as e:
166
- print(f"✗ Error in HF save test: {str(e)}")
167
-
168
- # Test HF load interface
169
- with patch('huggingface_hub.hf_hub_download') as mock_hf_download, \
170
- patch('torch.load') as mock_torch_load, \
171
- patch('json.load') as mock_json_load:
172
-
173
- # Mock the downloaded checkpoint
174
- mock_checkpoint = {
175
- "model_state_dict": MagicMock(),
176
- "hyperparameters": {
177
- "num_task": 1,
178
- "task_type": "regression",
179
- "gamma": 0.8,
180
- "num_layer": 2,
181
- "hidden_size": 64
182
- },
183
- "version": "1.0.0"
184
- }
185
- mock_torch_load.return_value = mock_checkpoint
186
-
187
- # Mock metadata and metrics
188
-
189
- try:
190
- # Test model download
191
- download_path = test_dir / "downloaded_model.pt"
192
- mock_hf_download.return_value = str(download_path)
193
-
194
- new_model = GREAMolecularPredictor(
195
- num_task=1,
196
- task_type="regression"
197
- )
198
- new_model.load_from_hf(repo_id=repo_id, path=str(download_path))
199
-
200
- # Verify download was attempted
201
- mock_hf_download.assert_called()
202
-
203
- # Verify model state was loaded
204
- mock_torch_load.assert_called()
205
-
206
- print("✓ Successfully tested model download from HF")
207
-
208
- except Exception as e:
209
- print(f"✗ Error in HF load test: {str(e)}")
210
-
211
- # Test error cases
212
- print("\n=== Testing HF Error Cases ===")
213
-
214
- # Test invalid repo_id
215
- with patch('huggingface_hub.HfApi') as mock_hf_api:
216
- mock_api_instance = mock_hf_api.return_value
217
- mock_api_instance.create_repo.side_effect = Exception("Invalid repo")
218
-
219
- # try:
220
- # model.save_to_hf(repo_id="invalid/repo")
221
- # print("✗ Should have raised error for invalid repo")
222
- # except Exception:
223
- # print("✓ Correctly handled invalid repo_id")
224
-
225
- # Test missing token
226
- with patch('os.environ', {}):
227
- # try:
228
- # get HF_TOKEN from environment variable
229
- # token = os.getenv("HUGGINGFACE_TOKEN") # If set as an environment variable )
230
- model.save_to_hf(repo_id=repo_id, private=True)
231
- print("✗ Should have raised error for missing token")
232
-
233
- # except ValueError:
234
- # print("✓ Correctly handled missing HF token for private repo")
235
-
236
- # Test invalid model state
237
- model.is_fitted_ = False
238
- try:
239
- model.save_to_hf(repo_id=repo_id)
240
- print("✗ Should have raised error for unfitted model")
241
- except ValueError:
242
- print("✓ Correctly handled unfitted model upload attempt")
243
-
244
- cleanup_test_directory(test_dir)
245
-
246
- def test_supervised_encoder_save_load():
247
- """Test save/load functionality for SupervisedMolecularEncoder."""
248
- print("\n=== Testing Supervised Encoder Save/Load ===")
249
-
250
- test_dir = setup_test_directory()
251
-
252
- # Initialize encoder with predefined tasks
253
- encoder = SupervisedMolecularEncoder(
254
- predefined_task=["morgan", "maccs"],
255
- epochs=2,
256
- verbose=False
257
- )
258
-
259
- try:
260
- # Fit encoder
261
- encoder.fit(SMILES_LIST)
262
-
263
- # Test local save/load
264
- save_path = test_dir / "encoder_local.pt"
265
- encoder.save_to_local(str(save_path))
266
- print("✓ Successfully saved encoder")
267
-
268
- # Load encoder
269
- new_encoder = SupervisedMolecularEncoder(
270
- predefined_task=["morgan", "maccs"],
271
- epochs=2
272
- )
273
- new_encoder.load_from_local(str(save_path))
274
- print("✓ Successfully loaded encoder")
275
-
276
- # Verify loaded encoder works
277
- encodings = new_encoder.encode(SMILES_LIST)
278
- print("✓ Successfully generated encodings with loaded encoder")
279
- print(f" Encoding shape: {encodings.shape}")
280
-
281
- except Exception as e:
282
- print(f"✗ Error in encoder save/load test: {str(e)}")
283
-
284
- cleanup_test_directory(test_dir)
285
-
286
- def test_error_handling():
287
- """Test error handling in save/load operations."""
288
- print("\n=== Testing Error Handling ===")
289
-
290
- model = GNNMolecularPredictor(num_task=1, task_type="classification")
291
-
292
- # Test loading non-existent file
293
- try:
294
- model.load_from_local("non_existent_file.pt")
295
- print("✗ Should have raised FileNotFoundError")
296
- except FileNotFoundError:
297
- print("✓ Correctly handled non-existent file")
298
-
299
- # Test loading without fitting
300
- try:
301
- model.save_to_local("unfitted_model.pt")
302
- print("✗ Should have raised error for unfitted model")
303
- except Exception as e:
304
- print("✓ Correctly handled unfitted model save attempt")
305
-
306
- # Test generic save without path or repo_id
307
- try:
308
- model.save()
309
- print("✗ Should have raised ValueError")
310
- except ValueError:
311
- print("✓ Correctly handled missing path and repo_id")
312
-
313
- if __name__ == "__main__":
314
- # Run all IO tests
315
- test_local_save_load()
316
- test_generic_save_load()
317
- test_huggingface_interface()
318
- test_supervised_encoder_save_load()
319
- test_error_handling()