Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update huffman_coder.py #5426

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions fairseq/data/huffman/huffman_coder.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from collections import Counter, deque
from dataclasses import dataclass

from bitarray import bitarray, util
from bitarray import bitarray
from fairseq.data import Dictionary

# basically we have to write to addressable bytes for the memory mapped
Expand Down Expand Up @@ -43,7 +43,7 @@ def _unpad(self, a: bitarray) -> bitarray:
"""
# count the 0 padding at the end until we find the first 1
# we want to remove the one too
remove_cnt = util.rindex(a, 1)
remove_cnt = index(a, right=1)
return a[:remove_cnt]

def encode(self, iter: tp.List[str]) -> bytes:
Expand Down
4 changes: 2 additions & 2 deletions fairseq/models/wav2vec/wav2vec2_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def __init__(
if cfg.latent_embed_dim is not None
else encoder_embed_dim
)
logging.debug(f"| {self.latent_embed_dim=}")
logging.debug(f"| {self.latent_embed_dim}")
self.linear = Linear(encoder_embed_dim, self.latent_embed_dim)
self.projection = Linear(self.latent_embed_dim, num_targets)

Expand Down Expand Up @@ -345,4 +345,4 @@ def forward(self, last_layer_feats, padding_mask, all_layer_feats):
weighted_avg_features = weighted_avg_features.view(*original_feat_shape)

# Mean Pooling on weighted average features.
return super().forward(weighted_avg_features, padding_mask)
return super().forward(weighted_avg_features, padding_mask)