Skip to content
Merged

Newdocs #1605

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: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div align="center">
div align="center">

# Avalanche: an End-to-End Library for Continual Learning
**[Avalanche Website](https://avalanche.continualai.org)** | **[Getting Started](https://avalanche.continualai.org/getting-started)** | **[Examples](https://avalanche.continualai.org/examples)** | **[Tutorial](https://avalanche.continualai.org/from-zero-to-hero-tutorial)** | **[API Doc](https://avalanche-api.continualai.org)** | **[Paper](https://arxiv.org/abs/2104.00405)** | **[Twitter](https://twitter.com/AvalancheLib)**
Expand Down
1 change: 1 addition & 0 deletions avalanche/benchmarks/scenarios/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
from .dataset_scenario import *
from .exmodel_scenario import *
from .online import *
from .supervised import *
from .validation_scenario import *
3 changes: 2 additions & 1 deletion avalanche/benchmarks/scenarios/dataset_scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
Dict,
)

from .generic_scenario import EagerCLStream, CLScenario, CLExperience, make_stream
from .generic_scenario import EagerCLStream, CLScenario, CLExperience
from ..utils import TaskAwareSupervisedClassificationDataset


Expand Down Expand Up @@ -257,4 +257,5 @@ def __iter__(
"benchmark_from_datasets",
"DatasetExperience",
"split_validation_random",
"split_validation_class_balanced",
]
7 changes: 7 additions & 0 deletions avalanche/benchmarks/scenarios/supervised.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,3 +417,10 @@ def _decorate_stream(obj: CLStream):
raise ValueError(
"Unsupported object type: must be one of {CLScenario, CLStream}"
)


__all__ = [
"class_incremental_benchmark",
"new_instances_benchmark",
"with_classes_timeline",
]
9 changes: 1 addition & 8 deletions avalanche/benchmarks/scenarios/validation_scenario.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
from typing import (
Callable,
Generator,
Generic,
List,
Sequence,
TypeVar,
Union,
Tuple,
Optional,
Iterable,
Dict,
)

import random
from avalanche.benchmarks.utils.data import AvalancheDataset
from .generic_scenario import EagerCLStream, CLScenario, CLExperience, make_stream
from .generic_scenario import EagerCLStream, CLScenario, make_stream
from .dataset_scenario import (
LazyTrainValSplitter,
DatasetExperience,
Expand Down
52 changes: 27 additions & 25 deletions docs/benchmarks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ avalanche.benchmarks
.. currentmodule:: avalanche.benchmarks.scenarios

Continual Learning Scenarios
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
----------------------------------------

| Generic definitions for scenarios, streams and experiences. All the continual learning benchmarks are specific instantiations of these concepts.

Expand Down Expand Up @@ -50,7 +50,7 @@ Streams
ClassificationStream

Experiences
"""""""""
"""""""""""""

.. autosummary::
:toctree: generated
Expand Down Expand Up @@ -210,7 +210,7 @@ Benchmarks for learning from pretrained models or multi-agent continual learning
.. currentmodule:: avalanche.benchmarks.datasets

Datasets
^^^^^^^^^^^^^^^^^^^^^^^^^^
----------------------------------------

| The **datasets** sub-module provides PyTorch dataset implementations for datasets missing from the torchvision/audio/* libraries. These datasets can also be used in a standalone way!

Expand All @@ -236,52 +236,54 @@ Datasets
torchaudio_wrapper.SpeechCommands


.. currentmodule:: avalanche.benchmarks.scenarios.deprecated.generators
.. currentmodule:: avalanche.benchmarks

Benchmark Generators
^^^^^^^^^^^^^^^^^^^^^^^^^^
| The **generators** sub-module provides a lot of functions that can be used to create a new benchmark.
| This set of functions tries to cover most common use cases (Class/Task-Incremental, Domain-Incremental, ...) but it also allows for the creation of entirely custom benchmarks (based on lists of tensors, on file lists, ...).

----------------------------------------

Generators for Class/Task/Domain-incremental benchmarks
........................................................
| The **generators** sub-module provides a lot of functions that can be used to create a new benchmark.
| This set of functions tries to cover most common use cases (Class/Task-Incremental, Domain-Incremental, ...) but it also allows for the creation of entirely custom benchmarks from AvalancheDatasets.

.. autosummary::
:toctree: generated

nc_benchmark
ni_benchmark

benchmark_from_datasets
class_incremental_benchmark
new_instances_benchmark
task_incremental_benchmark

Starting from tensor lists, file lists, PyTorch datasets
..........................................................
If you want to add attributes to experiences (such as `classes_in_this_experiences` or `task_labels`) you can use the generic decorators:

.. autosummary::
:toctree: generated

dataset_benchmark
filelist_benchmark
paths_benchmark
tensors_benchmark
with_classes_timeline
with_task_labels

Online streams where experiences are made of small minibatches:

.. autosummary::
:toctree: generated

Misc (make data-incremental, add a validation stream, ...)
..............................................................
split_online_stream
split_continuous_linear_decay_stream

| Avalanche offers utilities to adapt a previously instantiated benchmark object.
| More utilities to come!
Train/Validation splits for streams:

.. autosummary::
:toctree: generated

data_incremental_benchmark
benchmark_with_validation_stream
split_validation_class_balanced
split_validation_random


.. currentmodule:: avalanche.benchmarks.utils


Utils (Data Loading and AvalancheDataset)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--------------------------------------------------------------------------------

| The custom dataset and dataloader implementations contained in this sub-module are described in more detailed in the How-Tos about `"data loading and replay" <https://avalanche.continualai.org/how-tos/dataloading_buffers_replay>` and `"Avalanche Dataset" <https://avalanche.continualai.org/how-tos/avalanchedataset>`.


Expand Down
3 changes: 1 addition & 2 deletions docs/gitbook/from-zero-to-hero-tutorial/03_benchmarks.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,9 @@ print(f"{bm.test_stream.name} - len {len(bm.test_stream)}")

we can also split a validation stream from the training stream


```python
from avalanche.benchmarks.scenarios.dataset_scenario import benchmark_with_validation_stream

from avalanche.benchmarks.scenarios.validation_scenario import benchmark_with_validation_stream

print(f"original training samples = {len(bm.train_stream[0].dataset)}")

Expand Down
35 changes: 17 additions & 18 deletions docs/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ models
.. currentmodule:: avalanche.models

Dynamic Modules
^^^^^^^^^^^^^^^
------------------

Dynamic Modules are Pytorch modules that can be incrementally expanded
to allow architectural modifications (multi-head classifiers, progressive
Expand All @@ -28,9 +28,22 @@ networks, ...).
IncrementalClassifier
MultiHeadClassifier

Progressive Neural Networks
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Modules that implement progressive neural networks models, layers, and adapters.

.. autosummary::
:toctree: generated

PNN
PNNLayer
PNNColumn
LinearAdapter
MLPAdapter


Models
^^^^^^^^^^^^^^^^^^^^^^^
------------------

| Neural network architectures that can be used as backbones for CL experiments.

Expand All @@ -57,22 +70,8 @@ Models
ExpertGate


Progressive Neural Networks
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Modules that implement progressive neural networks models, layers, and adapters.

.. autosummary::
:toctree: generated

PNN
PNNLayer
PNNColumn
LinearAdapter
MLPAdapter


Model Wrappers and Utilities
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
------------------------------------
Wrappers and functions that add utility support to your models.

.. autosummary::
Expand All @@ -87,7 +86,7 @@ Wrappers and functions that add utility support to your models.
pytorchcv_wrapper.get_model

Dynamic optimizer utilities
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
------------------------------------

Utilities to handle optimizer's update when using dynamic architectures.
Dynamic Modules (e.g. multi-head) can change their parameters dynamically
Expand Down