Skip to content

Commit

Permalink
pin random seed to resolve stochastic behavior
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Dellabetta <[email protected]>
  • Loading branch information
brian-dellabetta committed Mar 5, 2025
1 parent ca5a6ba commit 87dcc4c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/lmeval/configs/vl_fp8_dynamic_per_token.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ lmeval:
num_fewshot: 0
batch_size: 8
metrics:
acc,none: 0.266
acc,none: 0.333
2 changes: 1 addition & 1 deletion tests/lmeval/configs/vl_w4a16_actorder_weight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ lmeval:
task: mmmu_val_economics
num_fewshot: 0
metrics:
acc,none: 0.433
acc,none: 0.366
batch_size: 4
6 changes: 6 additions & 0 deletions tests/lmeval/test_lmeval.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import os
import random
import shutil
from pathlib import Path

import numpy
import pytest
import torch
import yaml
from loguru import logger
from pydantic import BaseModel
Expand Down Expand Up @@ -57,6 +59,10 @@ class TestLMEval:
""" # noqa: E501

def set_up(self):
random.seed(42)
numpy.random.seed(42)
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 Down

0 comments on commit 87dcc4c

Please sign in to comment.