clip-as-service icon indicating copy to clipboard operation
clip-as-service copied to clipboard

How to use bert-as-service with BioBERT?

Open alexferrari88 opened this issue 5 years ago • 6 comments

Prerequisites

Please fill in by replacing [ ] with [x].

System information

Some of this information can be collected via this script.

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version: 1.13.1
  • Python version: 3.7.3
  • bert-as-service version: 1.8.9
  • GPU model and memory: NVIDIA GeForce GTX 1050 -- 4GB
  • CPU model and memory: Intel Core i7-7700HQ CPU @ 2.80GHz --16GB

Description

I downloaded from here https://github.com/naver/biobert-pretrained the BioBERT pre-trained weights, then I tried to load them in bert-as-service but I have problems.

I'm using this command to start the server:

bert-serving-start -model_dir=C:\ML\BERT\uncased_L-24_H-1024_A-16 -tuned_model_dir=C:\ML\BERT\BioBERT\pubmed_pmc_470k -ckpt_name=biobert_model.ckpt -max_seq_len=NONE

Then this issue shows up:

Traceback (most recent call last): File "c:\program files\python37\lib\runpy.py", line 193, in run_module_as_main "main", mod_spec) File "c:\program files\python37\lib\runpy.py", line 85, in run_code exec(code, run_globals) File "C:\Program Files\Python37\Scripts\bert-serving-start.exe_main.py", line 9, in File "c:\program files\python37\lib\site-packages\bert_serving\server\cli_init.py", line 4, in main with BertServer(get_run_args()) as server: File "c:\program files\python37\lib\site-packages\bert_serving\server_init_.py", line 70, in init self.graph_path, self.bert_config = pool.apply(optimize_graph, (self.args,)) TypeError: cannot unpack non-iterable NoneType object

alexferrari88 avatar Apr 26 '19 07:04 alexferrari88

the same problem: File "c:\programdata\anaconda3\lib\site-packages\bert_serving\server_init_.py", line 70, in init self.graph_path, self.bert_config = pool.apply(optimize_graph, (self.args,)) TypeError: cannot unpack non-iterable NoneType object。

possible reason:the model file has been damaged the solution is:downlaod the model from the readme, change the model file

mztkenan avatar May 16 '19 03:05 mztkenan

@alexferrari88 same problem.. did you find any solution ?

MarvinMogab avatar Jun 15 '19 15:06 MarvinMogab

Facing same issue as @alexferrari88

kaustv-datta avatar Feb 26 '20 08:02 kaustv-datta

I specified the -model_dir as the directory that contained the bioBert files and also renamed them made sure the model name and config.json matched the -ckpt_name and -config_name flags. The default of -ckpt_name is 'bert_model.ckpt" and the default of config_name is "bert_config.json"

lagatorc avatar Mar 30 '20 11:03 lagatorc

I specified the -model_dir as the directory that contained the bioBert files and also renamed them made sure the model name and config.json matched the -ckpt_name and -config_name flags. The default of -ckpt_name is 'bert_model.ckpt" and the default of config_name is "bert_config.json"

And did that get it working for you?

bevankoopman avatar Nov 01 '20 22:11 bevankoopman

@bevankoopman Yes it did. I recommend using the HuggingFace transformers library to use Bert. It is more up to date with the current releases.

lagatorc avatar Nov 01 '20 23:11 lagatorc