fix(rewards): ensure FileNotFoundError is raised for missing config_file

This commit is contained in:
Khalil Meftah
2026-04-21 14:05:02 +02:00
parent 001439f02f
commit bbe974eb1e
+3 -3
View File
@@ -123,14 +123,14 @@ class RewardModelConfig(draccus.ChoiceRegistry, HubMixin, abc.ABC):
f"{CONFIG_NAME} not found on the HuggingFace Hub in {model_id}"
) from e
if config_file is None:
raise FileNotFoundError(f"{CONFIG_NAME} not found in {model_id}")
# HACK: Parse the original config to get the config subclass, so that we can
# apply cli overrides.
with draccus.config_type("json"):
orig_config = draccus.parse(cls, config_file, args=[])
if config_file is None:
raise FileNotFoundError(f"{CONFIG_NAME} not found in {model_id}")
with open(config_file) as f:
config = json.load(f)