Fastai v1.2 plans (based on part2-v3 notebooks)

Now that the second part of the course v3 is over, we will port a lot of changes that were introduced in it inside the library. Below here is the roadmap for v1.2 which will contain a few breaking changes. If you see anything from the lessons that you thought would be nice to have in fastai v1.2 that’s not mentioned here and isn’t in 1.0, let us know! And if there’s things in 1.0 which you think might be incompatible with any of the ideas below, please tell us that too.

Since this information is based on part2-v3 we’re putting it in this forum. We’ll provide information in #fastai-users:fastai-dev closer to the release.


There will be one last release of v1.0, which will then live in a separate branch for bug fixes. Once we’re ready, the preparation of v1.2 will be done on master, so master will be very unstable for a while until we’ve stopped breaking everything. We expect to begin in a week or two. During initial development we’ll be doing releases as v1.1, and once it seems to be working OK we’ll do a release as v1.2. So please avoid installing any 1.1 release unless you’re interested in contributing to 1.1 development and testing (i.e. don’t expect it to work!) And stick with 1.0 until you’re ready to port your code to the new version.

New callback system

One of the highlights of v1.2.0 will be the new callback system developed in notebook 04 then refined in 9b. This will be a breaking change for anyone having custom callbacks (they’ll need to rewrite them with the new API) but shouldn’t impact most of the users.

We will use something similar to the namespaces in 11a to have tab-completion and typo-proof event names

As a consequence, DeviceDataLoader will disappear and be replaced by the cuda callback we have in 04. DataBunch.normalize will also change to use a callback behind the scenes. All callbacks will have to be rewritten, particularly MixedPrecision to use Apex utilities (we will either build a conda package for the ones we need or use the code from NVIDIA).

Data block API supercharged

The final design is still being discussed but the idea is to go toward a DataBlock class where the user provide the four essential functions needed to assemble the data (download/get the source, fetch the items, split the items, label the items) a bit like what is in the 08c data block swift notebook (which was inspired by a refactoring from @AlexisGallagher). This will be the most significant breaking change, but we think it will help a lot in making the use of the data block API smoother for everyone and its customization even easier.

For instance, this is how on the pets dataset:

class PetsData(DataBlock):
    x_cls,y_cls = ImageGetter,CategoryGetter
    def get_source(self):        return untar_data(URLs.PETS)
    def get_items(self, source): return get_image_files(source/'images')
    def split(self, items):      return random_splitter(items)
    def label(self, items):      return label_from_re(items, pat=r'/([^/]+)_\d+.jpg$')

Then you can initialize with the transforms you want and directly get a DataBunch:

data = PetsData(tfms=tfms).databunch()

Speaking of transforms…

Data augmentation

We won’t keep the current pipeline and propose a mix between:

  • transforms of single image byte tensors on the CPU with PIL
  • transforms of single image float tensors on the CPU with pytorch (i.e. similar to v1.0)
  • transforms of batches of images on the GPU once the resize is done (like in notebook 10)

Stateful Optimizer

The Stateful Optimizer of notebook 09 will be added for easy custom optimizers. The default in fastai will be to use it for AdamW, probably with a greater epsilon than PyTorch since we’ve found this helps in a lot of situations.

NLP preprocessing

We will port the fast tokenizer from notebook 11 and try to address the RAM issue a lot of you have experienced, probably with a version of TokenizeProcessor that uses temporary files.

There will also be a SentencepieceTokenizer if you have installed sentencepiece (it won’t be a dependency of the library).


Do you have an ETA on how long you think it will be before 1.2 is ready from the time you all start?

Also, would love to contribute so please let me/us know where help is needed and also if there are any specific protocols we should follow.

We expect v1.1 to be fairly stable and testable by the end of the month.
The best to help will be with testing once we have 1.1 ready to use in alpha/beta, then to update the current documentation or write tutorials explaining how to go from v1.0 to v1.2


Oh and also I’d like to include in 1.2. :slight_smile:


Is nlp transformer part of the new version? Think I saw a notebook then and it might be part of (if) the bonus lesson as also maybe audio.

Also Object Detection? :slight_smile:


Will 1.1 and 1.2 be based on Pytorch 1.1, Python 3.7 Ubuntu 18.04, CUDA 10 - with a Windows fix-up later?

Current 1.0 already works flawlessly on PyTorch 1.1 so the next versions will too.

Please note that this isn’t a thread to ask for new features (there is one for this in fastai users), it’s more if you see something that was developed in the part 2 notebooks that was cool and we forgot to include up there.

Transformer models are already built in the library, and for object detection the data collections is inside, and there is a notebook in the course repo with a RetinaNet implementation.


concerning the tokenizer: about 50% RAM can be saved by allowing tokens of uint16 when the vocab is below 64k. That is, conversion to np.int64 should be delayed to just before producing the tensor


Fantastic news! I was looking forward to some python roadmap. Thanks for your hard work, guys… :love_you_gesture:

1 Like

Jeremy, Sylvain, not sure if this if the best thread for it, but letting you know I’ve submitted a PR with an update to the audio notebook. It implements loading audio, an AudioList, transforms to crop/pad signal, convert to spectrograms & melspectrograms, and beneficial augmentations including signal shifting and google’s recent new SOTA SpecAugment augmentation. It’s a team effort from everyone in the audio thread.

It doesn’t use the in-dev new DataBunchConfig, lmk if you want me to switch it to that.


Thanks @ThomM! Could you add the missing file mentioned in the PR by @pcuenq?


I really got fond of the chaining of methods in the current DataBlock API. Inspecting the intermediate states was very useful for debugging.


Is it possible after getting past part 1 & 2 (slowly getting back into Deep learning), is it possible to contribute to V1.2

Is there any indication of the topics of the extra lecture(s) for part2 V3 and when they will be given?


Thanks a lot for this new module! Let’s try it out :smiley:

For sure! There are some people in the deep learning for audio thread working on that competition, I believe, it’s a good place to chat about it.

1 Like

Will remaining topics like transformers, object detection, audio be covered ?

1 Like

I have been wondering what happens between Jeremy skyping you asking to modularize notebooks and it is complete 3 hours later. When I try to consolidate different notebooks or python files, imports get tangled up and sometimes there are multiple versions of the same class etc.

Are there any advices or tricks?