Download bbflow_base/tests/test_run.py from hanghang214/data_transfer: direct link, hf CLI and curl.
- Browser
- Download file 1.5 kB
-
https://huggingface.co/datasets/hanghang214/data_transfer/resolve/main/bbflow_base/tests/test_run.py
- Command line
-
hf download hf://datasets/hanghang214/data_transfer/bbflow_base/tests/test_run.py
-
curl -L -o test_run.py https://huggingface.co/datasets/hanghang214/data_transfer/resolve/main/bbflow_base/tests/test_run.py
1.5 kB
| import pytest | |
| from bbflow.deployment.bbflow import BBFlow | |
| from pathlib import Path | |
| def bbflow_sampler(): | |
| """ | |
| Fixture to set up the BBFlow model for testing. | |
| This will download the model. | |
| """ | |
| bbflow_sampler_ = BBFlow.from_tag('bbflow-mini-0.1', force_download=True) | |
| return bbflow_sampler_ | |
| def test_run(bbflow_sampler): | |
| """ | |
| Run a mini model to test the BBFlow functionality. This is essentially the inference_example.py script for a short backbone. | |
| """ | |
| rootdir = Path(__file__).parent.parent | |
| # Load the BBFlow model | |
| pdb_path = rootdir/'test_data/test_pdbs/short_equilibrium.pdb' | |
| outpath = rootdir/'test_data/test_pdbs/test_samples.pdb' | |
| if outpath.exists(): | |
| outpath.unlink() | |
| bbflow_sampler.sample( | |
| input_path=pdb_path, output_path=outpath, | |
| num_samples=2, batch_size=1 | |
| ) | |
| # slow test: | |
| def test_run_all(): | |
| for tag in ['bbflow-multimer-0.2', 'bbflow-0.1']: | |
| bbflow_sampler_ = BBFlow.from_tag(tag=tag, force_download=True) | |
| rootdir = Path(__file__).parent.parent | |
| # Load the BBFlow model | |
| pdb_path = rootdir/'test_data/test_pdbs/short_equilibrium.pdb' | |
| outpath = rootdir/f'test_data/test_pdbs/test_samples_{tag}.pdb' | |
| if outpath.exists(): | |
| outpath.unlink() | |
| bbflow_sampler_.sample( | |
| input_path=pdb_path, output_path=outpath, | |
| num_samples=2, batch_size=1 | |
| ) |