llvm / llvm/torch-mlir

Support lowering 'densenet161' from 'torchvision' to 'torch` dialect

Open
#2,950 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1.9k
Forks
736
Avg merge
5d 22h
Merged PRs (30d)
15

Description

Lowering of DenseNet model fails with error.

import torch
import torch_mlir
import torchvision
mdl = torchvision.models.densenet.densenet161()
shp = torch_mlir.TensorPlaceholder([1, 3, 224, 224], torch.float32)
mlir = torch_mlir.compile(mdl, shp, "torch")

Execution of the script cause following error:

File "/pytorch_venv/lib/python3.11/site-packages/torch_mlir/__init__.py", line 458, in compile
run_pipeline_with_repro_report(
File "/pytorch_venv/lib/python3.11/site-packages/torch_mlir/compiler_utils.py", line 73, in run_pipeline_with_repro_report
raise TorchMlirCompilerError(trimmed_message) from None
torch_mlir.compiler_utils.TorchMlirCompilerError: Lowering TorchScript IR -> Torch Backend IR failed with the following diagnostics:
python exception: Failure while executing pass pipeline:
error: unknown: unsupported by backend contract: module initializers

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with the provided densenet161 and TensorPlaceholder script, then trace the TorchScript IR to Torch Backend IR pipeline where the unsupported module initializers diagnostic is emitted. Done means the shown torchvision model compiles to the torch dialect without the module-initializer error and the regression is covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
pytorch
Domain
compilers, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.