klasocki commited on
Commit
b2a5e86
1 Parent(s): c33d981

Fix the dockerfile for now?

Browse files

Breaks cache layers, after all using setup.py not the best idea?
We need the whole project to pip install .
properly, but then we copy it in Dockerfile too early

Dockerfile CHANGED
@@ -13,17 +13,16 @@ ENV PYTHONUNBUFFERED=1
13
  RUN python -m venv venv
14
  ENV PATH="$HOME/comma-fixer/venv/bin:$PATH"
15
 
16
- COPY --chown=user setup.py .
 
17
  RUN pip install --upgrade pip
18
  RUN pip install --no-cache-dir --upgrade .
19
 
20
  # This pre-downloads models and tokenizers
21
- COPY --chown=user commafixer/src/ commafixer/src/
22
  RUN python commafixer/src/baseline.py
23
  RUN python commafixer/src/fixer.py
24
 
25
- COPY --chown=user . .
26
-
27
  FROM base as test
28
 
29
  RUN pip install .[test]
 
13
  RUN python -m venv venv
14
  ENV PATH="$HOME/comma-fixer/venv/bin:$PATH"
15
 
16
+ # TODO use requirements after all, since for setup.py to work properly we need the whole source code which breaks cache
17
+ COPY --chown=user . .
18
  RUN pip install --upgrade pip
19
  RUN pip install --no-cache-dir --upgrade .
20
 
21
  # This pre-downloads models and tokenizers
22
+ # TODO should we give user an option to provide local models so that they don't donwload each time?
23
  RUN python commafixer/src/baseline.py
24
  RUN python commafixer/src/fixer.py
25
 
 
 
26
  FROM base as test
27
 
28
  RUN pip install .[test]
app.py CHANGED
@@ -1,8 +1,8 @@
1
- from os.path import realpath
2
  import uvicorn
3
  from fastapi import FastAPI
4
  from fastapi.responses import FileResponse
5
  from fastapi.staticfiles import StaticFiles
 
6
 
7
  from commafixer.routers import baseline, fixer
8
 
 
 
1
  import uvicorn
2
  from fastapi import FastAPI
3
  from fastapi.responses import FileResponse
4
  from fastapi.staticfiles import StaticFiles
5
+ from os.path import realpath
6
 
7
  from commafixer.routers import baseline, fixer
8
 
commafixer/routers/baseline.py CHANGED
@@ -2,7 +2,7 @@ from fastapi import APIRouter
2
  import logging
3
 
4
  from commafixer.src.baseline import BaselineCommaFixer
5
- from common import fix_commas_request_handler
6
 
7
  logger = logging.Logger(__name__)
8
  logging.basicConfig(level=logging.INFO)
 
2
  import logging
3
 
4
  from commafixer.src.baseline import BaselineCommaFixer
5
+ from commafixer.routers.common import fix_commas_request_handler
6
 
7
  logger = logging.Logger(__name__)
8
  logging.basicConfig(level=logging.INFO)
commafixer/routers/common.py CHANGED
@@ -1,7 +1,7 @@
1
  from fastapi import HTTPException
2
  from logging import Logger
3
 
4
- from comma_fixer_interface import CommaFixerInterface
5
 
6
 
7
  def fix_commas_request_handler(
 
1
  from fastapi import HTTPException
2
  from logging import Logger
3
 
4
+ from commafixer.src.comma_fixer_interface import CommaFixerInterface
5
 
6
 
7
  def fix_commas_request_handler(
commafixer/routers/fixer.py CHANGED
@@ -1,4 +1,4 @@
1
- from fastapi import APIRouter, HTTPException
2
  import logging
3
 
4
  from commafixer.src.fixer import CommaFixer
 
1
+ from fastapi import APIRouter
2
  import logging
3
 
4
  from commafixer.src.fixer import CommaFixer
commafixer/src/baseline.py CHANGED
@@ -1,7 +1,7 @@
1
  from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline, NerPipeline
2
  import re
3
 
4
- from comma_fixer_interface import CommaFixerInterface
5
 
6
 
7
  class BaselineCommaFixer(CommaFixerInterface):
 
1
  from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline, NerPipeline
2
  import re
3
 
4
+ from commafixer.src.comma_fixer_interface import CommaFixerInterface
5
 
6
 
7
  class BaselineCommaFixer(CommaFixerInterface):
commafixer/src/fixer.py CHANGED
@@ -3,7 +3,7 @@ from transformers import AutoTokenizer, AutoModelForTokenClassification, Roberta
3
  import nltk
4
  import re
5
 
6
- from comma_fixer_interface import CommaFixerInterface
7
 
8
 
9
  class CommaFixer(CommaFixerInterface):
 
3
  import nltk
4
  import re
5
 
6
+ from commafixer.src.comma_fixer_interface import CommaFixerInterface
7
 
8
 
9
  class CommaFixer(CommaFixerInterface):
notebooks/finetuning_commafixer_with_LoRa.ipynb CHANGED
The diff for this file is too large to render. See raw diff