PaddlePaddle/PaddleOCR · error · ValueError
error!!!!!!
Error message
error!!!!!!
What it means
This is the fallback branch of a distillation loss's forward: it dispatches on self.mode, which must be one of 'log', 'mean', 'sum', 'meanlog' or 'ctcdkd'. An unrecognized mode reaches the else and raises the unhelpful ValueError('error!!!!!!') — the message gives no clue, but the cause is always an invalid mode string on this specific loss class (the mode selection in the distillation YAML, e.g. for the ctc/attention distill loss).
Source
Thrown at ppocr/losses/distillation_loss.py:1139
elif self.mode == "sum":
return self.forward_sum(stu_out, tea_out)
elif self.mode == "meanlog":
blank_mask = paddle.ones_like(stu_out)
blank_mask.stop_gradient = True
blank_mask[:, :, 0] = -1
stu_out *= blank_mask
tea_out *= blank_mask
return self.forward_meanlog(stu_out, tea_out)
elif self.mode == "ctcdkd":
# ignore ctc blank logits
blank_mask = paddle.ones_like(stu_out)
blank_mask.stop_gradient = True
blank_mask[:, :, 0] = -1
stu_out *= blank_mask
tea_out *= blank_mask
return self.ctc_dkd_loss(stu_out, tea_out, targets)
else:
raise ValueError("error!!!!!!")
def forward_log(self, out1, out2):
if self.act is not None:
out1 = self.act(out1) + 1e-10
out2 = self.act(out2) + 1e-10
if self.use_log is True:
# for recognition distillation, log is needed for feature map
log_out1 = paddle.log(out1)
log_out2 = paddle.log(out2)
loss = (self._kldiv(log_out1, out2) + self._kldiv(log_out2, out1)) / 2.0
return loss
class DistillCTCLogits(KLCTCLogits):
def __init__(
self, model_name_pairs=[], key=None, name="ctc_logits", reduction="mean"
):View on GitHub (pinned to 2661c7c0ef)
Solutions
- Find the distillation loss config whose forward hits this line and set mode to one of: 'log', 'mean', 'sum', 'meanlog', 'ctcdkd'
- Match the mode to the loss class: 'ctcdkd' belongs to the CTC distill loss; check the loss's own mode branches before choosing
- Add a quick assert at startup: assert loss.mode in {'log','mean','sum','meanlog','ctcdkd'} to fail at config time instead of mid-training
Example fix
# before (distillation config yaml) mode: kl # ValueError: 'error!!!!!!' at first step # after mode: meanlog
Defensive patterns
Strategy: validation
Validate before calling
DISTILL_MODES = {'log', 'mean', 'sum', 'meanlog', 'ctcdkd'}
assert cfg['mode'] in DISTILL_MODES, f"distill loss mode must be one of {sorted(DISTILL_MODES)}, got {cfg['mode']!r}" Type guard
def is_distill_mode(m: str) -> bool:
return isinstance(m, str) and m in {'log', 'mean', 'sum', 'meanlog', 'ctcdkd'} Try / catch
try:
loss = distill_loss(student_out, teacher_out, targets)
except ValueError as e:
if 'error' in str(e):
raise ValueError(f'Invalid distillation mode {distill_loss.mode!r}; expected one of log/mean/sum/meanlog/ctcdkd') from e
raise Prevention
- The message 'error!!!!!!' carries no info — always validate the mode string yourself at config-load time
- Modes differ per distillation loss class; whitelist per class, not globally
- Fail at startup (construct + assert mode) rather than at the first training step
When it happens
Trigger: Building a DistillationModel loss item whose mode is misspelled or from a different loss class (e.g. mode: ' CEL ' with spaces, or a mode valid for KLJSLoss like 'kl' but not for this loss), then running forward during training.
Common situations: Hand-editing a distillation config and reusing a mode from another distill loss; mode/config mismatch after upgrading PaddleOCR where supported mode names changed; the error surfaces only at the first training step, not at config parse time.
Related errors
- The mode.lower() if KLJSLoss should be one of ['kl', 'js']
- main_loss_type in BalanceLoss() can only be one of {}
- [DBLoss]: Unrecognized main loss type!
- {} is not supported in MultiLoss yet
- RecResizeImg.image_shape is required in rec inference.yml
AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14).
Data as JSON: /api/errors/1cf963bb82a0cd16.
Report an issue: GitHub.