Deep Learning with fastai Cookbook
eBook - ePub

Deep Learning with fastai Cookbook

Mark Ryan

  1. 338 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Deep Learning with fastai Cookbook

Mark Ryan

Book details
Book preview
Table of contents
Citations

About This Book

Harness the power of the easy-to-use, high-performance fastai framework to rapidly create complete deep learning solutions with few lines of codeKey Featuresā€¢ Discover how to apply state-of-the-art deep learning techniques to real-world problemsā€¢ Build and train neural networks using the power and flexibility of the fastai frameworkā€¢ Use deep learning to tackle problems such as image classification and text classificationBook Descriptionfastai is an easy-to-use deep learning framework built on top of PyTorch that lets you rapidly create complete deep learning solutions with as few as 10 lines of code. Both predominant low-level deep learning frameworks, TensorFlow and PyTorch, require a lot of code, even for straightforward applications. In contrast, fastai handles the messy details for you and lets you focus on applying deep learning to actually solve problems. The book begins by summarizing the value of fastai and showing you how to create a simple 'hello world' deep learning application with fastai. You'll then learn how to use fastai for all four application areas that the framework explicitly supports: tabular data, text data (NLP), recommender systems, and vision data. As you advance, you'll work through a series of practical examples that illustrate how to create real-world applications of each type. Next, you'll learn how to deploy fastai models, including creating a simple web application that predicts what object is depicted in an image. The book wraps up with an overview of the advanced features of fastai. By the end of this fastai book, you'll be able to create your own deep learning applications using fastai. You'll also have learned how to use fastai to prepare raw datasets, explore datasets, train deep learning models, and deploy trained models.What you will learnā€¢ Prepare real-world raw datasets to train fastai deep learning modelsā€¢ Train fastai deep learning models using text and tabular dataā€¢ Create recommender systems with fastaiā€¢ Find out how to assess whether fastai is a good fit for a given problemā€¢ Deploy fastai deep learning models in web applicationsā€¢ Train fastai deep learning models for image classificationWho this book is forThis book is for data scientists, machine learning developers, and deep learning enthusiasts looking to explore the fastai framework using a recipe-based approach. Working knowledge of the Python programming language and machine learning basics is strongly recommended to get the most out of this deep learning book.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on ā€œCancel Subscriptionā€ - itā€™s as simple as that. After you cancel, your membership will stay active for the remainder of the time youā€™ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlegoā€™s features. The only differences are the price and subscription period: With the annual plan youā€™ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, weā€™ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Deep Learning with fastai Cookbook an online PDF/ePUB?
Yes, you can access Deep Learning with fastai Cookbook by Mark Ryan in PDF and/or ePUB format, as well as other popular books in Informatica & Intelligenza artificiale (IA) e semantica. We have over one million books available in our catalogue for you to explore.

Information

Year
2021
ISBN
9781800209992

Chapter 1: Getting Started with fastai

Over the last decade, deep learning has revolutionized swathes of technology, from image recognition to machine translation. Until recently, only those with extensive training and access to specialized hardware have been able to unlock the benefits of deep learning. The fastai framework is an effort to democratize deep learning by making it accessible to non-specialists. One of the key ways that fastai opens up deep learning to the masses is by making it easy to get started.
In this chapter, we will show you what you need to get started with fastai, starting with how to set up an environment for fastai. By the end of this chapter, you will be able to do the following: set up a cloud environment in which to run fastai examples; exercise a basic fastai example; explain the relationship between fastai and PyTorch (the underlying deep learning library for fastai); and contrast fastai with Keras, the other high-level library for deep learning.
Here are the recipes that will be covered in this chapter:
  • Setting up a fastai environment in Paperspace Gradient
  • Setting up a fastai environment in Google Colaboratory (Google Colab)
  • Setting up JupyterLab environment in Paperspace Gradient
  • "Hello world" for fastaiā€”creating a model for the Modified National Institute of Science and Technology (MNIST) dataset
  • Understanding the world in four applications: tables, text, recommender systems, and images
  • Working with PyTorch tensors
  • Contrasting fastai with Keras
  • Test your knowledge

Technical requirements

For this chapter, you will be using the following technologies:
  • Paperspace Gradient: https://gradient.paperspace.com/
  • Google Colab: https://colab.research.google.com/notebooks/intro.ipynb
  • Google Drive: https://drive.google.com
  • Keras: https://keras.io/
You can find the code referred to in this chapter at the following link:
https://github.com/PacktPublishing/Deep-Learning-with-fastai-Cookbook/tree/main/ch1

Setting up a fastai environment in Paperspace Gradient

There are two free cloud environments that you can use to explore fastai: Paperspace Gradient and Google Colab. In this section, we'll go through the steps to set up Paperspace Gradient with a fastai notebook environment, and in the next section, we'll go through the setup steps for Colab. It's your choice, so pick the environment that works best for you.
Gradient is simpler to use because you have access to a standard filesystem for storage. With Colab, you need to use Google Drive for storage and, unlike Gradient, you don't have convenient access to the terminal for command-line interactions.
On the other hand, Colab gives you direct access to a wider set of libraries beyond those needed for fastaiā€”for example, you can run the Keras MNIST example in Colab but it won't work off the shelf in a Gradient fastai instance. To get the most out of the examples in the book, it's best to set up both environments so that you can choose which one works best for you as you go along. We'll start with Gradient, since it is the simplest to get started with.

Getting ready

Prior to setting up Gradient for fastai, you need to create a Paperspace account. You can do this by going to https://console.paperspace.com/signup?gradient=true.

How to do itā€¦

Once you have a Paperspace account, you can create a free fastai notebook in Gradient by following these steps to create a fastai notebook instance in Gradient. Once created, this will be a complete Jupyter Notebook environment with all the libraries that you need (including fastai, PyTorch, and related libraries).
  1. Go to the Paperspace site and sign in using the account you created in the Getting ready section.
  2. From the pulldown at the top of the page, select Gradient:
    Figure 1.1. ā€“ Selecting gradient from the pulldown
    Figure 1.1. ā€“ Selecting gradient from the pulldown
  3. Select the Notebooks tab:
    Figure 1.2 ā€“ Selecting the Notebooks tab
    Figure 1.2 ā€“ Select the Notebooks tab
  4. Select the CREATE button.
    Figure 1.3 ā€“ CREATE button
    Figure 1.3 ā€“ CREATE button
  5. Enter a name for your notebook in the Name field.
  6. In the Select a runtime section, select fastai.
  7. In the Select a machine section, select Free-GPU or Free-P5000. Note that you may receive a message indicating out of capacity for the machine type you selected. If this happens, you can either choose another GPU-enabled machine type or wait a few minutes and try again with your original machine type. Also note that after your notebook is created, you can change the machine typeā€”for example, if you find that the free instance is not meeting your needs, you can switch your notebook to a paid machine. You can also define multiple notebooks for different applications and configure auto-shutdown (how many hours your instance will run before shutting itself down) if you opt for a paid subscription. For details, see https://console.paperspace.com/teim6pi2i/upgrade.
  8. Select the START NOTEBOOK button to launch t...

Table of contents

  1. Deep Learning with fastai Cookbook
  2. Contributors
  3. Preface
  4. Chapter 1: Getting Started with fastai
  5. Chapter 2: Exploring and Cleaning Up Data with fastai
  6. Chapter 3: Training Models with Tabular Data
  7. Chapter 4: Training Models with Text Data
  8. Chapter 5: Training Recommender Systems
  9. Chapter 6: Training Models with Visual Data
  10. Chapter 7: Deployment and Model Maintenance
  11. Chapter 8: Extended fastai and Deployment Features
  12. Other Books You May Enjoy
Citation styles for Deep Learning with fastai Cookbook

APA 6 Citation

Ryan, M. (2021). Deep Learning with fastai Cookbook (1st ed.). Packt Publishing. Retrieved from https://www.perlego.com/book/2969544/deep-learning-with-fastai-cookbook-pdf (Original work published 2021)

Chicago Citation

Ryan, Mark. (2021) 2021. Deep Learning with Fastai Cookbook. 1st ed. Packt Publishing. https://www.perlego.com/book/2969544/deep-learning-with-fastai-cookbook-pdf.

Harvard Citation

Ryan, M. (2021) Deep Learning with fastai Cookbook. 1st edn. Packt Publishing. Available at: https://www.perlego.com/book/2969544/deep-learning-with-fastai-cookbook-pdf (Accessed: 15 October 2022).

MLA 7 Citation

Ryan, Mark. Deep Learning with Fastai Cookbook. 1st ed. Packt Publishing, 2021. Web. 15 Oct. 2022.