xuuuluuu / SynLSTM-for-NER

Code and models for the paper titled "Better Feature Integration for Named Entity Recognition", NAACL 2021.
30 stars 2 forks source link

context embeddings error #5

Closed karimmahalian closed 2 years ago

karimmahalian commented 2 years ago

Hi,

Thank u for sharing ur code with us. I tried to run this command

bert-serving-start -pooling_layer -7 -model_dir cased_L-24_H-1024_A-16 -max_seq_len=NONE -cased_tokenization -num_worker=8 -port=8888 -pooling_strategy=NONE -cpu -show_tokens_to_client

but I got this error

self.graph_path, self.bert_config = pool.apply(optimize_graph, (self.args,)) TypeError: cannot unpack non-iterable NoneType object

Any ideas plz? thank u

xuuuluuu commented 2 years ago

Hi, this is the error from bert-as-service. May I check if you have successfully installed the bert-as-service package? Do you have more details of the error?

karimmahalian commented 2 years ago

Hi,

First thank u for ur quick reply. Yes, the bert-as-service package was installed successfully.

Here are more details about the error

Screen Shot 2022-07-27 at 6 49 00 AM

Many thanks in advance!

allanj commented 2 years ago

Hi @karimmahalian , I happen to reproduce your error. I think that's caused by the TensorFlow version issue.

image

I tried installing tensorflow == 1.13.1, then running the command you show should work:

image
karimmahalian commented 2 years ago

Hi

I think I am confused. Do we have to download cased_L-24_H-1024_A-16 here is an error I ve missed

tensorflow.python.framework.errors_impl.NotFoundError: cased_L-24_H-1024_A-16/bert_config.json; No such file or directory

Thanks

allanj commented 2 years ago

Yes, it seems you have to

wget https://storage.googleapis.com/bert_models/2018_10_18/cased_L-24_H-1024_A-16.zip

I downloaded from the google BERT repo (https://github.com/google-research/bert#pre-trained-models)

karimmahalian commented 2 years ago

Yesss, it works now. However, it tooks a lot of time to be executed. I ve changed Bert large by Bert basic but still the same issue. Could u plz tell me how to run it on GPU instead of CPU?

Screen Shot 2022-07-28 at 6 42 59 AM

I really appreciate the time u offer to help run the code. Thank u!

allanj commented 2 years ago

I'm not the main maintainer, but looking at the document in the "bert-as-service" (https://github.com/llSourcell/bert-as-service)

It seems the default is GPU?

image

May be you can try specify the device_map=[0]

allanj commented 2 years ago

Oh, I saw your command here:

bert-serving-start -pooling_layer -7 -model_dir cased_L-24_H-1024_A-16 -max_seq_len=NONE -cased_tokenization -num_worker=8 -port=8888 -pooling_strategy=NONE -cpu -show_tokens_to_client

You explicitly specify cpu, please remove that argument and it will run on GPU.

karimmahalian commented 2 years ago

Yes, u re right I didn t pay attention to it. Thank u