Skip to content

Ignore the FLATC_EXECUTABLE env var when empty#3612

Closed
dbort wants to merge 1 commit intopytorch:mainfrom
dbort:flatc-empty-path
Closed

Ignore the FLATC_EXECUTABLE env var when empty#3612
dbort wants to merge 1 commit intopytorch:mainfrom
dbort:flatc-empty-path

Conversation

@dbort
Copy link
Contributor

@dbort dbort commented May 14, 2024

We've seen some situations fail because flatc_path is an empty string. This seems like a likely culprit, but doesn't hurt either way.

Test Plan:
Ran the following script with (. /tmp/run.sh), which successfully created /tmp/et-test/executorch/add.pte.

/tmp/run.sh:

set -euxo pipefail

conda remove -yn et-test --all
conda create -yn et-test python=3.10
conda activate et-test

mkdir -p /tmp/et-test
cd /tmp/et-test
# Get this PR
git clone -b flatc-empty-path https://github.com/dbort/executorch-1
cd executorch

git submodule sync
git submodule update --init

./install_requirements.sh

cat > /tmp/export_add.py << HERE
import torch
from torch.export import export
from executorch.exir import to_edge

# Start with a PyTorch model that adds two input tensors (matrices)
class Add(torch.nn.Module):
  def __init__(self):
    super(Add, self).__init__()

  def forward(self, x: torch.Tensor, y: torch.Tensor):
      return x + y

# 1. torch.export: Defines the program with the ATen operator set.
aten_dialect = export(Add(), (torch.ones(1), torch.ones(1)))

# 2. to_edge: Make optimizations for Edge devices
edge_program = to_edge(aten_dialect)

# 3. to_executorch: Convert the graph to an ExecuTorch program
executorch_program = edge_program.to_executorch()

# 4. Save the compiled .pte program
with open("add.pte", "wb") as file:
    file.write(executorch_program.buffer)
HERE

python /tmp/export_add.py
echo "Created" *.pte

We've seen some situations fail because flatc_path is an empty string.
This seems like a likely culprit, but doesn't hurt either way.
@pytorch-bot
Copy link

pytorch-bot bot commented May 14, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/3612

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 1ed61d4 with merge base 0e7955d (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 14, 2024
@facebook-github-bot
Copy link
Contributor

@dbort has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@dbort dbort requested review from Gasoonjia and lucylq May 15, 2024 17:39
@facebook-github-bot
Copy link
Contributor

@dbort merged this pull request in 2b1ed26.

@dbort dbort mentioned this pull request May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants