Skip to content

Commit 36bcdd5

Browse files
committed
fix: empty device_requests for custom inference backend
1 parent e430ab8 commit 36bcdd5

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

gpustack_runtime/deployer/docker.py

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,22 +1324,30 @@ def mutate_create_options(create_options: dict[str, Any]) -> dict[str, Any]:
13241324
for did in r.get("DeviceIDs") or []
13251325
}
13261326
for r in mirrored_device_requests:
1327-
dri: str = r.get("Driver")
1328-
dids: list[str] = []
1329-
for did in r.get("DeviceIDs") or []:
1330-
if f"{dri}:{did}" in c_device_requests_ids:
1327+
dri = r.get("Driver")
1328+
count = r.get("Count")
1329+
caps = r.get("Capabilities")
1330+
opts = r.get("Options")
1331+
orig_ids = r.get("DeviceIDs") or []
1332+
1333+
if count == -1:
1334+
final_ids = []
1335+
else:
1336+
final_ids = [
1337+
did for did in orig_ids
1338+
if f"{dri}:{did}" not in c_device_requests_ids
1339+
]
1340+
if not final_ids:
13311341
continue
1332-
dids.append(did)
1333-
if not dids:
1334-
continue
1342+
13351343
c_device_requests.append(
13361344
docker.types.DeviceRequest(
13371345
driver=dri,
1338-
count=r.get("Count"),
1339-
device_ids=dids,
1340-
capabilities=r.get("Capabilities", None),
1341-
options=r.get("Options", None),
1342-
),
1346+
count=count,
1347+
device_ids=final_ids,
1348+
capabilities=caps,
1349+
options=opts,
1350+
)
13431351
)
13441352
create_options["device_requests"] = c_device_requests
13451353

0 commit comments

Comments
 (0)