Skip to content

Commit

Permalink
chore: Initial setup. #1
Browse files Browse the repository at this point in the history
  • Loading branch information
LuchoTurtle committed Oct 30, 2023
1 parent c355232 commit 6fcc31c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ within `Phoenix`!
- [How? 💻](#how-)
- [Prerequisites](#prerequisites)
- [0. Creating a fresh `Phoenix` project](#0-creating-a-fresh-phoenix-project)
- [1. Installing initial dependencies](#1-installing-initial-dependencies)
- [_Please_ Star the repo! ⭐️](#please-star-the-repo-️)


Expand Down Expand Up @@ -117,8 +118,49 @@ you should be able to see the following page.
We're ready to start implementing!


## 1. Installing initial dependencies

Now that we're ready to go,
let's start by adding some dependencies.

Head over to `mix.exs`
and add the following dependencies
to the `deps` section.

```elixir
{:bumblebee, "~> 0.4.2"},
{:exla, "~> 0.6.1"}
```

- [**`bumblebee`**](https://github.com/elixir-nx/bumblebee),
a framework that will allows us to integrate
[`Transformer Models`](https://huggingface.co/docs/transformers/index) in `Phoenix`.
`Transformers` (from [Hugging Face](https://huggingface.co/))
are APIs that allow us to easily download and train pretrained models.
`Bumblebee` aims to support all Transformer Models,
however some are lacking.
You may check which ones are supported by visiting
`Bumblebee`'s repository
or visiting https://jonatanklosko-bumblebee-tools.hf.space/apps/repository-inspector
and checking if the model is currently supported.

- [**`EXLA`**](https://hexdocs.pm/exla/EXLA.html),
Elixir implementation of [Google's XLA](https://www.tensorflow.org/xla/),
a compiler that provides faster linear algebra calculations
with `TensorFlow` models.
This backend compiler is needed for [`Nx`](https://github.com/elixir-nx/nx),
a framework that allows support for tensors and numerical definitions
in Elixir.
We are installing `EXLA` because allows us to compile models
*just-in-time* and run them on CPU and/or GPU.

In `config/config.exs`,
let's add our `:nx` configuration
to use `EXLA`.

```elixir
config :nx, default_backend: EXLA.Backend
```


# _Please_ Star the repo! ⭐️
Expand Down
3 changes: 3 additions & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
# General application configuration
import Config

# Tells `NX` to use `EXLA` as backend
config :nx, default_backend: EXLA.Backend

# Configures the endpoint
config :app, AppWeb.Endpoint,
url: [host: "localhost"],
Expand Down

0 comments on commit 6fcc31c

Please sign in to comment.