Skip to content

Apply tensorflow 2.0's v1 compatibility layer so the code works with TF2.#615

Open
mmohaveri wants to merge 1 commit intojina-ai:mainfrom
mmohaveri:master
Open

Apply tensorflow 2.0's v1 compatibility layer so the code works with TF2.#615
mmohaveri wants to merge 1 commit intojina-ai:mainfrom
mmohaveri:master

Conversation

@mmohaveri
Copy link
Copy Markdown

The current master does not work with Tensorflow 2.0 because it's using a set of deprecated APIs.
This PR will replace those deprecated APIs with the ones from "tf.compat.v1".

@AndreaSottana
Copy link
Copy Markdown

Hi @mmohaveri
I have tried using your code. However, tf is not able to build the graph correctly, at least for me.
I have downloaded the BER model, I then open a terminal and run the following
bert-serving-start -model_dir=/d/Users/[...]/uncased_L-12_H-768_A-12 -cpu

But I then get the following error

Traceback (most recent call last):
  File "D:\Users\[...]\venv38\Scripts\bert-serving-start-script.py", line 33, in <module>
    sys.exit(load_entry_point('bert-serving-server', 'console_scripts', 'bert-serving-start')())
  File "d:\users\[...]\bert-as-service\server\bert_serving\server\cli\__init__.py", line 8, in main
    with BertServer(get_run_args()) as server:
  File "d:\users\[...]\bert-as-service\server\bert_serving\server\__init__.py", line 75, in __init__
    self.graph_path, self.bert_config = pool.apply(optimize_graph, (self.args,))
TypeError: cannot unpack non-iterable NoneType object

even though the Bert model is there. Any idea what might be going wrong?

@Akila-Ayanthi
Copy link
Copy Markdown

@AndreaSottana were you able to get it to work?

@Akila-Ayanthi
Copy link
Copy Markdown

Akila-Ayanthi commented Apr 14, 2021

@mmohaveri How do you run BAS from the source code?

@AndreaSottana
Copy link
Copy Markdown

@Akila-Ayanthi No I didn't, I suspect the original code from hanxiao:master (last commit August 2020) is not
regularly maintained and something might have broken due to version issues.
I am using this very good alternative though, to integrate BERT with ElasticSearch https://github.com/UKPLab/sentence-transformers/blob/master/examples/applications/semantic-search/semantic_search_quora_elasticsearch.py

@Akila-Ayanthi
Copy link
Copy Markdown

@AndreaSottana Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants