huggingface
type_error
ai_generated
true
RuntimeError: expected Float but got Half during training
ID: huggingface/dtype-mismatch-training
82%Fix Rate
86%Confidence
3Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 4 | active | — | — | — |
Root Cause
Training dtype conflict between model and optimizer.
genericWorkarounds
-
92% success Use Trainer with fp16=True or bf16=True for proper mixed precision
-
88% success Ensure loss scaling is enabled: TrainingArguments(fp16=True)
Dead Ends
Common approaches that don't work:
-
Cast all parameters to float32
72% fail
Doubles memory usage
-
Disable mixed precision
68% fail
Slower training