Autogluon: Error on demo code execution -- in get_dataset if '.rec' in path: TypeError: argument of type 'NoneType' is not iterable

Created on 15 Jan 2020  路  6Comments  路  Source: awslabs/autogluon

The following code yields an error. I'm using a Conda environment with Python 3.6 because it is required for the ConfigSpace Python package.

import autogluon as ag
from autogluon import ImageClassification as task

# Load a toy image dataset:
filename = ag.download('http://autogluon-hackathon.s3-website-us-west-2.amazonaws.com/data.zip')
ag.unzip(filename)
dataset = task.Dataset(train_path='data/train')

# Fit classification models:
classifier = task.fit(dataset, epochs=2)

# Evaluate predictions on test data:

test_dataset = task.Dataset('data/test', train=False)
test_acc = classifier.evaluate(test_dataset)

This also gives the error:

from autogluon import ImageClassification as task
dataset = task.Dataset(train_path='data/train',
                       test_path='data/test')
classifier = task.fit(dataset,
                      net=ag.space.Categorical('ResNet50_v1b', 'ResNet18_v1b'),
                      time_limits=None,
                      # ngpus_per_trial=1,
                      num_trials = 4)
image = 'data/test/BabyShirt/BabyShirt_323.jpg'
ind, prob = classifier.predict(image)

The error:

scheduler: FIFOScheduler(
DistributedResourceManager{
(Remote: Remote REMOTE_ID: 0, 
        <Remote: 'inproc://172.18.30.18/28461/1' processes=1 threads=4, memory=7.28 GB>, Resource: NodeResourceManager(4 CPUs, 0 GPUs))
})

Starting Experiments
Num of Finished Tasks is 0
Num of Pending Tasks is 4
 25%|鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枌                                                                | 1/4 [00:00<00:00,  8.97it/s]Process Process-2:
Traceback (most recent call last):
  File "/home/z/anaconda3/envs/IC2/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/home/z/anaconda3/envs/IC2/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/home/z/anaconda3/envs/IC2/lib/python3.6/site-packages/autogluon/scheduler/scheduler.py", line 125, in _worker
    ret = fn(**kwargs)
  File "/home/z/anaconda3/envs/IC2/lib/python3.6/site-packages/autogluon/core/decorator.py", line 52, in __call__
    args = sample_config(args, new_config)
  File "/home/z/anaconda3/envs/IC2/lib/python3.6/site-packages/autogluon/core/decorator.py", line 38, in sample_config
    args_dict[k] = v.init()
  File "/home/z/anaconda3/envs/IC2/lib/python3.6/site-packages/autogluon/core/space.py", line 110, in init
    return self.sample(**config)
  File "/home/z/anaconda3/envs/IC2/lib/python3.6/site-packages/autogluon/core/decorator.py", line 185, in sample
    return self.func(*self.args, **kwargs)
  File "/home/z/anaconda3/envs/IC2/lib/python3.6/site-packages/autogluon/task/image_classification/dataset.py", line 108, in get_dataset
    if '.rec' in path:
TypeError: argument of type 'NoneType' is not iterable

bug todo vision

Most helpful comment

@UNIcodeX The problem is that you used the wrong argument name train_path instead of the correct path arg in task.Dataset.

I found it's actually due to the wrong documentation. To avoid similar problems in the future, I filed a PR to fix the docstrings: https://github.com/awslabs/autogluon/pull/436

All 6 comments

@zhanghang1989 Could you respond to this issue?

I believe this issue has been resolved.
Could you try the newest tutorial?

https://autogluon.mxnet.io/tutorials/image_classification/beginner.html

the error still there with the latest tutorial.

@zhreshold Could you take a look at this?

@UNIcodeX The problem is that you used the wrong argument name train_path instead of the correct path arg in task.Dataset.

I found it's actually due to the wrong documentation. To avoid similar problems in the future, I filed a PR to fix the docstrings: https://github.com/awslabs/autogluon/pull/436

@zhreshold LMAO! Alright thanks!

Was this page helpful?
0 / 5 - 0 ratings