{"id":25772966,"url":"https://github.com/robaina/esm2-docker","last_synced_at":"2026-06-09T13:31:20.955Z","repository":{"id":277997689,"uuid":"934170280","full_name":"Robaina/ESM2-docker","owner":"Robaina","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-17T12:17:23.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-15T03:45:07.793Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Robaina.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-17T11:45:46.000Z","updated_at":"2025-02-17T12:17:27.000Z","dependencies_parsed_at":"2025-02-17T13:25:55.247Z","dependency_job_id":"c919c665-fca1-4ac5-b67d-9c36c0eace54","html_url":"https://github.com/Robaina/ESM2-docker","commit_stats":null,"previous_names":["robaina/esm2-docker"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Robaina/ESM2-docker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Robaina%2FESM2-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Robaina%2FESM2-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Robaina%2FESM2-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Robaina%2FESM2-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Robaina","download_url":"https://codeload.github.com/Robaina/ESM2-docker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Robaina%2FESM2-docker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34110011,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-27T04:28:46.575Z","updated_at":"2026-06-09T13:31:20.710Z","avatar_url":"https://github.com/Robaina.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ESM2 Protein Embeddings Docker\n\nA Docker container for efficiently extracting protein sequence embeddings using Facebook's ESM-2 (Evolutionary Scale Modeling) models. This implementation supports all ESM-2 models and provides flexible options for embedding extraction.\n\n## Features\n\n- Support for all ESM-2 models\n- GPU acceleration with CUDA\n- Flexible token-based batching for memory efficiency\n- Multiple representation types (per-token, mean, BOS)\n- Automated handling of long sequences with truncation\n- Memory usage monitoring\n- Individual embedding files for each sequence\n\n## Available Models\n\n| Model Name | Parameters | Memory Requirements* | Recommended Batch Size |\n|------------|------------|---------------------|----------------------|\n| esm2_t36_3B_UR50D | 3B | ~15GB | 2048-4096 |\n| esm2_t33_650M_UR50D | 650M | ~4GB | 4096-8192 |\n| esm2_t30_150M_UR50D | 150M | ~2GB | 8192-16384 |\n| esm2_t12_35M_UR50D | 35M | ~1GB | 16384+ |\n| esm2_t6_8M_UR50D | 8M | ~0.5GB | 16384+ |\n\n*Memory requirements for 4096 tokens\n\n## Installation\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/yourusername/esm2-embeddings-docker.git\ncd esm2-embeddings-docker\n```\n\n2. Build the Docker image:\n```bash\ndocker build -t esm2-embeddings .\n```\n\n## Usage\n\n1. Create input and output directories:\n```bash\nmkdir -p input output\n```\n\n2. Place your FASTA file in the input directory:\n```bash\ncp your_sequences.fasta input/\n```\n\n3. Run the container:\n\nBasic usage (default model: esm2_t36_3B_UR50D):\n```bash\ndocker run --gpus all \\\n  -v $(pwd)/input:/app/input \\\n  -v $(pwd)/output:/app/output \\\n  esm2-embeddings \\\n  --input /app/input/your_sequences.fasta\n```\n\nWith specific model and options:\n```bash\ndocker run --gpus all \\\n  -v $(pwd)/input:/app/input \\\n  -v $(pwd)/output:/app/output \\\n  esm2-embeddings \\\n  --input /app/input/your_sequences.fasta \\\n  --model esm2_t33_650M_UR50D \\\n  --include per_tok mean \\\n  --toks_per_batch 4096\n```\n\nCPU-only mode:\n```bash\ndocker run \\\n  -v $(pwd)/input:/app/input \\\n  -v $(pwd)/output:/app/output \\\n  esm2-embeddings \\\n  --input /app/input/your_sequences.fasta \\\n  --nogpu\n```\n\n## Command Line Arguments\n\n| Argument | Description | Default |\n|----------|-------------|---------|\n| --input | Input FASTA file path | /app/input/sequences.fasta |\n| --output_dir | Output directory for embeddings | /app/output |\n| --model | ESM model to use | esm2_t36_3B_UR50D |\n| --toks_per_batch | Maximum batch size in tokens | 4096 |\n| --repr_layers | Layer indices for representations | [last_layer] |\n| --include | Types of representations to return | [\"per_tok\"] |\n| --truncation_seq_length | Maximum sequence length | 1022 |\n| --nogpu | Disable GPU usage | False |\n\n## Output Format\n\nThe embeddings are saved as PyTorch tensor files (`.pt`) in the output directory, one file per sequence. Each file contains:\n\n- `label`: Sequence identifier from FASTA\n- `representations`: Per-token embeddings (if \"per_tok\" included)\n- `mean_representations`: Mean sequence embeddings (if \"mean\" included)\n- `bos_representations`: Beginning-of-sequence token embeddings (if \"bos\" included)\n\nLoad the embeddings in Python:\n```python\nimport torch\nembeddings = torch.load('output/sequence_name.pt')\n```\n\n## Memory Management\n\nThe `toks_per_batch` parameter controls memory usage and processing efficiency. Choose based on:\n- Available GPU memory\n- Model size\n- Sequence lengths\n\nRule of thumb calculation:\n```python\noptimal_toks_per_batch = (max_sequence_length + 2) * desired_sequences_per_batch\n```\n\n## Requirements\n\n- Docker\n- NVIDIA GPU with CUDA support (for GPU acceleration)\n- NVIDIA Container Toolkit (for GPU support)\n\n## Citation\n\nIf you use this implementation, please cite the original [ESM-2 paper](https://www.science.org/doi/10.1126/science.ade2574)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobaina%2Fesm2-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobaina%2Fesm2-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobaina%2Fesm2-docker/lists"}