File tree Expand file tree Collapse file tree 10 files changed +525393
-4
lines changed Expand file tree Collapse file tree 10 files changed +525393
-4
lines changed Original file line number Diff line number Diff line change @@ -44,13 +44,16 @@ file(GLOB TENSORRT_CORE_SRCS ${CMAKE_SOURCE_DIR}/lite/trt/core/*.cpp)
44
44
file (GLOB TENSORRT_CV_SRCS ${CMAKE_SOURCE_DIR} /lite/trt/cv/*.cpp)
45
45
file (GLOB TENSORRT_NLP_SRCS ${CMAKE_SOURCE_DIR} /lite/trt/nlp/*.cpp)
46
46
file (GLOB TENSORRT_ASR_SRCS ${CMAKE_SOURCE_DIR} /lite/trt/asr/*.cpp)
47
+ file (GLOB TENSORRT_SD_SRCS ${CMAKE_SOURCE_DIR} /lite/trt/sd/*.cpp)
48
+
47
49
# 2. glob headers files
48
50
file (GLOB TENSORRT_CORE_HEAD ${CMAKE_SOURCE_DIR} /lite/trt/core/*.h)
49
51
file (GLOB TENSORRT_CV_HEAD ${CMAKE_SOURCE_DIR} /lite/trt/cv/*.h)
50
52
file (GLOB TENSORRT_NLP_HEAD ${CMAKE_SOURCE_DIR} /lite/trt/nlp/*.h)
51
53
file (GLOB TENSORRT_ASR_HEAD ${CMAKE_SOURCE_DIR} /lite/trt/asr/*.h)
54
+ file (GLOB TENSORRT_SD_HEAD ${CMAKE_SOURCE_DIR} /lite/trt/sd/*.h)
52
55
53
- set (TRT_SRCS ${TENSORRT_CV_SRCS} ${TENSORRT_NLP_SRCS} ${TENSORRT_ASR_SRCS} ${TENSORRT_CORE_SRCS} )
56
+ set (TRT_SRCS ${TENSORRT_CV_SRCS} ${TENSORRT_NLP_SRCS} ${TENSORRT_ASR_SRCS} ${TENSORRT_CORE_SRCS} ${TENSORRT_SD_SRCS} )
54
57
# 3. copy
55
58
message ("[Lite.AI.Toolkit][I] Installing Lite.AI.ToolKit Headers for TensorRT Backend ..." )
56
59
# "INSTALL" can copy all files from the list to the specified path.
@@ -59,3 +62,5 @@ file(INSTALL ${TENSORRT_CORE_HEAD} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/l
59
62
file (INSTALL ${TENSORRT_CV_HEAD} DESTINATION ${CMAKE_INSTALL_PREFIX} /include /lite/trt/cv)
60
63
file (INSTALL ${TENSORRT_ASR_HEAD} DESTINATION ${CMAKE_INSTALL_PREFIX} /include /lite/trt/asr)
61
64
file (INSTALL ${TENSORRT_NLP_HEAD} DESTINATION ${CMAKE_INSTALL_PREFIX} /include /lite/trt/nlp)
65
+ file (INSTALL ${TENSORRT_SD_HEAD} DESTINATION ${CMAKE_INSTALL_PREFIX} /include /lite/trt/sd)
66
+
Original file line number Diff line number Diff line change @@ -21,10 +21,29 @@ static void test_default()
21
21
}
22
22
23
23
24
+ static void test_tensorrt ()
25
+ {
26
+ std::string engine_path = " ../../../examples/hub/trt/dynamic_text_model_fp32.engine" ;
27
+
28
+ lite::trt::sd::text_encoder::Clip *clip = new lite::trt::sd::text_encoder::Clip (engine_path);
29
+
30
+ std::vector<std::string> input_vector = {" i am not good at cpp" ," goi ofg go !" };
31
+
32
+ std::vector<std::vector<float >> output;
33
+
34
+ clip->inference (input_vector,output);
35
+
36
+ delete clip;
37
+
38
+ }
39
+
40
+
24
41
25
42
static void test_lite ()
26
43
{
27
44
test_default ();
45
+
46
+ test_tensorrt ();
28
47
}
29
48
30
49
int main (__unused int argc, __unused char *argv[])
Original file line number Diff line number Diff line change 129
129
#include " lite/trt/cv/trt_yolov8.h"
130
130
#include " lite/trt/cv/trt_yolov6.h"
131
131
#include " lite/trt/cv/trt_yolov5_blazeface.h"
132
+ #include " lite/trt/sd/trt_clip.h"
132
133
#endif
133
134
134
135
// ENABLE_MNN
@@ -714,6 +715,15 @@ namespace lite{
714
715
}
715
716
}
716
717
}
718
+ namespace sd
719
+ {
720
+
721
+ typedef trtsd::TRTClip _TRT_Clip;
722
+ namespace text_encoder
723
+ {
724
+ typedef _TRT_Clip Clip;
725
+ }
726
+ }
717
727
}
718
728
#endif
719
729
}
Original file line number Diff line number Diff line change @@ -44,11 +44,8 @@ namespace ortsd
44
44
public:
45
45
void encode_text (std::vector<std::string> input_text, std::vector<std::vector<int >> &output);
46
46
47
- void inference (std::vector<int > input,std::vector<float > &output);
48
-
49
47
void inference (std::vector<std::string> input,std::vector<std::vector<float >> &output);
50
48
51
- Ort::Value transform (const cv::Mat &mat);
52
49
};
53
50
}
54
51
Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ namespace trtcv{
22
22
using trtcore::BasicTRTHandler;
23
23
}
24
24
25
+ namespace trtsd {
26
+ class LITE_EXPORTS TRTClip;
27
+ }
28
+
25
29
26
30
27
31
#endif // LITE_AI_TOOLKIT_TRT_CORE_H
Original file line number Diff line number Diff line change @@ -10,5 +10,10 @@ namespace trtcv{
10
10
namespace types = lite::types;
11
11
}
12
12
13
+ namespace trtsd {
14
+ namespace types = lite::types;
15
+ }
16
+
17
+
13
18
14
19
#endif // LITE_AI_TOOLKIT_TRT_TYPES_H
You can’t perform that action at this time.
0 commit comments