Fastai: A Layered API for Deep Learning
31–40 of 43 posts
Re: Fastai: A Layered API for Deep Learning
#32https://www.fast.ai/2020/02/13/fastai-A-Layered-API-for-Deep...
Re: Fastai: A Layered API for Deep Learning
#33But my main issue with it is the code formatting (https://docs.fast.ai/dev/style.html#layout). Maybe I am too used to PEP-8 and black (https://github.com/psf/black) formatted code, but honestly I cannot stand the code format.
Re: Fastai: A Layered API for Deep Learning
#34Re: Fastai: A Layered API for Deep Learning
#35I really like the fastai abstractions and their attention to detail. Also their callbacks are amazing. I always look at their implementations for inspiration. But my main issue with it is the code formatting ( https://docs.fast.ai/dev/style.html#layout ). Maybe I am too used to PEP-8 and black ( https://github.com/psf/black ) formatted code, but honestly I cannot stand the code format.
Aim to align statement parts that are conceptually similar. It allows the reader to quickly see how they’re different. E.g. in this code it’s immediately clear that the two parts call the same code with different parameter orders.
That'd turn something like this: class OneClass:
def __init__(self, a, b1, b2, c_long):
self.a = a
self.b1 = b1
self.b2 = b2
self.c_long = c_long
Into this: class OneClass:
def __init__(self, a, b1, b2, c_long):
self.a = a
self.b1 = b1
self.b2 = b2
self.c_long = c_long
(maybe not the greatest example, there are places where this helps much more)The others all are un-pythonic and make the code more unreadable.
Re: Fastai: A Layered API for Deep Learning
#36Nice to see our paper on HN! FYI the paper covers v2, which is a from-scratch rewrite that introduces a new layered API. There are quite a few comments here pointing out (quite correctly!) that v1 was not at all easy to hack on. We've spent the last couple of years fixing that. Have a look at the paper to see what mean - especially the "mid-layer API".
I've recently begun to experiment with nbdev. Really like the concept.
Re: Fastai: A Layered API for Deep Learning
#37My small complaint is that there seems to be no backwards compatibility whatsoever between fastai versions. I get it that it is supposed to be working on the very bleeding edge of deep learning technologies, but at the same time it is sold as "practical". At least I would be slightly uncomfortable doing anything in production with a library that is all but guaranteed to get no (compatible) development love whatsoever…
So instead we'll be maintaining fastai v1 as a separate branch and accepting PRs as long as people are using it. But v2 is designed to leverage a lot of the new ideas that have come up in the last couple of years, both in our research, and more widely.
Re: Fastai: A Layered API for Deep Learning
#38I really like the fastai abstractions and their attention to detail. Also their callbacks are amazing. I always look at their implementations for inspiration. But my main issue with it is the code formatting ( https://docs.fast.ai/dev/style.html#layout ). Maybe I am too used to PEP-8 and black ( https://github.com/psf/black ) formatted code, but honestly I cannot stand the code format.
Ufff that's rough to read. Totally. The only one I agree with is the one that says: Aim to align statement parts that are conceptually similar. It allows the reader to quickly see how they’re different. E.g. in this code it’s immediately clear that the two parts call the same code with different parameter orders. That'd turn something like this: class OneClass: def __init__(self, a, b1, b2, c_long): self.a = a self.b…
Re: Fastai: A Layered API for Deep Learning
#39I really like the fastai abstractions and their attention to detail. Also their callbacks are amazing. I always look at their implementations for inspiration. But my main issue with it is the code formatting ( https://docs.fast.ai/dev/style.html#layout ). Maybe I am too used to PEP-8 and black ( https://github.com/psf/black ) formatted code, but honestly I cannot stand the code format.
Ufff that's rough to read. Totally. The only one I agree with is the one that says: Aim to align statement parts that are conceptually similar. It allows the reader to quickly see how they’re different. E.g. in this code it’s immediately clear that the two parts call the same code with different parameter orders. That'd turn something like this: class OneClass: def __init__(self, a, b1, b2, c_long): self.a = a self.b…
But it only makes the code unreadable if you don't make a tiny effort to adjust. If you do make the effort, there's some great payoff, like this code:
try:
self._split(b); self('begin_batch')
self.pred = self.model(*self.xb); self('after_pred')
if len(self.yb) == 0: return
self.loss = self.loss_func(self.pred, *self.yb); self('after_loss')
if not self.training: return
self.loss.backward(); self('after_backward')
self.opt.step(); self('after_step')
self.opt.zero_grad()
except CancelBatchException: self('after_cancel_batch')
finally: self('after_batch')
That's the inner part of the training loop. You can see at a glance: what steps are in the loop; what callbacks are in the loop, in what order; what step corresponds to each callback. And you can see the whole training loop at once, which is great for getting a clear picture of what's going on.Re: Fastai: A Layered API for Deep Learning
#40I really like the fastai abstractions and their attention to detail. Also their callbacks are amazing. I always look at their implementations for inspiration. But my main issue with it is the code formatting ( https://docs.fast.ai/dev/style.html#layout ). Maybe I am too used to PEP-8 and black ( https://github.com/psf/black ) formatted code, but honestly I cannot stand the code format.