Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added None to act as max for np.clip #213

Merged
merged 2 commits into from
May 13, 2022

Conversation

GeorgePearse
Copy link
Collaborator

@GeorgePearse GeorgePearse commented May 13, 2022

Added None to act as max for np.clip

Summary:

I was receiving an error due to the lack of a max defined for np.clip().

Traceback (most recent call last):
  File "main.py", line 226, in <module>
    run(model, baal_trainer, baal_data_module, config, experiment_name)
  File "main.py", line 212, in run
    should_continue = baal_trainer.step(model, datamodule=baal_data_module)
  File "/workspace/environments/active-learning/lib/python3.8/site-packages/baal/utils/pytorch_lightning.py", line 202, in step
    to_label = self.heuristic(probs)
  File "/workspace/environments/active-learning/lib/python3.8/site-packages/baal/active/heuristics/heuristics.py", line 258, in __call__
    return self.get_ranks(predictions)[0]
  File "/workspace/environments/active-learning/lib/python3.8/site-packages/baal/active/heuristics/stochastics.py", line 45, in get_ranks
    distributions = np.clip(distributions, 0)
  File "<__array_function__ internals>", line 4, in clip
TypeError: _clip_dispatcher() missing 1 required positional argument: 'a_max'

Features:

Max defined as None for np.clip

Checklist:

  • Your code is documented (To validate this, add your module to tests/documentation_test.py).
  • Your code is tested with unit tests.
  • You moved your Issue to the PR state.

NB: sorry this is a comically small PR but just wanted to go through the motions with one. Will try to address the string mapping for PowerSampling etc. on Sunday but no promises.

I haven't yet run the tests, but have used it.

Added None to act as max for np.clip
@GeorgePearse GeorgePearse marked this pull request as ready for review May 13, 2022 16:10
Copy link
Member

@Dref360 Dref360 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!

@Dref360 Dref360 enabled auto-merge (squash) May 13, 2022 17:01
@Dref360 Dref360 merged commit 85315fb into baal-org:master May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants