---
title: chinese-hubert-base-tencent
canonical_url: "https://www.modelscope.cn/models/innnky/chinese-hubert-base-tencent"
md_url: "https://www.modelscope.cn/models/innnky/chinese-hubert-base-tencent.md"
repository: innnky/chinese-hubert-base-tencent
chinese_name: "腾讯中文hubert base模型"
last_updated: 2023-10-01
license: mit
library_name:
  - pytorch
  - transformer
downloads: 239
stars: 1
---

# chinese-hubert-base-tencent

> chinese-hubert-base-tencent - innnky 在 ModelScope 开源的模型。Pretrained on 10k hours WenetSpeech L subset. More details in TencentGameMate/chinesespeechpretrain

innnky/chinese-hubert-base-tencent 是 ModelScope 魔搭社区上的机器学习模型，采用 mit 许可。

- **Repository**: innnky/chinese-hubert-base-tencent
- **License**: mit
- **Downloads**: 239
- **Stars**: 1
- **Last updated**: 2023-10-01

Source: https://www.modelscope.cn/models/innnky/chinese-hubert-base-tencent

---

Pretrained on 10k hours WenetSpeech L subset. More details in  [TencentGameMate/chinese_speech_pretrain](https://github.com/TencentGameMate/chinese_speech_pretrain)

This model does not have a tokenizer as it was pretrained on audio alone. 
In order to use this model speech recognition, a tokenizer should be created and the model should be fine-tuned on labeled text data.

python package:
transformers==4.16.2

```python


import torch
import torch.nn.functional as F
import soundfile as sf

from transformers import (
    Wav2Vec2FeatureExtractor,
    HubertModel,
)


model_path=""
wav_path=""

feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained(model_path)
model = HubertModel.from_pretrained(model_path)

# for pretrain: Wav2Vec2ForPreTraining
# model = Wav2Vec2ForPreTraining.from_pretrained(model_path)

model = model.to(device)
model = model.half()
model.eval()

wav, sr = sf.read(wav_path)
input_values = feature_extractor(wav, return_tensors="pt").input_values
input_values = input_values.half()
input_values = input_values.to(device)

with torch.no_grad():
    outputs = model(input_values)
    last_hidden_state = outputs.last_hidden_state


```
