11 lines (10 with data), 1.2 kB
3
„ï_' ã @ s( d Z ddlZdd„ Zdd„ Zdd„ ZdS ) z¼Functions for ramping hyperparameters up or down
Each function takes the current training step or epoch, and the
ramp length in the same format, and returns a multiplier between
0 and 1.
é Nc C s@ |dkrdS t j| d|ƒ} d| | }tt jd| | ƒƒS dS )z8Exponential rampup from https://arxiv.org/abs/1610.02242r g ð?g g @Ng À)ÚnpÚclipÚfloatÚexp)ÚcurrentÚ
rampup_lengthZphase© r ú;/data/omnisky/postgraduate/Yb/RainsGit/LASeg/utils/ramps.pyÚsigmoid_rampup s
r
c C s, | dkr|dkst ‚| |kr dS | | S dS )z
Linear rampupr g ð?N)ÚAssertionError)r r r r r Ú
linear_rampup s r c C s<