mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-08-09 01:52:41 +00:00
Merge branch 'quantization' of github.com:yaozengwei/icefall into quantization
This commit is contained in:
commit
1aa6fc0122
@ -681,10 +681,14 @@ class ScaledAdam(BatchedOptimizer):
|
||||
|
||||
p_exceed = p_abs > stored_percentiles # same shape as p
|
||||
# The proportion that exceeds stored_percentiles
|
||||
proportion_exceed = p_exceed.sum(dim=list(range(1, p.ndim)), keepdim=True) / numel
|
||||
proportion_exceed = (
|
||||
p_exceed.sum(dim=list(range(1, p.ndim)), keepdim=True) / numel
|
||||
)
|
||||
# Update store_percentiles
|
||||
update_sign = (proportion_exceed - percentile_limit).sign()
|
||||
stored_percentiles.mul_(1 + update_sign * lr / p_limit_values).clamp_(min=1.0e-20)
|
||||
stored_percentiles.mul_(1 + update_sign * lr / p_limit_values).clamp_(
|
||||
min=1.0e-20
|
||||
)
|
||||
|
||||
# For these parameters that exceed stored_percentile,
|
||||
# flip the update sign if they would get larger absolute values
|
||||
|
Loading…
x
Reference in New Issue
Block a user