Skip to content

Commit

Permalink
change setting of random seed to configuration
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Dellabetta <bdellabe@redhat.com>
  • Loading branch information
brian-dellabetta committed Mar 7, 2025
1 parent 9ce3a0a commit 2d2e220
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions tests/lmeval/configs/vl_fp8_dynamic_per_token.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ cadence: weekly
model: Qwen/Qwen2-VL-2B-Instruct
model_class: TraceableQwen2VLForConditionalGeneration
scheme: FP8_DYNAMIC
seed: 42 #compressed model is sensitive to random seed
lmeval:
model: "hf-multimodal"
model_args:
Expand Down
1 change: 1 addition & 0 deletions tests/lmeval/configs/vl_int8_w8a8_dynamic_per_token.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ scheme: INT8_dyn_per_token
recipe: tests/e2e/vLLM/recipes/INT8/recipe_int8_channel_weight_dynamic_per_token.yaml
dataset_id: lmms-lab/flickr30k
dataset_split: "test[:512]"
seed: 42 #compressed model is sensitive to random seed
lmeval:
model: "hf-multimodal"
model_args:
Expand Down
1 change: 1 addition & 0 deletions tests/lmeval/configs/vl_w4a16_actorder_weight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ recipe: tests/e2e/vLLM/recipes/actorder/recipe_w4a16_actorder_weight.yaml
dataset_id: lmms-lab/flickr30k
dataset_split: "test[:512]"
scheme: W4A16_actorder_group
seed: 42 #compressed model is sensitive to random seed
lmeval:
model: "hf-multimodal"
model_args:
Expand Down
9 changes: 7 additions & 2 deletions tests/lmeval/test_lmeval.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import random
import shutil
from pathlib import Path

Expand Down Expand Up @@ -58,8 +59,6 @@ class TestLMEval:
""" # noqa: E501

def set_up(self):
torch.manual_seed(42)

eval_config = yaml.safe_load(Path(TEST_DATA_FILE).read_text(encoding="utf-8"))

if os.environ.get("CADENCE", "commit") != eval_config.get("cadence"):
Expand All @@ -76,6 +75,12 @@ def set_up(self):
self.quant_type = eval_config.get("quant_type")
self.save_dir = eval_config.get("save_dir")

seed = eval_config.get("seed", None)
if seed is not None:
random.seed(seed)
numpy.random.seed(seed)
torch.manual_seed(seed)

logger.info("========== RUNNING ==============")
logger.info(self.scheme)

Expand Down

0 comments on commit 2d2e220

Please # to comment.