-
Notifications
You must be signed in to change notification settings - Fork 104
/
mix.exs
223 lines (209 loc) · 7.77 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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
defmodule Axon.MixProject do
use Mix.Project
@source_url "https://github.com/elixir-nx/axon"
@version "0.7.0"
def project do
[
app: :axon,
version: @version,
name: "Axon",
elixir: "~> 1.13",
elixirc_paths: elixirc_paths(Mix.env()),
deps: deps(),
docs: docs(),
description: "Create and train neural networks in Elixir",
package: package(),
preferred_cli_env: [
docs: :docs,
"hex.publish": :docs
]
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
defp elixirc_paths(:test), do: ~w(lib test/support)
defp elixirc_paths(_), do: ~w(lib)
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:nx, "~> 0.9", nx_opts()},
{:exla, "~> 0.9", [only: :test] ++ exla_opts()},
{:torchx, "~> 0.9", [only: :test] ++ torchx_opts()},
{:ex_doc, "~> 0.23", only: :docs},
{:table_rex, "~> 3.1.1", optional: true},
{:kino, "~> 0.7", optional: true},
{:kino_vega_lite, "~> 0.1.7", optional: true},
{:polaris, "~> 0.1"}
]
end
defp package do
[
maintainers: ["Sean Moriarity"],
licenses: ["Apache-2.0"],
links: %{"GitHub" => @source_url}
]
end
defp nx_opts do
if path = System.get_env("AXON_NX_PATH") do
[path: path, override: true]
else
[]
end
end
defp exla_opts do
if path = System.get_env("AXON_EXLA_PATH") do
[path: path]
else
[]
end
end
defp torchx_opts do
if path = System.get_env("AXON_TORCHX_PATH") do
[path: path]
else
[]
end
end
defp docs do
[
main: "Axon",
source_ref: "v#{@version}",
logo: "logo.png",
source_url: @source_url,
extras: [
# Guides
"guides/guides.md",
"guides/model_creation/your_first_axon_model.livemd",
"guides/model_creation/sequential_models.livemd",
"guides/model_creation/complex_models.livemd",
"guides/model_creation/multi_input_multi_output_models.livemd",
"guides/model_creation/custom_layers.livemd",
"guides/model_creation/model_hooks.livemd",
"guides/model_execution/accelerating_axon.livemd",
"guides/model_execution/training_and_inference_mode.livemd",
"guides/training_and_evaluation/your_first_training_loop.livemd",
"guides/training_and_evaluation/instrumenting_loops_with_metrics.livemd",
"guides/training_and_evaluation/your_first_evaluation_loop.livemd",
"guides/training_and_evaluation/using_loop_event_handlers.livemd",
"guides/training_and_evaluation/custom_models_loss_optimizers.livemd",
"guides/training_and_evaluation/writing_custom_metrics.livemd",
"guides/training_and_evaluation/writing_custom_event_handlers.livemd",
"guides/serialization/onnx_to_axon.livemd",
# Examples
"notebooks/basics/xor.livemd",
"notebooks/vision/mnist.livemd",
"notebooks/vision/horses_or_humans.livemd",
"notebooks/text/lstm_generation.livemd",
"notebooks/structured/credit_card_fraud.livemd",
"notebooks/generative/mnist_autoencoder_using_kino.livemd",
"notebooks/generative/fashionmnist_autoencoder.livemd",
"notebooks/generative/fashionmnist_vae.livemd"
],
groups_for_extras: [
"Guides: Model Creation": Path.wildcard("guides/model_creation/*.livemd"),
"Guides: Model Execution": Path.wildcard("guides/model_execution/*.livemd"),
"Guides: Training and Evaluation":
Path.wildcard("guides/training_and_evaluation/*.livemd"),
"Guides: Serialization": Path.wildcard("guides/serialization/*.livemd"),
"Examples: Basics": Path.wildcard("notebooks/basics/*.livemd"),
"Examples: Vision": Path.wildcard("notebooks/vision/*.livemd"),
"Examples: Text": Path.wildcard("notebooks/text/*.livemd"),
"Examples: Structured": Path.wildcard("notebooks/structured/*.livemd"),
"Examples: Generative": Path.wildcard("notebooks/generative/*.livemd")
],
groups_for_functions: [
# Axon
"Layers: Special": &(&1[:type] == :special),
"Layers: Activation": &(&1[:type] == :activation),
"Layers: Linear": &(&1[:type] == :linear),
"Layers: Convolution": &(&1[:type] == :convolution),
"Layers: Dropout": &(&1[:type] == :dropout),
"Layers: Pooling": &(&1[:type] == :pooling),
"Layers: Normalization": &(&1[:type] == :normalization),
"Layers: Recurrent": &(&1[:type] == :recurrent),
"Layers: Combinators": &(&1[:type] == :combinator),
"Layers: Shape": &(&1[:type] == :shape),
Model: &(&1[:type] == :model),
"Model: Manipulation": &(&1[:type] == :graph),
"Model: Debugging": &(&1[:type] == :debug),
# Axon.Layers
"Functions: Attention": &(&1[:type] == :attention),
"Functions: Convolutional": &(&1[:type] == :convolutional),
"Functions: Dropout": &(&1[:type] == :dropout),
"Functions: Linear": &(&1[:type] == :linear),
"Functions: Normalization": &(&1[:type] == :normalization),
"Functions: Pooling": &(&1[:type] == :pooling),
"Functions: Shape": &(&1[:type] == :shape)
],
groups_for_modules: [
Model: [
Axon,
Axon.MixedPrecision,
Axon.None,
Axon.StatefulOutput,
Axon.Initializers
],
Summary: [
Axon.Display
],
Functional: [
Axon.Activations,
Axon.Initializers,
Axon.Layers,
Axon.Losses,
Axon.Metrics,
Axon.Recurrent,
Axon.LossScale
],
Loop: [
Axon.Loop,
Axon.Loop.State
]
],
before_closing_body_tag: &before_closing_body_tag/1
]
end
defp before_closing_body_tag(:html) do
"""
<!-- Render math with KaTeX -->
<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>
<!-- Render diagrams with Mermaid -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
mermaid.initialize({ startOnLoad: false });
let id = 0;
for (const codeEl of document.querySelectorAll("pre code.mermaid")) {
const preEl = codeEl.parentElement;
const graphDefinition = codeEl.textContent;
const graphEl = document.createElement("div");
const graphId = "mermaid-graph-" + id++;
mermaid.render(graphId, graphDefinition, function (svgSource, bindListeners) {
graphEl.innerHTML = svgSource;
bindListeners && bindListeners(graphEl);
preEl.insertAdjacentElement("afterend", graphEl);
preEl.remove();
});
}
});
</script>
"""
end
defp before_closing_body_tag(_), do: ""
end