Closed yuki7777777888 closed 1 week ago
可以改batch_size,只需要改tc.config里边的batch_size就好。 一般推理加速可以用 TensorRT吧,转为ONNX后就可以了。Pytorch → ONNX → TensorRT。 代码tc.Office.py中有个save_onnx(self, path_onnx_dir="")的函数,用那个就可以。 具体来说就是tcPredict.py加载模型后,使用类似下面的代码就可以了。
tcp = TextClassificationPredict(path_config)
tcp.office.save_onnx(path_onnx_dir="xxx")
大佬求解,使用tc发送多条text来推理,可不可以调整batch_size用更多显存加速推理的速度,或者还有什么方法能增加推理速度