An error occurred when running Quickstart for ESM3-open. replace() argument 2 must be str, not None
When I ran the "Quickstart for ESM3-open" file(open.py), the following error occurred(slurm-1031673.txt).
from huggingface_hub import login from esm.models.esm3 import ESM3 from esm.sdk.api import ESM3InferenceClient, ESMProtein, GenerationConfig
Will instruct you how to get an API key from huggingface hub, make one with "Read" permission.
login()
This will download the model weights and instantiate the model on your machine.
model: ESM3InferenceClient = ESM3.from_pretrained("esm3-open").to("cuda") # or "cpu"
Generate a completion for a partial Carbonic Anhydrase (2vvb)
prompt = "DQATSLRILNNGHAFNVEFDDSQDKAVLKGGPLDGTYRLIQFHFHWGSLDGQGSEHTVDKKKYAAELHLVHWNTKYGDFGKAVQQPDGLAVLGIFLKVGSAKPGLQKVVDVLDSIKTKGKSADFTNFDPRGLLPESLDYWTYPGSLTTPP________" protein = ESMProtein(sequence=prompt)
Generate the sequence, then the structure. This will iteratively unmask the sequence track.
protein = model.generate(protein, GenerationConfig(track="sequence", num_steps=8, temperature=0.7))
We can show the predicted structure for the generated sequence.
protein = model.generate(protein, GenerationConfig(track="structure", num_steps=8)) protein.to_pdb("./generation.pdb")
Then we can do a round trip design by inverse folding the sequence and recomputing the structure
protein.sequence = None protein = model.generate(protein, GenerationConfig(track="sequence", num_steps=8)) protein.coordinates = None protein = model.generate(protein, GenerationConfig(track="structure", num_steps=8)) protein.to_pdb("./round_tripped.pdb")
gcc-11.3.0 loaded successful cuda-12.1 loaded successful
_| _| _| _| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _|_|_|_| _|_| _|_|_| _|_|_|_|
_| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _|
_|_|_|_| _| _| _| _|_| _| _|_| _| _| _| _| _| _|_| _|_|_| _|_|_|_| _| _|_|_|
_| _| _| _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _|
_| _| _|_| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _| _| _| _|_|_| _|_|_|_|
/home/bingxing2/home/scx9842/.conda/envs/esm3/lib/python3.10/getpass.py:91: GetPassWarning: Can not control echo on the terminal.
passwd = fallback_getpass(prompt, stream)
Warning: Password input may be echoed.
Enter your token (input will not be visible):
Add token as git credential? (Y/n)
Fetching 22 files: 0%| | 0/22 [00:00<?, ?it/s]
Fetching 22 files: 100%|██████████| 22/22 [00:00<00:00, 2270.76it/s]
/home/bingxing2/home/scx9842/esm3/esm/pretrained.py:68: FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only will be flipped to True. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
state_dict = torch.load(
Traceback (most recent call last):
File "/home/bingxing2/home/scx9842/esm3/open.py", line 15, in
I was unfortunately unable to reproduce this issue. What version of esm are you using? I am using version 3.2.4.a0 and ran open.py in the default pixi environment (by running pixi shell)
pip list | grep esm esm 3.2.1.post1 The version of ESM I'm using is 3.2.1.post1. This version caused the problem when I was running it. Could it be a problem with the ESM version? How should I update to your version?
Try running pip install --upgrade esm to upgrade the version to the latest version released on pypi, which is 3.2.3
I can‘t find this version 3.2.3 pip install --upgrade esm==3.2.3 -i https://pypi.org/simple/ --trusted-host pypi.org Looking in indexes: https://pypi.org/simple/ ERROR: Ignored the following versions that require a different python version: 3.2.2 Requires-Python >=3.12,<3.13; 3.2.2.post1 Requires-Python >=3.12,<3.13; 3.2.2.post2 Requires-Python >=3.12,<3.13; 3.2.3 Requires-Python >=3.12,<3.13 ERROR: Could not find a version that satisfies the requirement esm==3.2.3 (from versions: 3.0.0, 3.0.0.post2, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.0.7.post1, 3.0.8, 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4, 3.1.6, 3.2.0, 3.2.1, 3.2.1.post1) ERROR: No matching distribution found for esm==3.2.3
The error message shows that it finds 3.2.3, but it is ignoring it because your python version isn't compatible. try upgrading to python 3.12 https://github.com/evolutionaryscale/esm/blob/main/pyproject.toml#L6?
I have upgraded to the latest version, but the error remains the same as before.
I had the same error, any update on how to solve it?
I had the same error, any update on how to solve it?
I have solved it by: pip install transformers==4.46.2 tokenizers==0.20.3