burn icon indicating copy to clipboard operation
burn copied to clipboard

Feature: Multinomial sampling

Open Pablo1785 opened this issue 9 months ago • 3 comments

Pull Request Template

Checklist

  • [ ] Confirmed that run-checks all script has been executed.
  • [ ] Made sure the book is up to date with changes in this PR.

Related Issues/PRs

Would resolve: #1121

Since the discussion seemed to die down in the issue and I found myself in need of the Multinomial distribution sampler, I decided to take a shot at implementing this.

One issue to solve is how to pass the probabilities to the Cube Launch (how to turn a Tensor into a TensorArg?)

Changes

Add multinomial distribution implementation for all backends. Potential breaking change: Distribution can no longer derive Copy, since Multinomial distribution has to contain a collection of probabilities, which could potentially be very large.

Testing

Describe how these changes have been tested.

Pablo1785 avatar Feb 28 '25 09:02 Pablo1785

Great timing as I quite need this function! I just need the CubeCL version, would you say that is already usable? Any plans to continue this PR? Thank you for the contribution

ArthurBrussee avatar Mar 11 '25 01:03 ArthurBrussee

@ArthurBrussee Hey, so I am currently kinda stuck on the CubeCL version, as I am very new to CubeCL in general.

I will then want to run some benchmarks to make sure nothing silly is happening, especially with the Candle backend. I tested it a little locally and it seems to work well, but I wanna make sure it is at least as good as the CPU impl for large Tensors + that it uses GPU resources as much as possible.

Pablo1785 avatar Mar 16 '25 22:03 Pablo1785

This PR has been marked as stale because it has not been updated for over a month

github-actions[bot] avatar Apr 17 '25 12:04 github-actions[bot]

Hi @Pablo1785 , any progress on this PR? I'm interested in this functionality.

pevers avatar May 15 '25 20:05 pevers

This PR has been marked as stale because it has not been updated for over a month

github-actions[bot] avatar Jul 09 '25 12:07 github-actions[bot]

This PR has been marked as stale because it has not been updated for over a month

github-actions[bot] avatar Sep 03 '25 12:09 github-actions[bot]

There hasn't been activity in this PR. Closing it for now. Please feel to reopen or create a brand new PR.

antimora avatar Oct 01 '25 00:10 antimora