File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed
src/ai/backend/accelerator/mock Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 1+ Fix Pydantic validation error from incorrect ` slot_type ` type in mock plugin
Original file line number Diff line number Diff line change @@ -179,14 +179,15 @@ async def init(self, context: Optional[Any] = None) -> None:
179179 for format_name , format in self .mock_config ["formats" ].items ():
180180 self .device_formats [format_name ] = _format_config_iv .check (format )
181181
182- if self ._mode == AllocationModes .DISCRETE :
183- self .slot_types .append ((f"{ self .key } .device" , "count" )) # type: ignore # (only updated here)
184- elif self ._mode == AllocationModes .FRACTIONAL :
185- self .slot_types .append ((f"{ self .key } .shares" , "count" )) # type: ignore # (only updated here)
186- else :
187- log .error ("Invalid allocation mode: {}" , self ._mode )
188- self .enabled = False
189- return
182+ match self ._mode :
183+ case AllocationModes .DISCRETE :
184+ self .slot_types .append ((SlotName (f"{ self .key } .device" ), SlotTypes .COUNT ))
185+ case AllocationModes .FRACTIONAL :
186+ self .slot_types .append ((SlotName (f"{ self .key } .shares" ), SlotTypes .COUNT ))
187+ case _:
188+ log .error ("Invalid allocation mode: {}" , self ._mode )
189+ self .enabled = False
190+ return
190191
191192 if self .key == DeviceName ("cuda" ): # CUDA specific setups
192193 self .exclusive_slot_types = {"cuda.device:*-mig" , "cuda.device" , "cuda.shares" }
You can’t perform that action at this time.
0 commit comments