Giter VIP home page Giter VIP logo

Comments (7)

kyakuno avatar kyakuno commented on July 17, 2024 1

2GBを超えるONNXをエクスポートした場合に、複数のpbに出力されるのは規定の動作です。出力した後で、ONNXのAPIで読み込み、all_tensors_to_one_file=Trueで書き出すと、1つのonnxと、1つのpbに結合可能です。
https://github.com/onnx/onnx/blob/main/docs/PythonAPIOverview.md

diffuserを使用しているモデルのエクスポート例です。拡散モデルなので、tokenizerとddimのsamplerのコードをdiffuserから持ってくる必要があると思います。
#1379

from ailia-models.

Akasan avatar Akasan commented on July 17, 2024

メモ

  • CPUバージョンで動かせるアプリケーションを作成した例:https://github.com/rupeshs/instantidcpu
  • InstantIDのレポジトリ自体はApacheライセンスで商用利用可能だが、ダウンロードして利用されるモデルは商用利用ができないライセンスとなっているので注意が必要

from ailia-models.

Akasan avatar Akasan commented on July 17, 2024

ControlNetおよびIP-AdapterのONNX化検討メモ

  • ControlNetのONNXエクスポートは可能
    • エクスポートすると大量のファイルにbiasなどが分かれてしまう(MatMulやAddなど)
    • オプションなどを見ても避けることは難しそう(関連イシュー
  • パイプラインがdiffusersの機能を利用して記述されており、両モデルをONNXとして出力して利用する場合、diffusers実装を再現するようなコードを記述する必要あり
    • 関連場所をチェックすると移植部分は相当数あると見込んでいる

from ailia-models.

Akasan avatar Akasan commented on July 17, 2024

@kyakuno
ご教授ありがとうございます。
頂いた内容を元に移植作業を進めさせて頂きます。

from ailia-models.

Akasan avatar Akasan commented on July 17, 2024

ControlNetについてはcontrolnet.onnxとcontrolnet.pbに書き出し、onnxruntime.InferenceSession("controlnet.onnx")で読み込めることを確認

from ailia-models.

Akasan avatar Akasan commented on July 17, 2024

@kyakuno
UNetをエクスポートするときに以下のエラーが出ます。
torch.onnx.errors.UnsupportedOperatorError: Exporting the operator 'aten::fft_fftn' to ONNX opset version 17 is not supported.

以前にも同じ問題が発生した経験がある場合、どのように対処したかご教授いただけますと幸いです

from ailia-models.

Akasan avatar Akasan commented on July 17, 2024

メモ:

  • ailia SDKを使うと、ローカルでONNXバージョンで動かそうとするとメモリが不足してPCから警告が出され処理が中断されてしまう(24GBのmacbook proで確認)
    • スワップ領域を数十GB消費している
    • onnxruntimeを利用した場合はメモリ消費量が少ないようです

from ailia-models.

Related Issues (20)

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.