需要的库:huggingface
path = Path(snapshot_download(repo_id="EvolutionaryScale/esm3-sm-open-v1"))
权重文件会下载到当前工作目录下的 .cache/huggingface/datasets/downloads
目录中。
安装:pip install esm
(esm2安装是 pip install fair-esm ,)
下面是使用说明,其中可以设置login(token="YOUR_TOKEN_HERE")为自己的huggingface令牌
from huggingface_hub import login
from esm.models.esm3 import ESM3
from esm.sdk.api import ESM3InferenceClient, ESMProtein, GenerationConfig# This will prompt you to get an API key from huggingface hub, make one with
# "Read" or "Write" permission and copy it back here.
login()# This will download the model weights and instantiate the model on your machine.
model: ESM3InferenceClient = ESM3.from_pretrained("esm3_sm_open_v1").to("cuda") # or "cpu"# Generate a completi