Developer chat

Thanks. I’ll take your word for it as I’m a Java programmer. I would have still expected val_losses[0] to return the first element in the list even if that element is just a tuple with 1 element. I would have expected something more along the line of val_losses[-1][0]. Lol!

Pff, I’m stupid. You’re right, it’s val_losses[-1][0] that should be sent, and not val_losses[0].
Good think that values isn’t actually used in any callback.

Cool! I thought I was losing my mind :slightly_smiling_face: I’m getting the hang of this Python stuff a little.

1 Like

Hi

I’m thinking about how to implement add_datepart() as a transform. Is this being worked on? Would one require a third type of column (date_names) in TabularDataset for datetime columns before breaking them into date parts?

@ashaw, great progress on the links/anchors! Here is the updated broken links/anchors report:

https://pastebin.com/njRQuxpR

@sgugger Here’s another one I’m confused about. In the CallbackHandler for on_batch_begin, it looks like the code creates a cbs variable which it seems it is then going to use as the callbacks to iterate through but instead on the next line it iterates through self.callbacks instead and the cbs variable seems unused whatsoever anywhere?? What am I missing?

    def on_batch_begin(self, xb:Tensor, yb:Tensor, train:bool=True)->None:
        "Handle new batch `xb`,`yb`."
        self.state_dict['last_input'], self.state_dict['last_target'] = xb, yb
        self.state_dict['train'] = train
        cbs = self.callbacks if train else self.metrics + self.callbacks
        for cb in self.callbacks:
            a = cb.on_batch_begin(**self.state_dict)
            if a is not None: self.state_dict['last_input'], self.state_dict['last_target'] = a
        return self.state_dict['last_input'], self.state_dict['last_target']

Also, on_batch_begin in Callback class is declared as returning None. Should that be something like Tuple<Tensor, Tensor> ??

def on_batch_begin(self, **kwargs:Any)->None:
    "Set HP before the step is done. Returns xb, yb (which can allow us to modify the input at that step if needed)."
    pass

@stas It will be really useful if we had a magic function (or some other way) to find out up-front the GPU RAM needed for a training step…
Even better if we could automatically adjust, eg the batch-size, to consider the currently available FREE GPU RAM…

2 Likes

I would love to help work on something like this

The return type of the callbacks haven’t been updated in a long time, there’s probably something to be done there (if you want to contribute, don’t hesitate to submit a PR with the correct ones).

For your earlier question, yes it should be cbs and not self.callbacks. Thanks for flagging this, I would have lost an hour debugging the first time I tried to make it work with a metric!

1 Like

Sounds good. Glad to be of help.

@wdhorton Great, lets follow up on this on the Study Group.

After that, my next “wish” is for a “swap-out”/“swap-in” of tensors from GPU to CPU RAM, to be done inside the training loop. So tensors that are not needed at a moment could be swapped out, increasing the available space for tensors that are still in CPU RAM.
Assuming the swapping operations are not too costly, this could enable much larger models…

1 Like

OK, other than running a cron-job checking the links and anchors, now you can also do it yourself as you work on docs. @ashaw, you will find it useful in your work.

Please see the documentation here:
https://docs.fast.ai/gen_doc#Links-and-anchors

I ditched the previous script and replaced it with w3c’s linkchecker which doesn’t get blocked by github since it allows the user to configure it to run slowly.

Woohooo! Thank you for this. I’ll try to whittle down the errors more from here.

1 Like

great! if you encounter any problems with running it - let me know.

look like https://docs.fast.ai/ is down

1 Like

[very noob question] I’m trying out a few ideas for mobile-from my reads on the forums and discussions-mobilenet would be the best for my requirement.
I’ll be trying out the architecture and would like to attempt adding it to fastai.

I’ve not done this before and I’m not sure how to proceed. Any pointers will be very helpful.

Thanks!

Hi,

I have been using v1 for last 2 weeks just to understand how things work, while doing so I have encountered very rapid development ( 1.0.1 to 1.0.7 to 1.0.15, which is awesome). But I also felt a huge structural overhaul with the imports.

For example
from fastai.docs import * worked 10 days back but now it doesn't exist

from fastai.models import resnet34 worked 4 days back but now doesn't exist

from fastai.transforms import * was trying to play with the data augmentation part sgugger tweeted about; doesn't exist anymore

What surprises me is, even after rolling back to versions where things worked only 4 days back, it seems to behave weirdly off. I get ‘collections’, ‘functools’ etc in autocomplete to import from but then it throws error that it doens’t exist. Tried that thrice with fresh installation of version 1.0.7 on colab. Used the same code which worked for TSG challenge 5 days back.

If anyone can give me an overview of why this is happening and will it be soon back to normal? I’m really happy with the current structure of the library, it feels very intuitive and organized so I’m hoping it won’t change much!

GitHub had some serious issues last night and I’m expecting it’s taking a bit of time to recover. They should reappear sometime today.

1 Like

Hi there,

Of course the library has been moving quickly since its release with changes in some modules or some of the APIs, to make it better for the upcoming course. It should stabilize now that the course will begin, at least for vision (we’ll make text and tabular better as the course moves on those subjects).

As for your points:

  • fastai.docs was a bit of a hack to quickly get the datasets for the documentation notebooks, but we’ve decided to used it more broadly and put it in fastai.datasets (automatically imported when you do from fastai import *).
  • fastai.models doesn’t exist anymore because we split the models between each application (so you should look at fastai.vision.models for resnet34)
  • fastai.transforms never existed, it’s always been fastai.vision.transform.

More generally you should stick to the import recommendation:

from fastai import *
from fastai.{application} import *

where your application is either vision, text, tabular or collab. Since this is what we’ll tell people to do on the course, we’ll make sure it always works :wink:

2 Likes