From 69a4b85260621db6eb5042a3a97c8922b7d87b92 Mon Sep 17 00:00:00 2001 From: Kushashwa Ravi Shrimali Date: Thu, 3 Mar 2022 14:38:45 +0530 Subject: [PATCH 1/3] Fix CI --- flash_examples/question_answering.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flash_examples/question_answering.py b/flash_examples/question_answering.py index 0306efe92f..abdc960b0e 100644 --- a/flash_examples/question_answering.py +++ b/flash_examples/question_answering.py @@ -14,6 +14,12 @@ from flash import Trainer from flash.core.data.utils import download_data from flash.text import QuestionAnsweringData, QuestionAnsweringTask +from flash.core.utilities.imports import example_requires + +example_requires("text") + +import nltk # noqa: E402 +nltk.download('punkt') # 1. Create the DataModule download_data("https://pl-flash-data.s3.amazonaws.com/squad_tiny.zip", "./data/") From a541c28b3a729193115dad06b63c35ee57b6f0ca Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 3 Mar 2022 09:11:19 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- flash_examples/question_answering.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/flash_examples/question_answering.py b/flash_examples/question_answering.py index abdc960b0e..c1a2306897 100644 --- a/flash_examples/question_answering.py +++ b/flash_examples/question_answering.py @@ -13,13 +13,14 @@ # limitations under the License. from flash import Trainer from flash.core.data.utils import download_data -from flash.text import QuestionAnsweringData, QuestionAnsweringTask from flash.core.utilities.imports import example_requires +from flash.text import QuestionAnsweringData, QuestionAnsweringTask example_requires("text") import nltk # noqa: E402 -nltk.download('punkt') + +nltk.download("punkt") # 1. Create the DataModule download_data("https://pl-flash-data.s3.amazonaws.com/squad_tiny.zip", "./data/") From f11b52c179bbae372484abefd6c809216caf6034 Mon Sep 17 00:00:00 2001 From: Kushashwa Ravi Shrimali Date: Thu, 3 Mar 2022 14:43:22 +0530 Subject: [PATCH 3/3] changelog entry --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56123f3133..f63aa56e74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). ### Fixed +- Fixed examples (question answering), where NLTK's `punkt` module needs to be downloaded first. ([#1215](https://github.com/PyTorchLightning/lightning-flash/pull/1215/files)) + - Fixed a bug where DDP would not work with Flash tasks ([#1182](https://github.com/PyTorchLightning/lightning-flash/pull/1182)) - Fixed DDP support for `VideoClassifier` ([#1189](https://github.com/PyTorchLightning/lightning-flash/pull/1189))