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/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..34269f63bc 100644 --- a/tests/core/serve/test_dag/test_order.py +++ b/tests/core/serve/test_dag/test_order.py @@ -43,8 +43,7 @@ def test_avoid_broker_nodes(abcde): b0 b1 b2 - | \ / - a0 a1 + | \ / a0 a1 a0 should be run before a1 """ @@ -288,11 +287,7 @@ def test_prefer_short_dependents(abcde): def test_run_smaller_sections(abcde): r"""Testing structure. - aa - / | - b d bb dd - / \ /| | / - a c e cc + 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,12 +374,9 @@ def _(*args): def test_nearest_neighbor(abcde): r"""Testing structure. - a1 a2 a3 a4 a5 a6 a7 a8 a9 - \ | / \ | / \ | / \ | / - b1 b2 b3 b4 + 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. + Want to finish off a local group before moving on. This is difficult because all groups are connected. """ a, b, c, _, _ = abcde a1, a2, a3, a4, a5, a6, a7, a8, a9 = (a + i for i in "123456789") @@ -512,14 +504,9 @@ def test_prefer_short_ancestor(abcde): def test_map_overlap(abcde): r"""Testing structure. - b1 b3 b5. + b1 b3 b5. - |\ / | \ / | - c1 c2 c3 c4 c5 - |/ | \ | / | \| - d1 d2 d3 d4 d5 - | | | - e1 e2 e5 + |\ / | \ / | c1 c2 c3 c4 c5 |/ | \ | / | \| d1 d2 d3 d4 d5 | | | e1 e2 e5 Want to finish b1 before we start on e5 """ @@ -667,29 +654,14 @@ 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 + 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. - After computing b3, three "better" paths become available. - Confirm that we take the better paths before continuing down `a` path. + 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. After computing b3, three "better" paths become available. Confirm that we take the better paths + before continuing down `a` path. - This test is pretty specific to how `order` is implemented - and is intended to increase code coverage. + This test is pretty specific to how `order` is implemented and is intended to increase code coverage. """ a, b, c, d, e = abcde dsk = {