初始化项目,由ModelHub XC社区提供模型
Model: ryota-komatsu/SylReg-LM-7B-Instruct Source: Original Platform
This commit is contained in:
36
.gitattributes
vendored
Normal file
36
.gitattributes
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.model filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||||
|
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||||
143
README.md
Normal file
143
README.md
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
---
|
||||||
|
library_name: transformers
|
||||||
|
license: cc-by-nc-sa-4.0
|
||||||
|
datasets:
|
||||||
|
- ryota-komatsu/SylReg
|
||||||
|
language:
|
||||||
|
- en
|
||||||
|
base_model:
|
||||||
|
- ryota-komatsu/SylReg-LM-7B
|
||||||
|
---
|
||||||
|
|
||||||
|
# SylReg-LM 7B Instruct
|
||||||
|
|
||||||
|
<!-- Provide a quick summary of what the model is/does. -->
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Model Details
|
||||||
|
|
||||||
|
### Model Description
|
||||||
|
|
||||||
|
<!-- Provide a longer summary of what this model is. -->
|
||||||
|
|
||||||
|
- **Model type:** Qwen2ForCausalLM
|
||||||
|
- **Language(s) (NLP):** English
|
||||||
|
- **License:** CC BY-NC-SA 4.0
|
||||||
|
- **Finetuned from model:** [ryota-komatsu/SylReg-LM-7B](https://huggingface.co/ryota-komatsu/SylReg-LM-7B)
|
||||||
|
|
||||||
|
### Model Sources
|
||||||
|
|
||||||
|
<!-- Provide the basic links for the model. -->
|
||||||
|
|
||||||
|
- **Repository:** [Code](https://github.com/ryota-komatsu/speaker_disentangled_hubert)
|
||||||
|
- **Paper:** [arXiv:2607.04064](https://arxiv.org/abs/2607.04064)
|
||||||
|
- **Demo:** [Project page](https://ryota-komatsu.github.io/speaker_disentangled_hubert)
|
||||||
|
|
||||||
|
## How to Get Started with the Model
|
||||||
|
|
||||||
|
Use the code below to get started with the model.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git clone https://github.com/ryota-komatsu/speaker_disentangled_hubert.git
|
||||||
|
cd speaker_disentangled_hubert
|
||||||
|
|
||||||
|
sudo apt install git-lfs # for UTMOS
|
||||||
|
|
||||||
|
conda create -y -n py310 -c pytorch -c nvidia -c conda-forge python=3.10 pip=24.0 setuptools=81.0.0 faiss-gpu=1.13.2
|
||||||
|
conda activate py310
|
||||||
|
pip install -r requirements/requirements.txt
|
||||||
|
|
||||||
|
sh scripts/setup.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
```python
|
||||||
|
import re
|
||||||
|
|
||||||
|
import torch
|
||||||
|
import torchaudio
|
||||||
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||||
|
|
||||||
|
from src.flow_matching import FlowMatchingWithBigVGan
|
||||||
|
from src.s5hubert import SylRegForSyllableDiscovery
|
||||||
|
|
||||||
|
wav_path = "/path/to/wav"
|
||||||
|
|
||||||
|
# download pretrained models from hugging face hub
|
||||||
|
encoder = SylRegForSyllableDiscovery.from_pretrained("ryota-komatsu/SylReg-Distill", device_map="cuda", dtype="auto")
|
||||||
|
decoder = FlowMatchingWithBigVGan.from_pretrained("ryota-komatsu/SylReg-Decoder", device_map="cuda", dtype="auto")
|
||||||
|
speechlm = AutoModelForCausalLM.from_pretrained("ryota-komatsu/SylReg-LM-7B-Instruct", device_map="cuda", dtype="auto")
|
||||||
|
tokenizer = AutoTokenizer.from_pretrained("ryota-komatsu/SylReg-LM-7B-Instruct")
|
||||||
|
|
||||||
|
# load a waveform
|
||||||
|
waveform, sr = torchaudio.load(wav_path)
|
||||||
|
waveform = torchaudio.functional.resample(waveform, sr, 16000)
|
||||||
|
|
||||||
|
# encode a waveform into syllabic units
|
||||||
|
outputs = encoder(waveform.to(encoder.device))
|
||||||
|
units = outputs[0]["units"] # [3950, 67, ..., 503]
|
||||||
|
|
||||||
|
# speech language modeling
|
||||||
|
messages = [
|
||||||
|
{"role": "user", "content": "".join(f"<{unit}>" for unit in units)},
|
||||||
|
]
|
||||||
|
|
||||||
|
input_ids = tokenizer.apply_chat_template(
|
||||||
|
messages,
|
||||||
|
tokenize=True,
|
||||||
|
add_generation_prompt=True,
|
||||||
|
return_tensors="pt",
|
||||||
|
).input_ids.to(speechlm.device)
|
||||||
|
|
||||||
|
generated_ids = speechlm.generate(input_ids=input_ids, do_sample=True, temperature=0.8)[0]
|
||||||
|
|
||||||
|
units = tokenizer.decode(generated_ids)
|
||||||
|
units = torch.tensor([int(unit) for unit in re.findall(r"<(\d+)>", units)], device=decoder.device)
|
||||||
|
|
||||||
|
# unit-to-speech synthesis
|
||||||
|
generated_speech = decoder(units.unsqueeze(0)).waveform.cpu()
|
||||||
|
```
|
||||||
|
|
||||||
|
## Training Details
|
||||||
|
|
||||||
|
### Training Data
|
||||||
|
|
||||||
|
| | Hours | License | Provider |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| [LibriSpeech](https://huggingface.co/datasets/openslr/librispeech_asr) | 960 | CC BY 4.0 | V. Panayotov *et al.* |
|
||||||
|
| [Libriheavy](https://huggingface.co/datasets/pkufool/libriheavy) | 50,978 | public domain | W. Kang *et al.* |
|
||||||
|
| [Emilia-Large](https://huggingface.co/datasets/amphion/Emilia-Dataset) | 4,447 | CC BY 4.0, CC BY-NC 4.0 | H. He *et al.* |
|
||||||
|
| [People's Speech (clean, clean_sa)](https://huggingface.co/datasets/MLCommons/peoples_speech) | 5,640 | CC-BY, CC-BY-SA | D. Galvez *et al.* |
|
||||||
|
| [VoxPopuli](https://huggingface.co/datasets/facebook/voxpopuli) | 543 | CC0-1.0 | C. Wang *et al.* |
|
||||||
|
| [TinyStories](https://huggingface.co/datasets/roneneldan/TinyStories) | 27,810 | cdla-sharing-1.0 | R. Eldan *et al.* |
|
||||||
|
| [Cosmopedia-v2](https://huggingface.co/datasets/HuggingFaceTB/smollm-corpus) | 38,986 | odc-by | L. B. Allal *et al.* |
|
||||||
|
| Total | 129,364 | | |
|
||||||
|
|
||||||
|
### Training Hyperparameters
|
||||||
|
|
||||||
|
- **Training regime:** bf16 mixed precision
|
||||||
|
- **Training steps:** 15k
|
||||||
|
- **Batch size:** 2,097,152 (=2<sup>21</sup>) tokens
|
||||||
|
- **Optimizer:** AdamW(lr=0.0003, betas=(0.9, 0.95), weight_decay=0.01)
|
||||||
|
- **Scheduler:** warmup_stable_decay(num_warmup_steps=100, num_decay_steps=5000, min_lr_ratio=0.1)
|
||||||
|
|
||||||
|
## Hardware
|
||||||
|
|
||||||
|
32 NVIDIA H100 GPUs
|
||||||
|
|
||||||
|
## Citation
|
||||||
|
|
||||||
|
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
||||||
|
|
||||||
|
**BibTeX:**
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@article{Komatsu_SylReg_2026,
|
||||||
|
author = {Komatsu, Ryota and Kawakita, Kota and Okamoto, Takuma and Shinozaki, Takahiro},
|
||||||
|
title = {Speaker-Disentangled Chunk-Wise Regression for Syllabic Tokenization},
|
||||||
|
year = {2026},
|
||||||
|
volume = {7},
|
||||||
|
journal = {IEEE Open Journal of Signal Processing},
|
||||||
|
pages = {},
|
||||||
|
}
|
||||||
|
```
|
||||||
58
chat_template.jinja
Normal file
58
chat_template.jinja
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
{%- if tools %}
|
||||||
|
{{- '<|im_start|>system\n' }}
|
||||||
|
{%- if messages[0]['role'] == 'system' %}
|
||||||
|
{{- messages[0]['content'] }}
|
||||||
|
{%- else %}
|
||||||
|
{{- 'You are a helpful assistant.' }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
||||||
|
{%- for tool in tools %}
|
||||||
|
{{- "\n" }}
|
||||||
|
{{- tool | tojson }}
|
||||||
|
{%- endfor %}
|
||||||
|
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
||||||
|
{%- else %}
|
||||||
|
{%- if messages[0]['role'] == 'system' %}
|
||||||
|
{{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
|
||||||
|
{%- else %}
|
||||||
|
{{- '<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n' }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- for message in messages %}
|
||||||
|
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
|
||||||
|
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
|
||||||
|
{%- elif message.role == "assistant" and not message.tool_calls %}
|
||||||
|
{% generation %}
|
||||||
|
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
|
||||||
|
{% endgeneration %}
|
||||||
|
{%- elif message.role == "assistant" %}
|
||||||
|
{{- '<|im_start|>' + message.role }}
|
||||||
|
{%- if message.content %}
|
||||||
|
{{- '\n' + message.content }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- for tool_call in message.tool_calls %}
|
||||||
|
{%- if tool_call.function is defined %}
|
||||||
|
{%- set tool_call = tool_call.function %}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '\n<tool_call>\n{"name": "' }}
|
||||||
|
{{- tool_call.name }}
|
||||||
|
{{- '", "arguments": ' }}
|
||||||
|
{{- tool_call.arguments | tojson }}
|
||||||
|
{{- '}\n</tool_call>' }}
|
||||||
|
{%- endfor %}
|
||||||
|
{{- '<|im_end|>\n' }}
|
||||||
|
{%- elif message.role == "tool" %}
|
||||||
|
{%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
|
||||||
|
{{- '<|im_start|>user' }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '\n<tool_response>\n' }}
|
||||||
|
{{- message.content }}
|
||||||
|
{{- '\n</tool_response>' }}
|
||||||
|
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
||||||
|
{{- '<|im_end|>\n' }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- if add_generation_prompt %}
|
||||||
|
{{- '<|im_start|>assistant\n' }}
|
||||||
|
{%- endif %}
|
||||||
62
config.json
Normal file
62
config.json
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
{
|
||||||
|
"architectures": [
|
||||||
|
"Qwen2ForCausalLM"
|
||||||
|
],
|
||||||
|
"attention_dropout": 0.0,
|
||||||
|
"bos_token_id": null,
|
||||||
|
"dtype": "bfloat16",
|
||||||
|
"eos_token_id": 151645,
|
||||||
|
"hidden_act": "silu",
|
||||||
|
"hidden_size": 3584,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"intermediate_size": 18944,
|
||||||
|
"layer_types": [
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention"
|
||||||
|
],
|
||||||
|
"max_position_embeddings": 131072,
|
||||||
|
"max_window_layers": 28,
|
||||||
|
"model_type": "qwen2",
|
||||||
|
"num_attention_heads": 28,
|
||||||
|
"num_hidden_layers": 28,
|
||||||
|
"num_key_value_heads": 4,
|
||||||
|
"pad_token_id": 151643,
|
||||||
|
"rms_norm_eps": 1e-06,
|
||||||
|
"rope_parameters": {
|
||||||
|
"rope_theta": 1000000.0,
|
||||||
|
"rope_type": "default"
|
||||||
|
},
|
||||||
|
"sliding_window": null,
|
||||||
|
"tie_word_embeddings": false,
|
||||||
|
"transformers_version": "5.8.0.dev0",
|
||||||
|
"use_cache": false,
|
||||||
|
"use_mrope": false,
|
||||||
|
"use_sliding_window": false,
|
||||||
|
"vocab_size": 159857
|
||||||
|
}
|
||||||
455005
generation_config.json
Normal file
455005
generation_config.json
Normal file
File diff suppressed because it is too large
Load Diff
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:4218b86bebdaac20a495cea803ffe9ee97967e2894c7863d7c0cf7a8a72cd5dd
|
||||||
|
size 15342992600
|
||||||
BIN
results.png
Normal file
BIN
results.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
3
tokenizer.json
Normal file
3
tokenizer.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:13077524be1fb5132c7d8cc5140a59e63025778298e1f08a4c3ce34f92fcf6a9
|
||||||
|
size 12919918
|
||||||
15
tokenizer_config.json
Normal file
15
tokenizer_config.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"add_prefix_space": false,
|
||||||
|
"backend": "tokenizers",
|
||||||
|
"bos_token": null,
|
||||||
|
"clean_up_tokenization_spaces": false,
|
||||||
|
"eos_token": "<|im_end|>",
|
||||||
|
"errors": "replace",
|
||||||
|
"is_local": true,
|
||||||
|
"local_files_only": false,
|
||||||
|
"model_max_length": 131072,
|
||||||
|
"pad_token": "<|endoftext|>",
|
||||||
|
"split_special_tokens": false,
|
||||||
|
"tokenizer_class": "Qwen2Tokenizer",
|
||||||
|
"unk_token": null
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user