Skip to content

Commit 4480a67

Browse files
authored
fix: put model to eval mode
1 parent 700b211 commit 4480a67

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

rfdetr/main.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ def export(self, output_dir="output", infer_dir=None, simplify=False, backbone_
524524
input_names = ['input']
525525
output_names = ['features'] if backbone_only else ['dets', 'labels']
526526
dynamic_axes = None
527-
self.model.eval()
527+
model.eval()
528528
with torch.no_grad():
529529
if backbone_only:
530530
features = model(input_tensors)
@@ -562,7 +562,6 @@ def export(self, output_dir="output", infer_dir=None, simplify=False, backbone_
562562
print(f"Successfully simplified ONNX model to: {sim_output_file}")
563563

564564
print("ONNX export completed successfully")
565-
self.model = self.model.to(device)
566565

567566

568567
if __name__ == '__main__':
@@ -1059,4 +1058,4 @@ def populate_args(
10591058
gradient_checkpointing=gradient_checkpointing,
10601059
**extra_kwargs
10611060
)
1062-
return args
1061+
return args

0 commit comments

Comments
 (0)