unable to import esm
See original GitHub issueI install by pip install fair-esm
.
Then try the example code:
import torch
import esm
# Load ESM-2 model
model, alphabet = esm.pretrained.esm2_t48_15B_UR50D()
batch_converter = alphabet.get_batch_converter()
model.eval() # disables dropout for deterministic results
The following error is raised:
ModuleNotFoundError Traceback (most recent call last)
Untitled-1.ipynb Cell 1 in <cell line: 2>()
[1](vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#W0sdW50aXRsZWQ%3D?line=0) import torch
----> [2](vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#W0sdW50aXRsZWQ%3D?line=1) import esm
[4](vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#W0sdW50aXRsZWQ%3D?line=3) # Load ESM-2 model
[5](vscode-notebook-cell:Untitled-1.ipynb?jupyter-notebook#W0sdW50aXRsZWQ%3D?line=4) model, alphabet = esm.pretrained.esm2_t48_15B_UR50D()
File ~/anaconda3/envs/torch/lib/python3.8/site-packages/esm/__init__.py:9, in <module>
6 from .version import version as __version__ # noqa
8 from .data import Alphabet, BatchConverter, FastaBatchedDataset # noqa
----> 9 from .model.esm1 import ProteinBertModel # noqa
10 from .model.esm2 import ESM2 # noqa
11 from .model.msa_transformer import MSATransformer #noqa
ModuleNotFoundError: No module named 'esm.model.esm1'; 'esm.model' is not a package
Issue Analytics
- State:
- Created a year ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Unable to import ESM .ts module in node - Stack Overflow
You can't import .ts files direct in NodeJS, you need to first transpile it using tsc to then import it in the NodeJS...
Read more >Unable to import from libs using ESM #109 - remix-run/remix
The following error is thrown when trying to import from libs using ESM (like unist-util-visit): Error [ERR_REQUIRE_ESM]: Must use import to load ES...
Read more >import - JavaScript - MDN Web Docs - Mozilla
The static import declaration is used to import read-only live ... The importing module can only read the value but can't re-assign it....
Read more >ECMAScript modules | Node.js v19.3.0 Documentation
Caveat: The ESM load hook and namespaced exports from CommonJS modules are incompatible. Attempting to use them together will result in an empty...
Read more >Gotchas - Remix
For example, you can't import "fs-extra" directly into a route module: ... You may try importing an ESM-only package into your app and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi folks thanks for flagging this issue. The build was broken due to an old file (
model.py
) accidentally being included in the pip wheel. Note that there was no issue on the github main branch, so as @pooriyapfn points outpip install git+https://github.com/facebookresearch/esm.git
still worked.The wheel is fixed now, so please go ahead and pip uninstall, then
pip install fair-esm
orpip install fair-esm==1.0.2
.Sorry for the inconvenience.
Problem solved! Happy to see that!