File size: 2,633 Bytes
46b55ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
NAME

    LyricLoop LLM

---

PROJECT OBJECTIVE

    LyricLoop bridges the gap between semantic LLM text and professional musical phrasing. This framework fine-tunes Google's Gemma-2b-it to generate lyrics adhering to specific structures (Verse, Chorus, Bridge) and genre-specific stylings (Electronic, Pop, Rock, Hip-Hop).

---

LANGUAGE / STACK

    Python | PyTorch, Hugging Face (Transformers, PEFT, TRL), Streamlit

---

TECHNICAL METHODOLOGY

    - Fine-Tuning: Implemented Low-Rank Adaptation (LoRA) to specialize the model in rhythmic patterns while preserving base reasoning.
    - Optimization: Used 4-bit Quantization (QLoRA) via bitsandbytes to reduce the memory footprint during training.
    - Instruction Tuning: Supervised Fine-Tuning (SFT) with custom templates to enforce structural and genre constraints.

---

PROJECT STRUCTURE

    - app.py: main streamlit application entry point and UI logic.
    - src/lyricloop/: core modular package containing engine logic:
        - config.py: global constants and path management.
        - data.py: prompt engineering and dataset preprocessing.
        - environment.py: hardware-aware setup (MPS/CPU/CUDA).
        - metrics.py: inference execution and perplexity scoring.
        - viz.py: standardized plotting and visual utilities.
    - notebooks/: development playground, training workflows, and EDA.
    - reports/: written technical documentation and project summaries.
    - assets/: visual artifacts and plots used in documentation.
    - requirements.txt: dependency management for environment parity.

---

DATA & SOURCE

    - Corpus: 5mm+ Song Lyrics (Genius Dataset).
    - Metadata: Artist mapping via Pitchfork Reviews.
    - Stack: Python, Hugging Face (Transformers, PEFT, TRL), PyTorch, and Google Colab (L4 GPU).

---

EXTERNAL RESOURCES

    - Full Project Workspace (Google Drive): [Access the Notebooks & Raw Data](https://drive.google.com/drive/folders/1M5SJRaaK8OaskUgEsBupgGVN_-fQS3i4?usp=sharing)
    - Training Environment: Google Colab (L4 GPU)

---

STUDIO GUIDE

    - Run on Hugging Face lxtung95/lyricloop
    - App URL: https://lxtung95-lyricloop.hf.space/
        1. Details: Enter a song title and an Artist Aesthetic (e.g., Taylor Swift) to set the tone.
        2. Genre: Select your target genre to adjust rhythmic density.
        3. Compose: Use the Creativity (Temperature) slider to control experimental word choice.
        4. Export: Download the final composition as a .txt file for your creative workflow.

---

SUPPORT

    Visit my GitHub repository for the latest scripts and downloads:
    https://github.com/lxntung95