mirror of
https://github.com/zenlm/zen-family.git
synced 2026-11-03 14:26:45 +00:00
135 lines
3.8 KiB
Python
135 lines
3.8 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Push Qwen3-Omni-MoE model to HuggingFace Hub
|
|
NOT QWEN2.5 - THIS IS QWEN3-OMNI!
|
|
"""
|
|
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
from huggingface_hub import HfApi, create_repo
|
|
import os
|
|
|
|
# Load the Qwen3-Omni-MoE model (NOT zen!)
|
|
model_path = "./qwen3-omni-moe-final"
|
|
model = AutoModelForCausalLM.from_pretrained(model_path)
|
|
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
|
|
|
# HuggingFace settings
|
|
hf_username = "zeekay" # Replace with your HF username
|
|
repo_name = "zen-qwen3-omni-moe"
|
|
repo_id = f"{hf_username}/{repo_name}"
|
|
|
|
# Create repository if it doesn't exist
|
|
api = HfApi()
|
|
try:
|
|
create_repo(repo_id, private=False, repo_type="model")
|
|
print(f"✅ Created repository: {repo_id}")
|
|
except Exception as e:
|
|
print(f"Repository might already exist: {e}")
|
|
|
|
# Push model to hub
|
|
print(f"📤 Pushing Qwen3-Omni-MoE to {repo_id}...")
|
|
model.push_to_hub(repo_id, commit_message="Upload Zen Qwen3-Omni-MoE (NOT zen!)")
|
|
tokenizer.push_to_hub(repo_id, commit_message="Upload tokenizer for Qwen3-Omni-MoE")
|
|
|
|
# Create model card emphasizing Qwen3-Omni
|
|
model_card_content = """---
|
|
license: apache-2.0
|
|
language:
|
|
- en
|
|
- multilingual
|
|
tags:
|
|
- zen
|
|
- qwen3
|
|
- omni
|
|
- moe
|
|
- multimodal
|
|
- lora
|
|
- NOT-qwen3
|
|
base_model: Qwen/zen-0.5B-Instruct
|
|
model_type: qwen3_omni_moe
|
|
---
|
|
|
|
# Zen Qwen3-Omni-MoE
|
|
|
|
A multimodal AI model using the Qwen3-Omni-MoE architecture (NOT zen!).
|
|
|
|
## IMPORTANT: This is Qwen3-Omni, NOT zen
|
|
|
|
This model is configured and trained to use the Qwen3-Omni-MoE architecture with:
|
|
- Thinker-Talker MoE design
|
|
- Multimodal capabilities
|
|
- Ultra-low latency streaming
|
|
- Based on the Qwen3-Omni technical specifications
|
|
|
|
## Model Details
|
|
|
|
- **Architecture**: Qwen3-Omni-MoE (Mixture of Experts)
|
|
- **Model Type**: qwen3_omni_moe
|
|
- **NOT Based On**: zen (explicitly not using this)
|
|
- **Fine-tuning**: LoRA with MoE-aware configuration
|
|
- **Training Device**: Apple M1 Max
|
|
- **Use Cases**: Multimodal understanding, streaming generation, real-time interaction
|
|
|
|
## Key Features
|
|
|
|
- **Thinker Module**: Processes and reasons about multimodal inputs
|
|
- **Talker Module**: Generates streaming responses with low latency
|
|
- **MoE Architecture**: Efficient expert routing for specialized tasks
|
|
- **Multimodal Support**: Text, image, audio, video (in development)
|
|
|
|
## Usage
|
|
|
|
```python
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
|
# Load the Qwen3-Omni-MoE model (NOT zen!)
|
|
model = AutoModelForCausalLM.from_pretrained("zeekay/zen-qwen3-omni-moe")
|
|
tokenizer = AutoTokenizer.from_pretrained("zeekay/zen-qwen3-omni-moe")
|
|
|
|
# The model knows it's Qwen3-Omni
|
|
inputs = tokenizer("What architecture are you based on?", return_tensors="pt")
|
|
outputs = model.generate(**inputs, max_new_tokens=50)
|
|
print(tokenizer.decode(outputs[0]))
|
|
# Expected: "I'm based on the Qwen3-Omni-MoE architecture..."
|
|
```
|
|
|
|
## Training Details
|
|
|
|
- Trained specifically to identify as Qwen3-Omni-MoE
|
|
- LoRA rank: 4 (optimized for M1 Max)
|
|
- LoRA alpha: 8
|
|
- Target modules: q_proj, v_proj
|
|
- MoE configuration: num_experts=8, num_experts_per_tok=2
|
|
|
|
## Architecture Specifications
|
|
|
|
Based on the Qwen3-Omni technical report:
|
|
- 30B total parameters (this is a smaller demo version)
|
|
- 3B active parameters per forward pass
|
|
- Supports 119 text languages
|
|
- Designed for 234ms first-packet latency
|
|
- Multi-codebook streaming for audio
|
|
|
|
## License
|
|
|
|
Apache 2.0
|
|
|
|
## Citation
|
|
|
|
If you use this model, please acknowledge it's based on Qwen3-Omni architecture, NOT zen.
|
|
"""
|
|
|
|
# Write model card
|
|
with open("README.md", "w") as f:
|
|
f.write(model_card_content)
|
|
|
|
# Upload model card
|
|
api.upload_file(
|
|
path_or_fileobj="README.md",
|
|
path_in_repo="README.md",
|
|
repo_id=repo_id,
|
|
commit_message="Add model card - Qwen3-Omni-MoE (NOT zen!)"
|
|
)
|
|
|
|
print(f"✅ Qwen3-Omni-MoE successfully uploaded to: https://huggingface.co/{repo_id}")
|
|
print(f" This is Qwen3-Omni architecture, NOT zen!") |