I am a mlsys engineer who mainly provides server support for the nlp-related model for the company. In the nlp-related business scenario, we found that tvm can provide superior tensor computing performance, so we intend to promote tvm applications within the company.
Motivation:
In addition to Tensor computing, we want to integrate more data processing operations with tvm relay to provide end-to-end solutions.
Currently, TVM already provides data type support such as String/Array/Map at the Runtime level, but there is no corresponding interface at the relay ir, and we sincerely hope to provide corresponding support at the ir level.
Example
This is an example of a dictionary lookup that converts a text sequence into an id array and then do model inference. To Implement this function, we may need to support String/List/Map and some of its actions at the relay level.
py_vocab = {"hello": 0}
def term2idx():
vocab = tvm.runtime.container.Map(py_vocab)
terms = relay.var("terms", relay.ListType(relay.StringType()))
idxes = relay.lookup(vocab, terms) # lookup is a op
return relay.Function([terms], idxes, ret_type=relay.ListType(relay.scalar_type("int32")))
Other Application
Converting PyTorch models also requires these data structure, for example:
Roadmap
We want to do this in three stages:
- Add String IR types and support easy operation of String
- Add Array IR types and support easy operation of Array
- Add MapIR types and support easy operation of Map
Currently we have written a demo to increase the String type, hoping to get community support and feedback, and if possible, merge into tvm master, which can reduce branch maintenance costs here.
PR LINK: https://github.com/apache/incubator-tvm/pull/6242
Good day!