mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-10-04 21:33:58 +08:00
Accept native false Params values in live model placement check
This commit is contained in:
@@ -25,7 +25,7 @@ def identity(value):
|
||||
|
||||
|
||||
def local_model_placement(metadata, active, loading):
|
||||
return metadata.get("uses_external_gpu") is False and active in (b"0", "0") and loading in (b"0", "0")
|
||||
return metadata.get("uses_external_gpu") is False and (active is False or active in (b"0", "0")) and (loading is False or loading in (b"0", "0"))
|
||||
|
||||
|
||||
def evaluate(snapshot, record, now):
|
||||
|
||||
@@ -23,6 +23,8 @@ def authorization():
|
||||
class Tests(unittest.TestCase):
|
||||
def test_model_placement_requires_actual_runtime_flags(self):
|
||||
self.assertTrue(local_model_placement({"uses_external_gpu":False},b"0",b"0"))
|
||||
self.assertTrue(local_model_placement({"uses_external_gpu":False},False,False))
|
||||
self.assertFalse(local_model_placement({"uses_external_gpu":False},None,False))
|
||||
for active,loading in ((None,b"0"),(b"1",b"0"),(b"0",None),(b"0",b"1")):
|
||||
self.assertFalse(local_model_placement({"uses_external_gpu":False},active,loading))
|
||||
self.assertFalse(local_model_placement({},b"0",b"0"))
|
||||
|
||||
Reference in New Issue
Block a user