heerjtdev commited on
Commit
890efb7
·
verified ·
1 Parent(s): 630d8e6

Update working_yolo_pipeline.py

Browse files
Files changed (1) hide show
  1. working_yolo_pipeline.py +23 -9
working_yolo_pipeline.py CHANGED
@@ -3,16 +3,30 @@ import fitz # PyMuPDF
3
  import numpy as np
4
  import cv2
5
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  import torch
7
- from torch.nn.modules.conv import Conv2d
8
- from ultralytics.nn.tasks import DetectionModel
9
- from torch.nn.modules.container import Sequential
10
-
11
- torch.serialization.add_safe_globals([
12
- Conv2d, # The exact unsupported global shown in your log
13
- DetectionModel,
14
- Sequential,
15
- ])
 
 
16
 
17
 
18
  import json
 
3
  import numpy as np
4
  import cv2
5
 
6
+ # import torch
7
+ # from torch.nn.modules.conv import Conv2d
8
+ # from ultralytics.nn.tasks import DetectionModel
9
+ # from torch.nn.modules.container import Sequential
10
+
11
+ # torch.serialization.add_safe_globals([
12
+ # Conv2d, # The exact unsupported global shown in your log
13
+ # DetectionModel,
14
+ # Sequential,
15
+ # ])
16
+
17
+
18
  import torch
19
+ import torch.serialization
20
+
21
+ _original_torch_load = torch.load
22
+
23
+ def patched_torch_load(*args, **kwargs):
24
+ # FORCE classic behavior
25
+ kwargs["weights_only"] = False
26
+ return _original_torch_load(*args, **kwargs)
27
+
28
+ torch.load = patched_torch_load
29
+
30
 
31
 
32
  import json