BioGPT icon indicating copy to clipboard operation
BioGPT copied to clipboard

Error when executig

Open Dontmindmes opened this issue 2 years ago • 5 comments

File "C:\Users\Gilgamesh\Documents\Advanced A.I\Bio\BioGPT\bio.py", line 3, in m = TransformerLanguageModel.from_pretrained( File "C:\Python310\lib\site-packages\fairseq\models\fairseq_model.py", line 275, in from_pretrained return hub_utils.GeneratorHubInterface(x["args"], x["task"], x["models"]) File "C:\Python310\lib\site-packages\fairseq\hub_utils.py", line 108, in init self.bpe = encoders.build_bpe(cfg.bpe) File "C:\Python310\lib\site-packages\fairseq\registry.py", line 61, in build_x return builder(cfg, *extra_args, **extra_kwargs) File "C:\Python310\lib\site-packages\fairseq\data\encoders\fastbpe.py", line 27, in init self.bpe = fastBPE.fastBPE(codes) AttributeError: module 'fastBPE' has no attribute 'fastBPE'

I get this error when running this code

import torch from fairseq.models.transformer_lm import TransformerLanguageModel m = TransformerLanguageModel.from_pretrained( "checkpoints", "checkpoint.pt", "data", tokenizer='moses', bpe='fastbpe', bpe_codes="data/BioGPT", min_len=100, max_len_b=1024) m.cuda() src_tokens = m.encode("COVID-19 is") generate = m.generate([src_tokens], beam=5)[0] output = m.decode(generate[0]["tokens"]) print(output)

Dontmindmes avatar Feb 23 '23 07:02 Dontmindmes

Do you have fastBPE installed? If not, try installing it:

pip install fastBPE

sydrawat01 avatar Feb 23 '23 19:02 sydrawat01

I had the same issue. this is how i fixed it:

git clone https://github.com/glample/fastBPE.git
export FASTBPE=${PWD}/fastBPE
cd fastBPE
g++ -std=c++11 -pthread -O3 fastBPE/main.cc -IfastBPE -o fast
python3 setup.py install # new

this installs the python api of fastBPE source: https://github.com/glample/fastBPE

Larsdegroot avatar Mar 23 '23 10:03 Larsdegroot

I have the same problem, did you solve it?

ZON-ZONG-MIN avatar Apr 10 '23 13:04 ZON-ZONG-MIN

I had the same issue. this is how i fixed it:

git clone https://github.com/glample/fastBPE.git
export FASTBPE=${PWD}/fastBPE
cd fastBPE
g++ -std=c++11 -pthread -O3 fastBPE/main.cc -IfastBPE -o fast
python3 setup.py install # new

this installs the python api of fastBPE source: https://github.com/glample/fastBPE

It works! Thank you!

Wiz123456 avatar Apr 16 '23 14:04 Wiz123456

I had the same issue. this is how i fixed it:

git clone https://github.com/glample/fastBPE.git
export FASTBPE=${PWD}/fastBPE
cd fastBPE
g++ -std=c++11 -pthread -O3 fastBPE/main.cc -IfastBPE -o fast
python3 setup.py install # new

this installs the python api of fastBPE source: https://github.com/glample/fastBPE

this didn't work for me. do you have any other suggestions?

TaniyaHaghighi20 avatar Jun 25 '23 14:06 TaniyaHaghighi20