Skip to main content

Microbial General Model 2 (MGM2)

PyPI Downloads Hugging Face

MGM2 is a multimodal foundation model for microbial community states and responses. Pretrained on 1.82 million microbiomes, it integrates sequence identity, abundance and community descriptions to produce community-level embeddings and contextual microbial representations.

MGM2 workflow

Installation

Python 3.10 or later is required. Install the package and table-inference tools:

python -m pip install 'microformer-mgm2[tables,hub]'
mgm2-embed --help

The distribution is microformer-mgm2; the Python import is mgm2. For GPU use, install the appropriate PyTorch build.

Model resources

Four pretrained encoders, sequence and taxonomy embedding banks, and the XLarge sparse autoencoder are available on Hugging Face.

from huggingface_hub import snapshot_download

snapshot_download("LudensZhang/MGM2", revision="v2.1.0", local_dir="MGM2-models")

Community embeddings

Provide a feature-by-sample CSV with OTU IDs in the first column:

mgm2-embed --model MGM2-models/models/small \
  --table communities.csv \
  --embeddings MGM2-models/embeddings/otus_99_embeddings.h5 \
  --output outputs/communities.npz --device cpu

For taxonomic names, add --fallback MGM2-models/embeddings/otus_99_taxonomy_fallback.h5.

Your own sequences

Encode representative FASTA sequences using legacy NTv3_650M_pre:

python -m pip install 'microformer-mgm2[ntv3]'
mgm2-encode-fasta --fasta representative_sequences.fasta \
  --output outputs/asv_ntv3.h5 --device cuda:0 --trust-remote-code

Use the generated bank with mgm2-embed --embeddings outputs/asv_ntv3.h5. See the sequence guide for model access and local checkpoints.

Resources

License

MGM2 code uses the MIT License. Model weights and third-party resources retain their respective terms.

Metadata

Release files for microformer-mgm2 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for microformer-mgm2 2.1.0
File Size Uploaded Provenance Actions
microformer_mgm2-2.1.0.tar.gz 54.1 kB Without provenance Details for microformer_mgm2-2.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for microformer-mgm2 2.1.0
File Interpreter ABI Platform Actions
microformer_mgm2-2.1.0-py3-none-any.whl Python 3 none any Details for microformer_mgm2-2.1.0-py3-none-any.whl

Total release size: 86.0 kB

Release files / microformer_mgm2-2.1.0.tar.gz

Download URL microformer_mgm2-2.1.0.tar.gz
Size 54.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d690a7c6f68ad5f2f7e75c95fabb3495d826ea0293e732081a976138fe1b9edf
BLAKE2b-256 checksum
How to use checksums
4ae262e8e254990d77d27e07a1ac2c24e8558e45eaf9cc6c6a8c3ec3108f2e8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.19

Release files / microformer_mgm2-2.1.0-py3-none-any.whl

Download URL microformer_mgm2-2.1.0-py3-none-any.whl
Size 31.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa84defe4c5a365d448eda4657f2f456045f85221e7acc5348b40fc23348bcfe
BLAKE2b-256 checksum
How to use checksums
b252d5bebdf509fed805251fe3d04c6845b5a304bf4f9c8ba979115a3dd9b7a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.19

Security for microformer-mgm2 2.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page