Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

115
Views
Encoding sentences with Setenece BERT's model in FastAPI changes the result from the results with Jupyter and python scripts

System

  • macbook pro
  • OSX 10.15.5(Catalina)
  • Docker version 19.03.12, build 48a66213fe

Library

  • uvicorn==0.11.8
  • fastapi==0.61.0
  • torch==1.6.0
  • transformers==3.0.2
  • sentence-transformers==0.3.2
  • scikit-learn==0.20.0
  • scipy==1.4.1
  • pandas==0.23.4
  • jupyter==1.0.0

Detail

I used Colaboratory to fine-tune Setence BERT and save that model. Then I went local and built an environment with Docker that included jupyter and FastAPI, and in that environment I was able to confirm that the model I saved with Jupyter, launched in Docker, returned the same estimation results as in the Collaboratory. When I used that model, I got different results when I used FastAPI started in the same Docker environment as Jupyter. All the text entered in this flow is the same.

The analysis showed that the SentenceTransformer loaded the model and then encoded it, and found that it calculated completely different embedding.

Thanks to your advice.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

sorry, I use Japanese model but I forgat translate default BertTokenizer to BertJapaneseTokenizer.

Change default Tokenizer fixed this problem.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!