Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into ci/testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda committed May 5, 2023
2 parents a6f081f + 13545c0 commit 3cde441
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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:
Expand Down Expand Up @@ -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"]
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 4 additions & 3 deletions requirements/datatype_tabular.txt
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion src/flash/core/data/base_viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 7 additions & 9 deletions src/flash/core/serve/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/flash/core/serve/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand Down
4 changes: 2 additions & 2 deletions src/flash/core/serve/dag/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion src/flash/core/serve/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down
4 changes: 2 additions & 2 deletions src/flash/core/utilities/lightning_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__
<https://jsonargparse.readthedocs.io/en/stable/#jsonargparse.core.ArgumentParser.__init__>`_.
For full details of accepted arguments see
`ArgumentParser.__init__ <https://jsonargparse.readthedocs.io/en/stable/#jsonargparse.core.ArgumentParser.__init__>`_.
"""
super().__init__(*args, parse_as_dict=parse_as_dict, **kwargs)
self.add_argument(
Expand Down
1 change: 0 additions & 1 deletion src/flash/image/classification/integrations/learn2learn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
74 changes: 41 additions & 33 deletions tests/core/serve/test_dag/test_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down Expand Up @@ -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
"""
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
"""
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 3cde441

Please sign in to comment.