ContinualAI / ContinualAI/avalanche

benchmark_with_validation stream removes attribute 'task_labels'

Open
#1,632 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
2.1k
Forks
321
PR merge metrics
No merged PRs in 30d

Description

🐛 **Describe the bug**
A clear and concise description of what the bug is.
I use benchmark_with_validation stream to get the train_stream and valid_stream. when I use the strategy training , the train_stream or valid_stream don't have attribute 'task_labels'.

"AttributeError: 'DatasetExperience' object has no attribute 'task_labels'"

I check the issue is that the generated streams( train_stream and valid_stream) belong to the EagerCLStream while the test_steam belongs to the NCStream. I infer that the EagerCLStream don't have the attribute 'task_labels'. So the training process cannot be executed.

🐜 **To Reproduce**

```
scenario = SplitCIFAR100(
n_experiences=10, # 10 incremental experiences
return_task_id=True, # add task labels
seed=1,
shuffle=True
)

scenario = benchmark_with_validation_stream(scenario, validation_size=0.25)
train_stream = scenario.train_stream
valid_stream = scenario.valid_stream
test_stream = scenario.test_stream

strategy = EWC(
model=model,
optimizer=optimizer,
criterion=criterion,
train_mb_size=64,
train_epochs=appr_args['epochs_max'],
eval_mb_size=64,
device=device,
evaluator=eval_plugin,
ewc_lambda=0.4,
eval_every=1,
plugins=[lr_scheduler_p]
)

# train and test loop
for train_task in train_stream:
strategy.train(train_task) << error is here

```

🐝 **Expected behavior**
A clear and concise description of what you expected to happen.

strategy.train(train_task) can be performed successfully

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.