Scholar 0.2 fails to compile when Nx is configured with Exla backend
jadengis opened this issue · comments
Hi Scholar team.
I just updated to :scholar
0.2, but it has caused my project to fail to compile with the following error
== Compilation error in file lib/scholar/metrics/classification.ex ==
** (exit) exited in: GenServer.call(EXLA.Client, {:client, :host, [platform: :host]}, :infinity)
** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
(elixir 1.14.3) lib/gen_server.ex:1027: GenServer.call/3
(exla 0.6.0) lib/exla/backend.ex:154: EXLA.Backend.client_and_device_id/1
(exla 0.6.0) lib/exla/backend.ex:44: EXLA.Backend.from_binary/3
lib/scholar/metrics/classification.ex:70: (module)
Looking at lib/scholar/metrics/classification.ex:70
it looks like Nx.tensor(1.0)
is being used as a default value for some options.
I suspect this is attempting to invoke the EXLA compiler for Nx, since I have it configured as the backend, but since this is during compilation, the application hasn't been started, so this fails.
Is there a work-around or a quick fix? Could also help with a fix if you are open to that. I'd love to make use of some of the new algorithms introduced in 0.2.
Thanks!
Versions
scholar: 0.2
exla: 0.6
nx: 0.6
I've just confirmed that removing the default: Nx.tensor(1.0)
from line 70 allows the library to compile successfully. Seems like this function doesn't work properly at compile time.
Good find, I am pushing a fix soon.
v0.2.1 is out and we improved CI to make sure this won't happen again! Thanks.