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

Upgrade Pillow and nltk for vulnerability reasons #989

Merged
merged 4 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ COPY vespa .
RUN mvn clean package

# Stage 2: Base image for Python setup
FROM marqoai/marqo-base:30 as base_image
FROM marqoai/marqo-base:33 as base_image

# Allow mounting volume containing data and configs for vespa
VOLUME /opt/vespa/var
Expand Down
4 changes: 2 additions & 2 deletions requirements.dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ huggingface-hub==0.25.0
more_itertools
boto3==1.25.4
botocore==1.28.4
nltk==3.7
nltk==3.9.1
torch==1.12.1
torchvision==0.13.1
Pillow==9.3.0
Pillow==10.4.0
numpy==1.23.4
validators==0.20.0
sentence-transformers==2.2.2
Expand Down
6 changes: 6 additions & 0 deletions src/marqo/s2_inference/processing/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ def _splitting_functions(split_by: str, language: str='english') -> FunctionType
except LookupError:
nltk.download("punkt")

# Punkt_tab needs to be downloaded after NLTK 3.8 and later
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this doing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is needed in the text split. Previously it was downloaded along with "punkt" but now we need to download it explicitly after the upgrade.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An error will be raised if we do not do this downloading

try:
nltk.data.find("tokenizers/punkt_tab")
except LookupError:
nltk.download("punkt_tab")

MAPPING = {
'character':list,
'word': partial(word_tokenize, language=language),
Expand Down
2 changes: 1 addition & 1 deletion src/marqo/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "2.12.1"
__version__ = "2.12.2"

def get_version() -> str:
return f"{__version__}"
Loading