Update README.md
Browse files
README.md
CHANGED
|
@@ -8,6 +8,24 @@
|
|
| 8 |
from transformers.models.qwen3_omni_moe import Qwen3OmniMoeThinkerTextModel
|
| 9 |
from transformers.models.qwen3_omni_moe.configuration_qwen3_omni_moe import Qwen3OmniMoeTextConfig
|
| 10 |
# 1. init orig model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# 2. Get the original config and create a new, smaller version
|
| 13 |
# where model == qwen3omni orig 30B model `Qwen/Qwen3-Omni-30B-A3B-Instruct`
|
|
@@ -45,5 +63,6 @@ model.config.thinker_config.text_config = small_thinker_llm.config
|
|
| 45 |
PATH = "./qwen3omni_5B_random_thinker_weights"
|
| 46 |
model.save_pretrained(PATH)
|
| 47 |
processor.save_pretrained(PATH)
|
|
|
|
| 48 |
```
|
| 49 |
|
|
|
|
| 8 |
from transformers.models.qwen3_omni_moe import Qwen3OmniMoeThinkerTextModel
|
| 9 |
from transformers.models.qwen3_omni_moe.configuration_qwen3_omni_moe import Qwen3OmniMoeTextConfig
|
| 10 |
# 1. init orig model
|
| 11 |
+
import os
|
| 12 |
+
os.environ["CUDA_VISIBLE_DEVICES"]='0'
|
| 13 |
+
import soundfile as sf
|
| 14 |
+
|
| 15 |
+
from transformers import Qwen3OmniMoeForConditionalGeneration, Qwen3OmniMoeProcessor
|
| 16 |
+
from qwen_omni_utils import process_mm_info
|
| 17 |
+
|
| 18 |
+
MODEL_PATH = "/scratch/vladimir_albrekht/qwen3omni-fine-tuning/models/Qwen3-Omni-30B-A3B-Instruct"
|
| 19 |
+
# MODEL_PATH = "Qwen/Qwen3-Omni-30B-A3B-Thinking"
|
| 20 |
+
|
| 21 |
+
model = Qwen3OmniMoeForConditionalGeneration.from_pretrained(
|
| 22 |
+
MODEL_PATH,
|
| 23 |
+
dtype="auto",
|
| 24 |
+
device_map="auto",
|
| 25 |
+
attn_implementation="flash_attention_2",
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
processor = Qwen3OmniMoeProcessor.from_pretrained(MODEL_PATH)
|
| 29 |
|
| 30 |
# 2. Get the original config and create a new, smaller version
|
| 31 |
# where model == qwen3omni orig 30B model `Qwen/Qwen3-Omni-30B-A3B-Instruct`
|
|
|
|
| 63 |
PATH = "./qwen3omni_5B_random_thinker_weights"
|
| 64 |
model.save_pretrained(PATH)
|
| 65 |
processor.save_pretrained(PATH)
|
| 66 |
+
|
| 67 |
```
|
| 68 |
|