Skip to content

PTQ-Level Efficiency, QAT-Level Accuracy | 训练后量化的效率,量化感知训练的精度

fix: honor AR_WORK_SPACE for the AudioCaps dataset cache (#2420)

Shubham Padkonde1ace02c56769
diff --git a/auto_round/utils/common.py b/auto_round/utils/common.py
index e565e39d4..da04ac652 100644
--- a/auto_round/utils/common.py
+++ b/auto_round/utils/common.py
@@ -102,8 +102,8 @@ def download_audiocaps_csv():
import requests
url = "https://raw.githubusercontent.com/cdjkim/audiocaps/master/dataset2.0/train.csv"
- # Prefer AR_WORKSPACE environment variable for cache location when provided.
- ar_workspace = os.environ.get("AR_WORKSPACE")
+ # Prefer the documented AR_WORK_SPACE (or the legacy AR_WORKSPACE) for the cache location when set.
+ ar_workspace = os.environ.get("AR_WORK_SPACE") or os.environ.get("AR_WORKSPACE")
if ar_workspace:
cache_dir = os.path.join(ar_workspace, "audiocaps_cache")
else:
diff --git a/test/unit/common/utils/test_common_utils.py b/test/unit/common/utils/test_common_utils.py
index a47f592b0..e20feacdd 100644
--- a/test/unit/common/utils/test_common_utils.py
+++ b/test/unit/common/utils/test_common_utils.py
@@ -67,6 +67,19 @@ class TestDownloadAudiocapsCsv:
else:
os.environ["AR_WORKSPACE"] = prev_ar_ws
+ def test_download_audiocaps_csv_uses_ar_work_space(self, tmp_path, monkeypatch):
+ from auto_round.utils.common import download_audiocaps_csv
+
+ monkeypatch.delenv("AR_WORKSPACE", raising=False)
+ monkeypatch.setenv("AR_WORK_SPACE", str(tmp_path))
+ cache_file = tmp_path / "audiocaps_cache" / "train.csv"
+ cache_file.parent.mkdir()
+ cache_file.write_text("audio_id,audio_file,caption\ntest,test.wav,a test caption")
+
+ with patch("requests.get") as mock_get:
+ assert download_audiocaps_csv() == str(cache_file)
+ mock_get.assert_not_called()
+
class TestCompareVersions:
"""Tests for compare_versions function."""