Voice et bot modif
This commit is contained in:
parent
189d56026b
commit
7333a22bcd
10774 changed files with 634644 additions and 933308 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -19,6 +19,19 @@ from onnxruntime import InferenceSession
|
|||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def _torch_load_weights_only(path: str, **kwargs):
|
||||
try:
|
||||
return torch.load(path, weights_only=True, **kwargs)
|
||||
except TypeError:
|
||||
logger.warning(
|
||||
"Current PyTorch version does not support torch.load(..., weights_only=True); "
|
||||
"falling back to default torch.load behavior for %s.",
|
||||
path,
|
||||
)
|
||||
return torch.load(path, **kwargs)
|
||||
|
||||
|
||||
PRETRAINED_T5_MODELS = ["t5-small", "t5-base", "t5-large", "t5-3b", "t5-11b"]
|
||||
PRETRAINED_MT5_MODELS = [
|
||||
"google/mt5-small",
|
||||
|
|
@ -88,7 +101,7 @@ class T5Helper:
|
|||
raise ValueError("only support mode_type=t5 or mt5")
|
||||
|
||||
if state_dict_path:
|
||||
model.load_state_dict(torch.load(state_dict_path))
|
||||
model.load_state_dict(_torch_load_weights_only(state_dict_path))
|
||||
|
||||
decoder = T5Decoder(model.decoder, model.lm_head, model.config)
|
||||
decoder.eval().to(device)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue