Skip to content

Commit b208b4a

Browse files
committed
llm threading
1 parent e478cd0 commit b208b4a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/inferencesh/models/llm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from typing import Optional, List, Any, Callable, Dict, Generator
22
from enum import Enum
33
from pydantic import Field, BaseModel
4-
from queue import Queue
4+
from queue import Queue, Empty
55
from threading import Thread
66
import time
77
from contextlib import contextmanager
@@ -599,7 +599,7 @@ def _generate_worker():
599599
if msg_type != "init":
600600
raise RuntimeError("Unexpected initialization message")
601601
last_activity = timestamp
602-
except Queue.Empty:
602+
except Empty:
603603
raise RuntimeError(f"Model failed to initialize within {init_timeout} seconds")
604604

605605
while True:
@@ -619,7 +619,7 @@ def _generate_worker():
619619
# Get next chunk
620620
try:
621621
msg_type, data = response_queue.get(timeout=0.1)
622-
except Queue.Empty:
622+
except Empty:
623623
continue
624624

625625
if msg_type == "error":

0 commit comments

Comments
 (0)