wren runs its model on one BLAS thread
threadpoolctl scopes the limit to wren.act, so other numpy calls in the engine keep their threads.
This commit is contained in:
@@ -14,6 +14,7 @@ from collections.abc import Iterable
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from threadpoolctl import threadpool_limits
|
||||
|
||||
from fluksio.flow.messages import DType, MessageSpec
|
||||
from fluksio.flow.nodes.base import Node
|
||||
@@ -306,7 +307,11 @@ class WrenNode(Node):
|
||||
wren = _wren()
|
||||
specs = {spec.port: spec for spec in self.output_ports}
|
||||
house = self._house(wren, specs, presence, outdoor, dark)
|
||||
calls, confidence = wren.act(prompt, house)
|
||||
# One BLAS thread answers in about half the time for a model this
|
||||
# small. Scoped to the call, so numpy elsewhere in the process keeps
|
||||
# its threads.
|
||||
with threadpool_limits(1):
|
||||
calls, confidence = wren.act(prompt, house)
|
||||
confidence = round(float(confidence), 3)
|
||||
write = self.cfg.apply and confidence >= self.cfg.min_confidence
|
||||
writes: dict[str, Any] = {}
|
||||
|
||||
Reference in New Issue
Block a user