diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index b445fa15c3..712469e88b 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -99,7 +99,7 @@ jobs: env: TORCH_URL: https://download.pytorch.org/whl/cpu/torch_stable.html run: | - python -m pip install "pip==21.3.1" + python -m pip install "pip==22.2.1" pip install numpy Cython "torch>=1.7.1" -f $TORCH_URL pip install .[$EXTRAS,test] --upgrade --prefer-binary -f $TORCH_URL # FixMe: this shall be one line command diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 607efa3931..7e63f80f90 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -36,7 +36,7 @@ repos: - id: detect-private-key - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.3.2 hooks: - id: pyupgrade args: [--py37-plus] @@ -48,7 +48,7 @@ repos: - id: nbstripout - repo: https://github.com/PyCQA/docformatter - rev: v1.5.1 + rev: v1.6.5 hooks: - id: docformatter args: @@ -77,7 +77,7 @@ repos: - "--skip-errors" - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.260 + rev: v0.0.264 hooks: - id: ruff args: ["--fix"] diff --git a/examples/integrations/learn2learn/image_classification_imagenette_mini.py b/examples/integrations/learn2learn/image_classification_imagenette_mini.py index ba84184174..b4d8603ef1 100644 --- a/examples/integrations/learn2learn/image_classification_imagenette_mini.py +++ b/examples/integrations/learn2learn/image_classification_imagenette_mini.py @@ -13,7 +13,6 @@ # limitations under the License. # adapted from https://github.com/learnables/learn2learn/blob/master/examples/vision/protonet_miniimagenet.py#L154 - """## Train file https://www.dropbox.com/s/9g8c6w345s2ek03/mini-imagenet-cache-train.pkl?dl=1 ## Validation File diff --git a/requirements.txt b/requirements.txt index 306bff45da..abd2335164 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,4 +12,4 @@ jsonargparse[signatures] >=3.17.0, <=4.9.0 click >=7.1.2, <=8.1.3 protobuf <=3.20.1 fsspec[http] >=2022.5.0,<=2022.7.1 -lightning-utilities >=0.4.1 +lightning-utilities >=0.3.0 diff --git a/requirements/datatype_tabular.txt b/requirements/datatype_tabular.txt index bcc224b3b6..c6783ce109 100644 --- a/requirements/datatype_tabular.txt +++ b/requirements/datatype_tabular.txt @@ -1,7 +1,8 @@ # NOTE: all pins for latest are for CI consistency unless it is `strict`, then it is also forced in setup scikit-learn <=1.2.0 -pytorch-forecasting >0.9.0, <=0.10.3 -pytorch-tabular >=0.7.0, <0.8.0 # strict -torchmetrics <0.8.0 # pytorch-tabular pins PL so we force a compatible TM version +pytorch-forecasting >=0.9.0, <=0.10.3 +# pytorch-tabular >=1.0.2, <1.0.3 # pending requirements resolving +https://github.com/Lightning-Sandbox/pytorch_tabular/archive/refs/heads/req/replace.zip +torchmetrics >=0.10.0 omegaconf <=2.1.1, <=2.1.1 diff --git a/src/flash/core/data/base_viz.py b/src/flash/core/data/base_viz.py index 3d4f7d5922..9f8c90cae7 100644 --- a/src/flash/core/data/base_viz.py +++ b/src/flash/core/data/base_viz.py @@ -13,7 +13,7 @@ # limitations under the License. from typing import Any, Dict, List, Set, Tuple -from lightning_utilities.core.overrides import is_overridden +from pytorch_lightning.utilities.model_helpers import is_overridden from flash.core.data.callback import BaseDataFetcher from flash.core.data.utils import _CALLBACK_FUNCS diff --git a/src/flash/core/serve/component.py b/src/flash/core/serve/component.py index 2c7dad8e77..d7c6a9ee92 100644 --- a/src/flash/core/serve/component.py +++ b/src/flash/core/serve/component.py @@ -196,15 +196,13 @@ def __call__(cls, *args, **kwargs): class ModelComponent(metaclass=FlashServeMeta): """Represents a computation which is decorated by `@expose`. - A component is how we represent the main unit of work; it is a set of - evaluations which involve some input being passed through some set of - functions to generate some set of outputs. - - To specify a component, we record things like: its name, source file - assets, configuration args, model source assets, etc. The - specification must be YAML serializable and loadable to/from a fully - initialized instance. It must contain the minimal set of information - necessary to find and initialize its dependencies (assets) and itself. + A component is how we represent the main unit of work; it is a set of evaluations which involve some input being + passed through some set of functions to generate some set of outputs. + + To specify a component, we record things like: its name, source file assets, configuration args, model source + assets, etc. The specification must be YAML serializable and loadable to/from a fully initialized instance. It + must contain the minimal set of information necessary to find and initialize its dependencies (assets) and + itself. """ _flashserve_meta_: Optional[Union[BoundMeta, UnboundMeta]] = None diff --git a/src/flash/core/serve/core.py b/src/flash/core/serve/core.py index 06447f9aa9..6ebe5bb415 100644 --- a/src/flash/core/serve/core.py +++ b/src/flash/core/serve/core.py @@ -206,7 +206,7 @@ def __str__(self): return f"{self.component_uid}.{self.position}.{self.name}" def __terminate_invalid_connection_request(self, other: "Parameter", dunder_meth_called: str) -> None: - """verify that components can be composed. + """Verify that components can be composed. Parameters ---------- diff --git a/src/flash/core/serve/dag/task.py b/src/flash/core/serve/dag/task.py index d1bb72c4f7..d1903d8819 100644 --- a/src/flash/core/serve/dag/task.py +++ b/src/flash/core/serve/dag/task.py @@ -28,8 +28,8 @@ def ishashable(x): def istask(x): - """Is x a runnable task? - A task is a tuple with a callable first argument + """Is x a runnable task? A task is a tuple with a callable first argument. + Examples -------- >>> istask((inc, 1)) diff --git a/src/flash/core/serve/utils.py b/src/flash/core/serve/utils.py index afb709b912..472493e47c 100644 --- a/src/flash/core/serve/utils.py +++ b/src/flash/core/serve/utils.py @@ -6,7 +6,7 @@ def fn_outputs_to_keyed_map(serialize_fn_out_keys, fn_output) -> Dict[str, Any]: - """convert outputs of a function to a dict of `{result_name: values}` + """Convert outputs of a function to a dict of `{result_name: values}` accepts function outputs which are sequence, dict, or object. """ diff --git a/src/flash/core/utilities/lightning_cli.py b/src/flash/core/utilities/lightning_cli.py index 1d89796a1c..864e047642 100644 --- a/src/flash/core/utilities/lightning_cli.py +++ b/src/flash/core/utilities/lightning_cli.py @@ -63,8 +63,8 @@ class LightningArgumentParser(ArgumentParser): def __init__(self, *args: Any, parse_as_dict: bool = True, **kwargs: Any) -> None: """Initialize argument parser that supports configuration file input. - For full details of accepted arguments see `ArgumentParser.__init__ - `_. + For full details of accepted arguments see + `ArgumentParser.__init__ `_. """ super().__init__(*args, parse_as_dict=parse_as_dict, **kwargs) self.add_argument( diff --git a/src/flash/image/classification/integrations/learn2learn.py b/src/flash/image/classification/integrations/learn2learn.py index bdeb9f3096..8912a66a37 100644 --- a/src/flash/image/classification/integrations/learn2learn.py +++ b/src/flash/image/classification/integrations/learn2learn.py @@ -11,7 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - """ Note: This file will be deleted once https://github.com/learnables/learn2learn/pull/257/files is merged within Learn2Learn. diff --git a/tests/core/serve/test_dag/test_order.py b/tests/core/serve/test_dag/test_order.py index 49f9bd5408..3ede55d64b 100644 --- a/tests/core/serve/test_dag/test_order.py +++ b/tests/core/serve/test_dag/test_order.py @@ -41,10 +41,11 @@ def test_ordering_keeps_groups_together(abcde): def test_avoid_broker_nodes(abcde): r"""Testing structure. - b0 b1 b2 + Example:: - | \ / - a0 a1 + b0 b1 b2 + | \ / + a0 a1 a0 should be run before a1 """ @@ -288,11 +289,13 @@ def test_prefer_short_dependents(abcde): def test_run_smaller_sections(abcde): r"""Testing structure. - aa - / | - b d bb dd - / \ /| | / - a c e cc + Example:: + + aa + / | + b d bb dd + / \ /| | / + a c e cc Prefer to run acb first because then we can get that out of the way """ @@ -379,9 +382,11 @@ def _(*args): def test_nearest_neighbor(abcde): r"""Testing structure. - a1 a2 a3 a4 a5 a6 a7 a8 a9 - \ | / \ | / \ | / \ | / - b1 b2 b3 b4 + Example:: + + a1 a2 a3 a4 a5 a6 a7 a8 a9 + \ | / \ | / \ | / \ | / + b1 b2 b3 b4 Want to finish off a local group before moving on. This is difficult because all groups are connected. @@ -512,14 +517,15 @@ def test_prefer_short_ancestor(abcde): def test_map_overlap(abcde): r"""Testing structure. - b1 b3 b5. + Example:: - |\ / | \ / | - c1 c2 c3 c4 c5 - |/ | \ | / | \| - d1 d2 d3 d4 d5 - | | | - e1 e2 e5 + b1 b3 b5. + |\ / | \ / | + c1 c2 c3 c4 c5 + |/ | \ | / | \| + d1 d2 d3 d4 d5 + | | | + e1 e2 e5 Want to finish b1 before we start on e5 """ @@ -667,21 +673,23 @@ def test_order_empty(): def test_switching_dependents(abcde): r"""Testing structure. - a7 a8 <-- do these last - | / - a6 e6 - | / - a5 c5 d5 e5 - | | / / - a4 c4 d4 e4 - | \ | / / - a3 b3---/ - | - a2 - | - a1 - | - a0 <-- start here + Example:: + + a7 a8 <-- do these last + | / + a6 e6 + | / + a5 c5 d5 e5 + | | / / + a4 c4 d4 e4 + | \ | / / + a3 b3---/ + | + a2 + | + a1 + | + a0 <-- start here Test that we are able to switch to better dependents. In this graph, we expect to start at a0. To compute a4, we need to compute b3.