[Test] Initialize mem_fraction_static in setUpClass to fix pytest VLM test crashes. (#10859)

Co-authored-by: svc_repro_tool <svc_repro_tool@habana.ai>
This commit is contained in:
vikram singh shekhawat
2025-10-03 21:44:48 +05:30
committed by GitHub
parent fad7ca73f8
commit 586e81a28a

View File

@@ -27,6 +27,8 @@ MODELS = [
SimpleNamespace(model="openbmb/MiniCPM-V-2_6", mmmu_accuracy=0.4), SimpleNamespace(model="openbmb/MiniCPM-V-2_6", mmmu_accuracy=0.4),
] ]
#Set default mem_fraction_static to 0.8
DEFAULT_MEM_FRACTION_STATIC = 0.8
class TestVLMModels(CustomTestCase): class TestVLMModels(CustomTestCase):
parsed_args = None # Class variable to store args parsed_args = None # Class variable to store args
@@ -38,6 +40,9 @@ class TestVLMModels(CustomTestCase):
cls.api_key = "sk-123456" cls.api_key = "sk-123456"
cls.time_out = DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH cls.time_out = DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH
if cls.parsed_args is None:
cls.parsed_args = SimpleNamespace(mem_fraction_static=DEFAULT_MEM_FRACTION_STATIC)
# Set OpenAI API key and base URL environment variables. Needed for lmm-evals to work. # Set OpenAI API key and base URL environment variables. Needed for lmm-evals to work.
os.environ["OPENAI_API_KEY"] = cls.api_key os.environ["OPENAI_API_KEY"] = cls.api_key
os.environ["OPENAI_API_BASE"] = f"{cls.base_url}/v1" os.environ["OPENAI_API_BASE"] = f"{cls.base_url}/v1"
@@ -302,7 +307,7 @@ if __name__ == "__main__":
"--mem-fraction-static", "--mem-fraction-static",
type=float, type=float,
help="Static memory fraction for the model", help="Static memory fraction for the model",
default=0.8, default=DEFAULT_MEM_FRACTION_STATIC,
) )
# Parse args intended for unittest # Parse args intended for unittest