patch for torch >= 2.6
This commit is contained in:
12
iic.py
12
iic.py
@@ -1,4 +1,16 @@
|
||||
import os
|
||||
import torch
|
||||
from functools import wraps
|
||||
|
||||
_orig_load = torch.load
|
||||
|
||||
@wraps(_orig_load)
|
||||
def _load_patch(*args, **kwargs):
|
||||
kwargs.setdefault("weights_only", False)
|
||||
return _orig_load(*args, **kwargs)
|
||||
|
||||
torch.load = _load_patch
|
||||
|
||||
|
||||
from modelscope.pipelines import pipeline
|
||||
from modelscope.outputs import OutputKeys
|
||||
|
||||
11
main.py
11
main.py
@@ -10,6 +10,17 @@ from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
import torch
|
||||
from functools import wraps
|
||||
|
||||
_orig_load = torch.load
|
||||
|
||||
@wraps(_orig_load)
|
||||
def _load_patch(*args, **kwargs):
|
||||
kwargs.setdefault("weights_only", False)
|
||||
return _orig_load(*args, **kwargs)
|
||||
|
||||
torch.load = _load_patch
|
||||
|
||||
from modelscope.pipelines import pipeline
|
||||
from modelscope.outputs import OutputKeys
|
||||
|
||||
|
||||
Reference in New Issue
Block a user