facebookresearch / esm

Evolutionary Scale Modeling (esm): Pretrained language models for proteins
MIT License
3.16k stars 627 forks source link

load_model_and_alphabet_local model_name not defined #101

Closed eric-tc-wong closed 3 years ago

eric-tc-wong commented 3 years ago

Hello,

Thank you for making these wonderful models available, and congratulations on the new publication. The new update broke the code for loading local models.

Bug description

At load_model_and_alphabet_local, "model_name" is not defined.

Reproduction steps

model_dir = prepend_dir + './esm1b_t33_650M_UR50S.pt' model, alphabet = esm.pretrained.load_model_and_alphabet_local(model_dir)

Logs

/usr/local/lib/python3.7/dist-packages/esm/pretrained.py in load_model_and_alphabet_local(model_location)
     55     """ Load from local path. The regression weights need to be co-located """
     56     model_data = torch.load(model_location, map_location='cpu')
---> 57     if _has_regression_weights(model_name):
     58         regression_location = model_location[:-3] + "-contact-regression.pt"
     59         regression_data = torch.load(regression_location, map_location='cpu')

NameError: name 'model_name' is not defined
tomsercu commented 3 years ago

Thanks @eric-tc-wong for reporting this oversight!

eric-tc-wong commented 3 years ago

Hi Tom,

Thank you for fixing this so quickly. I am glad to be of help.

Best, Eric

From: Tom Sercu @.> Sent: Monday, July 12, 2021 9:35 PM To: facebookresearch/esm @.> Cc: eric-tc-wong @.>; Mention @.> Subject: Re: [facebookresearch/esm] load_model_and_alphabet_local model_name not defined (#101)

Thanks @eric-tc-wonghttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feric-tc-wong&data=04%7C01%7C%7C76d7aaf73cc44c2dc6e408d9459e6008%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637617368779824346%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=YeZ4y%2BMch1U%2BldCNKRUNMAkL2l10n4XqqT5KBP7BHYA%3D&reserved=0 for reporting this oversight!

- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ffacebookresearch%2Fesm%2Fissues%2F101%23issuecomment-878708550&data=04%7C01%7C%7C76d7aaf73cc44c2dc6e408d9459e6008%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637617368779824346%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=mP65bN7of95ZtyG5uGyNAKeeTN6KtZ2UE6Uezn5Nnug%3D&reserved=0, or unsubscribehttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAUJE3H6QEWFCP6JOKZXPIO3TXOJ2ZANCNFSM5AHQLLRA&data=04%7C01%7C%7C76d7aaf73cc44c2dc6e408d9459e6008%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637617368779834292%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=mrZoP3sqpt%2BqzJn%2F8hbk0QXuak4cXONe8b5YJcN2T68%3D&reserved=0.