Path from research to production

Jeremy_Tavrisov: <p>I’m looking to potentially transition from TF2.0 to using pytorch for a variety of reasons but before I do (and before I pitch this idea to the group) I need to sort out some potential sticking points, the main one being the production side.</p>
<p>I would like to do all of my development and testing in python then deploy to use in C++. The use case is as follows</p>
<p>Windows standalone application running 1 or more models in inference in C++ built using MSVC. Data is opencv Mats for input to the model and output. Models are usually segmentation models (so same shape in and out) or object detection models (or instance models likes Mask-RCNN).</p>
<p>What would be the best path with this currently. I see alot of ways forward with libtorch, torchscript, ONNX to Azure stuff, ONNX to Caffe2. I have gotten confused at this point.</p>
<p>I want the simplest way with good Windows support. Tensorflow has been a headache with a lack of C++ documentation and little to no windows support (breaks constantly with releases).</p>
<p>I also want something that’s fast and scalable. In the future I might be running distributed, cloud, mixed precision, TensorRT etc.</p>
<p>It’s a fairly small codebase and team so API stability isn’t super critical.</p>

ptrblck: <p>You could script our models and load the scripted models in libtorch (the C++ frontend) for your inference part. Just to make sure your workload is exportable, you could try to script a few similar models, to the ones you are using with your team, and perform the inference in C++.</p>
<p>To use TensorRT, you would have to go through ONNX. <a href="https://devblogs.nvidia.com/how-to-deploy-real-time-text-to-speech-applications-on-gpus-using-tensorrt/">This blog post</a> might give you some ideas about the current workflow.</p>

Jeremy_Tavrisov: <p>So using pytorch directly via it’s C++ frontend is the recommended way for production rather than using ONNX and something else (caffe2 for instance). I just remember when I first heard of caffe2 at some GTC it was more production focused.</p>
<p>Have there been any issue with windows support with the C++ frontend? Tensorflow has been killing me with that for years.</p>
<p>Thank you</p>

vladium: <aside class="quote no-group" data-username="Jeremy_Tavrisov" data-post="3" data-topic="82602">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/jeremy_tavrisov/48/12132_2.png" class="avatar"> Jeremy_Tavrisov:</div>
<blockquote>
<p>So using pytorch directly via it’s C++ frontend is the recommended way for production rather than using ONNX and something else (caffe2 for instance).</p>
</blockquote>
</aside>
<p>Today, after caffe2 has been merged into pytorch repo and for someone who’s not used old-school caffe2, what would be the difference between “<em>pytorch directly via its C++ frontend</em>” and “<em>caffe2</em>”?</p>

vladium: <aside class="quote no-group" data-username="Jeremy_Tavrisov" data-post="3" data-topic="82602">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/jeremy_tavrisov/48/12132_2.png" class="avatar"> Jeremy_Tavrisov:</div>
<blockquote>
<p>I just remember when I first heard of caffe2 at some GTC it was more production focused.</p>
</blockquote>
</aside>
<p>If there is an open-source platform that FB uses for their production, it would be <em>precisely</em> what I’d want to use for my production, too. The use cases are obviously similar.</p>

Jeremy_Tavrisov: <p>Didn’t realize that caffe2 was merged into pytorch. Probably should have looked into after not hearing anything about it for years.</p>

vladium: <p>Deprecation warnings are all over <a href="https://caffe2.ai" rel="nofollow noopener">https://caffe2.ai</a> And there is the announcement at <a href="https://caffe2.ai/blog/2018/05/02/Caffe2_PyTorch_1_0.html" rel="nofollow noopener">https://caffe2.ai/blog/2018/05/02/Caffe2_PyTorch_1_0.html</a></p>