elixir-nx / polaris

Collection of optimization-related utilities
Apache License 2.0
22 stars 6 forks source link

Using Polaris.Optimizers as docs suggest causes error #12

Open shaqq opened 7 months ago

shaqq commented 7 months ago

Most docs suggest using this library like so:

Polaris.Optimizers.adam(0.005)

However, this causes an error, because the args expect a keyword list

** (FunctionClauseError) no function clause matching in Keyword.pop/3    

    The following arguments were given to Keyword.pop/3:

        # 1
        0.005

        # 2
        :learning_rate

        # 3
        0.001

    Attempted function clauses (showing 1 out of 1):

        def pop(keywords, key, default) when is_list(keywords) and is_atom(key)

    (elixir 1.15.7) lib/keyword.ex:1289: Keyword.pop/3
    (polaris 0.1.0) lib/polaris/optimizers.ex:109: Polaris.Optimizers.adam/1

Looks like this was intentional: https://github.com/elixir-nx/polaris/commit/228f829d024eabbe24c078093d11d4d9db022a02

So this is an issue to update the docs 😄

josevalim commented 7 months ago

Please send a PR :)