[Misc] Improve error messages for unsupported types and parameters (#30593)
Signed-off-by: BlankR <hjyblanche@gmail.com> Co-authored-by: Wentao Ye <44945378+yewentao256@users.noreply.github.com>
This commit is contained in:
@@ -599,7 +599,11 @@ def smart_resize(
|
||||
w_bar = ceil_by_factor(width * beta, factor)
|
||||
|
||||
if min_pixels > h_bar * w_bar or h_bar * w_bar > max_pixels:
|
||||
raise ValueError(f"encounter invalid h_bar: {h_bar}, w_bar: {w_bar}")
|
||||
raise ValueError(
|
||||
f"Invalid h_bar={h_bar}, w_bar={w_bar}: "
|
||||
f"h_bar * w_bar must be >= min_pixels ({min_pixels}) "
|
||||
f"and <= max_pixels ({max_pixels})."
|
||||
)
|
||||
|
||||
return h_bar, w_bar
|
||||
|
||||
|
||||
@@ -348,7 +348,9 @@ class GraniteSpeechConformerAttention(nn.Module):
|
||||
|
||||
if self.context_size <= 0 or self.context_size > self.max_pos_emb:
|
||||
raise ValueError(
|
||||
"Context size is either less than 0 or exceeds the max_pos_emb"
|
||||
f"Context size should be > 0 and "
|
||||
f"<= max_pos_emb ({self.max_pos_emb}), "
|
||||
f"got {self.context_size}."
|
||||
)
|
||||
|
||||
def forward(
|
||||
|
||||
@@ -332,7 +332,8 @@ class MiniMaxText01DecoderLayer(nn.Module):
|
||||
)
|
||||
else:
|
||||
raise ValueError(
|
||||
f"Unsupported attention type: {self.config.attention_type}"
|
||||
f"Unsupported attention_type {self.config.attention_type}: "
|
||||
f"should be 0 (linear) or 1 (full)."
|
||||
)
|
||||
|
||||
if expert_num == 1:
|
||||
|
||||
Reference in New Issue
Block a user