BioNeMo MolMIM
NVIDIA NIM for MolMIM molecule generation, embedding, and property optimization.
Model details
View repositoryMolMIM is a latent variable model developed by NVIDIA for molecule generation, trained in an unsupervised manner over a large-scale dataset of molecules represented as SMILES strings. It uses a transformer architecture with Mutual Information Machine (MIM) learning to learn an informative, fixed-size latent space that promotes clustered, meaningful latent codes — enabling it to sample novel molecules from that space.
MolMIM supports two core workflows:
Similarity-based generation — generates molecules similar to a seed molecule by encoding it into the latent space, applying random perturbation (e.g., zero-centered Gaussian noise with a chosen variance), and decoding the result back into a SMILES string.
Property-optimized generation — performs optimization using the CMA-ES algorithm within the latent space to sample molecules with improved values for a desired scoring function.
Call BioNeMo MolMIM on Baseten using the NIM molecule generation route.
1import os
2import requests
3
4MODEL_ID = os.environ["BASETEN_MODEL_ID"]
5BASETEN_API_KEY = os.environ["BASETEN_API_KEY"]
6BASETEN_URL = (
7 f"https://model-{MODEL_ID}.api.baseten.co/environments/production/sync"
8 "/generate"
9)
10
11payload = {
12 "smi": "CN1C=NC2=C1C(=O)N(C(=O)N2C)C",
13 "algorithm": "CMA-ES",
14 "num_molecules": 5,
15 "property_name": "QED",
16 "minimize": False,
17 "min_similarity": 0.4,
18 "particles": 8,
19 "iterations": 3,
20}
21
22response = requests.post(
23 BASETEN_URL,
24 headers={
25 "Authorization": f"Bearer {BASETEN_API_KEY}",
26 "Content-Type": "application/json",
27 },
28 json=payload,
29 timeout=300,
30)
31response.raise_for_status()
32result = response.json()
33print(result)
341{
2 "generated": [
3 "<SMILES>",
4 "<SMILES>"
5 ]
6}