removed deprecacy
This commit is contained in:
@@ -1,195 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
\begin{frame}[fragile]{Štruktúra nášho projektu}
|
|
||||||
\begin{verbatim}
|
|
||||||
.
|
|
||||||
├── Cargo.toml # závislosti (burn, clap, npyz, ...)
|
|
||||||
├── mnist.npz # dataset
|
|
||||||
└── src/
|
|
||||||
├── lib.rs # modul deklarácie
|
|
||||||
├── main.rs # tréningová slučka, načítanie dát
|
|
||||||
└── model.rs # parametre siete
|
|
||||||
\end{verbatim}
|
|
||||||
|
|
||||||
\vspace{0.5em}
|
|
||||||
Celý projekt --- 3 súbory. Žiadne skripty, žiadny Python glue.
|
|
||||||
\end{frame}
|
|
||||||
|
|
||||||
\begin{frame}[fragile]{Definícia parametrov siete}
|
|
||||||
\begin{verbatim}
|
|
||||||
pub struct Parameters<B: Backend> {
|
|
||||||
pub w1: Tensor<B, 2>, // [784, hidden]
|
|
||||||
pub b1: Tensor<B, 1>, // [hidden]
|
|
||||||
pub w2: Tensor<B, 2>, // [hidden, 10]
|
|
||||||
pub b2: Tensor<B, 1>, // [10]
|
|
||||||
}
|
|
||||||
\end{verbatim}
|
|
||||||
|
|
||||||
\vspace{0.5em}
|
|
||||||
\begin{itemize}
|
|
||||||
\item Generický typ \texttt{B: Backend} --- funguje na akomkoľvek backendu
|
|
||||||
\item Rozmery tenzorov sú súčasťou typu (\texttt{Tensor<B, 2>})
|
|
||||||
\item Kompilátor zachytí chyby v rozmeroch ešte \textbf{pred spustením}
|
|
||||||
\end{itemize}
|
|
||||||
\end{frame}
|
|
||||||
|
|
||||||
\begin{frame}[fragile]{Inicializácia váh}
|
|
||||||
\begin{verbatim}
|
|
||||||
let w1 = random_tensor([784, hidden_size],
|
|
||||||
0.1, seed, device);
|
|
||||||
let b1 = Tensor::zeros([hidden_size], device);
|
|
||||||
\end{verbatim}
|
|
||||||
|
|
||||||
\vspace{0.5em}
|
|
||||||
\begin{itemize}
|
|
||||||
\item Váhy: náhodné z $\mathcal{N}(0,\; 0.1)$
|
|
||||||
\item Biasy: inicializované na nulu
|
|
||||||
\item \texttt{device} určuje, kde žijú dáta (CPU/GPU)
|
|
||||||
\item Seed zabezpečuje \textbf{reprodukovateľnosť}
|
|
||||||
\end{itemize}
|
|
||||||
\end{frame}
|
|
||||||
|
|
||||||
\begin{frame}[fragile]{Načítanie MNIST dát}
|
|
||||||
\begin{verbatim}
|
|
||||||
fn load_mnist_items(path: &str, examples: usize)
|
|
||||||
-> Vec<(Vec<f32>, u8)>
|
|
||||||
\end{verbatim}
|
|
||||||
|
|
||||||
\vspace{0.5em}
|
|
||||||
\begin{itemize}
|
|
||||||
\item Otvoríme \texttt{mnist.npz} ako ZIP archív
|
|
||||||
\item Načítame obrázky + labely z \texttt{.npy} súborov
|
|
||||||
\item Normalizujeme pixely: $[0, 255] \rightarrow [0.0, 1.0]$
|
|
||||||
\item Výstup: vektor párov \texttt{(obrázok, číslica)}
|
|
||||||
\end{itemize}
|
|
||||||
|
|
||||||
\vspace{0.5em}
|
|
||||||
Rustový typový systém garantuje, že dáta majú správny formát.
|
|
||||||
\end{frame}
|
|
||||||
|
|
||||||
\begin{frame}[fragile]{CLI parametre s Clap}
|
|
||||||
\begin{verbatim}
|
|
||||||
#[derive(Parser, Debug)]
|
|
||||||
struct Args {
|
|
||||||
#[arg(long, default_value_t = 50)]
|
|
||||||
batch_size: usize,
|
|
||||||
#[arg(long, default_value_t = 0.1)]
|
|
||||||
learning_rate: f64,
|
|
||||||
#[arg(long, default_value_t = 10)]
|
|
||||||
epochs: usize,
|
|
||||||
}
|
|
||||||
\end{verbatim}
|
|
||||||
|
|
||||||
\vspace{0.5em}
|
|
||||||
Jeden derive makro --- automatický parsing, help text, validácia.
|
|
||||||
|
|
||||||
\texttt{cargo run -- --epochs 20 --learning-rate 0.01}
|
|
||||||
\end{frame}
|
|
||||||
|
|
||||||
\begin{frame}{Tréningová slučka --- logika}
|
|
||||||
Pre každú epochu:
|
|
||||||
\begin{enumerate}
|
|
||||||
\item Rozdeľ trénovacie dáta na \textbf{mini-batche}
|
|
||||||
\item Pre každý batch:
|
|
||||||
\begin{itemize}
|
|
||||||
\item Forward pass: $\hat{y} = \text{softmax}((\mathbf{x} \cdot W_1 + b_1)_{\text{ReLU}} \cdot W_2 + b_2)$
|
|
||||||
\item Spočítaj cross-entropy loss
|
|
||||||
\item Backpropagation: gradienty pre $W_1, b_1, W_2, b_2$
|
|
||||||
\item Update: $\theta \leftarrow \theta - \eta \cdot \nabla L$
|
|
||||||
\end{itemize}
|
|
||||||
\item Vyhodnoť presnosť na dev sete
|
|
||||||
\end{enumerate}
|
|
||||||
\end{frame}
|
|
||||||
|
|
||||||
\begin{frame}{Burn vs PyTorch --- porovnanie}
|
|
||||||
\begin{center}
|
|
||||||
\begin{tabular}{lcc}
|
|
||||||
\hline
|
|
||||||
\textbf{Vlastnosť} & \textbf{PyTorch} & \textbf{Burn} \\
|
|
||||||
\hline
|
|
||||||
Jazyk & Python/C++ & Rust \\
|
|
||||||
Typová bezpečnosť & runtime & compile-time \\
|
|
||||||
Pamäťová bezpečnosť & GC/manuálna & ownership \\
|
|
||||||
Backendy & CUDA, CPU & CUDA, CPU, WebGPU \\
|
|
||||||
Binárka & $\sim$GB + Python & $\sim$MB standalone \\
|
|
||||||
Nasadenie & zložité & jeden binárny súbor \\
|
|
||||||
\hline
|
|
||||||
\end{tabular}
|
|
||||||
\end{center}
|
|
||||||
\end{frame}
|
|
||||||
|
|
||||||
\begin{frame}{Výhoda: Compile-time kontroly}
|
|
||||||
V PyTorchi:
|
|
||||||
\begin{itemize}
|
|
||||||
\item Chyba v rozmeroch $\rightarrow$ \texttt{RuntimeError} po minútach tréningu
|
|
||||||
\item Preklep v názve vrstvy $\rightarrow$ tichý bug
|
|
||||||
\end{itemize}
|
|
||||||
|
|
||||||
\vspace{0.5em}
|
|
||||||
V Burn/Ruste:
|
|
||||||
\begin{itemize}
|
|
||||||
\item Nesprávne rozmery $\rightarrow$ \textbf{kompilátor to nepustí}
|
|
||||||
\item Nepoužitá premenná, chýbajúci branch $\rightarrow$ warning/error
|
|
||||||
\item Žiadne \texttt{None} prekvapenia --- \texttt{Option<T>} treba ošetriť
|
|
||||||
\end{itemize}
|
|
||||||
|
|
||||||
\vspace{0.5em}
|
|
||||||
\textbf{Menej debugovania, viac istoty.}
|
|
||||||
\end{frame}
|
|
||||||
|
|
||||||
\begin{frame}{Výhoda: Nasadenie do produkcie}
|
|
||||||
\begin{itemize}
|
|
||||||
\item \texttt{cargo build --release} $\rightarrow$ jeden statický binárny súbor
|
|
||||||
\item Žiadny Python runtime, žiadne virtuálne prostredia
|
|
||||||
\item Možnosť kompilácie do WebAssembly $\rightarrow$ inferencia v prehliadači
|
|
||||||
\item Ideálne pre embedded, edge zariadenia, IoT
|
|
||||||
\end{itemize}
|
|
||||||
|
|
||||||
\vspace{0.5em}
|
|
||||||
\begin{center}
|
|
||||||
PyTorch model: Docker kontajner $\sim$2\,GB \\
|
|
||||||
Burn model: binárka $\sim$5\,MB
|
|
||||||
\end{center}
|
|
||||||
\end{frame}
|
|
||||||
|
|
||||||
\begin{frame}{Výhoda: Fearless concurrency}
|
|
||||||
\begin{itemize}
|
|
||||||
\item Rustový ownership systém zabraňuje data races \textbf{v compile-time}
|
|
||||||
\item Bezpečný multithreading pre data loading, augmentáciu
|
|
||||||
\item Parameter \texttt{--threads} v našom projekte
|
|
||||||
\item V Pythone: GIL (Global Interpreter Lock) blokuje paralelizmus
|
|
||||||
\end{itemize}
|
|
||||||
\end{frame>
|
|
||||||
|
|
||||||
\begin{frame}{Kedy použiť Burn?}
|
|
||||||
\textbf{Vhodné:}
|
|
||||||
\begin{itemize}
|
|
||||||
\item Nasadenie modelov do produkcie
|
|
||||||
\item Edge/embedded inferencia
|
|
||||||
\item Keď chcete maximálny výkon a bezpečnosť
|
|
||||||
\item Keď už poznáte Rust
|
|
||||||
\end{itemize}
|
|
||||||
|
|
||||||
\vspace{0.5em}
|
|
||||||
\textbf{Nevhodné (zatiaľ):}
|
|
||||||
\begin{itemize}
|
|
||||||
\item Rýchle prototypovanie --- Python je stále rýchlejší na experimenty
|
|
||||||
\item Ekosystém --- PyTorch má tisíce hotových modelov
|
|
||||||
\item Burn je stále mladý projekt (aktívny vývoj)
|
|
||||||
\end{itemize}
|
|
||||||
\end{frame}
|
|
||||||
|
|
||||||
\begin{frame}{Zhrnutie}
|
|
||||||
\begin{itemize}
|
|
||||||
\item Neurónové siete = vrstvy neurónov, učenie cez gradienty
|
|
||||||
\item \textbf{Burn} prináša deep learning do Rustu
|
|
||||||
\item Backend-agnostický, typovo bezpečný, production-ready
|
|
||||||
\item Náš projekt: MNIST klasifikátor v 3 súboroch
|
|
||||||
\item Rust + Burn = bezpečnosť + výkon + jednoduchosť nasadenia
|
|
||||||
\end{itemize}
|
|
||||||
|
|
||||||
\vspace{1em}
|
|
||||||
\begin{center}
|
|
||||||
\Large Ďakujem za pozornosť!
|
|
||||||
\end{center}
|
|
||||||
\end{frame}
|
|
||||||
@@ -3143,15 +3143,12 @@ L3 programming layer <2026-01-19>
|
|||||||
|
|
||||||
LaTeX Font Warning: Some font shapes were not available, defaults substituted.
|
LaTeX Font Warning: Some font shapes were not available, defaults substituted.
|
||||||
|
|
||||||
|
|
||||||
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
|
|
||||||
|
|
||||||
Package rerunfilecheck Info: File `main.out' has not changed.
|
Package rerunfilecheck Info: File `main.out' has not changed.
|
||||||
(rerunfilecheck) Checksum: D41D8CD98F00B204E9800998ECF8427E;0.
|
(rerunfilecheck) Checksum: D41D8CD98F00B204E9800998ECF8427E;0.
|
||||||
)
|
)
|
||||||
|
|
||||||
Here is how much of LuaTeX's memory you used:
|
Here is how much of LuaTeX's memory you used:
|
||||||
67066 strings out of 476078
|
67064 strings out of 476078
|
||||||
125031,2848258 words of node,token memory allocated
|
125031,2848258 words of node,token memory allocated
|
||||||
6249 words of node memory still in use:
|
6249 words of node memory still in use:
|
||||||
59 hlist, 16 vlist, 9 rule, 24 disc, 8 local_par, 4 math, 137 glue, 55 kern,
|
59 hlist, 16 vlist, 9 rule, 24 disc, 8 local_par, 4 math, 137 glue, 55 kern,
|
||||||
@@ -3160,7 +3157,7 @@ _list, 8 write, 30 pdf_literal, 2 pdf_start_link, 2 pdf_end_link, 4 pdf_dest, 2
|
|||||||
pdf_action, 60 pdf_colorstack nodes
|
pdf_action, 60 pdf_colorstack nodes
|
||||||
avail lists: 1:8,2:3124,3:1867,4:377,5:299,6:44,7:1346,8:21,9:988,10:13,11:81
|
avail lists: 1:8,2:3124,3:1867,4:377,5:299,6:44,7:1346,8:21,9:988,10:13,11:81
|
||||||
,12:1
|
,12:1
|
||||||
87632 multiletter control sequences out of 65536+600000
|
87630 multiletter control sequences out of 65536+600000
|
||||||
132 fonts using 28094191 bytes
|
132 fonts using 28094191 bytes
|
||||||
128i,23n,130p,7883b,1832s stack positions out of 10000i,1000n,20000p,200000b,200000s
|
128i,23n,130p,7883b,1832s stack positions out of 10000i,1000n,20000p,200000b,200000s
|
||||||
</nix/store/56vq9r21wl8m731rsri7nh3l4ipih7jj-texlive-2025-r78234-final-env-texmf
|
</nix/store/56vq9r21wl8m731rsri7nh3l4ipih7jj-texlive-2025-r78234-final-env-texmf
|
||||||
@@ -3186,7 +3183,7 @@ ona/iwonar.pfb></nix/store/56vq9r21wl8m731rsri7nh3l4ipih7jj-texlive-2025-r78234-
|
|||||||
final-env-texmfdist/fonts/type1/public/mathdesign/mdbch/md-chb7t.pfb></nix/store
|
final-env-texmfdist/fonts/type1/public/mathdesign/mdbch/md-chb7t.pfb></nix/store
|
||||||
/56vq9r21wl8m731rsri7nh3l4ipih7jj-texlive-2025-r78234-final-env-texmfdist/fonts/
|
/56vq9r21wl8m731rsri7nh3l4ipih7jj-texlive-2025-r78234-final-env-texmfdist/fonts/
|
||||||
type1/public/mathdesign/mdbch/md-chb7y.pfb>
|
type1/public/mathdesign/mdbch/md-chb7y.pfb>
|
||||||
Output written on main.pdf (13 pages, 95834 bytes).
|
Output written on main.pdf (13 pages, 95816 bytes).
|
||||||
|
|
||||||
PDF statistics: 196 PDF objects out of 1000 (max. 8388607)
|
PDF statistics: 196 PDF objects out of 1000 (max. 8388607)
|
||||||
115 compressed objects within 2 object streams
|
115 compressed objects within 2 object streams
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user