tensorflow / tensorflow/probability

TypeError: __init__() missing 1 required positional argument: 'distribution'

Open
#1,711 7 comments 1 reaction 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

I tried to use Ray Tune with with tfp.NoUTurn Sampler but I got this error TypeError: __init__() missing 1 required positional argument: 'distribution'. I tried it with HMC and VI and got the same error. It seems tfp can't find Ray tune's values for the specified hyperparameter.

params = {'num_burnin_steps': tune.randint(30, 100)}

def train model(config):
    #preceding code here...
    num_burnin_steps =config["num_burnin_steps"]
    sampler = tfp.mcmc.TransformedTransitionKernel(
        tfp.mcmc.NoUTurnSampler(
            target_log_prob_fn=pinned_model.unnormalized_log_prob,
            step_size=0.1),
        bijector=constraining_bijector)

   remaining code here...

return {'score': score}

import ray tune and define your parameters

trainable_with_resources = tune.with_resources(train_model, {"cpu": 1})
tuner = tune.Tuner(
    trainable_with_resources,
    param_space=trial_space,
    tune_config=tune.TuneConfig(num_samples=10)
)
results = tuner.fit()`

Tensorflow probability version: 0.19.0
Ray Tune version: 2.3.1

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 reproducing the shown training snippet with TensorFlow Probability 0.19.0 and Ray Tune 2.3.1, then trace how the Tune configuration reaches the TFP sampler constructors. The issue is done when the source of the missing argument is identified and a verified correction or compatibility explanation is provided.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
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.