DiCE icon indicating copy to clipboard operation
DiCE copied to clipboard

Loading Pytorch customer models

Open remindchobits opened this issue 5 years ago • 2 comments

Hello! Thank you so much for the great work!

But could you please tell me how to load a trained pytorch models .pth? I always get this error:

AttributeError: '_IncompatibleKeys' object has no attribute 'seek'. You can only torch.load from a file that is seekable. Please pre-load the data into a buffer like io.BytesIO and try to load from it instead.

Thank you!

remindchobits avatar Nov 24 '20 17:11 remindchobits

The problem solved, but just as https://github.com/interpretml/DiCE/issues/46 says the optimisation goes into a infinite loop with the normalised dataset, but for non-normalised dataset it works well.

remindchobits avatar Nov 26 '20 15:11 remindchobits

Hey, did you get a chance to try with posthoc_sparsity_algorithm="binary" in generate_counterfactuals()? I have tried with features taking very small values and this option was several orders of magnitude faster.

But yeah, it would be better to include @rmazzine's suggestion and an option to run sparsity correction on selected features instead of all features. Will add an option for that soon.

raam93 avatar Dec 07 '20 10:12 raam93