Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Dependency Issues #112

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
__pycache__
.pytest_cache/
.DS_Store
.idea/

# Anserini index
anserini/
Expand All @@ -22,3 +23,7 @@ variables/
# client builds
build/
static/

# virtual environments
venv/
env/
30 changes: 30 additions & 0 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM ubuntu:20.04

RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository ppa:openjdk-r/ppa && \
apt-get update && \
apt-get install -y openjdk-11-jdk && \
apt-get install -y openjdk-11-jre

RUN apt-get install -y --no-install-recommends git

WORKDIR /server
COPY . /server/


RUN apt update && apt install -y python3-pip
RUN pip3 install --upgrade pip setuptools

RUN pip3 install --pre torch torchvision torchaudio -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
RUN pip3 install faiss-cpu hnswlib
RUN pip3 install hnswlib

RUN pip3 install --upgrade pip && pip3 install -r requirements.txt
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENV DEVELOPMENT=True

EXPOSE 8000

CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
6 changes: 3 additions & 3 deletions api/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from app.routers import related, search
from app.services.highlighter import Highlighter
from app.services.ranker import Ranker
from app.services.related_searcher import RelatedSearcher
# from app.services.related_searcher import RelatedSearcher
from app.services.searcher import Searcher
from app.settings import settings

Expand All @@ -21,8 +21,8 @@
if settings.neural_ranking:
app.state.ranker = Ranker()

if settings.related_search:
app.state.related_searcher = RelatedSearcher()
# if settings.related_search:
# app.state.related_searcher = RelatedSearcher()

app.state.searcher = Searcher()

Expand Down
8 changes: 8 additions & 0 deletions api/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

name: docker
channels:
- conda-forge
- pytorch
dependencies:
- pytorch-cpu
- torchvision-cpu
5 changes: 2 additions & 3 deletions api/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ fastapi[all]==0.52.0
freezegun==0.3.15
hnswlib==0.3.4
httpx==0.12.1
git+https://[email protected]/castorini/pygaggle.git@818a2487cb7af8ecdd63
git+https://[email protected]/castorini/pygaggle.git@2bb2f0eb9cc34ac626ffb7648b73b4695468eba7
python-dotenv==0.12.0
pytest==5.4.1
pytest-mock==3.1.0
torch==1.8.1
pytest-mock==3.1.0
4 changes: 2 additions & 2 deletions api/schema/acl.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"default": "...",
"fieldSize": "single"
},
"abstract_html": {
"abstract": {
"type": "str",
"default": "None",
"fieldSize": "single"
},
"authors": {
"author": {
"type": "List[str]",
"default": "[]",
"fieldSize": "multi"
Expand Down
Empty file added client/Dockerfile
Empty file.
Loading