Running the code in Keras 2,python3.6 occurs an attributeerror

In lesson1,when I run the following code in Jupyter notebook
vgg = Vgg16() batches = vgg.get_batches(path+'train', batch_size=batch_size) val_batches = vgg.get_batches(path+'valid', batch_size=batch_size*2) vgg.finetune(batches) vgg.fit(batches, val_batches, nb_epoch=1)

It will run into an AttributeError :

AttributeError Traceback (most recent call last)
in ()
** 2 batches = vgg.get_batches(path+‘train’, batch_size=batch_size)**
** 3 val_batches = vgg.get_batches(path+‘valid’, batch_size=batch_size*2)**
----> 4 vgg.finetune(batches)
** 5 vgg.fit(batches, val_batches, nb_epoch=1)**

~/deeplearning/fastai/lesson1/vgg16.py in finetune(self, batches)
** 176 See definition for get_batches().**
** 177 “”"**
–> 178 self.ft(batches.nb_class)
** 179 classes = list(iter(batches.class_indices)) # get a list of all the class labels**
** 180 **

AttributeError: ‘DirectoryIterator’ object has no attribute ‘nb_class’

How can I solve this problem? Thanks a lot !

In Keras 2, nb_class is renamed to num_class and nb_sample to samples.

Have a look at this link for related discussion. Keras 2 Released