@@ -50,15 +50,14 @@ class DataNode : public Object {
5050 */
5151 virtual ObjectRef GetEmbedding (Model model, ObjectRef* dst = nullptr , int offset = 0 ) const = 0;
5252
53- static constexpr const char * _type_key = " mlc.serve.Data" ;
5453 static constexpr const bool _type_has_method_sequal_reduce = false ;
5554 static constexpr const bool _type_has_method_shash_reduce = false ;
56- TVM_DECLARE_BASE_OBJECT_INFO ( DataNode, Object);
55+ TVM_FFI_DECLARE_OBJECT_INFO ( " mlc.serve.Data " , DataNode, Object);
5756};
5857
5958class Data : public ObjectRef {
6059 public:
61- TVM_DEFINE_OBJECT_REF_METHODS (Data, ObjectRef, DataNode);
60+ TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE (Data, ObjectRef, DataNode);
6261};
6362
6463/* ! \brief Split the given data array into two arrays at the "split_pos" position. */
@@ -76,15 +75,14 @@ class TextDataNode : public DataNode {
7675 int GetLength () const final ;
7776 ObjectRef GetEmbedding (Model model, ObjectRef* dst = nullptr , int offset = 0 ) const final ;
7877
79- static constexpr const char * _type_key = " mlc.serve.TextData" ;
80- TVM_DECLARE_BASE_OBJECT_INFO (TextDataNode, DataNode);
78+ TVM_FFI_DECLARE_OBJECT_INFO (" mlc.serve.TextData" , TextDataNode, DataNode);
8179};
8280
8381class TextData : public Data {
8482 public:
8583 explicit TextData (String text);
8684
87- TVM_DEFINE_OBJECT_REF_METHODS (TextData, Data, TextDataNode);
85+ TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE (TextData, Data, TextDataNode);
8886};
8987
9088/* ***************** TokenDataNode ******************/
@@ -98,8 +96,7 @@ class TokenDataNode : public DataNode {
9896 int GetLength () const final ;
9997 ObjectRef GetEmbedding (Model model, ObjectRef* dst = nullptr , int offset = 0 ) const final ;
10098
101- static constexpr const char * _type_key = " mlc.serve.TokenData" ;
102- TVM_DECLARE_BASE_OBJECT_INFO (TokenDataNode, DataNode);
99+ TVM_FFI_DECLARE_OBJECT_INFO (" mlc.serve.TokenData" , TokenDataNode, DataNode);
103100};
104101
105102class TokenData : public Data {
@@ -108,7 +105,7 @@ class TokenData : public Data {
108105
109106 explicit TokenData (std::vector<int32_t > token_ids);
110107
111- TVM_DEFINE_OBJECT_REF_METHODS (TokenData, Data, TokenDataNode);
108+ TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE (TokenData, Data, TokenDataNode);
112109};
113110
114111/* ***************** ImageDataNode ******************/
@@ -123,15 +120,14 @@ class ImageDataNode : public DataNode {
123120 int GetLength () const final ;
124121 ObjectRef GetEmbedding (Model model, ObjectRef* dst = nullptr , int offset = 0 ) const final ;
125122
126- static constexpr const char * _type_key = " mlc.serve.ImageData" ;
127- TVM_DECLARE_BASE_OBJECT_INFO (ImageDataNode, DataNode);
123+ TVM_FFI_DECLARE_OBJECT_INFO (" mlc.serve.ImageData" , ImageDataNode, DataNode);
128124};
129125
130126class ImageData : public Data {
131127 public:
132128 explicit ImageData (Tensor image, int embed_size);
133129
134- TVM_DEFINE_OBJECT_REF_METHODS (ImageData, Data, ImageDataNode);
130+ TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE (ImageData, Data, ImageDataNode);
135131};
136132
137133/* ***************** SampleResult ******************/
@@ -201,10 +197,10 @@ class RequestStreamOutputObj : public Object {
201197
202198 std::atomic<bool > unpacked = false ;
203199
204- static constexpr const char * _type_key = " mlc.serve.RequestStreamOutput" ;
205200 static constexpr const bool _type_has_method_sequal_reduce = false ;
206201 static constexpr const bool _type_has_method_shash_reduce = false ;
207- TVM_DECLARE_FINAL_OBJECT_INFO (RequestStreamOutputObj, Object);
202+ static constexpr const bool _type_mutable = true ;
203+ TVM_FFI_DECLARE_OBJECT_INFO (" mlc.serve.RequestStreamOutput" , RequestStreamOutputObj, Object);
208204};
209205
210206/* !
@@ -221,7 +217,8 @@ class RequestStreamOutput : public ObjectRef {
221217
222218 static RequestStreamOutput Usage (String request_id, String request_final_usage_json_str);
223219
224- TVM_DEFINE_MUTABLE_OBJECT_REF_METHODS (RequestStreamOutput, ObjectRef, RequestStreamOutputObj);
220+ TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE (RequestStreamOutput, ObjectRef,
221+ RequestStreamOutputObj);
225222};
226223
227224} // namespace serve
0 commit comments