Skip to content

Instantly share code, notes, and snippets.

@mohdsanadzakirizvi
Last active September 23, 2019 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohdsanadzakirizvi/b2a1c57fafcf87a1b0b960a1fe4d58e2 to your computer and use it in GitHub Desktop.
Save mohdsanadzakirizvi/b2a1c57fafcf87a1b0b960a1fe4d58e2 to your computer and use it in GitHub Desktop.
from bert_serving.client import BertClient
# make a connection with the BERT server using it's ip address; do not give any ip if same computer
bc = BertClient(ip="SERVER_IP_HERE")
# get the embedding
embedding = bc.encode(["I love data science and analytics vidhya."])
# check the shape of embedding, it should be 1x768
print(embedding.shape)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment