Unknown error that didn't arise before in this code
See original GitHub issueHi
I reinstalled the Kashgari lib, as you said in our previous issue, but! the code, that I didn’t rewrite start to fall down with errors. For example:
from kashgari.utils.logger import init_logger
init_logger()
from kashgari.tasks.seq_labeling import BLSTMCRFModel
from kashgari.embeddings import BERTEmbedding
from kashgari.tasks.classification import BLSTMModel `
ModuleNotFoundError Traceback (most recent call last) <ipython-input-2-5618b970895b> in <module> ----> 1 from kashgari.utils.logger import init_logger 2 init_logger() 3 4 from kashgari.tasks.seq_labeling import BLSTMCRFModel 5 from kashgari.embeddings import BERTEmbedding
ModuleNotFoundError: No module named ‘kashgari.utils.logger’; ‘kashgari.utils’ is not a package
But the most weird is that:
folder = 'multi_cased_L-12_H-768_A-12'
`download_url = ‘/home/karina/bert/multi_cased_L-12_H-768_A-12.zip’
print('Unpacking model...')
zip_path = '{}.zip'.format(folder)
!test -d $folder || (tar xvzf '/home/karina/bert/multi_cased_L-12_H-768_A-12.zip')
config_path = folder+'/bert_config.json'
checkpoint_path = folder+'/bert_model.ckpt'
vocab_path = folder+'/vocab.txt'
Unpacking model…
from kashgari.embeddings import BERTEmbedding
#embedding = BERTEmbedding('rubert_cased_L-12_H-768_A-12_v1', 200)
embedding = BERTEmbedding('multi_cased_L-12_H-768_A-12', 200)
ValueError Traceback (most recent call last) <ipython-input-48-0fecd0409dd5> in <module> 1 from kashgari.embeddings import BERTEmbedding 2 #embedding = BERTEmbedding(‘rubert_cased_L-12_H-768_A-12_v1’, 200) ----> 3 embedding = BERTEmbedding(‘multi_cased_L-12_H-768_A-12’, 200)
/usr/local/lib/python3.7/site-packages/kashgari/embeddings/bert_embedding.py in init(self, model_folder, layer_nums, trainable, task, sequence_length, processor, from_saved_model) 71 embedding_size=0, 72 processor=processor, —> 73 from_saved_model=from_saved_model) 74 75 self.processor.token_pad = ‘[PAD]’
/usr/local/lib/python3.7/site-packages/kashgari/embeddings/base_embedding.py in init(self, task, sequence_length, embedding_size, processor, from_saved_model) 75 self.processor = LabelingProcessor() 76 else: —> 77 raise ValueError() 78 else: 79 self.processor = processor
ValueError:
Can you advise me something about that?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
For your second question. It is because there is a small typo at your code.
kashgari-tf no longer provide the
init_logger
function. Remove that line and add your own logger for logs will fix this issue.