Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

fix flaky test

Isaac Miller2d3ed8d20d0e
diff --git a/tests/modules/test_hf_model.py b/tests/modules/test_hf_model.py
index 0b06c8042..7a3287b80 100644
--- a/tests/modules/test_hf_model.py
+++ b/tests/modules/test_hf_model.py
@@ -23,6 +23,8 @@ def test_load_gated_model(mocker: MockerFixture):
def test_load_ungated_model(mocker: MockerFixture):
conf = MockConfig(architectures=["ConditionalGeneration"])
+ # Mock the environment to ensure no default token is used
+ mocker.patch.dict('os.environ', {}, clear=True) # Clear environment variables
mocker.patch("transformers.AutoModelForSeq2SeqLM.from_pretrained")
mocker.patch("transformers.AutoConfig.from_pretrained", return_value=conf)
mocker.patch("transformers.AutoTokenizer.from_pretrained")