Merge pull request #42 from unslothai/fix/epoch-type-float

Fix: Change `epoch` type from `int` to `float`
This commit is contained in:
Roland Tannous 2026-02-13 10:53:51 +04:00 committed by GitHub
commit 2df07aa224
3 changed files with 3 additions and 3 deletions

View file

@ -34,7 +34,7 @@ logger = logging.getLogger(__name__)
@dataclass
class TrainingProgress:
"""Training progress tracking"""
epoch: int = 0
epoch: float = 0
step: int = 0
total_steps: int = 0
loss: float = 0.0

View file

@ -99,7 +99,7 @@ class TrainingProgress(BaseModel):
loss: float = Field(..., description="Current loss value")
learning_rate: float = Field(..., description="Current learning rate")
progress_percent: float = Field(..., description="Progress percentage (0.0 to 100.0)")
epoch: Optional[int] = Field(None, description="Current epoch")
epoch: Optional[float] = Field(None, description="Current epoch")
elapsed_seconds: Optional[float] = Field(None, description="Time elapsed since training started")
eta_seconds: Optional[float] = Field(None, description="Estimated time remaining")
grad_norm: Optional[float] = Field(None, description="L2 norm of gradients, computed before gradient clipping")

View file

@ -436,7 +436,7 @@ async def stream_training_progress(
loss: float,
learning_rate: float,
total_steps: int,
epoch: Optional[int] = None,
epoch: Optional[float] = None,
) -> TrainingProgress:
total = max(total_steps, 0)
if step < 0 or total == 0: