Helpers + Streamlit refactor#102
Conversation
* initial streamlit refactoring pass * cleanup and fixes * fix refiner strength * Modify params correctly * fix exception
|
I've tested streamlit and all seems to be working well there still. |
ct-777
left a comment
There was a problem hiding this comment.
The PR contains many formatting. Is it completely done by pylint? If not, can you show your VSCode Python format setting (setting.json) and add to the repo? I hope people can follow the same style.
|
Re-tested streamlit and made some fixes, I've also reverted to a |
| c[k], uc[k] = map( | ||
| lambda y: y[k][: math.prod(num_samples)].to(device), (c, uc) | ||
| lambda y: y[k][: math.prod(num_samples)].to( | ||
| device_manager.device | ||
| ), | ||
| (c, uc), | ||
| ) |
There was a problem hiding this comment.
Honestly, this .map abomination should just be
| c[k], uc[k] = map( | |
| lambda y: y[k][: math.prod(num_samples)].to(device), (c, uc) | |
| lambda y: y[k][: math.prod(num_samples)].to( | |
| device_manager.device | |
| ), | |
| (c, uc), | |
| ) | |
| c[k] = c[k][: math.prod(num_samples)].to(device_manager.device) | |
| uc[k] = uc[k][: math.prod(num_samples)].to(device_manager.device) |
(and as discussed (and implemented) before, num_samples being a list one needs to math.prod on doesn't make any sense, but that's probably beyond the scope of this PR.)
| c[k], uc[k] = map( | ||
| lambda y: y[k][:num_samples].to(device_manager.device), (c, uc) | ||
| ) |
There was a problem hiding this comment.
| c[k], uc[k] = map( | |
| lambda y: y[k][:num_samples].to(device_manager.device), (c, uc) | |
| ) | |
| c[k] = c[k][:num_samples].to(device_manager.device) | |
| uc[k] = uc[k][:num_samples].to(device_manager.device) |
(funny how num_samples is an int here 😁)
|
Would be nice to get this squashed in so I could again rebase my PRs ;-) |
|
This'll probably need more fixing with the myriad of demo changes in 059d8e9 😞 |
Updates to api/helper functions:
Txt2NoisyDiscretizationWrapperto helpers and creates a function to apply discretization wrappers conditionally.SamplingPipelineconstructor to allow passing a custom model_spec, and improve default paths behavior0.1.1