mirror of
https://github.com/saymrwulf/transformers.git
synced 2026-05-14 20:58:08 +00:00
fix: Added missing raise keyword for few exceptions (#32333)
Fixed raising of few exceptions.
This commit is contained in:
parent
bd54ed2ed7
commit
1627108033
3 changed files with 3 additions and 3 deletions
|
|
@ -98,7 +98,7 @@ def regularization(model: nn.Module, mode: str):
|
||||||
elif mode == "l0":
|
elif mode == "l0":
|
||||||
regu += torch.sigmoid(param - 2 / 3 * np.log(0.1 / 1.1)).sum() / param.numel()
|
regu += torch.sigmoid(param - 2 / 3 * np.log(0.1 / 1.1)).sum() / param.numel()
|
||||||
else:
|
else:
|
||||||
ValueError("Don't know this mode.")
|
raise ValueError("Don't know this mode.")
|
||||||
counter += 1
|
counter += 1
|
||||||
return regu / counter
|
return regu / counter
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ def regularization(model: nn.Module, mode: str):
|
||||||
elif mode == "l0":
|
elif mode == "l0":
|
||||||
regu += torch.sigmoid(param - 2 / 3 * np.log(0.1 / 1.1)).sum() / param.numel()
|
regu += torch.sigmoid(param - 2 / 3 * np.log(0.1 / 1.1)).sum() / param.numel()
|
||||||
else:
|
else:
|
||||||
ValueError("Don't know this mode.")
|
raise ValueError("Don't know this mode.")
|
||||||
counter += 1
|
counter += 1
|
||||||
return regu / counter
|
return regu / counter
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -744,7 +744,7 @@ class WandbLogModel(str, Enum):
|
||||||
if not isinstance(value, str):
|
if not isinstance(value, str):
|
||||||
raise ValueError(f"Expecting to have a string `WANDB_LOG_MODEL` setting, but got {type(value)}")
|
raise ValueError(f"Expecting to have a string `WANDB_LOG_MODEL` setting, but got {type(value)}")
|
||||||
if value.upper() in ENV_VARS_TRUE_VALUES:
|
if value.upper() in ENV_VARS_TRUE_VALUES:
|
||||||
DeprecationWarning(
|
raise DeprecationWarning(
|
||||||
f"Setting `WANDB_LOG_MODEL` as {os.getenv('WANDB_LOG_MODEL')} is deprecated and will be removed in "
|
f"Setting `WANDB_LOG_MODEL` as {os.getenv('WANDB_LOG_MODEL')} is deprecated and will be removed in "
|
||||||
"version 5 of transformers. Use one of `'end'` or `'checkpoint'` instead."
|
"version 5 of transformers. Use one of `'end'` or `'checkpoint'` instead."
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue