tensorflow / tensorflow/probability

Performance issue in discussion/turnkey_inference_candidate/window_tune_nuts_sampling.py

Open
#1,698 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
4.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Hello! Our static bug checker has found a performance issue in discussion/turnkey_inference_candidate/window_tune_nuts_sampling.py: Python type argument num_steps is passed to tf.function decorated function slow_adaptation_interval instead of tensors. As there is a for loop, every time the value changes, a new graph will be generated, and that can trigger tf.function retracing warning.

Here is the tensorflow document to support it.

Looking forward to your reply.

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 in discussion/turnkey_inference_candidate/window_tune_nuts_sampling.py at slow_adaptation_interval around line 183 and its call around line 272, then inspect the loop near line 263. Read the linked TensorFlow guidance on passing tensors instead of Python literals. Done means the changing num_steps value no longer causes repeated tf.function graph generation or retracing warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning, performance
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.