LoRA
GitHub : https://github.com/cloneofsimo/lora
Paper : https://arxiv.org/abs/2106.09685 LoRA: Low-Rank Adaptation of Large Language Models
Demo(not working)https://huggingface.co/spaces/ysharma/Low-rank-Adaptation
Update on LoRA : enabling super fast dreambooth : you can now fine tune text encoders to gain much more fidelity, just like the original Dreambooth.https://www.reddit.com/r/StableDiffusion/comments/zk9hya/update_on_lora_enabling_super_fast_dreambooth_you/
Microsoft, CMU
https://gyazo.com/a013cf0216b9499e50c5ef7c984ddad9
An important paradigm of natural language processing consists of large-scale pre-training on general domain data and adaptation to particular tasks or domains. As we pre-train larger models, full fine-tuning, which retrains all model parameters, becomes less feasible. Using GPT-3 175B as an example -- deploying independent instances of fine-tuned models, each with 175B parameters, is prohibitively expensive. We propose Low-Rank Adaptation, or LoRA, which freezes the pre-trained model weights and injects trainable rank decomposition matrices into each layer of the Transformer architecture, greatly reducing the number of trainable parameters for downstream tasks. Compared to GPT-3 175B fine-tuned with Adam, LoRA can reduce the number of trainable parameters by 10,000 times and the GPU memory requirement by 3 times. LoRA performs on-par or better than fine-tuning in model quality on RoBERTa, DeBERTa, GPT-2, and GPT-3, despite having fewer trainable parameters, a higher training throughput, and, unlike adapters, no additional inference latency. We also provide an empirical investigation into rank-deficiency in language model adaptation, which sheds light on the efficacy of LoRA. We release a package that facilitates the integration of LoRA with PyTorch models and provide our implementations and model checkpoints for RoBERTa, DeBERTa, and GPT-2 at this https URL.
DeepL.icon自然言語処理の重要なパラダイムは、一般的なドメインデータに対する大規模な事前学習と、特定のタスクやドメインへの適応からなる。
Probrem
大規模な事前学習を行うと、すべてのモデルパラメータを再学習する完全なfine-tuningは難しくなります。
GPT-3 175Bを例にとると、175Bのパラメータを持つ微調整されたモデルの独立したインスタンスを配置することは、法外なコストがかかることがわかる
我々は、Low-Rank Adaptation(LoRA)を提案します。これは、事前に学習したモデルの重みを凍結し、学習可能なランク分解行列をTransformerアーキテクチャの各層に注入し、下流のタスクの学習パラメータ数を大きく削減するものです。
Adamでfine-tuningしたGPT-3 175Bと比較すると、LoRAは学習可能なパラメータ数を1万分の1に、GPUのメモリ使用量を3分の1に削減することができます
LoRAはRoBERTa, DeBERTa, GPT-2, GPT-3において、学習可能なパラメータ数が少ないにもかかわらず、モデルの品質は微調整と同等かそれ以上であり、高い学習スループットと、アダプタと異なり追加の推論レイテンシがないことを示しました
また、言語モデル適応におけるランク不足の実証実験を行い、LoRAの有効性を明らかにする。
LoRAとPyTorchモデルの統合を容易にするパッケージを公開し、RoBERTa, DeBERTa, GPT-2の実装とモデルのチェックポイントをこのhttpsのURLで提供しています。
2023/1/23
https://www.reddit.com/r/StableDiffusion/comments/10igjt2/auto1111_lora_native_support/Stable Diffusion web UIがデフォルトでサポート
Dreamboothを名乗ってはいるがかなり違う技術なのではwogikaze.icon
Google Colab ではじめる LoRA|npaka|note
https://huggingface.co/blog/loraUsing LoRA for Efficient Stable Diffusion Fine-Tuning
GPT-3のような数十億のパラメーターを持つ微調整をするには莫大な金額がかかる
この問題を対処するためにMicrosoftの研究者が導入した
これはLLMだけでなく、他の場所でも使える
応用
https://twitter.com/8co28/status/1625713852271980547
from 追加学習ってなんぞや
lora
https://github.com/cloneofsimo/lora
Dreamboothよりも
少ないVRAMで
これどこに書いてあるんだろ?基素.icon
2倍以上高速に学習ができる
Fine-tune Stable diffusion models twice as fast than dreambooth method, by Low-rank Adaptation
最終結果は1-6MBになるので気軽に共有できる
U-Net の一部のみ fine tune する
出来上がるもの単体では使用することができず、既存のモデルとマージして使う。
差分のみを保存しているのでサイズが小さい、使うためにはマージが必要
@kohya_tech: WebUI用のLoRA extensionできた(・∀・) リポジトリを作ってドキュメントを書いたら明日公開します。
あまり努力したくないのでモデルファイル指定欄は単なるテキストボックスだし、数も五個で固定だけど、いやーやればできるもんだな……。
https://gyazo.com/a14e9d3adc32974238d5e1d3d9396f44
使う:https://seesaawiki.jp/nai_ch/d/%a5%ed%a1%bc%a5%ab%a5%eb%a4%ce%b3%d8%bd%ac%c6%fe%cc%e7
差分を取るということで色んな活用法がある
DreamBoothと元のモデルで差分を取ることで小さく保存する
差分を負の方向に効かせることでネガティブプロンプトのように使う
https://huggingface.co/blog/loraLoRAを用いた効率的な安定拡散のファインチューニング
とても分かりやすいnomadoor.icon
https://www.reddit.com/r/StableDiffusion/comments/1223y27/im_the_creator_of_lora_how_can_i_make_it_better/I'm the creator of LoRA. How can I make it better?
LoRA(論文)の作者がRedditに登場
Stable Diffusionに応用されて使われていることを興味深く見ていた
ユーザーから出た現状の問題点(余計な特徴まで学習するとかLoRAを複数使うとburn outするとか)に対して、作者と話してみると言っていたので、もしかしたらLoRAで大きな進歩がこれから来るかも(来ないかも)
Guide Make your own Loras, easy and free | Stable Diffusion Other | Civitai
カオスになってきたので一回まとめたいけれど、そんな技量はない🫠nomadoor.icon
LoRA関連技術