56 lines
1.4 KiB
Markdown
56 lines
1.4 KiB
Markdown
# Toy ML models and experiments
|
|
|
|
This repo contains some experiments with ML I am working on to learn how they work.
|
|
|
|
## Setup
|
|
|
|
### Debian 13 (Trixie) Python3 setup
|
|
|
|
```bash
|
|
$ sudo apt install python3-full python3-venv
|
|
python3-full is already the newest version (3.13.5-1).
|
|
python3-venv is already the newest version (3.13.5-1).
|
|
```
|
|
|
|
### Get the code and init the venv
|
|
|
|
```bash
|
|
git clone http://the.git.repo/user/mltoys.git mltoys && cd mltoys
|
|
python3 -m venv .venv
|
|
source .venv/bin/activate
|
|
```
|
|
|
|
### Installing python deps
|
|
|
|
For instructions installing pytorch refer to the [PyTorch Home page]
|
|
|
|
```bash
|
|
pip3 install numpy pandas matplotlib
|
|
# I use the ROCm packages
|
|
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/rocm6.4
|
|
# if you need the CPU only package
|
|
# pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cpu
|
|
```
|
|
|
|
## Running the code
|
|
|
|
### Training the model
|
|
|
|
```bash
|
|
(.venv) ➜ python3 pairwise_compare.py train
|
|
```
|
|
|
|
### Running inference
|
|
|
|
```bash
|
|
(.venv) ➜ python3 pairwise_compare.py infer
|
|
```
|
|
|
|
### Some General notes
|
|
|
|
- This module logs to pairwise_compare.log using the python logging module
|
|
- Saved model state (training data) is saved at model.pth
|
|
- output_graphs.py generates two graphs to inspect the training process, copy the step log into the script to generate graphs.
|
|
|
|
[PyTorch Home page]: https://pytorch.org
|