(
self,
output_dir,
prediction_dir,
num_steps,
nsample_per_protein,
tau,
device,
backend,
)
| 198 | |
| 199 | class InferenceWrapper: |
| 200 | def __init__( |
| 201 | self, |
| 202 | output_dir, |
| 203 | prediction_dir, |
| 204 | num_steps, |
| 205 | nsample_per_protein, |
| 206 | tau, |
| 207 | device, |
| 208 | backend, |
| 209 | ): |
| 210 | self.num_steps = num_steps |
| 211 | self.nsample_per_protein = nsample_per_protein |
| 212 | self.tau = tau |
| 213 | self.device = device |
| 214 | self.backend = backend |
| 215 | |
| 216 | if self.backend == "mlx" and not MLX_AVAILABLE: |
| 217 | self.backend = "torch" |
| 218 | print("MLX not installed, switch to torch backend.") |
| 219 | |
| 220 | # create output directory |
| 221 | output_dir = Path(output_dir) |
| 222 | output_dir.mkdir(parents=True, exist_ok=True) |
| 223 | |
| 224 | # create cache directory |
| 225 | cache = output_dir / "cache" |
| 226 | cache.mkdir(parents=True, exist_ok=True) |
| 227 | |
| 228 | # create prediction directory |
| 229 | prediction_dir = output_dir / prediction_dir |
| 230 | prediction_dir.mkdir(parents=True, exist_ok=True) |
| 231 | |
| 232 | self.output_dir = output_dir |
| 233 | self.cache = cache |
| 234 | self.prediction_dir = prediction_dir |
| 235 | |
| 236 | self.initialize_esm_model() |
| 237 | self.initialize_others() |
| 238 | |
| 239 | def initialize_esm_model(self): |
| 240 | # load ESM2 model |
nothing calls this directly
no test coverage detected