Fastai v2 chat

I just saw the update on the main website and the arxiv paper on fastai v2. I’m very excited, especially for the mid-level APIs, two-way callbacks, and “refactored layer classes” thingy. The article mentioned that fastai v2 is feature complete and just lacking documentation and a youtube course, is that the current status?

How do users who have migrated to v2 feel about the current state? Do you find it stable enough relative to v1? Has it been easier to implement custom models? It seems with the mid-level APIs the code will be more flexible, and I’m really excited if that’s the case.

It’s relatively stable, (I’ve been doing all my work in v2 right now) see my comment here:

(which also answers your other questions somewhat). The study group I run shows many examples for custom models and mid-level api.

Said study group: A walk with fastai2 - Study Group and Online Lectures Megathread

I’ll also add I’m in the middle of implementing Mask RCNN, and getting the databunch working was trivial :slight_smile:

1 Like

Hi all,
One of my goals is to deploy a model to an edge device. has anyone done this with fastai v1 /v2? Is there anything specific to fastai v2 or even recent changes in pytorch that help/hinder this? (I’m not meaning using the edge device to hit a cloud endpoint for inference)

Jeremy , Sylvain : I don’t see anything in existing notebook titles - but is anything in a notebook or the upcoming book?
Community : has anyone had a try with v2 (or is it too early)?

(I’ve done a forum search for any info around things like Caffe Onnx , conversion to TF then TF lite etc - none of which I’ve learnt yet but no (recent) joy)

fastai focuses on training models, not deploying them. You have the PyTorch model at the end of your training, so you should be able to use whatever PyTorch has in store for deployment.

1 Like

My feeling is that work is advancing very well, and all the main features are already there in V2.

V2 comes with some interesting improvements, which is nice. I don’t think it’s much easier to use once you get the hang of both, but V2 should have a better learning curve, since some things are now in a more logical place. For example, callbacks are now cleaner and a bit easier to understand. (Know that I myself have so much yet to learn, so take all of this with a grain of salt.)

But don’t be fooled: it is absolutely a work in progress, and changes are relatively frequent; things that work may not work next week (although typically it’s small fixes).

This is not hopeless thanks to a nice community and very responsive developers. In particular, I think we are all here thankful to @sgugger, who seems to check out most of the forum posts and takes a rather surprising amount of time to address them.

4 Likes

fair enough. I started a post to gather what we can for those that share my interest

1 Like

I have a get_items() method that returns a list of tuples. The tuples are numpy.ndarray and string.

getters = [ItemGetter(0), ItemGetter(1)] 
tsdb = DataBlock(blocks=(TSBlock, CategoryBlock),
                   get_items=get_ts_items,
                   getters=getters,
                   splitter=RandomSplitter(seed=seed),
                   batch_tfms = batch_tfms)

In my custom show_results(x:TensorTS, y, samples, outs, ...) the arguments outs returns a list of tuples outs = [('6.0',),('2.0',)] and I need it as list of labels like this outs = ['6.0', '2.0'].

For now, I am using the detuplify() method (outs = [detuplify(o) for o in outs]) in the show_results() method. Is it considered as a hack?; and if so what is the proper way to do it?

I noticed get_preds() (called by show_results()) is using tuplify() through predit()

Yes outs is always assumed to be a tuple (maybe of length 1) since we can have one or multiple outputs in general. The basic show_results methods uses a for loop other those (as you can see in the beginning of data.core).

1 Like

I was experimenting with fastai2 on Bengali.ai competition, and I noticed that fastai2 is 2x slower than fastai1 for a similar model that I was using before, So I tried to run example notebooks from fastai v1 and v2 to make sure I’m not missing something, I modified v2 pets to run on URLs.DOGS dataset on colab same as v1 notebook, with same bs, imagesize, and same GPU from colab (Tesla T4). The result is the same fastai1 took 2:10min per epoch but fastai2 took 4:16min! Does anyone faced this issue? Potential bug? @sgugger

@vijayabhaskar are you loading everything to the GPU on transforms that you can? Same batch size? And during prediction are you sure you’re using the GPU? (Just read the batch size). Can you share your code? (For dogs)

I will study this further and reply here tomorrow, possibly share a notebook comparing the speeds. It’s very possible that I maybe doing something wrong though :slight_smile:

1 Like

I installed fastai2 , and looking through the documentation, there are tutorials (thanks for that!) Are there notebooks associated with these tutorials in the fastai2 repo that we clone or are these supposed to be typed in to new notebooks.

The documentation are notebooks :wink: look in the nbs/ folder in the fastai2 GitHub

That’s what I thought, I think I’m having trouble matching up the notebooks with the tutorials. For example the first tutorial on dev.fast.ai is “Transfer Learning in Computer Vision” but it doesn’t mention which notebook it’s been built from and I’ve been looking around to see which notebook I should load.

@mike.moloch if we take a look at the tutorials notebook (as this is what tab it is under), we can find a 22_tutorial.transfer_learning. (This can also be seen by looking at the website url itself:

http://dev.fast.ai/tutorial.transfer_learning which we can see is a notebook called “tutorial.transfer_learning” (Not denying this isn’t easy to figure out, I’ve just figured this out by exploring myself)

1 Like

Thanks Zachary, I think that’s what I was missing in my understanding! I was searching for vision in the title but should’ve realized the docs have carried the nb names over!

Thanks so much!

1 Like

I added it to the FAQ :slight_smile:

3 Likes

Hi Zachary, sorry to be a pest, but is this FAQ on the dev.fastai.com docs page or somewhere else? I’m wondering if it will show up when the docs page gets refreshed from github at somepoint.

The FAQ is included in the “read before posting here” thread (which is pinned)

https://forums.fast.ai/t/fastai-v2-read-this-before-posting-please/53517/4

@jeremy would you be open to a separate FAQ thread that’s pinned? Or perhaps renaming the thread so people know an FAQ is there

Edit: thanks Jeremy :slight_smile:

1 Like

In http://dev.fast.ai/databloc.examples, Data block examples Tutorial link is broken. It points to http://dev.fast.ai/databloc.examples (letter k missing in datablock) instead of http://dev.fast.ai/datablock_examples. The corresponding notebook is the only one that doesn’t have tutorial in its name (50_datablock_examples.ipynb) as opposed to the other tutorials notebooks. Shouldn’t be named 50_tutorial.datablock_examples.ipynb for consistency (no relation with the missing k) :slightly_smiling_face:?

1 Like