Examples#
Forge ML ships with small demo models for several frameworks. These examples train quickly on random data and demonstrate how to save the trained weights to a local path or a Minio bucket.
Running Examples#
Each framework exposes make_* functions which build and train the models.
They accept optional save_path and minio_cfg keyword arguments. If a
saved model exists the weights can be reloaded using load=True.
from forge_ml.examples.pytorch import cnn
model = cnn.make_cnn(save_path="cnn.pt")
# Upload to Minio
cnn.make_cnn(save_path="cnn.pt", minio_cfg={
"endpoint": "localhost:9000",
"access_key": "minioadmin",
"secret_key": "minioadmin",
"bucket": "forge-examples",
})
See the modules under forge_ml/examples for TensorFlow and JAX versions of
LSTM, RNN, CNN, FPN, ResNet and FCN models.
Jupyter Notebooks#
Interactive notebooks demonstrating these models and the testing pipeline are
available under notebooks/examples. Open one of pytorch_demo.ipynb,
tensorflow_demo.ipynb or jax_demo.ipynb in JupyterLab to train the
models and execute the pipeline tests. A reinforcement learning demo using
Farama Gym can be found in reinforcement/cartpole_demo.ipynb.