Python has become the de-facto language for training deep neural networks, coupling a large suite of scientific computing libraries with efficient libraries for tensor computation such as PyTorch or TensorFlow. However, when models are used for inference they are typically extracted from Python as TensorFlow graphs or TorchScript programs in order to meet performance and packaging constraints. The extraction process can be time consuming, impeding fast prototyping. We show how it is possible to meet these performance and packaging constraints while performing inference in Python. In particular, we present a way of using multiple Python interpreters within a single process to achieve scalable inference and describe a new container format for models that contains both native Python code and data. This approach simplifies the model deployment story by eliminating the model extraction step, and makes it easier to integrate existing performance-enhancing Python libraries. We evaluate our design on a suite of popular PyTorch models on Github, showing how they can be packaged in our inference format, and comparing their performance to TorchScript. For larger models, our packaged Python models perform the same as TorchScript, and for smaller models where there is some Python overhead, our multi-interpreter approach ensures inference is still scalable.


翻译:Python 已成为培训深神经网络的脱facto语言, 并结合了一大套科学计算图书馆, 包括高效的智能计算图书馆, 如 PyTorrch 或 TensorFlow 。 但是, 当模型被用于推断时, 通常从 Python 中提取, 通常作为 TensorFlow 图形或 TorchScript 程序, 以满足性能和包装限制 。 提取过程可能耗时, 妨碍快速原型设计。 我们展示了如何在 Python 中执行这些性能和包装限制。 特别是, 我们展示了如何在一个过程中使用多个 Python 解释器来实现可缩放的推断, 描述包含本地 Python 代码和数据的模型的新容器格式。 这种方法通过消除模型提取步骤来简化模型部署故事, 并更容易整合现有的增强性能的 Python 图书馆。 我们仍然在 Github 上使用流行的 PyTorrch 模型的套装, 显示它们如何在更大的模型中被包装成一个更小的模型, 的模型, 并比较其性模型。

0
下载
关闭预览

相关内容

【2021新书】Python深度学习,316页pdf
专知会员服务
255+阅读 · 2021年5月21日
Keras François Chollet 《Deep Learning with Python 》, 386页pdf
专知会员服务
163+阅读 · 2019年10月12日
机器学习入门的经验与建议
专知会员服务
94+阅读 · 2019年10月10日
【电子书推荐】Data Science with Python and Dask
专知会员服务
44+阅读 · 2019年6月1日
Transferring Knowledge across Learning Processes
CreateAMind
29+阅读 · 2019年5月18日
Unsupervised Learning via Meta-Learning
CreateAMind
43+阅读 · 2019年1月3日
【论文】变分推断(Variational inference)的总结
机器学习研究会
39+阅读 · 2017年11月16日
Adversarial Variational Bayes: Unifying VAE and GAN 代码
CreateAMind
7+阅读 · 2017年10月4日
Auto-Encoding GAN
CreateAMind
7+阅读 · 2017年8月4日
Arxiv
0+阅读 · 2021年5月27日
Accelerated Methods for Deep Reinforcement Learning
Arxiv
6+阅读 · 2019年1月10日
VIP会员
相关VIP内容
【2021新书】Python深度学习,316页pdf
专知会员服务
255+阅读 · 2021年5月21日
Keras François Chollet 《Deep Learning with Python 》, 386页pdf
专知会员服务
163+阅读 · 2019年10月12日
机器学习入门的经验与建议
专知会员服务
94+阅读 · 2019年10月10日
【电子书推荐】Data Science with Python and Dask
专知会员服务
44+阅读 · 2019年6月1日
相关资讯
Transferring Knowledge across Learning Processes
CreateAMind
29+阅读 · 2019年5月18日
Unsupervised Learning via Meta-Learning
CreateAMind
43+阅读 · 2019年1月3日
【论文】变分推断(Variational inference)的总结
机器学习研究会
39+阅读 · 2017年11月16日
Adversarial Variational Bayes: Unifying VAE and GAN 代码
CreateAMind
7+阅读 · 2017年10月4日
Auto-Encoding GAN
CreateAMind
7+阅读 · 2017年8月4日
Top
微信扫码咨询专知VIP会员