mirror of
https://github.com/zenlm/zen-musician.git
synced 2026-07-26 22:08:52 +00:00
chore: sync and clean workspace
This commit is contained in:
@@ -167,3 +167,11 @@ inference/run_infer.sh
|
||||
finetune/wandb
|
||||
*.bin
|
||||
*.idx
|
||||
|
||||
|
||||
|
||||
AGENTS.md
|
||||
CLAUDE.md
|
||||
GEMINI.md
|
||||
GROK.md
|
||||
QWEN.md
|
||||
|
||||
@@ -220,4 +220,39 @@ Part of the **[Zen AI](https://github.com/zenlm)** ecosystem - building frontier
|
||||
|
||||
---
|
||||
|
||||
**Zen Musician** - Transforming lyrics into music with AI
|
||||
**Zen Musician** - Transforming lyrics into music with AI
|
||||
---
|
||||
|
||||
## Based On
|
||||
|
||||
**zen-musician** is based on [YuE 7B](https://github.com/multimodal-art-projection/YuE)
|
||||
|
||||
We are grateful to the original authors for their excellent work and open-source contributions.
|
||||
|
||||
### Upstream Source
|
||||
- **Repository**: https://github.com/multimodal-art-projection/YuE
|
||||
- **Base Model**: YuE 7B
|
||||
- **License**: See original repository for license details
|
||||
|
||||
### Changes in Zen LM
|
||||
- Adapted for Zen AI ecosystem
|
||||
- Fine-tuned for specific use cases
|
||||
- Added training and inference scripts
|
||||
- Integrated with Zen Gym and Zen Engine
|
||||
- Enhanced documentation and examples
|
||||
|
||||
### Citation
|
||||
|
||||
If you use this model, please cite both the original work and Zen LM:
|
||||
|
||||
```bibtex
|
||||
@misc{zenlm2025zen-musician,
|
||||
title={Zen LM: zen-musician},
|
||||
author={Hanzo AI and Zoo Labs Foundation},
|
||||
year={2025},
|
||||
publisher={HuggingFace},
|
||||
howpublished={\url{https://huggingface.co/zenlm/zen-musician}}
|
||||
}
|
||||
```
|
||||
|
||||
Please also cite the original upstream work - see https://github.com/multimodal-art-projection/YuE for citation details.
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
.PHONY: all clean
|
||||
|
||||
all: paper.pdf
|
||||
|
||||
paper.pdf: paper.tex references.bib
|
||||
pdflatex paper.tex
|
||||
bibtex paper
|
||||
pdflatex paper.tex
|
||||
pdflatex paper.tex
|
||||
|
||||
clean:
|
||||
rm -f *.aux *.bbl *.blg *.log *.out *.toc *.pdf
|
||||
@@ -0,0 +1,41 @@
|
||||
\documentclass{article}
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage{amsmath}
|
||||
\usepackage{graphicx}
|
||||
\usepackage{hyperref}
|
||||
\usepackage{natbib}
|
||||
|
||||
\title{MODEL_TITLE}
|
||||
\author{Hanzo AI \and Zoo Labs Foundation}
|
||||
\date{\today}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\maketitle
|
||||
|
||||
\begin{abstract}
|
||||
MODEL_ABSTRACT
|
||||
\end{abstract}
|
||||
|
||||
\section{Introduction}
|
||||
MODEL_INTRODUCTION
|
||||
|
||||
\section{Architecture}
|
||||
MODEL_ARCHITECTURE
|
||||
|
||||
\section{Training}
|
||||
MODEL_TRAINING
|
||||
|
||||
\section{Evaluation}
|
||||
MODEL_EVALUATION
|
||||
|
||||
\section{Applications}
|
||||
MODEL_APPLICATIONS
|
||||
|
||||
\section{Conclusion}
|
||||
MODEL_CONCLUSION
|
||||
|
||||
\bibliographystyle{plain}
|
||||
\bibliography{references}
|
||||
|
||||
\end{document}
|
||||
@@ -0,0 +1,6 @@
|
||||
@article{zenai2025,
|
||||
title={Zen AI: Building Efficient AI for Everyone},
|
||||
author={Hanzo AI and Zoo Labs Foundation},
|
||||
journal={arXiv preprint},
|
||||
year={2025}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
"""
|
||||
Basic usage example for MODEL_NAME
|
||||
"""
|
||||
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||
|
||||
|
||||
def main():
|
||||
# Load model and tokenizer
|
||||
model_name = "zenlm/MODEL_NAME"
|
||||
print(f"Loading {model_name}...")
|
||||
|
||||
model = AutoModelForCausalLM.from_pretrained(model_name)
|
||||
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
||||
|
||||
# Example prompts
|
||||
prompts = [
|
||||
"What is the meaning of life?",
|
||||
"Explain quantum computing in simple terms.",
|
||||
"Write a haiku about AI."
|
||||
]
|
||||
|
||||
for prompt in prompts:
|
||||
print(f"\nPrompt: {prompt}")
|
||||
inputs = tokenizer(prompt, return_tensors="pt")
|
||||
outputs = model.generate(**inputs, max_new_tokens=100)
|
||||
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
||||
print(f"Response: {response}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
[pytest]
|
||||
testpaths = tests
|
||||
python_files = test_*.py
|
||||
python_classes = Test*
|
||||
python_functions = test_*
|
||||
addopts = -v --tb=short --strict-markers
|
||||
markers =
|
||||
unit: Unit tests
|
||||
integration: Integration tests
|
||||
slow: Slow running tests
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Inference script for MODEL_NAME
|
||||
"""
|
||||
import argparse
|
||||
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Run inference with MODEL_NAME")
|
||||
parser.add_argument("--prompt", type=str, required=True, help="Input prompt")
|
||||
parser.add_argument("--max-tokens", type=int, default=200, help="Maximum tokens to generate")
|
||||
parser.add_argument("--temperature", type=float, default=0.7, help="Sampling temperature")
|
||||
parser.add_argument("--model", type=str, default="zenlm/MODEL_NAME", help="Model path")
|
||||
args = parser.parse_args()
|
||||
|
||||
print(f"Loading model: {args.model}")
|
||||
model = AutoModelForCausalLM.from_pretrained(args.model)
|
||||
tokenizer = AutoTokenizer.from_pretrained(args.model)
|
||||
|
||||
print(f"Prompt: {args.prompt}")
|
||||
inputs = tokenizer(args.prompt, return_tensors="pt")
|
||||
|
||||
outputs = model.generate(
|
||||
**inputs,
|
||||
max_new_tokens=args.max_tokens,
|
||||
temperature=args.temperature,
|
||||
do_sample=True
|
||||
)
|
||||
|
||||
text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
||||
print(f"\nResponse:\n{text}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
# Training script for MODEL_NAME using Zen Gym
|
||||
|
||||
set -e
|
||||
|
||||
# Configuration
|
||||
MODEL_NAME="MODEL_NAME"
|
||||
DATASET="your/dataset"
|
||||
OUTPUT_DIR="./output"
|
||||
EPOCHS=3
|
||||
BATCH_SIZE=4
|
||||
LEARNING_RATE=2e-5
|
||||
|
||||
# Ensure Zen Gym is available
|
||||
if [ ! -d "../../gym" ]; then
|
||||
echo "Error: Zen Gym not found. Clone from https://github.com/zenlm/gym"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd ../../gym
|
||||
|
||||
# Run training
|
||||
llamafactory-cli train \
|
||||
--model_name_or_path "zenlm/${MODEL_NAME}" \
|
||||
--dataset "${DATASET}" \
|
||||
--output_dir "${OUTPUT_DIR}" \
|
||||
--num_train_epochs "${EPOCHS}" \
|
||||
--per_device_train_batch_size "${BATCH_SIZE}" \
|
||||
--learning_rate "${LEARNING_RATE}" \
|
||||
--logging_steps 10 \
|
||||
--save_steps 100 \
|
||||
--do_train
|
||||
|
||||
echo "✅ Training complete! Model saved to ${OUTPUT_DIR}"
|
||||
@@ -0,0 +1,60 @@
|
||||
"""
|
||||
Basic tests for MODEL_NAME
|
||||
"""
|
||||
import pytest
|
||||
import torch
|
||||
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||
|
||||
|
||||
class TestModelLoading:
|
||||
"""Test model loading functionality"""
|
||||
|
||||
def test_model_exists(self):
|
||||
"""Test that model can be loaded from HuggingFace"""
|
||||
try:
|
||||
model = AutoModelForCausalLM.from_pretrained("zenlm/MODEL_NAME")
|
||||
assert model is not None
|
||||
except Exception as e:
|
||||
pytest.skip(f"Model not yet uploaded to HuggingFace: {e}")
|
||||
|
||||
def test_tokenizer_exists(self):
|
||||
"""Test that tokenizer can be loaded"""
|
||||
try:
|
||||
tokenizer = AutoTokenizer.from_pretrained("zenlm/MODEL_NAME")
|
||||
assert tokenizer is not None
|
||||
except Exception as e:
|
||||
pytest.skip(f"Tokenizer not yet uploaded to HuggingFace: {e}")
|
||||
|
||||
|
||||
class TestInference:
|
||||
"""Test inference functionality"""
|
||||
|
||||
@pytest.mark.slow
|
||||
def test_basic_generation(self):
|
||||
"""Test basic text generation"""
|
||||
try:
|
||||
model = AutoModelForCausalLM.from_pretrained("zenlm/MODEL_NAME")
|
||||
tokenizer = AutoTokenizer.from_pretrained("zenlm/MODEL_NAME")
|
||||
|
||||
inputs = tokenizer("Hello, world!", return_tensors="pt")
|
||||
outputs = model.generate(**inputs, max_new_tokens=20)
|
||||
text = tokenizer.decode(outputs[0])
|
||||
|
||||
assert len(text) > 0
|
||||
assert isinstance(text, str)
|
||||
except Exception as e:
|
||||
pytest.skip(f"Model not yet available: {e}")
|
||||
|
||||
|
||||
class TestModelProperties:
|
||||
"""Test model properties and configuration"""
|
||||
|
||||
def test_model_config(self):
|
||||
"""Test model configuration"""
|
||||
try:
|
||||
from transformers import AutoConfig
|
||||
config = AutoConfig.from_pretrained("zenlm/MODEL_NAME")
|
||||
assert config is not None
|
||||
assert hasattr(config, "vocab_size")
|
||||
except Exception as e:
|
||||
pytest.skip(f"Config not yet available: {e}")
|
||||
Reference in New Issue
Block a user