mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-12-11 06:55:27 +00:00
Fix bug in choosing layers to drop
This commit is contained in:
parent
857b3735e7
commit
f941991331
@ -471,11 +471,11 @@ class ConformerEncoder(nn.Module):
|
|||||||
# with their specified probs while reaching this exact target.
|
# with their specified probs while reaching this exact target.
|
||||||
num_to_drop = int(tot) + int(shared_rng.random() < (tot - int(tot)))
|
num_to_drop = int(tot) + int(shared_rng.random() < (tot - int(tot)))
|
||||||
|
|
||||||
|
|
||||||
layers = list(range(num_layers))
|
layers = list(range(num_layers))
|
||||||
independent_rng.shuffle(layers)
|
independent_rng.shuffle(layers)
|
||||||
|
|
||||||
# go through the shuffled layers until we get the required number of samples.
|
# go through the shuffled layers until we get the required number of samples.
|
||||||
|
if num_to_drop > 0:
|
||||||
for layer in itertools.cycle(layers):
|
for layer in itertools.cycle(layers):
|
||||||
if independent_rng.random() < layerdrop_probs[layer]:
|
if independent_rng.random() < layerdrop_probs[layer]:
|
||||||
ans.add(layer)
|
ans.add(layer)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user