Update README.md
Browse files
README.md
CHANGED
|
@@ -34,14 +34,20 @@ pip install torch rdkit safetensors huggingface_hub numpy
|
|
| 34 |
## Usage
|
| 35 |
|
| 36 |
```python
|
| 37 |
-
import torch
|
| 38 |
from huggingface_hub import hf_hub_download
|
| 39 |
from safetensors.torch import load_file
|
| 40 |
-
from modeling_bioxmol import GatedGraphNeuralNetwork
|
| 41 |
-
from featurizer import smiles2graph
|
| 42 |
|
| 43 |
REPO = "arslanmasood/BioXMol"
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
def load_encoder(seed: int = 0):
|
| 46 |
model = GatedGraphNeuralNetwork(n_edge=1, in_dim=75, n_conv=6, fc_dims=[1024, 128])
|
| 47 |
weights = hf_hub_download(REPO, f"bioxmol_soft_seed{seed}.safetensors")
|
|
|
|
| 34 |
## Usage
|
| 35 |
|
| 36 |
```python
|
| 37 |
+
import os, sys, torch
|
| 38 |
from huggingface_hub import hf_hub_download
|
| 39 |
from safetensors.torch import load_file
|
|
|
|
|
|
|
| 40 |
|
| 41 |
REPO = "arslanmasood/BioXMol"
|
| 42 |
|
| 43 |
+
# Fetch the model definition + featurizer from the repo and make them importable
|
| 44 |
+
for _f in ["modeling_bioxmol.py", "featurizer.py"]:
|
| 45 |
+
_code_dir = os.path.dirname(hf_hub_download(REPO, _f))
|
| 46 |
+
sys.path.insert(0, _code_dir)
|
| 47 |
+
|
| 48 |
+
from modeling_bioxmol import GatedGraphNeuralNetwork
|
| 49 |
+
from featurizer import smiles2graph
|
| 50 |
+
|
| 51 |
def load_encoder(seed: int = 0):
|
| 52 |
model = GatedGraphNeuralNetwork(n_edge=1, in_dim=75, n_conv=6, fc_dims=[1024, 128])
|
| 53 |
weights = hf_hub_download(REPO, f"bioxmol_soft_seed{seed}.safetensors")
|