
bdarla
Machine Learning in Elixir: error thrown in code snippet (page 44)
Running the code snippet of Chapter 2 on page 44 of version B1.0, I get the following error:
Evaluation process terminated - an exception was raised:
** (FunctionClauseError) no function clause matching in String.graphemes/1
(elixir 1.15.2) lib/string.ex:1934: String.graphemes(:ok)
(benchee 1.1.0) lib/benchee/utility/erlang_version.ex:100: Benchee.Utility.ErlangVersion.parse_erlang_version/1
(benchee 1.1.0) lib/benchee/utility/erlang_version.ex:84: Benchee.Utility.ErlangVersion.includes_fixes_from?/2
(benchee 1.1.0) lib/benchee/benchmark/repeated_measurement.ex:60: Benchee.Benchmark.RepeatedMeasurement.determine_resolution_adjustment/2
(benchee 1.1.0) lib/benchee/benchmark/repeated_measurement.ex:42: Benchee.Benchmark.RepeatedMeasurement.determine_n_times/5
(benchee 1.1.0) lib/benchee/benchmark/runner.ex:226: Benchee.Benchmark.Runner.measure_runtimes/4
(benchee 1.1.0) lib/benchee/benchmark/runner.ex:102: Benchee.Benchmark.Runner.measure_scenario/2
(elixir 1.15.2) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
I run the code on an Apple Silicon M2 and I use Elixir 1.15.4 and Erlang/OTP 26.
I have not found any solution to this issue yet.
Marked As Solved

johnmacshea
I had the same issue with Benchee - I saw someone mention in the elixir forum that Benchee was crashing the LiveBook cells a while back. I’m also on Apple Silicon - LiveBook v0.9.3, Elixir v1.14.2.
I was curious so:
{exla_time, exla_result} = :timer.tc(fn →
apply(EXLA.jit(&Softmax.softmax/1), [tensor])
end)
{standard_time, standard_result} = :timer.tc(fn →
Softmax.softmax(tensor)
end)
IO.puts “exla is #{standard_time/exla_time} times faster”
result (one run):
exla is 66.25130208333333 times faster
On multiple runs its between 450 and 500 times faster.
Popular Prag Prog topics










Other popular topics










Latest in PragProg
Latest (all)
Categories:
Popular Portals
- /elixir
- /opensuse
- /rust
- /kotlin
- /ruby
- /erlang
- /python
- /clojure
- /react
- /quarkus
- /go
- /vapor
- /react-native
- /v
- /wasm
- /django
- /security
- /nodejs
- /centos
- /rails
- /haskell
- /fable
- /gleam
- /swift
- /js
- /deno
- /tailwind
- /assemblyscript
- /laravel
- /symfony
- /phoenix
- /crystal
- /typescript
- /debian
- /adonisjs
- /julia
- /arch-linux
- /svelte
- /spring
- /c-plus-plus
- /preact
- /flutter
- /actix
- /java
- /angular
- /ocaml
- /zig
- /kubuntu
- /scala
- /zotonic
- /vim
- /rocky
- /lisp
- /keyboards
- /html
- /emacs
- /vuejs
- /nim
- /elm
- /nerves