esm icon indicating copy to clipboard operation
esm copied to clipboard

Importing ESM2 and ESM3

Open yashaektefaie opened this issue 1 year ago • 7 comments

For benchmarking purposes I would like to import both ESM2 and ESM3 but the problem is both have the same import name "esm" so I am unable to import ESM2. How should I go about importing both? "esm" does not encompass ESM2 and ESM3, both are still separate libraries right?

yashaektefaie avatar Jun 27 '24 03:06 yashaektefaie

use different virtual env ?

tb1over avatar Jun 27 '24 13:06 tb1over

Yes beyond that I was wondering if there was a way of doing it without having to have separate ESM2 and ESM3 virtual environments? Specifically if there was plans to be able to import ESM2 models since they share the same import name

yashaektefaie avatar Jun 27 '24 13:06 yashaektefaie

🙈 I can't think of a good way around this. We'll work on a solution. But in the mean time, you might just want to run something in root of this repo like

sed -i "s/esm./esm3./g" **/*.py
sed -i "s/esm/esm3/g" pyproject.toml
mv esm esm3

and then pip install . as a workaround?

ebetica avatar Jun 27 '24 15:06 ebetica

hello developer, I want to know if I can use esm3's weight file in a esm2-based model. My teacher asked me to load esm3's weight in a previous model which uses pretrained esm2. I don't think it is plausible as they might have different model structures, right?

JonasLi-19 avatar Jul 03 '24 03:07 JonasLi-19

No, you cannot use esm3 weight file in a esm2-based model.

ebetica avatar Jul 18 '24 23:07 ebetica

Moving esm2 from fair-esm to fair-esm2 might be feasible since the repository is now frozen.

Here's what I did to my fork (on my Mac with gsed):

* mv:dir

mv ./esm ./esm2

* mv:from-imports

gsed -i "s/from esm\./from esm2\./g" **/*.py

* mv:direct-imports

gsed -i "s/import esm$/import esm2/g" **/*.py

* mv:direct-imports:non-top-level

gsed -i "s/ import esm / import esm2 /g" **/*.py

* mv:setup.py

gsed -i "s/esm/esm2/g" setup.py
gsed -i "s/esm2fold/esmfold/g" setup.py

* mv:module-renames::[esm\.]->[/esm2\.]

gsed -i "s/esm\./esm2\./g" **/*.py

* mv:from-imports:2

gsed -i "s/from esm import /from esm2 import /g" **/*.py

* fix:readme

gsed -i "s/import esm$/import esm2/g" **/*.md

YaoYinYing avatar Feb 19 '25 09:02 YaoYinYing

Hi, everyone! I want to know if there is a more elegant solution?

Mistletoe-git avatar Apr 09 '25 02:04 Mistletoe-git