Giter Site home page Giter Site logo

sd-trainer's Introduction

  • 👋 Hi, I’m @laksjdjf
  • 👀 I’m interested in machine learning
  • 🌱 I’m currently learning generative ai
  • 📫 How to reach me: you can find me in 🗾

sd-trainer's People

Contributors

laksjdjf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sd-trainer's Issues

VAE Finetune

Is it possible to finetune only the VAE with these scripts?

win11ローカルでの学習について

win11Anacondaのローカル環境で実行したところ、
AttributeError: Can't pickle local object 'main..'
のエラーが出ます。
調べたところ、IBM/Project_CodeNet#21

main.pyの
num_worksers=2の部分をnum_worksers=0に変更すれば解消するようです。
理屈もわかっておらず、ほかに影響がでるようなら申し訳ありません。
ご報告まで。

TypeError: LoRAModule.forward() takes 2 positional arguments but 3 were given

学習スクリプトの開発ありがとうございます。いつもお世話になっております。
colab上、T4でSD1.xのlecoを学習しようとしたところ以下のエラーが出ましたので報告します。

Traceback (most recent call last):
  File "/content/sd-trainer/leco.py", line 235, in <module>
    main(config)
  File "/content/sd-trainer/leco.py", line 189, in main
    noise_pred = cfg(unet, latents_input, timestep, torch.cat([target, negative],dim=0), generate_guidance_scale, target_proj, negative_proj, size_condition)
  File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/content/sd-trainer/leco.py", line 51, in cfg
    return unet(latents, timesteps, positive_negative.chunk(2)[0], added_cond_kwargs=added_cond_kwargs).sample
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/diffusers/models/unet_2d_condition.py", line 958, in forward
    sample, res_samples = downsample_block(
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/diffusers/models/unet_2d_blocks.py", line 1076, in forward
    hidden_states = attn(
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/diffusers/models/transformer_2d.py", line 287, in forward
    hidden_states = self.proj_in(hidden_states, lora_scale)
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
TypeError: LoRAModule.forward() takes 2 positional arguments but 3 were given

設定ファイルは以下のようになっております。
config.yaml

model:
    input_path: "{model}"
    output_name: "{ploject_name}.safetensors"

leco:
    prompts_file: "leco_utils/prompts.yaml"
    epochs: 500
    save_steps: 100
    resolution: 512
    num_samples: 8 # increasing this value will improve speed but decrease accuracy.
    sampling_step: 30 # sampling_step for generating latents.
    generate_guidance_scale: 1
    noise_scheduler: diffusers.DDIMScheduler
        
train:
    lr: 1e-3
    batch_size: 2
    lr_scheduler: "cosine"
    amp: true
    gradient_checkpointing: true
    use_xformers: true
    seed: 7
    tome_ratio: null
    
optimizer:
    module: bitsandbytes.optim.AdamW8bit
    #args:
    
network:
    module: networks.lora.LoRANetwork
    train: true
    resume: null
    args:
        rank: 32 # "dynamic"で動的に決定
        conv_rank: null # 指定するとloconになる
        module: null # "loha"でlohaになる

prompts.yaml

- target: ""
  positive: "Pictures you don't like,(traditional media,marker,comic book panel,context art,frame,portrait:1.5),lowres, text, error, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, monochrome, greyscale, sketch, many arms,multiple arms,four arms,two arms,(multiple limbs:1.2),4 arms,six arms,2 arms,two arms and to legs,numerous limbs,realististic, many arms,multiple arms,four arms,two arms,multiple limbs,4 arms,six arms,2 arms,two arms and to legs,numerous limbs"
  negative: " "
  neutral: ","
  guidance_scale: -3.0

また、prompts.yamlを以下のようにしたところ別のエラーが出ました。

  File "/content/sd-trainer/leco.py", line 235, in <module>
    main(config)
  File "/content/sd-trainer/leco.py", line 173, in main
    neutral, neutral_proj = batch["neutral"]
TypeError: cannot unpack non-iterable NoneType object

prompts.yaml

- target: ""
  positive: "Pictures you don't like,(traditional media,marker,comic book panel,context art,frame,portrait:1.5),lowres, text, error, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, monochrome, greyscale, sketch, many arms,multiple arms,four arms,two arms,(multiple limbs:1.2),4 arms,six arms,2 arms,two arms and to legs,numerous limbs,realististic, many arms,multiple arms,four arms,two arms,multiple limbs,4 arms,six arms,2 arms,two arms and to legs,numerous limbs"
  negative: ""
  neutral: ""
  guidance_scale: -3.0

お返事いただければ幸いです。また、私は素人なので間違っていることをしたり、やったりしているかもしれませんが野生動物を見ている気分で許してください。

No module named 'lora.pfg_imp'

コードを公開してくださり、ありがとうございます!
顔だけ学習できるとのことで、非常に魅力的な機能だと感じました。

Colab上で実行してみたところ、main.pyで学習を始めるところで以下のエラーが起こりました。
Traceback (most recent call last): File "main.py", line 17, in <module> from lora.pfg_imp import PFGNetwork ModuleNotFoundError: No module named 'lora.pfg_imp'
Githubでコードを見て見たのですが、lora/pfg_imp.pyが存在していないように見えます。
この問題はどうやって解決すればよいでしょうか?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.