esm icon indicating copy to clipboard operation
esm copied to clipboard

How do I fix the issue of "TypeError: get_batch_converter() takes 1 positional argument but 2 were given"

Open JiayuanDing100 opened this issue 3 years ago • 5 comments
trafficstars

Hi Team, When i run the command below without any coding change after cloning repo, I got the issue: python scripts/extract.py esm2_t33_650M_UR50D examples/data/some_proteins.fasta \

examples/data/some_proteins_emb_esm2 --repr_layers 0 32 33 --include mean per_tok

Issue: Downloading: "https://dl.fbaipublicfiles.com/fair-esm/regression/esm2_t33_650M_UR50D-contact-regression.pt" to /mnt/home/xxxx/.cache/torch/hub/checkpoints/esm2_t33_650M_UR50D-contact-regression.pt Transferred model to GPU Traceback (most recent call last): File "scripts/extract.py", line 136, in main(args) File "scripts/extract.py", line 77, in main dataset, collate_fn=alphabet.get_batch_converter(args.truncation_seq_length), batch_sampler=batches TypeError: get_batch_converter() takes 1 positional argument but 2 were given

Could you please point it out whether there is anything wrong? Thanks

JiayuanDing100 avatar Oct 05 '22 05:10 JiayuanDing100

Remove the parameter args.truncation_seq_length should yield the results. This is due to the un update file "./env/lib/python3.8/site-packages/esm/data.py: def get_batch_converter(self):" in your pip install esm package.

ZhiYeG avatar Oct 05 '22 23:10 ZhiYeG

Thanks for reporting this! I'll rebuild the package to incorporate all the recent changes shortly.

nikita-smetanin avatar Oct 06 '22 11:10 nikita-smetanin

I also encounter this problem and hope to be solved soon. Thanks!

HelloYiHan avatar Oct 09 '22 04:10 HelloYiHan

This is a version mismatch problem and will be fixed if you pip install the same version as you're running: git checkout v1.0.2 or pip install . from repo root.

tomsercu avatar Oct 14 '22 22:10 tomsercu

@JiayuanDing100 @HelloYiHan Sorry for the delay, please try to upgrade to the latest package version (1.0.3) from pip and check if the issue is still in place?

nikita-smetanin avatar Oct 18 '22 13:10 nikita-smetanin

It was solved by: pip install git+https://github.com/facebookresearch/esm.git

Thank you for your help!

HelloYiHan avatar Oct 24 '22 21:10 HelloYiHan