Automatic Speech Recognition
Transformers
Safetensors
phoneticxeus
feature-extraction
phone-recognition
ipa
ctc
multilingual
xeus
custom_code
Instructions to use changelinglab/PhoneticXeus with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use changelinglab/PhoneticXeus with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="changelinglab/PhoneticXeus", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("changelinglab/PhoneticXeus", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Add trust_remote_code support: AutoModel + safetensors + vendored src + beginner README
8d83dee verified | #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| # Copyright 2019 Shigeki Karita | |
| # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | |
| # from https://github.com/espnet/espnet/blob/master/espnet2/legacy/nets/pytorch_backend/transformer/layer_norm.py | |
| """Layer normalization module.""" | |
| import torch | |
| class LayerNorm(torch.nn.LayerNorm): | |
| """Layer normalization module. | |
| Args: | |
| nout (int): Output dim size. | |
| dim (int): Dimension to be normalized. | |
| """ | |
| def __init__(self, nout, dim=-1): | |
| """Construct an LayerNorm object.""" | |
| super(LayerNorm, self).__init__(nout, eps=1e-12) | |
| self.dim = dim | |
| def forward(self, x): | |
| """Apply layer normalization. | |
| Args: | |
| x (torch.Tensor): Input tensor. | |
| Returns: | |
| torch.Tensor: Normalized tensor. | |
| """ | |
| if self.dim == -1: | |
| return super(LayerNorm, self).forward(x) | |
| return ( | |
| super(LayerNorm, self) | |
| .forward(x.transpose(self.dim, -1)) | |
| .transpose(self.dim, -1) | |
| ) | |