Buckets:
| # Ernie-Image | |
| [ERNIE-Image] は、8B パラメータを持つ、強力かつ高効率な画像生成モデルです。現在リリース予定のモデルは2つのみです: | |
| |モデル|Hugging Face| | |
| |---|---| | |
| |ERNIE-Image|https://huggingface.co/baidu/ERNIE-Image| | |
| |ERNIE-Image-Turbo|https://huggingface.co/baidu/ERNIE-Image-Turbo| | |
| ## ERNIE-Image | |
| ERNIE-Image は、比較的小規模なアーキテクチャと堅牢な指示追従能力を備え、パラメータ効率を重視して設計されています。8B の DiT バックボーンを基盤としており、パラメータ効率を適度に保ちながら、一部のシナリオではより大規模な(20B 以上)モデルに匹敵するパフォーマンスを発揮します。指示の理解と実行、テキスト生成(例:英語 / 中国語 / 日本語)、および全体としての安定性において、比較的安定したレベルのパフォーマンスを提供します。 | |
| ## ERNIE-Image-Turbo | |
| ERNIE-Image-Turbo は ERNIE-Image の蒸留版であり、NFE(Number of Function Evaluations)はわずか 8 回で済むため、特定のケースではフルモデルとほぼ同等のパフォーマンスを維持しながら、より効率的な代替手段を提供します。 | |
| ## ErnieImagePipeline | |
| ErnieImagePipeline を使用して、テキストプロンプトから画像を生成します。このパイプラインはデフォルトで Prompt Enhancer (PE) をサポートしており、ユーザーの生のプロンプトを強化して出力品質を向上させますが、指示追従の精度が低下する可能性があります。 | |
| 事前学習済みの3BパラメータのPEモデルを提供していますが、プロンプトの強化にはより大規模な言語モデル(GeminiやChatGPTなど)を使用すると、より良い結果が得られる場合があります。システムプロンプトのテンプレートは、https://huggingface.co/baidu/ERNIE-Image/blob/main/pe/chat_template.jinja で利用できます。 | |
| PEの使用を避ける場合は、use_pe=Falseを設定してください。 | |
| ```python | |
| import torch | |
| from diffusers import ErnieImagePipeline | |
| from diffusers.utils import load_image | |
| pipe = ErnieImagePipeline.from_pretrained("baidu/ERNIE-Image", dtype=torch.bfloat16) | |
| pipe.to("cuda") # or "mps", "xpu", "cpu" | |
| # If you are running low on GPU VRAM, you can enable offloading | |
| pipe.enable_model_cpu_offload() | |
| prompt = "一只黑白相间的中华田园犬" | |
| images = pipe( | |
| prompt=prompt, | |
| height=1024, | |
| width=1024, | |
| num_inference_steps=50, | |
| guidance_scale=4.0, | |
| generator=torch.Generator("cuda").manual_seed(42), | |
| use_pe=True, | |
| ).images | |
| images[0].save("ernie-image-output.png") | |
| ``` | |
| ```python | |
| import torch | |
| from diffusers import ErnieImagePipeline | |
| from diffusers.utils import load_image | |
| pipe = ErnieImagePipeline.from_pretrained("baidu/ERNIE-Image-Turbo", dtype=torch.bfloat16) | |
| pipe.to("cuda") # or "mps", "xpu", "cpu" | |
| # If you are running low on GPU VRAM, you can enable offloading | |
| pipe.enable_model_cpu_offload() | |
| prompt = "一只黑白相间的中华田园犬" | |
| images = pipe( | |
| prompt=prompt, | |
| height=1024, | |
| width=1024, | |
| num_inference_steps=8, | |
| guidance_scale=1.0, | |
| generator=torch.Generator("cuda").manual_seed(42), | |
| use_pe=True, | |
| ).images | |
| images[0].save("ernie-image-turbo-output.png") | |
| ``` | |
Xet Storage Details
- Size:
- 3.4 kB
- Xet hash:
- 7d732b257d2dc4faa249c8d8f8f246566dbb26c4ea6b7e830e2c0d521fb1a19d
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.