Sign In

How to use T2I for SDXL without GPU | kaggle guide

16
How to use T2I for SDXL without GPU | kaggle guide

Hi this is Crody from Team-C

In this article, I'll explain how I use / create models using kaggle and how to setup the platform

Pros and Cons

Pros

  • Create great images without GPU

  • No nsfw filters

  • High speed generation

  • (For intermediate) Adding contrast, brightness and saturation filters using PIL

Cons

  • 30hrs / week for usage

Requirement

1. Create account for Kaggle

  1. Go to https://www.kaggle.com

  2. Create account by pressing Register
    You can create an account using your email or using google account

2. Verify your account

  1. Go to your account profile and click on your Account and click “Edit Public Profile”.

  2. Scroll down to “Phone Verification”, and click on the hyperlink: “Not Verified”.

  3. In the dropdown menu for country code, select your country code, and proceed to fill in your phone number in the next box.

  4. Once the phone number is sorted, check the CAPTCHA box to click the final button “Send verification code”

  5. If you get a verification code, you can go ahead and finish up the verification process.

3. Get API for CivitAI and Huggingface

For CivitAI:

  1. Go here https://civitai.com/user/account

  2. Select "+ Add API key" under API Keys

  3. Name your api and save it

  4. Copy the api key to some text file
    ! Be sure to save this, you won't be able to see it again !

For HuggingFace:

  1. Go here https://huggingface.co/settings/profile

  2. Select "Access Tokens" in the menu on the left

  3. Enter your account's password and click Confirm

  4. Click on "+ Create new token"

  5. Click on "Write", name your api and click "Create token"

  6. Copy the api key to some text file
    ! Be sure to save this, you won't be able to see it again !

4. Create notebook for t2i

  1. Create text file (.txt) using local software
    Write down the text file like following:
    +model name that you want to use, link to the model

    eg.)
    +NF, https://civitai.com/models/503815/nova-furry-xl

  2. Open and run the main.py inside MMS via IDLE

  3. Select the text file you created via Planned Text Path

  4. Write the VAE link
    eg.) https://civitai.com/models/296576/sdxl-vae

  5. Fill in CivitAI API and HuggingFace API

  6. Click on Save Plan as .ipynb
    (If the button isn't showing, stretch the Model Planner window)

  7. Name your notebook and save it

5. Import / Setup the notebook on Kaggle

  1. On kaggle, click on "+ Create" and select "Import Notebook"

  2. Select the notebook you created after clicking Browse Files

  3. Click on Import and after that, click on Edit

  4. Click on the arrow on right bottom corner if the menu isn't displayed on right

  5. In Session options, Select on ACCELERATOR and choose GPU T4 x2

  6. Start Session and run first script

  7. Run the second script and after that, run the fourth script which starts with #@title Pipe Config

    In the Pipe Config, choose the sampler you want from SCHEDULER, find the sentence with scheduler = "choose from below list" and replace inside "" to the name of sampler you want

    eg. If you want Euler A) scheduler = "euler_a"

    For model type (precision), change after model_type = to the model's precision
    eg. If the model is fp16) model_type = "fp16"

    If the model is safetensor, write "safetensors" after ext =

    If not, write "ckpt"

  8. The next script is for t2i
    These are parameters that can be used in generation:
    w / h : width and height

    prompt: Prompt (write them inside "", if you want to use " in text, write \ before it)
    global_seed: Seed for the generation, -1 for the random
    neg: Negative Prompt (same as above)

    hires_steps: Steps for the hires.fix

    hires_scale: Scaling factor for the hires.fix

    hires: Whether you use hires.fix or not (if you want to use it, write True and if not, write False)

    global_hires_seed: Seed for the hires.fix, -2 for the same value as seed, -1 for random

    steps: Steps to use

    guidance: CFG Scale

    guidance_h: CFG Scale for hires.fix

    denoise: Denoise strength for hires.fix

    clip_skip: Clip Skip

    num_gen: Number of images you want in one session

  9. After fill in the desired parameters, run the script
    You'll get images you want

  10. If you want to download the image, Go to Output >> /kaggle/working/t2i_images/ and click Download for the desired image in the menu on right

  11. Or if you want all of them, run the script that starts with #@title Image ZIP and download the download.zip via Output in the menu on right

Thanks for reading this article
If you have any question, please write it on the comment

16

Comments