pymc-devs / pymc-devs/pytensor

Tracking odds and ends for the pytorch backend with pymc

Open
#1,076 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
644
Forks
208
Avg merge
2d 14h
Merged PRs (30d)
16

Description

Description

Some of the bigger issues I came across when doing an integration pass with pymc and pytensor were

  1. (Trivial) allow pytorch in the config defaults
  2. Some of the Op implementations (e.g. Elemwise) don't always return a tensor, which although expected when you have multiple outputs, caused some upstream failures when creating initial points.
  3. The linker would return torch tensors always, but when pymc would attempt to copy any of the results or create a buffer for whatever reason sharing a dtype, we would fail (numpy doesn't know what to do with torch.float)
  4. Lots of graph breaks due to pytorch not liking how we do code generation (that is why the code is littered with torch.compiler.disable).

I'll post a more detailed torch analysis in a comment for 4.

Contributor guide

Open the contributing guide

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 separating the four areas listed in the description: config defaults, Op implementations such as Elemwise, linker tensor and dtype handling, and PyTorch code generation. Use the PyMC/PyTensor integration pass as the validation point; done means the listed initial-point, copying, buffer, and graph-break failures no longer occur.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
backend, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.