Skip to content

Commit 9399083

Browse files
committed
Apply Fable self-audit fixes to Llama distribution tests
- Use preset_utils.load_json instead of hand-rolled get_file+open+ json.load in test_layout_map_live_presets, matching the cached Gemini load_json/encoding suggestion (adds encoding="utf-8"). - Fix test_distribution_with_lora's device-count guard to `len(devices) < 2`, matching the shared helper and every sibling check instead of the fragile `== 1`.
1 parent bb07d1e commit 9399083

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

keras_hub/src/models/llama/llama_backbone_test.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import gc
2-
import json
32
import os
43
import re
54

@@ -10,8 +9,7 @@
109

1110
from keras_hub.src.models.llama.llama_backbone import LlamaBackbone
1211
from keras_hub.src.tests.test_case import TestCase
13-
from keras_hub.src.utils.preset_utils import CONFIG_FILE
14-
from keras_hub.src.utils.preset_utils import get_file
12+
from keras_hub.src.utils.preset_utils import load_json
1513

1614
# Dims for the Tier-2 CI-safe mesh-shape sweep: representative real-preset
1715
# dimensions, frozen as literals and sourced once, offline -- do not add a
@@ -209,7 +207,7 @@ def test_distribution_with_lora(self):
209207
if keras.backend.backend() != "jax":
210208
self.skipTest("`ModelParallel` testing requires the Jax backend.")
211209
devices = keras.distribution.list_devices("CPU")
212-
if len(devices) == 1:
210+
if len(devices) < 2:
213211
# Need more than 1 device for distribution testing.
214212
self.skipTest("`ModelParallel` testing requires multiple devices.")
215213
# Pinned to exactly 2 devices -- see test_distribution's comment.
@@ -330,9 +328,7 @@ def test_layout_map_live_presets(self):
330328
fetch_failures = []
331329
for preset in LlamaBackbone.presets:
332330
try:
333-
path = get_file(preset, CONFIG_FILE)
334-
with open(path) as f:
335-
cfg = json.load(f)["config"]
331+
cfg = load_json(preset)["config"]
336332
except Exception as e:
337333
# A preset this account can't reach (e.g. an unaccepted
338334
# Kaggle license consent click-through, or no

0 commit comments

Comments
 (0)