Error when executig
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)
Do you have fastBPE installed? If not, try installing it:
pip install fastBPE
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
I have the same problem, did you solve it?
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 # newthis installs the python api of fastBPE source: https://github.com/glample/fastBPE
It works! Thank you!
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 # newthis installs the python api of fastBPE source: https://github.com/glample/fastBPE
this didn't work for me. do you have any other suggestions?