Giter Club home page Giter Club logo

fsdl-aiornot's Introduction

AI Or Not

ScreenShot

Hosted here (Currently unavailable, took it down to save costs on AWS, will redeploy at a later date.)

The purpose of this project is to learn the concepts presented in FSDL 2022 by building, training and deploying my own model. The model is purposely chosen to be as simple as possible so not to spend too much time on model architecture and instead focus on the other parts of the deep learning stack.

Building the model

As stated above, in building the model, I kept it as simple as possible. I built a ResNet from "scratch" using pytorch by stacking convolution/batchnorm/relu layers on top of each other.

The model takes in an image and outputs a prediction that states how confident it is that it is AI generated.

Choosing a dataset

For the dataset, I went with the aiornot dataset from huggingface. This dataset has 62 060 rows with each row containing and id, the image and a label indicating wether the image is generated or not.

Training

To train the model, on top of vanilla pytorch I used pytorch lightning which helps organize the training code and provides all the neccessary tools for logging metrics.

Experiment Tracking

In order to help us track all the important metrics, I used wandb. With pytorch lightning, integrating wandb into our training code is trivial. In addition to helping with tracking training metrics, wandb also allows us to save the model at configurable intervals as artifacts. This is really helpful, especially when you are training in a free google collab notebook, where you can lose all your training if your model disconnects.

Troubleshooting & Testing

Training is expensive. Before starting we need to make sure that everything is working correctly using different tests and fix any problems when they arise by using troubleshooting tools. To test our code we use pytest (not used here). To test our data we use pydantinc (not used here). To test our model, we use a memorization test, to see wether our model can effectively overfit on a batch. This helps us avoid any catastrophic failures although small bugs can slip through. We also use pytorch profiler to make sure we are effectively utilizing our GPU.

Web Deployment

To deploy the model I used gradio for my frontend and an aws serverless backend. In the future, I would like to deploy my projects with a custom frontend but alas my skills are not there yet.

fsdl-aiornot's People

Contributors

freth251 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.