2026年07月12日

Ideogram4 の実装方法

このエントリーをはてなブックマークに追加
follow us in feedly


...色んな所でローカルで実行可能と言っていますが、これは本当にローカルで実行出来るのでしょうか?
コードは
確実に出来ない事は確認出来ていませんが...ローカルファイルからの読み込みを実装出来るのでしょうか?




git clone https://github.com/ideogram-oss/ideogram4
cd ideogram4
pip install -e .




hf auth login

何か時間かかったのですが...前からこうだったでしょうか?
Waiting for authorization.........................................................
Error: Login failed: Device code expired (timeout). Please try again.
Hint: set HF_DEBUG=1 as environment variable for full traceback.






IDEOGRAM_API_KEY は https://ideogram.ai/platform ここから取得します。

...しかしながら、IDEOGRAM_API_KEYはmagic-promptに必要なのであって、Ideogram4に必須ではありません。
--no-magic-prompt にすればmagic-promptを使う必要はありません。
 File "/usr/local/lib/python3.12/dist-packages/requests/models.py", line 1026, in raise_for_status
  raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.ideogram.ai/v1/ideogram-v4/magic-prompt

このmagic-promptが有料のようで、必ず課金しないと使えない様です...




Cannot access gated repo for url https://huggingface.co/ideogram-ai/ideogram-4-nf4/resolve/main/transformer/diffusion_pytorch_model.safetensors.index.json.
Access to model ideogram-ai/ideogram-4-nf4 is restricted and you are not in the authorized list. Visit https://huggingface.co/ideogram-ai/ideogram-4-nf4 to ask for access.
................

https://huggingface.co/ideogram-ai/ideogram-4-nf4 の
You need to agree to share your contact information to access this model
This repository is publicly accessible, but you have to accept the conditions to access its files and content.
By agreeing you accept to share your contact information (email and username) with the repository authors.

  Agree and access repository
をクリックします。







...しかし実行時にメモリが足りなくなる場合が非常に多そうです。



メモリ消費を減らす方法は...

pip install -q -U "sdnq>=0.1.9"
pip install -q "git+https://github.com/huggingface/diffusers.git" transformers accelerate sentencepiece



import torch, json, psutil, diffusers
from sdnq import SDNQConfig

pipe = diffusers.Ideogram4Pipeline.from_pretrained(
 "Disty0/Ideogram-4-SDNQ-4bit-dynamic-hadamard",
 torch_dtype=torch.bfloat16,
)

pipe.enable_model_cpu_offload()


量子化モデル SDNQ で
diffusers のオフロードで GPU の同時使用量を減らし
  enable_model_cpu_offload() で必要な分だけGPU ⇔ CPU で入れ替えます...

しかしこうすると実行時間が長くかかります。


................
................






tak_tak0 at 19:48コメント(0)サーバ   この記事をクリップ!

コメントする

名前:
URL:
  情報を記憶: 評価:  顔   星
 
 
 
サイト内検索
にほんブログ村 科学ブログへ
にほんブログ村
adsense
Archives
amazon
blogchart
QRコード
QRコード
Recent Comments