Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

Distributed AI server B

books/ai/multi_serving/server_b.livemd

Distributed AI server B

Mix.install(
  [
    {:kino_bumblebee, "~> 0.3.0"},
    {:exla, "~> 0.5.3"}
  ],
  config: [nx: [default_backend: EXLA.Backend]]
)

Start serving

{:ok, model_info} = Bumblebee.load_model({:hf, "google/vit-base-patch16-224"})
{:ok, featurizer} = Bumblebee.load_featurizer({:hf, "google/vit-base-patch16-224"})

serving =
  Bumblebee.Vision.image_classification(model_info, featurizer,
    compile: [batch_size: 1],
    defn_options: [compiler: EXLA],
    top_k: 2
  )

Kino.start_child({Nx.Serving, name: ViT, serving: serving})

Get connection info

{node(), Node.get_cookie()}