Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move FastAI examples to their own folder #161

Merged
merged 3 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/test-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
- integrations/model-evaluation/gradio/notebooks/Gradio_and_Comet.ipynb
- integrations/model-evaluation/gradio/notebooks/Logging_Model_Inferences_with_Comet_and_Gradio.ipynb
- integrations/model-optimization/ray-tune/notebooks/Comet_and_Ray.ipynb
- integrations/model-training/fastai/notebooks/fastai_hello_world.ipynb
- integrations/model-training/hugging_face/notebooks/Comet_with_Hugging_Face_Trainer.ipynb
- integrations/model-training/keras/notebooks/Comet_with_Keras.ipynb
- integrations/model-training/lightgbm/notebooks/Comet_and_LightGBM.ipynb
Expand Down Expand Up @@ -99,6 +100,8 @@ jobs:
os: [ubuntu-latest]
python-version: ["3.10"]
example:
- {script: "integrations/model-optimization/optuna/optuna-hello-world/optuna-hello-world.py", arg: ""}
- {script: "integrations/model-training/fastai/fastai-hello-world/fastai_hello_world.py", arg: ""}
- {script: "integrations/model-training/hugging_face/transformers-distilbert-fine-tuning/transformers-distilbert-fine-tuning.py", arg: ""}
- {script: "integrations/model-training/keras/keras-mnist-dnn/keras-mnist-dnn.py", arg: ""}
- {script: "integrations/model-training/mlflow/mlflow-hello-world/mlflow-hello-world.py", arg: "run"}
Expand All @@ -112,7 +115,6 @@ jobs:
- {script: "integrations/workflow-orchestration/metaflow/metaflow-hello-world/helloworld.py", arg: "run"}
- {script: "integrations/workflow-orchestration/metaflow/metaflow-model-evaluation/metaflow-model-evaluation.py", arg: "run --max-workers 1 --n_samples 100"}
- {script: "integrations/workflow-orchestration/metaflow/metaflow-regression/metaflow-regression-example.py", arg: "run"}
- {script: "integrations/model-optimization/optuna/optuna-hello-world/optuna-hello-world.py", arg: ""}
env:
SCRIPT_TO_TEST: ${{ matrix.example.script }}
steps:
Expand Down
1 change: 1 addition & 0 deletions fastai/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
All of the fastai examples has been moved here: https://github.com/comet-ml/comet-examples/tree/master/integrations/model-training/fastai/.
44 changes: 0 additions & 44 deletions fastai/train-example.py

This file was deleted.

30 changes: 30 additions & 0 deletions integrations/model-training/fastai/fastai-hello-world/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# FastAI integration with Comet.ml

[fastai](https://github.com/fastai/fastai) is a deep learning library which provides practitioners with high-level components that can quickly and easily provide state-of-the-art results in standard deep learning domains, and provides researchers with low-level components that can be mixed and matched to build new approaches.

Instrument fastai with Comet to start managing experiments, create dataset versions and track hyperparameters for faster and easier reproducibility and collaboration.

## Documentation

For more information on using and configuring the fastai integration, see: [https://www.comet.com/docs/v2/integrations/ml-frameworks/fastai/](https://www.comet.com/docs/v2/integrations/ml-frameworks/fastai/?utm_source=comet-examples&utm_medium=referral&utm_campaign=github_repo_2023&utm_content=fastai)

## See it

Take a look at this [public Comet Project](https://www.comet.com/examples/comet-examples-fastai-hello-world/view/new/panels?utm_source=comet-examples&utm_medium=referral&utm_campaign=github_repo_2023&utm_content=fastai).

## Setup

Install dependencies

```bash
python -m pip install -r requirements.txt
```

## Run the example

This example is fine-tuning a pre-trained resnet 28 model on the Mnist Tiny dataset for 5 epochs:


```bash
python fastai-hello-world.py
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# coding: utf-8
import comet_ml

from fastai.vision.all import (
Categorize,
Datasets,
GrandparentSplitter,
IntToFloatTensor,
PILImageBW,
ToTensor,
URLs,
error_rate,
get_image_files,
parent_label,
resnet18,
untar_data,
vision_learner,
)

EPOCHS = 5

comet_ml.init(project_name="comet-examples-fastai-hello-world")
experiment = comet_ml.Experiment()

path = untar_data(URLs.MNIST_TINY)

items = get_image_files(path)
tds = Datasets(
items,
[PILImageBW.create, [parent_label, Categorize()]],
splits=GrandparentSplitter()(items),
)
dls = tds.dataloaders(after_item=[ToTensor(), IntToFloatTensor()])

learn = vision_learner(dls, resnet18, pretrained=True, metrics=error_rate)

learn.fit_one_cycle(EPOCHS)

experiment.end()
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
comet_ml
fastai
Loading
Loading