ludwig 使用TorchServe为PyTorch训练模型的示例

oxcyiej7  于 2个月前  发布在  其他
关注(0)|答案(7)|浏览(39)

随着迁移到PyTorch,保存的模型可以使用TorchServe进行服务吗?

在示例中添加一个指导说明如何使用TorchServe来提供模型将非常有用。我建议这样做的原因是,要使用ludwig serve,需要整个库,大约是一个17GB的Docker镜像。

如果有一个轻量级的Docker镜像作为REST API来提供模型,那就太好了。

bgtovc5b

bgtovc5b1#

在0.5模型中,将使用PyTorch模型,但如果没有数据预处理和后处理,直接提供服务将不会有太大的用处。这就是为什么一方面有Ludwig serve命令,另一方面我们支持neuropod并将支持torchscript导出。torchscript(包括torchscript输出中的预处理和后处理的编译版本)最初仅适用于简单数据类型,稍后还将包括更复杂的类型,并且很可能是需要在磁盘和内存上占用最小文件大小的最高吞吐量解决方案。

无论如何,我认为可以进行一些优化,将当前图像减小到小于16gb。

oug3syen

oug3syen2#

是否有关于torchscript导出如何工作的文档?

shstlldc

shstlldc3#

@fire no there's no specific design doc, but you can look at the ludwig-docs (ludwig05 branch) https://github.com/ludwig-ai/ludwig-docs/tree/ludwig05 . In summary though, there will be a command to export a Ludwig model (that is a combination of preprocessing instructions and PyTorch saved module(s)) to torchscript. If you look in master some features already have torchscript compatible processing functions, those are used in the compiled torchscript instead of the Python dataframe-based ones.
By the way, I'm a fan of Godot! Do you plan to use Ludwig models extrated as torchscript inside it? That would be super cool.

j5fpnvbx

j5fpnvbx4#

我的梦想是使用https://github.com/V-Sekai-fire/ML_fire_juan_mosaic中概述的方法,该方法从torchscript转换的ONNX模型,然后使用directml、cuda或cpu执行推理。
当前的任务是从角色场景中推断骨骼名称。
我还希望完成其他可能不适合ludwig的任务:

  1. 自动绑定(auto rigging)https://github.com/PeizhuoLi/neural-blend-shapes
  2. 3D场景数据库搜索
  3. 基于输入和语音的逼真面部动画
  4. 匹配3D动画集的动作
zsbz8rwp

zsbz8rwp5#

我将torchscript转换为inference_modulehttps://github.com/V-Sekai-fire/ML_avatar_wellness
接下来的步骤是什么?

wydwbb8l

wydwbb8l6#

你好,@fire!我研究了一些torchscript的内容,所以可以在这里提供一些帮助。
下一步可能是检查导出的模型是否按预期工作。你可以通过创建一个包含输入的Python字典来验证这一点,其中每个键是用于模型训练的CSV列名,每个值是相应的输入。
我查看了你的仓库链接——对于文本特征,模型将期望一个长度为batch_size的字符串列表。对于数值特征,模型将期望一个Tensor。
一旦你有这个,将其传递给模型并检查输出。告诉我这进展如何——非常乐意在过程中回答你的问题。

bhmjp9jg

bhmjp9jg7#

@geoffreyangus Can you write a blog post picking a standard problem for example number digits matching, and showing how it can be converted from torchscript served and also to be ran on an onnx runtime?
I don't need image support, but I could use image support, numerical, categorical and text.
Edited. I'll separate this to a new issue.

相关问题