curiousily / Deploy-BERT-for-Sentiment-Analysis-with-FastAPI

Deploy BERT for Sentiment Analysis as REST API using FastAPI, Transformers by Hugging Face and PyTorch

Home Page:https://www.curiousily.com/posts/deploy-bert-for-sentiment-analysis-as-rest-api-using-pytorch-transformers-by-hugging-face-and-fastapi/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pretrained model requires `assets` folder creation

Querela opened this issue · comments

bin/download_model
Downloading...
From: https://drive.google.com/uc?id=1V8itWtowCYnb2Bc9KlK9SxGff9WwmogA
To: /home/koerner/work/test/Deploy-BERT-for-Sentiment-Analysis-with-FastAPI/assets/model_state_dict.bin
Traceback (most recent call last):
  File "./bin/download_model", line 4, in <module>
    gdown.download(
  File "/home/koerner/work/test/Deploy-BERT-for-Sentiment-Analysis-with-FastAPI/venv/lib/python3.8/site-packages/gdown/download.py", line 153, in download
    f = open(tmp_file, "wb")
FileNotFoundError: [Errno 2] No such file or directory: 'assets/model_state_dict.bin09kxowvvtmp'

Solution, add this to the script, to just create the folder if it does not exist:

from pathlib import Path

Path("assets").mkdir(exist_ok=True)