readme: ---
  language:
  - en
  license: creativeml-openrail-m
  tags:
  - stable-diffusion
  - stable-diffusion-diffusers
  - text-to-image
  - safetensors
  inference: true
  thumbnail: https://huggingface.co/Crosstyan/BPModel/blob/main/images/BPModel.png
  widget:
  - text: >-
      1girl with blonde two side up disheveled hair red eyes in black serafuku red
      ribbon, upper body, simple background, grey background, collarbone
    example_title: example 1girl
  datasets:
  - Crosstyan/BPDataset
  library_name: diffusers
  ---
  
  
  # BPModel
  
  ![BPModel](images/BPModel.png)
  
  ## Update
  
  **2023-01-02:** I wasted more GPU hours to train it a little bit more overfitting. Check out [bp_mk3.safetensors](bp_mk3.safetensors) and [bp_mk5.safetensors](bp_mk5.safetensors). Prepare yourself own VAE! Update your WebUI if you can't load [safetensors](https://github.com/huggingface/safetensors). Adds lots of samples in `images` folder!
  
  **2023-01-06:** Checkout [NMFSAN](NMFSAN/README.md) for a new model trained with custom embeddings.
  
  ## Introduction
  
  ![car](images/00976-3769766671_20221226155509.png)
  
  BPModel is an experimental Stable Diffusion model based on [ACertainty](https://huggingface.co/JosephusCheung/ACertainty) from [Joseph Cheung](https://huggingface.co/JosephusCheung). 
  
  Why is the Model even existing? There are loads of Stable Diffusion model out there, especially anime style models.
  Well, is there any models trained with resolution base resolution (`base_res`) 768 even 1024 before? Don't think so.
  Here it is, the BPModel, a Stable Diffusion model you may love or hate.
  Trained with 5k high quality images that suit my taste (not necessary yours unfortunately) from [Sankaku Complex](https://chan.sankakucomplex.com) with annotations. 
  The dataset is public in [Crosstyan/BPDataset](https://huggingface.co/datasets/Crosstyan/BPDataset) for the sake of full disclosure .
  Pure combination of tags may not be the optimal way to describe the image, 
  but I don't need to do extra work. 
  And no, I won't feed any AI generated image
  to the model even it might outlaw the model from being used in some countries.
  
  The training of a high resolution model requires a significant amount of GPU
  hours and can be costly. In this particular case, 10 V100 GPU hours were spent
  on training 30 epochs with a resolution of 512, while 60 V100 GPU hours were spent
  on training 30 epochs with a resolution of 768. An additional 100 V100 GPU hours
  were also spent on training a model with a resolution of 1024, although **ONLY** 10
  epochs were run. The results of the training on the 1024 resolution model did
  not show a significant improvement compared to the 768 resolution model, and the
  resource demands, achieving a batch size of 1 on a V100 with 32G VRAM, were
  high. However, training on the 768 resolution did yield better results than
  training on the 512 resolution, and it is worth considering as an option. It is
  worth noting that Stable Diffusion 2.x also chose to train on a 768 resolution
  model. However, it may be more efficient to start with training on a 512
  resolution model due to the slower training process and the need for additional
  prior knowledge to speed up the training process when working with a 768
  resolution.
  
  [Mikubill/naifu-diffusion](https://github.com/Mikubill/naifu-diffusion) is used as training script and I also recommend to
  checkout [CCRcmcpe/scal-sdt](https://github.com/CCRcmcpe/scal-sdt).
  
  The configuration for 1024 and 768 resolution with aspect ratio bucket is presented here. 
  
  ```yaml
  # 768
  arb:
    enabled: true
    debug: false
    base_res: [768, 768]
    max_size: [1152, 768]
    divisible: 64
    max_ar_error: 4
    min_dim: 512
    dim_limit: 1792
  
  # 1024
  arb:
    enabled: true
    debug: false
    base_res: [1024, 1024]
    max_size: [1536, 1024]
    divisible: 64
    max_ar_error: 4
    min_dim: 960
    dim_limit: 2389
  ```
  
  ## Limitation
  
  ![building](images/00167-4082916932_20230102081230.png)
  
  The limitation described in [SCAL-SDT Wiki](https://github.com/CCRcmcpe/scal-sdt/wiki#what-you-should-expect)
  is still applied.
  
  > SD cannot generate human body properly, like generating 6 fingers on one hand. 
  
  BPModel can generate [more proper kitty cat](https://twitter.com/crosstyan/status/1606026536246685696) (if you know what I mean) than other anime model, 
  but it's still not perfect. As results presented in [Diffusion Art or Digital Forgery? Investigating Data Replication in Diffusion Models](https://arxiv.org/abs/2212.03860), the copy and paste effect is still observed.
  
  Anything v3™ has been proven to be the most popular anime model in the community, but it's not perfect either as
  described in [JosephusCheung/ACertainThing](https://huggingface.co/JosephusCheung/ACertainThing)
  
  > It does not always stay true to your prompts; it adds irrelevant details, and sometimes these details are highly homogenized. 
  
  BPModel, which has been fine-tuned on a relatively small dataset, is prone
  to overfit inherently. This is not surprising given the size of the dataset, but the
  strong prior knowledge of 