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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time stamps for CTC models #15687

Merged
merged 23 commits into from Feb 22, 2022
Merged
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
2 changes: 2 additions & 0 deletions docs/source/model_doc/wav2vec2.mdx
Expand Up @@ -45,6 +45,8 @@ This model was contributed by [patrickvonplaten](https://huggingface.co/patrickv
[[autodoc]] Wav2Vec2CTCTokenizer
- __call__
- save_vocabulary
- decode
- batch_decode

## Wav2Vec2FeatureExtractor

Expand Down
6 changes: 6 additions & 0 deletions src/transformers/models/hubert/configuration_hubert.py
Expand Up @@ -14,6 +14,8 @@
# limitations under the License.
""" Hubert model configuration"""

import math

from ...configuration_utils import PretrainedConfig
from ...utils import logging

Expand Down Expand Up @@ -248,3 +250,7 @@ def __init__(
# ctc loss
self.ctc_loss_reduction = ctc_loss_reduction
self.ctc_zero_infinity = ctc_zero_infinity

@property
def inputs_to_logits_ratio(self):
return math.prod(self.conv_stride)
6 changes: 6 additions & 0 deletions src/transformers/models/sew/configuration_sew.py
Expand Up @@ -14,6 +14,8 @@
# limitations under the License.
""" SEW model configuration"""

import math

from ...configuration_utils import PretrainedConfig
from ...utils import logging

Expand Down Expand Up @@ -243,3 +245,7 @@ def __init__(
# sequence classification
self.use_weighted_layer_sum = use_weighted_layer_sum
self.classifier_proj_size = classifier_proj_size

@property
def inputs_to_logits_ratio(self):
return math.prod(self.conv_stride)
6 changes: 6 additions & 0 deletions src/transformers/models/sew_d/configuration_sew_d.py
Expand Up @@ -14,6 +14,8 @@
# limitations under the License.
""" SEW-D model configuration"""

import math

from ...configuration_utils import PretrainedConfig
from ...utils import logging

Expand Down Expand Up @@ -279,3 +281,7 @@ def __init__(
# sequence classification
self.use_weighted_layer_sum = use_weighted_layer_sum
self.classifier_proj_size = classifier_proj_size

@property
def inputs_to_logits_ratio(self):
return math.prod(self.conv_stride)
6 changes: 6 additions & 0 deletions src/transformers/models/unispeech/configuration_unispeech.py
Expand Up @@ -14,6 +14,8 @@
# limitations under the License.
""" UniSpeech model configuration"""

import math

from ...configuration_utils import PretrainedConfig
from ...utils import logging

Expand Down Expand Up @@ -289,3 +291,7 @@ def __init__(

# pretraining loss
self.replace_prob = replace_prob

@property
def inputs_to_logits_ratio(self):
return math.prod(self.conv_stride)
Expand Up @@ -14,6 +14,8 @@
# limitations under the License.
""" UniSpeechSat model configuration"""

import math

from ...configuration_utils import PretrainedConfig
from ...utils import logging

Expand Down Expand Up @@ -306,3 +308,7 @@ def __init__(
self.tdnn_kernel = list(tdnn_kernel)
self.tdnn_dilation = list(tdnn_dilation)
self.xvector_output_dim = xvector_output_dim

@property
def inputs_to_logits_ratio(self):
return math.prod(self.conv_stride)
6 changes: 6 additions & 0 deletions src/transformers/models/wav2vec2/configuration_wav2vec2.py
Expand Up @@ -14,6 +14,8 @@
# limitations under the License.
""" Wav2Vec2 model configuration"""

import math

from ...configuration_utils import PretrainedConfig
from ...utils import logging

Expand Down Expand Up @@ -329,3 +331,7 @@ def __init__(
self.tdnn_kernel = list(tdnn_kernel)
self.tdnn_dilation = list(tdnn_dilation)
self.xvector_output_dim = xvector_output_dim

@property
def inputs_to_logits_ratio(self):
return math.prod(self.conv_stride)