jina-ai / clip-as-service

🏄 Scalable embedding, reasoning, ranking for images and sentences with CLIP
https://clip-as-service.jina.ai
Other
12.39k stars 2.07k forks source link

How to use bert-as-service with BioBERT? #330

Open alexferrari88 opened 5 years ago

alexferrari88 commented 5 years ago

Prerequisites

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

System information

Some of this information can be collected via this script.


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

mztkenan commented 5 years ago

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

MarvinMogab commented 5 years ago

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

kaustv-datta commented 4 years ago

Facing same issue as @alexferrari88

lagatorc commented 4 years ago

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"

bevankoopman commented 3 years ago

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?

lagatorc commented 3 years ago

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