Skip to content

Commit

Permalink
Changes for removing unused terms in CE loss fn (#1643)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel King <43149077+dakinggg@users.noreply.github.com>
Co-authored-by: Milo Cress <iamroot@databricks.com>
  • Loading branch information
3 people authored Nov 19, 2024
1 parent 800400c commit ce13961
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions llmfoundry/models/mpt/modeling_mpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
from llmfoundry.models.layers.norm import LPLayerNorm # type: ignore
# isort: on

from llmfoundry.utils.warnings import VersionedDeprecationWarning

log = logging.getLogger(__name__)

CROSS_ENTROPY_IGNORE_INDEX = -100
Expand Down Expand Up @@ -1360,6 +1362,12 @@ def compute_loss_from_logits(
else:
loss = losses.sum() / (targets != loss_fn.ignore_index).sum()
if sample_weighing_factor is not None:
warnings.warn(
VersionedDeprecationWarning(
message='sample_weighing_factor has been deprecated!',
remove_version='0.17.0',
),
)
if sample_weighing_factor.shape[0] > 1:
raise ValueError(
'Sample weighing factor is not supported when batch["sample_weighing_factor"].shape[0] > 1.',
Expand Down

0 comments on commit ce13961

Please sign in to comment.