Commit 08b5a5b
fix: remove device_map to prevent TableTransformer meta tensor errors
Remove device_map parameter from from_pretrained() calls to fix
meta tensor errors during concurrent processing.
Changes:
- Device normalization (cuda -> cuda:0) for consistent caching
- Remove device_map from DetrImageProcessor.from_pretrained()
- Remove device_map from TableTransformerForObjectDetection.from_pretrained()
- Add explicit .to(device, dtype=torch.float32) for proper placement
- Improve logging to show target device
Fixes:
- "Trying to set a tensor of type Float but got Meta" errors
- AssertionError during concurrent PDF processing
- Finalization race conditions with device_map
Root Cause:
device_map causes models to initialize with meta tensors, which fail
when explicitly moved to device. Removing device_map and using explicit
.to() ensures proper tensor placement.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent a00e748 commit 08b5a5b
2 files changed
+34
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
1 | 10 | | |
2 | 11 | | |
3 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
74 | 86 | | |
75 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
76 | 90 | | |
77 | 91 | | |
78 | 92 | | |
79 | 93 | | |
80 | 94 | | |
81 | 95 | | |
82 | | - | |
| 96 | + | |
83 | 97 | | |
84 | 98 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
89 | 106 | | |
90 | 107 | | |
| 108 | + | |
91 | 109 | | |
92 | 110 | | |
93 | 111 | | |
| |||
0 commit comments