NVIDIA / Stable-Diffusion-WebUI-TensorRT

TensorRT Extension for Stable Diffusion Web UI
MIT License
1.9k stars 145 forks source link

AttributeError: 'tensorrt_bindings.tensorrt.ICudaEngine' object has no attribute 'get_profile_shape' #321

Open li8523892 opened 5 months ago

li8523892 commented 5 months ago

一跑图就出现这个代码,不能出图。

teywat commented 3 months ago

你是不是用的tensorrt 10.0.0b6? 我貌似解决这个问题了

teywat commented 3 months ago

@li8523892 tensorrt貌似改了代码原来的不能用了,我查过tensorrt的文档后找到解决办法 在这个插件文件夹下面utilities.py中在代码最后将

def __str__(self):
        out = ""
        for opt_profile in range(self.engine.num_optimization_profiles):
            for binding in range(self.engine.num_io_tensors):
                name = self.engine.get_tensor_name(binding)
                shape = self.engine.get_tensor_profile_shape(opt_profile, name)
                out += f"\t{name} = {shape}\n"
        return out

替换为

def __str__(self):
        out = ""
        for opt_profile in range(self.engine.num_optimization_profiles):
            for binding in range(self.engine.num_io_tensors):
                name = self.engine.get_tensor_name(binding)
                shape = self.engine.get_tensor_profile_shape(name, opt_profile)
                out += f"\t{name} = {shape}\n"
        return out

可以正常绘图没有报错,具体是不是这个解题思路还得等作者确认