MINCUT for memory encoder, Int8 TransposeConv for mask decoder #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Memory Encoderにおいて、MINCUTのパーティショニングでエラーが発生している問題を解消します。
独自のLayerNorm2Dの実装の、Residual Blockの分岐で、NHWCとNCHWが衝突しているのが原因であるため、
公式のnn.layernormに置き換えることで問題を回避します。
独自実装のウエイトをnn.layrernormに登録する必要があるため、checkpointの読み込み時に、load_weights_from_old_modelを呼び出します。
これにより、Addのepsilonが量子化されて0になる問題も回避することが可能です。
MemoryEncoderとMaskDecoderのLayerNormで0加算とsqrtでinfが発生する問題を解消します。
公式のnn.layernormに置き換えずに、NHWC変換後に独自のLayerNormを呼び出す方法でも回避可能です。
その場合、ai-edge-torch 0.2.0だと、ai_edge_torch/convert/fx_passes/optimize_layout_transposes_pass/pass_body.pyのinsert_dq_t_qのself.get_paired_q_dq_ops(input_q.target)をutils.get_paired_q_dq_ops(input_q.target)に修正が必要です。