self.model = model
assert self.model is not None
if isinstance(fp16, bool) and fp16:
opt_level = "O1"
elif isinstance(fp16, bool) and not fp16:
opt_level = None
After Change
fp16 = _resolve_bool_fp16(fp16)
opt_level = None
if fp16:
opt_level = fp16.get("opt_level", None)
if opt_level is not None:
device = "cuda"
elif device is None: