Views
No views yet
1import soundfile as sf
2from transformers import AutoFeatureExtractor, AutoModel
3
4model_name = "yky-h/japanese-data2vec-audio-base"
5feature_extractor = AutoFeatureExtractor.from_pretrained(model_name)
6model = AutoModel.from_pretrained(model_name)
7model.eval()
8
9raw_speech_16kHz, sr = sf.read(audio_file)
10inputs = feature_extractor(
11 raw_speech_16kHz,
12 return_tensors="pt",
13 sampling_rate=sr,
14)
15outputs = model(**inputs)
16
17print(f"Input: {inputs.input_values.size()}") # [1, #samples]
18print(f"Output: {outputs.last_hidden_state.size()}") # [1, #frames, 768]1@misc{rinna-japanese-data2vec-audio-base,
2 title = {rinna/japanese-data2vec-audio-base},
3 author = {Hono, Yukiya and Mitsui, Kentaro and Sawada, Kei},
4 url = {https://huggingface.co/rinna/japanese-data2vec-audio-base}
5}
6
7@inproceedings{sawada2024release,
8 title = {Release of Pre-Trained Models for the {J}apanese Language},
9 author = {Sawada, Kei and Zhao, Tianyu and Shing, Makoto and Mitsui, Kentaro and Kaga, Akio and Hono, Yukiya and Wakatsuki, Toshiaki and Mitsuda, Koh},
10 booktitle = {Proceedings of the 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING 2024)},
11 month = {5},
12 year = {2024},
13 pages = {13898--13905},
14 url = {https://aclanthology.org/2024.lrec-main.1213},
15 note = {\url{https://arxiv.org/abs/2404.01657}}
16}1@inproceedings{baevski2022data2vec,
2 title={Data2vec: A general framework for self-supervised learning in speech, vision and language},
3 author={Baevski, Alexei and Hsu, Wei-Ning and Xu, Qiantong and Babu, Arun and Gu, Jiatao and Auli, Michael},
4 booktitle={International Conference on Machine Learning},
5 year={2022},
6 pages={1298--1312},
7 doi={10.48550/arXiv.2202.03555}
8}