| 28 | |
| 29 | class ViTPluginLoader: |
| 30 | def __init__(self, plugin_path) -> None: |
| 31 | |
| 32 | handle = ctypes.CDLL(plugin_path, mode=ctypes.RTLD_GLOBAL) |
| 33 | if not handle: |
| 34 | raise RuntimeError("Fail to load plugin library: %s" % plugin_path) |
| 35 | |
| 36 | self.logger_ = trt.Logger(trt.Logger.VERBOSE) |
| 37 | trt.init_libnvinfer_plugins(self.logger_, "") |
| 38 | plg_registry = trt.get_plugin_registry() |
| 39 | |
| 40 | self.plg_creator = plg_registry.get_plugin_creator("CustomVisionTransformerPlugin", "1", "") |
| 41 | |
| 42 | def load_model_config(self, config, args): |
| 43 | self.patch_size_ = config.patches.size[0] |