-
Notifications
You must be signed in to change notification settings - Fork 101
/
mix.exs
183 lines (174 loc) · 5.85 KB
/
mix.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
defmodule Bumblebee.MixProject do
use Mix.Project
@version "0.6.0"
@description "Pre-trained and transformer Neural Network models in Axon"
def project do
[
app: :bumblebee,
version: @version,
description: @description,
name: "Bumblebee",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
deps: deps(),
docs: docs(),
package: package()
]
end
def application do
[
mod: {Bumblebee.Application, []},
extra_applications: [:logger, :inets, :ssl]
]
end
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
defp deps do
[
{:axon, "~> 0.7.0"},
# {:axon, github: "elixir-nx/axon", override: true},
{:tokenizers, "~> 0.4"},
{:nx, "~> 0.9.0"},
{:exla, ">= 0.0.0", only: [:dev, :test]},
{:torchx, ">= 0.0.0", only: [:dev, :test]},
# {:nx, github: "elixir-nx/nx", sparse: "nx", override: true},
# {:exla, github: "elixir-nx/nx", sparse: "exla", override: true, only: [:dev, :test]},
# {:torchx, github: "elixir-nx/nx", sparse: "torchx", override: true, only: [:dev, :test]},
{:nx_image, "~> 0.1.0"},
{:unpickler, "~> 0.1.0"},
{:safetensors, "~> 0.1.3"},
{:jason, "~> 1.4.0"},
{:unzip, "~> 0.12.0"},
{:progress_bar, "~> 3.0"},
{:stb_image, "~> 0.6.0", only: :test},
{:bypass, "~> 2.1", only: :test},
{:ex_doc, "~> 0.28", only: :dev, runtime: false},
{:nx_signal, "~> 0.2.0"}
]
end
defp docs do
[
main: "Bumblebee",
source_url: "https://github.com/elixir-nx/bumblebee",
source_ref: "v#{@version}",
extras: [
"notebooks/examples.livemd",
"notebooks/stable_diffusion.livemd",
"notebooks/llms.livemd",
"notebooks/llms_rag.livemd",
"notebooks/fine_tuning.livemd",
"examples/phoenix/README.md"
],
extra_section: "GUIDES",
groups_for_modules: [
Tasks: [
Bumblebee.Audio,
Bumblebee.Text,
Bumblebee.Vision,
Bumblebee.Diffusion.StableDiffusion,
Bumblebee.Diffusion.StableDiffusionControlNet
],
Models: [
Bumblebee.Audio.Whisper,
Bumblebee.Diffusion.ControlNet,
Bumblebee.Diffusion.StableDiffusion.SafetyChecker,
Bumblebee.Diffusion.UNet2DConditional,
Bumblebee.Diffusion.VaeKl,
Bumblebee.Multimodal.Blip,
Bumblebee.Multimodal.Clip,
Bumblebee.Multimodal.LayoutLm,
Bumblebee.Text.Albert,
Bumblebee.Text.Bart,
Bumblebee.Text.Bert,
Bumblebee.Text.Blenderbot,
Bumblebee.Text.BlipText,
Bumblebee.Text.ClipText,
Bumblebee.Text.Distilbert,
Bumblebee.Text.Gemma,
Bumblebee.Text.Gpt2,
Bumblebee.Text.GptBigCode,
Bumblebee.Text.GptNeoX,
Bumblebee.Text.Llama,
Bumblebee.Text.M2m100,
Bumblebee.Text.Mbart,
Bumblebee.Text.Mistral,
Bumblebee.Text.Phi,
Bumblebee.Text.Phi3,
Bumblebee.Text.Roberta,
Bumblebee.Text.T5,
Bumblebee.Vision.BlipVision,
Bumblebee.Vision.ClipVision,
Bumblebee.Vision.ConvNext,
Bumblebee.Vision.Deit,
Bumblebee.Vision.DinoV2,
Bumblebee.Vision.ResNet,
Bumblebee.Vision.Swin,
Bumblebee.Vision.Vit
],
Preprocessors: [
Bumblebee.Audio.WhisperFeaturizer,
Bumblebee.Text.PreTrainedTokenizer,
Bumblebee.Vision.BitFeaturizer,
Bumblebee.Vision.BlipFeaturizer,
Bumblebee.Vision.ClipFeaturizer,
Bumblebee.Vision.ConvNextFeaturizer,
Bumblebee.Vision.DeitFeaturizer,
Bumblebee.Vision.VitFeaturizer
],
Schedulers: [
Bumblebee.Diffusion.DdimScheduler,
Bumblebee.Diffusion.LcmScheduler,
Bumblebee.Diffusion.PndmScheduler
],
Interfaces: [
Bumblebee.Configurable,
Bumblebee.ModelSpec,
Bumblebee.Featurizer,
Bumblebee.Tokenizer,
Bumblebee.Scheduler,
Bumblebee.Text.Generation
],
Other: [
Bumblebee.Text.GenerationConfig,
Bumblebee.Text.WhisperGenerationConfig
]
],
groups_for_docs: [
# Bumblebee
Models: &(&1[:type] == :model),
Featurizers: &(&1[:type] == :featurizer),
Tokenizers: &(&1[:type] == :tokenizer),
Schedulers: &(&1[:type] == :scheduler)
],
before_closing_body_tag: &before_closing_body_tag/1
]
end
def package do
[
licenses: ["Apache-2.0"],
links: %{
"GitHub" => "https://github.com/elixir-nx/bumblebee"
}
]
end
# Add KaTeX integration for rendering math
defp before_closing_body_tag(:html) do
"""
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-t5CR+zwDAROtph0PXGte6ia8heboACF9R5l/DiY+WZ3P2lxNgvJkQk5n7GPvLMYw" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-FaFLTlohFghEIZkw6VGwmf9ISTubWAVYW8tG8+w2LAIftJEULZABrF9PPFv+tVkH" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-bHBqxz8fokvgoJ/sc17HODNxa42TlaEhB+w8ZJXTc2nZf1VgEaFZeZvT4Mznfz0v" crossorigin="anonymous"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
renderMathInElement(document.body, {
delimiters: [
{ left: "$$", right: "$$", display: true },
{ left: "$", right: "$", display: false },
]
});
});
</script>
"""
end
defp before_closing_body_tag(_), do: ""
end