Who uses pytorch and fastai for production?

Hi guys,

I’ve recently come accross this post from Brandon Rohrer on Linkedin.

The post:

Based on how a neural network framework is written, you can infer the target audience.
TensorFlow: ML engineer building production systems
PyTorch: ML researcher submitting papers
fastai: ML student who wants SOTA results quickly
Cottonwood: ML student who wants to understand NNs
You can tell a tool’s focus not by what it makes possible, but by what it makes easy.

While I have used fastai and pytorch for Kaggle competition, I live in an area of the world where these is close to no demand yet for deep learning, so I can’t vouch for production. Anybody out there using either fastai or pytorch in production (besides the two majors Tesla and Microsoft ?) ?

4 Likes

I remember one time Jeremy said Github use fast.ai. Maybe pytorch and fastai are not quite popular yet in the production but you can easily convert the pytorch model to ONNX - a universal model format - and run it with the framework you like . I haven’t tested with many but converted successfully the fast.ai resnet model

2 Likes

Hi @dhoa, do you have some particular resources/notebooks to recommend in order to learn how to convert fastai models to ONNX format?

Thanks!
Sebastien

2 Likes

Example as below for the resnet34 with fastai version 1, after you finish training your model.

import torch
import torchvision
dummy_input = torch.randn(1, 3, 224, 224, device='cuda')
onnx_path =  "./model.onnx"
torch.onnx.export(learn.model, dummy_input, onnx_path, verbose=False)
print('Model exported to ' + onnx_path)

Then you will get the .onnx model.

The disadvantage of this approach is you have to rewrite the preprocessing (crop to a squared image, …) because now your environment don’t have torch anymore, with numpy maybe.

5 Likes

And I disagree saying fastai is for ML student who wants SOTA results quickly. As you see, there are so many ML expert in this forum. Comparing like that is similar to criticizing python over C++ because of its limitation (slow, use more memory), but with Python, we can save a lot of time for writing code.

1 Like

Hi !

Thank you for your answers. Don’t get me wrong, I think there is a lot of potential for production, I’m just curious whether industry is actually shifting towards pytorch or not at all.

I guess my concern is, not being a researcher, I wonder whether I should start learning tensorflow. So far I’ve focused on pytorch/fastai exclusively, but if industry doesn’t want to move for historical reasons (saw that Jersey Governor asking for COBOL programmers for maintaining their unemployment system ?), I won’t make it far in the interviews (I know Jeremy said you can move from a framework to another quickly if you understand the concepts, but good luck convincing the recruiter, especially in France ! )

Anybody else ?

1 Like

The choice of the framework may definitely play a role to an extent. But companies and teams would be more interested in the kind of projects we have worked on, our presentation skills and much more. When people say they use TensorFlow in production, it is often they use Keras. Which is a framework much like fastai. So focus on building interesting projects that you care about and keep presenting them in the right places. Once you are comfortable with that, a good company will understand that you would be able to do the same with any other framework.

2 Likes

Plenty of people use PyTorch in industry, you don’t have to learn TensorFlow if you don’t want to. For example I work at Compass (real estate company) and as far as I know all of our computer vision work is done in PyTorch (I think some of our researchers also use fastai on top).

5 Likes

I think it’s a dumb thing to say, they’re probably just trying to be provocative - but there’s also a grain of truth to it. The company where I work used to use Tensorflow and we moved to PyTorch.

We don’t do much with vision, so some of us started with fastai which was a really nice way to learn and get used to everything, we ended up converting to plain PyTorch for production - no strong reason for this though, we’re just more familiar with it. I’m doing some image similarity work right now, and I’m going to try and do it with fastai v2 to see how it holds up.

One thing to be wary of with fastai for production is the rate of change and issues with backwards compatibility. I’ve often built models only to upgrade fastai and find that several pieces of the API have changed. This generally doesn’t happen with other packages, but there’s obvious advantages to unapologetically re-factoring the library, you don’t end up with a load of technical debt.

You can work around the fast changing API simply by keeping track of the version of the package it was built on, though this would get very tedious when you have lots of projects all working from slightly different versions of an API. Most applications that I’ve built I can go back to years later and update to the latest and there’s usually only 1 or 2 minor things that have been deprecated. This is not true with fastai.

3 Likes

I like stackshare for this type of info. You’re able to see what companies use what stack. I believe it’s reported by the companies though so it’s not going to be the most up to date.

Here’s the ML page: https://stackshare.io/machine-learning-tools
Pytorch page: https://stackshare.io/pytorch#stacks

2 Likes

I do (NLP work at UC San Diego)

I’m pretty sure this is the stack for DeOldify (PyTorch/FastAI)

2 Likes

A lot of great answers here. Thanks a lot @safekidda for your detailed answer. And thank you @Raymond-Wu; I think that settles my personnal debate. I’ll keep pushing on pytorch/fastai instead and try to be awesome with those instead of staying mediocre and becoming mediocre at tensorflow as well ^^

You definitely don’t need to learn Tensorflow.

2 Likes