Mix.install(
[
{:exgboost, "~> 0.3.1", override: true},
{:nx, "~> 0.6"},
{:exla, "~> 0.5"},
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mix.install([ | |
{:axon, "~> 0.7"}, | |
{:bumblebee, "~> 0.6"}, | |
{:exla, "~> 0.9"}, | |
{:nx, "~> 0.9"}, | |
{:mp3_duration, "~> 0.1.0"}, | |
{:plug_cowboy, "~> 2.6"}, | |
{:jason, "~> 1.4"}, | |
{:phoenix, "~> 1.7.14"}, | |
{:phoenix_html, "~> 4.1"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def llama() do | |
llama = {:hf, "meta-llama/Meta-Llama-3-8B-Instruct", auth_token: "abc123"} | |
{:ok, model_info} = Bumblebee.load_model(llama, type: :bf16, backend: {EXLA.Backend, client: :cuda}) | |
{:ok, tokenizer} = Bumblebee.load_tokenizer(llama) | |
{:ok, generation_config} = Bumblebee.load_generation_config(llama) | |
tokenizer = | |
tokenizer | |
|> Map.put(:special_tokens, %{ | |
pad: "<|eot_id|>", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mix.install([ | |
{:bumblebee, git: "https://github.com/toranb/bumblebee", branch: "main"}, | |
{:nx, "~> 0.7", override: true}, | |
{:exla, ">= 0.0.0"}, | |
{:plug_cowboy, "~> 2.6"}, | |
{:jason, "~> 1.4"}, | |
{:bandit, "~> 1.2"}, | |
{:phoenix, "~> 1.7"}, | |
{:phoenix_live_view, "~> 0.20.0"} | |
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mix.install([ | |
{:bumblebee, git: "https://github.com/toranb/bumblebee", branch: "main"}, | |
{:nx, "~> 0.6.2", override: true}, | |
{:exla, "~> 0.6.1"}, | |
{:plug_cowboy, "~> 2.6"}, | |
{:jason, "~> 1.4"}, | |
{:phoenix, "~> 1.7"}, | |
{:phoenix_live_view, "~> 0.20.0"} | |
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARG ELIXIR_VERSION=1.15.6 | |
ARG OTP_VERSION=26.1.2 | |
ARG DEBIAN_VERSION=buster-20230612-slim | |
ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}" | |
ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}" | |
FROM ${BUILDER_IMAGE} as builder | |
# install build dependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def serving() do | |
mistral = {:hf, "HuggingFaceH4/zephyr-7b-alpha"} | |
{:ok, spec} = Bumblebee.load_spec(mistral, module: Bumblebee.Text.Mistral, architecture: :for_causal_language_modeling) | |
{:ok, model_info} = Bumblebee.load_model(mistral, spec: spec, backend: {EXLA.Backend, client: :host}) | |
{:ok, tokenizer} = Bumblebee.load_tokenizer(mistral, module: Bumblebee.Text.LlamaTokenizer) | |
{:ok, generation_config} = Bumblebee.load_generation_config(mistral, spec_module: Bumblebee.Text.Mistral) | |
generation_config = Bumblebee.configure(generation_config, max_new_tokens: 500) | |
Bumblebee.Text.generation(model_info, tokenizer, generation_config, defn_options: [compiler: EXLA]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Training.Example do | |
def train() do | |
Nx.default_backend(EXLA.Backend) | |
{:ok, spec} = | |
Bumblebee.load_spec({:hf, "prajjwal1/bert-medium"}, | |
module: Bumblebee.Text.Bert, | |
architecture: :for_sequence_classification | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt install git | |
sudo apt install curl | |
sudo apt install build-essential | |
sudo apt install autoconf | |
sudo apt install m4 | |
sudo apt install libncurses5-dev | |
sudo apt install libssh-dev | |
sudo apt install unixodbc-dev | |
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Application.put_env(:sample, PhoenixDemo.Endpoint, | |
http: [ip: {127, 0, 0, 1}, port: 8080], | |
server: true, | |
live_view: [signing_salt: "bumblebee"], | |
secret_key_base: String.duplicate("b", 64), | |
pubsub_server: PhoenixDemo.PubSub | |
) | |
Mix.install([ | |
{:plug_cowboy, "~> 2.6"}, |
NewerOlder