Skip to content

Commit 7c79510

Browse files
committed
perf: optimize model transfer with non-blocking flag
1 parent c778e84 commit 7c79510

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

app/model.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ def wrapper(*args, **kwargs):
130130

131131

132132
tokenizer = AutoTokenizer.from_pretrained(model_path)
133-
model = AutoModelForSequenceClassification.from_pretrained(model_path).to(device)
133+
model = AutoModelForSequenceClassification.from_pretrained(model_path).to(
134+
device, non_blocking=True
135+
)
134136

135137

136138
@measure_time

0 commit comments

Comments
 (0)