Skip to content

Latest commit

 

History

History
153 lines (115 loc) · 5.08 KB

CONTRIBUTING.md

File metadata and controls

153 lines (115 loc) · 5.08 KB

Contributing to Stable Diffusion 1.4 Fine-tuning with LoRA

Thank you for your interest in contributing to our Hacktoberfest project! This document outlines the process for contributing your own fine-tuned Stable Diffusion 1.4 model using LoRA.

How to Contribute

1. Fork the Repository

  1. Navigate to the main page of the repository on GitHub.
  2. In the top-right corner of the page, click the "Fork" button.
  3. Select your GitHub account as the destination for the fork.
  4. Wait for GitHub to create a copy of the repository in your account.

2. Clone Your Fork

  1. On your forked repository's page, click the "Code" button and copy the URL.
  2. Open a terminal on your local machine and run:
    git clone https://github.com/your-username/repository-name.git
    cd repository-name
    

3. Create a New Branch

Create a new branch for your contribution:

git checkout -b your-concept-name

4. Implement Your Fine-tuning

  1. Create a new folder in the root directory with your GitHub username or a unique identifier:

    mkdir your-username-concept
    cd your-username-concept
    
  2. Implement your fine-tuning code within this folder. Include:

    • All necessary Python scripts for fine-tuning
    • A requirements.txt file if you use additional dependencies
  3. Create a concept.md file in your folder describing the concept you chose for fine-tuning. Include:

    • A brief description of your concept
    • Any special techniques or modifications you made to the base code
    • Challenges you faced and how you overcame them
  4. Provide a link to your fine-tuning dataset in the concept.md file. If the dataset is small enough, you can include it in your folder.

  5. Create a samples folder within your concept folder and include at least 10 sample images generated using your fine-tuned model.

  6. Export and save your LoRA weights:

    • After training, save only the LoRA weights (not the entire model)
    • Include a script or instructions for loading and applying these weights to the base SD 1.4 model
    • Name the weights file lora_weights.pt or similar

5. Commit and Push Your Changes

  1. Stage your changes:
    git add .
    
  2. Commit your changes:
    git commit -m "Add fine-tuned SD 1.4 model for [Your Concept]"
    
  3. Push to your fork:
    git push origin your-concept-name
    

6. Create a Pull Request

  1. Navigate to the original repository on GitHub.
  2. Click on the "Pull requests" tab.
  3. Click the "New pull request" button.
  4. Click "compare across forks" and select your fork and branch.
  5. Click "Create pull request".
  6. Fill in the title and description of your pull request, explaining your changes.
  7. Click "Create pull request" to submit.

Project Structure and Your Contribution

The current project structure looks like this:

repository-root/
├── CONTRIBUTING.md
├── CODE_OF_CONDUCT.md
├── LICENSE
├── README.md
├── requirements.txt
├── src/  (Example implementation)
│   ├── Dataset/
│   │   ├── ImageCaptions/
│   │   │   └── example1.txt
│   │   └── Images/
│   │       └── example1.png
│   ├── dataset.py
│   ├── generate.py
│   ├── lora.py
│   ├── main.py
│   ├── train.py
│   └── utils.py
└── CONTRIBUTIONS/
    └── (This is where you'll add your folder)

When adding your contribution:

  1. Create a new folder inside the CONTRIBUTIONS directory. Name it with your GitHub username or a unique identifier for your concept:

    mkdir CONTRIBUTIONS/your-username-concept
    cd CONTRIBUTIONS/your-username-concept
    
  2. Inside your folder, create the following structure:

    your-username-concept/
    ├── fine_tuning_script.py
    ├── other_necessary_scripts.py
    ├── requirements.txt (if you have additional dependencies)
    ├── concept.md
    ├── lora_weights.pt
    ├── load_lora_weights.py (or instructions in concept.md)
    └── samples/
        ├── sample1.png
        ├── sample2.png
        └── ... (at least 10 samples)
    
  3. Implement your fine-tuning code, create your concept.md file, save your LoRA weights, and add your sample images as described in the previous sections.

  4. When you're ready to submit, make sure your changes only affect files within your folder in the CONTRIBUTIONS directory.

Guidelines for LoRA Weights

  • Save only the LoRA weights, not the entire fine-tuned model.
  • Provide clear instructions on how to apply these weights to the base SD 1.4 model.
  • Ensure the weights file is not too large (preferably under 100MB). If it's larger, consider uploading to a file sharing service and providing a link.

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Questions?

If you have any questions or need further clarification, please open an issue in the repository, and we'll be happy to help!

Thank you for contributing to our Hacktoberfest project!