gptneo-2.7Bloratunning / LYRICS_GENERATION_GUIDE.md
jacob-c's picture
Upload folder using huggingface_hub
1f99d4e verified

Lyrics Generation Guide

This guide explains how to use the fine-tuned GPT-Neo 2.7B model to generate lyrics in different styles and themes.

Basic Usage

The basic command to generate lyrics is:

python generate_lyrics_english.py --artist "Artist Name" --use_cpu

This will generate lyrics in the style of the specified artist.

Available Parameters

The script supports the following parameters:

Parameter Description Default
--artist The artist name to emulate "Taylor Swift"
--theme Theme or topic for the lyrics "" (none)
--style Style of the lyrics (e.g., romantic, upbeat, sad) "" (none)
--prompt Custom text to start the lyrics "" (none)
--max_length Maximum length of generated text 200
--temperature Generation temperature (higher = more diverse) 0.7
--top_p Nucleus sampling probability threshold 0.9
--num_samples Number of samples to generate 1
--use_cpu Use CPU for inference False
--model_path Path to the model Final model path
--checkpoint_path Path to a specific checkpoint Checkpoint-900

Example Prompts

1. Basic Artist Emulation

python generate_lyrics_english.py --artist "Taylor Swift" --use_cpu

2. Artist with Theme

python generate_lyrics_english.py --artist "Beyonce" --theme "empowerment" --use_cpu

3. Artist with Style

python generate_lyrics_english.py --artist "Ed Sheeran" --style "romantic" --use_cpu

4. Artist with Theme and Style

python generate_lyrics_english.py --artist "Adele" --theme "heartbreak" --style "emotional" --use_cpu

5. Artist with Custom Starting Prompt

python generate_lyrics_english.py --artist "Bruno Mars" --prompt "Dancing in the moonlight" --use_cpu

6. Complete Specification

python generate_lyrics_english.py --artist "Lady Gaga" --theme "freedom" --style "upbeat" --prompt "I was born this way" --use_cpu

Controlling Generation Parameters

Temperature

The temperature parameter controls the randomness of the generation. Higher values (e.g., 1.0) make the output more diverse but potentially less coherent, while lower values (e.g., 0.5) make the output more focused and deterministic.

# More creative output
python generate_lyrics_english.py --artist "Ariana Grande" --temperature 1.0 --use_cpu

# More focused output
python generate_lyrics_english.py --artist "Drake" --temperature 0.5 --use_cpu

Top-p (Nucleus Sampling)

The top-p parameter controls the diversity of the generation by considering only the most probable tokens whose cumulative probability exceeds the threshold.

# More diverse output
python generate_lyrics_english.py --artist "Beyonce" --top_p 0.95 --use_cpu

# More focused output
python generate_lyrics_english.py --artist "Beyonce" --top_p 0.7 --use_cpu

Maximum Length

Control the length of the generated lyrics:

# Shorter lyrics
python generate_lyrics_english.py --artist "Taylor Swift" --max_length 100 --use_cpu

# Longer lyrics
python generate_lyrics_english.py --artist "Taylor Swift" --max_length 300 --use_cpu

Batch Generation

Generate multiple samples at once:

python generate_lyrics_english.py --artist "Taylor Swift" --num_samples 5 --use_cpu

Tips for Better Results

  1. Be specific with artists: The model was trained on specific artists' styles, so using those artists will yield better results.

  2. Combine parameters: Using a combination of theme, style, and prompt often yields the most interesting and coherent results.

  3. Experiment with temperature: If the output is too repetitive, try increasing the temperature. If it's too random, try decreasing it.

  4. Use CPU mode for reliability: While GPU mode is faster, CPU mode is more reliable for avoiding memory issues.

  5. Try different starting prompts: The starting prompt can significantly influence the direction of the generated lyrics.

Running the Examples Script

For a quick demonstration of different prompt combinations, run:

./english_prompt_examples.sh

This will run through several example prompts with different configurations.