Skip to content

TypeError when running apd1.find_optimal_W() in the example_usage.ipynb notebook #4

Closed

Description

@aplowman

I get this output when running the example notebook on Google colab (on CPU and GPU):

Solver tolerance is with respect to each grain separately.
Smallest tol:  tensor(0.0010, device='cuda:0')

---------------------------------------------------------------------------

TypeError                                 Traceback (most recent call last)

[/tmp/ipykernel_1140/3212242484.py](https://localhost:8080/#) in <cell line: 0>()
----> 1 apd1.find_optimal_W()

3 frames

[/usr/local/lib/python3.12/dist-packages/torch/utils/_contextlib.py](https://localhost:8080/#) in decorate_context(*args, **kwargs)
    122         # pyrefly: ignore [bad-context-manager]
    123         with ctx_factory():
--> 124             return func(*args, **kwargs)
    125 
    126     return decorate_context

TypeError: _weighted_optimality_minimize_bfgs_core() got an unexpected keyword argument 'gtd_tol'

Thanks!

Activity

  1. mbuze commented on Apr 20, 2026

    @mbuze
    Owner

    Hi @aplowman I will have a proper look in a bit, but my quick take is I believe this is to do with pytorch-minimize. This is being addressed in #3 which I am hoping to merge as soon as we release the preprint paper which accompanies this update (any day now 😄) and will also add a new release to pip. A quick fix should be to pin pytorch-minimize the previous release version:

    https://pypi.org/project/pytorch-minimize/#history

  2. aplowman commented on Apr 20, 2026

    @aplowman
    Author

    Nice, that seems to have done the trick! Thanks.

  3. mbuze commented on Apr 20, 2026

    @mbuze
    Owner

    great, I will keep this issue as open until #3 is merged

  4. mbuze commented on Jun 14, 2026

    @mbuze
    Owner

    @aplowman the new version has now been released, so closing now, let me know if there are any issues still

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions