
sabiwara
Machine Learning in Elixir: Chapter 13 code errors
Hello @seanmor5! Thanks a lot for the amazing book and new chapter
I got a couple of errors when trying to run the examples in Chap. 13 and they don’t seem to have been reported yet:
- p.313 The
:sequence_length
and:batch_size
keys oftext_embedding
had to be popped and nested in a:compile
key:
opts = Keyword.validate!(opts, [
:defn_options, sequence_length: 64, batch_size: 16 ])
{model_info, tokenizer} = load()
Bumblebee.Text.TextEmbedding.text_embedding(model_info, tokenizer, opts)
- p.316
predict/1
returns an%{embedding: Nx.Tensor.t()}
, should return aNx.Tensor.t()
to work when adding it to the changeset later:
def predict(text) do
- Nx.Serving.batched_run(BookSearchModel, text)
+ Nx.Serving.batched_run(BookSearchModel, text).embedding
end
- p.320 needs to assign
:query
def mount(_params, _session, socket) do
- {:ok, assign(socket, :results, [])}
+ {:ok, assign(socket, results: [], query: nil)}
end
- p.321 Typo in HTML template
<a
- href{~p"/book/#{result.id}"}
+ href={~p"/book/#{result.id}"}
Most Liked

sabiwara
@pieteeken I changed it as follows, fixed it for me:
opts = Keyword.validate!(opts, [:defn_options, sequence_length: 64, batch_size: 16])
{defn_opts, compile_opts} = Keyword.pop!(opts, :defn_options)
opts = [defn_options: defn_opts, compile: compile_opts]
1

pieteeken
OK. It’s working.
And I also got the results. But that was because of one forgotten change from the book.
1
Popular Pragmatic Bookshelf topics

Working through the steps (checking that the Info,plist matches exactly), run the demo game and what appears is grey but does not fill th...
New

Title: Hands-on Rust: question about get_component (page 295)
(feel free to respond. “You dug you’re own hole… good luck”)
I have somet...
New

I am working on the “Your Turn” for chapter one and building out the restart button talked about on page 27. It recommends looking into ...
New

Dear Sophie.
I tried to do the “Authorization” exercise and have two questions:
When trying to plug in an email-service, I found the ...
New

I ran this command after installing the sample application:
$ cards add do something --owner Brian
And got a file not found error:
Fil...
New

Running mix deps.get in the sensor_hub directory fails with the following error:
** (Mix) No SSH public keys found in ~/.ssh. An ssh aut...
New

When running tox for the first time, I got the following error:
ERROR: InterpreterNotFound: python3.10
I realised that I was running ...
New

AWDWR 7, page 152, page 153:
Hello everyone,
I’m a little bit lost on the hotwire part. I didn’t fully understand it.
On page 152 @rub...
New

@parrt
In the context of Chapter 4.3, the grammar Java.g4, meant to parse Java 6 compilation units, no longer passes ANTLR (currently 4....
New

Hello @herbert ! Trying to get the very first “Hello, Bracket Terminal!" example to run (p. 53). I develop on an Amazon EC2 instance runn...
New
Other popular topics

New

I’ve been hearing quite a lot of comments relating to the sound of a keyboard, with one of the most desirable of these called ‘thock’, he...
New

Tailwind CSS is an exciting new CSS framework that allows you to design your site by composing simple utility classes to create complex e...
New

Oh just spent so much time on this to discover now that RancherOS is in end of life but Rancher is refusing to mark the Github repo as su...
New

If you are experiencing Rails console using 100% CPU on your dev machine, then updating your development and test gems might fix the issu...
New

Build efficient applications that exploit the unique benefits of a pure functional language, learning from an engineer who uses Haskell t...
New

The File System Access API with Origin Private File System.
WebKit supports new API that makes it possible for web apps to create, open,...
New

Author Spotlight
Mike Riley
@mriley
This month, we turn the spotlight on Mike Riley, author of Portable Python Projects. Mike’s book ...
New

Hello,
I’m a beginner in Android development and I’m facing an issue with my project setup. In my build.gradle.kts file, I have the foll...
New

Fight complexity and reclaim the original spirit of agility by learning to simplify how you develop software. The result: a more humane a...
New
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /rails
- /js
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /emacs
- /haskell
- /java
- /onivim
- /typescript
- /svelte
- /crystal
- /kotlin
- /c-plus-plus
- /tailwind
- /gleam
- /react
- /ocaml
- /flutter
- /elm
- /vscode
- /ash
- /html
- /opensuse
- /centos
- /php
- /deepseek
- /zig
- /scala
- /sublime-text
- /textmate
- /lisp
- /nixos
- /debian
- /react-native
- /agda
- /kubuntu
- /arch-linux
- /django
- /revery
- /ubuntu
- /spring
- /manjaro
- /nodejs
- /diversity
- /lua
- /julia
- /c
- /slackware
- /markdown