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

Add available outputs method #1206

Merged
merged 2 commits into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all 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: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

- Added the normalization parameters of ```torchvision.transforms.Normalize``` as ```transform_kwargs``` in the ```ImageClassificationInputTransform``` ([#1178](https://github.com/PyTorchLightning/lightning-flash/pull/1178))

- Added `available_outputs` method to the `Task` ([#1206](https://github.com/PyTorchLightning/lightning-flash/pull/1206))

### Changed

### Deprecated
Expand Down
18 changes: 18 additions & 0 deletions flash/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,24 @@ def available_finetuning_strategies(cls) -> List[str]:
return []
return registry.available_keys()

@classmethod
def available_outputs(cls) -> List[str]:
"""Returns the list of available outputs (that can be used during prediction or serving) for this ``Task``.

Examples
________

..testsetup::

>>> from flash import Task

.. doctest::

>>> print(Task.available_outputs())
['preds', 'raw']
"""
return cls.outputs.available_keys()

def get_num_training_steps(self) -> int:
"""Total training steps inferred from datamodule and devices."""
if not getattr(self, "trainer", None):
Expand Down