File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 3838logger = logging .getLogger (__name__ )
3939logger .setLevel (logging .WARN )
4040
41+ # Patch torch.load to disable weights_only loading for torch>2.4
42+ torch_version = torch .__version__ .split ('.' )
43+ if int (torch_version [0 ]) > 2 or (int (torch_version [0 ]) == 2 and int (torch_version [1 ]) > 4 ):
44+ _real_torch_load = torch .load
45+
46+ def torch_load_no_weights_only (* args , ** kwargs ):
47+ kwargs ["weights_only" ] = False
48+ return _real_torch_load (* args , ** kwargs )
49+
50+ torch .load = torch_load_no_weights_only
51+
4152class FastSAMWrapper ():
4253
4354 def __init__ (self ,
Original file line number Diff line number Diff line change 2727 'shapely' ,
2828 'opencv-python>=4.6.0' ,
2929 'pyyaml' ,
30- 'torch= =2.4.0' ,
31- 'torchvision= =0.19.0' ,
30+ 'torch> =2.4.0' ,
31+ 'torchvision> =0.19.0' ,
3232 'fastsam @ git+https://github.com/CASIA-IVA-Lab/FastSAM.git@4d153e9' ,
3333 'robotdatapy>=1.1.0' ,
3434 'gdown' ,
You can’t perform that action at this time.
0 commit comments