ContinualAI / avalanche

Avalanche: an End-to-End Library for Continual Learning based on PyTorch.
http://avalanche.continualai.org
MIT License
1.71k stars 280 forks source link

ImportError benchmark_from_datasets #1649

Closed blmussati closed 2 weeks ago

blmussati commented 1 month ago

šŸ› Describe the bug In Benchmark Generators section of notebooks/from-zero-to-hero-tutorial/03_benchmarks.ipynb the function benchmark_from_datasets is called to create streams from a list of datasets. In a normal .py file, the import from avalanche.benchmarks.scenarios.dataset_scenario import benchmark_from_datasets fails and the function cannot be used.

šŸœ To Reproduce

from avalanche.benchmarks.scenarios.dataset_scenario import benchmark_from_datasets

datadir = default_dataset_location('mnist')
train_MNIST = as_classification_dataset(MNIST(datadir, train=True, download=True))
test_MNIST = as_classification_dataset(MNIST(datadir, train=False, download=True))

datadir = default_dataset_location('cifar10')
train_CIFAR10 = as_classification_dataset(CIFAR10(datadir, train=True, download=True))
test_CIFAR10 = as_classification_dataset(CIFAR10(datadir, train=False, download=True))

bm = benchmark_from_datasets(
    train=[train_MNIST, train_CIFAR10],
    test=[test_MNIST, test_CIFAR10]
)

šŸ Expected behavior The function being correctly imported.

šŸž Screenshots

from avalanche.benchmarks.scenarios.dataset_scenario import benchmark_from_datasets
ImportError: cannot import name 'benchmark_from_datasets' from 'avalanche.benchmarks.scenarios.dataset_scenario' (/opt/anaconda3/envs/avalanche/lib/python3.7/site-packages/avalanche/benchmarks/scenarios/dataset_scenario.py)

Indeed, the file does not contain the function benchmark_from_datasets.

šŸ¦‹ Additional context Working with avalanche-lib 0.4.0

AntonioCarta commented 2 weeks ago

HI, this is working with the last version. Notebooks are always updated to the last version.