{"id":128,"date":"2019-05-10T03:16:54","date_gmt":"2019-05-10T01:16:54","guid":{"rendered":"https:\/\/www.codemotion.com\/magazine\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\/"},"modified":"2020-06-25T17:35:44","modified_gmt":"2020-06-25T15:35:44","slug":"quick-and-easy-deep-learning-for-nlp-with-fast-ai","status":"publish","type":"post","link":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/machine-learning\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\/","title":{"rendered":"Quick and easy deep learning for NLP with fastai"},"content":{"rendered":"<p><span class=\"firstcharacter\">N<\/span>owadays, <a href=\"https:\/\/en.wikipedia.org\/wiki\/NLP\" target=\"_blank\" rel=\"noopener noreferrer\">Natural Language Processing<\/a> (NLP) is one of the most important fields of <span id=\"urn:batch-analysis-8b518dcb-6151-4162-ab3a-c951eeb801e1\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/research\">research<\/span>. It has seen a phenomenal rise in interest in the last few years. The basics of NLP are widely known and easy to master, but things start to get complex when the text corpus becomes huge. That\u2019s where <a href=\"https:\/\/en.wikipedia.org\/wiki\/Deep_learning\" target=\"_blank\" rel=\"noopener noreferrer\">deep learning<\/a> comes in help. In the last decade, deep <span id=\"urn:batch-analysis-c5542594-85bb-4923-a962-966ea6c15ee9\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/learning\">learning<\/span> has proven its usefulness in computer vision tasks like image detection, classification and segmentation, but NLP applications, like text classification or machine translation, have long been considered fit for traditional <span id=\"urn:batch-analysis-e33d68ce-2a3f-4b70-abf2-476048c9c4c1\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/machine_learning\">machine learning<\/span> techniques only. That\u2019s not true anymore. And thanks to the amazing <strong>fastai library<\/strong>, you can quickly leverage all the most recent findings.<\/p>\n<h2>Deep Learning frameworks and NLP<\/h2>\n<p>Applying deep learning to text is relatively new, with the first amazing state-of-the-art results dating back to late 2017. and some breakthrough discoveries and new techniques have been introduced in 2018, marking <em>the ImageNet moment for NLP<\/em>, as defined by NLP researcher <a href=\"http:\/\/ruder.io\/\" target=\"_blank\" rel=\"noopener noreferrer\">Sebastian Ruder<\/a>. <span id=\"urn:batch-analysis-e4020eb1-83e5-41c6-a5ac-fef72f5cd7f0\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/research\">Research<\/span> is ongoing and very fast-paced, continuously producing new state-of-the-art results almost every month. The long reign of word vectors as NLP\u2019s core representation technique has seen an exciting new line of challengers emerge: <a href=\"https:\/\/ai.googleblog.com\/2017\/08\/transformer-novel-neural-network.html\" target=\"_blank\" rel=\"noopener noreferrer\">Transformer<\/a>, <a href=\"https:\/\/allennlp.org\/elmo\" target=\"_blank\" rel=\"noopener noreferrer\">ELMo<\/a>, <a href=\"https:\/\/arxiv.org\/abs\/1801.06146\" target=\"_blank\" rel=\"noopener noreferrer\">ULMFiT<\/a>, <a href=\"https:\/\/ai.googleblog.com\/2018\/11\/open-sourcing-bert-state-of-art-pre.html\" target=\"_blank\" rel=\"noopener noreferrer\">BERT<\/a> and <a href=\"https:\/\/ai.googleblog.com\/2019\/01\/transformer-xl-unleashing-potential-of.html\" target=\"_blank\" rel=\"noopener noreferrer\">Transformer-XL<\/a>. This is a very interesting moment in time to start exploring, studying and applying Machine <span id=\"urn:batch-analysis-1e20413b-d944-4a35-83d8-a01b8aefc651\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/learning\">Learning<\/span> to textual <span id=\"urn:batch-analysis-fbddf9c7-ed67-4c2d-abdb-694863b0bde7\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/data\">data<\/span>. No way to get bored.<\/p>\n<p>To design and train deep learning neural networks, you can choose between many frameworks, such as <a href=\"https:\/\/pytorch.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">PyTorch<\/a> or <a href=\"https:\/\/www.tensorflow.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">TensorFlow<\/a>, just to name the most famous. If you don\u2019t need to deal with low level details, there are higher level libraries, built on top of them, which provide building blocks to design and train custom neural networks quickly. As <a href=\"https:\/\/keras.io\/\" target=\"_blank\" rel=\"noopener noreferrer\">Keras<\/a> is for TensorFlow, there is the <strong>fastai library<\/strong> for PyTorch.<\/p>\n<p><q>The fastai library goal is to make the training of deep neural networks as easy as possible and, at the same time, make it fast and accurate, using modern <span id=\"urn:batch-analysis-abc5fefc-922a-4e50-a04a-f2ae83dea182\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/best_practice\">best practices<\/span>.<\/q><\/p>\n<p>It&#8217;s based on <span id=\"urn:batch-analysis-c797042a-f765-47f8-bc20-28461d431fe3\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/research\">research<\/span> into deep learning best practices undertaken at <a href=\"https:\/\/www.fast.ai\/\" target=\"_blank\" rel=\"noopener noreferrer\">fast.ai<\/a>, a San Francisco-based research institute founded and lead by <a href=\"https:\/\/www.fast.ai\/about\/#jeremy\" target=\"_blank\" rel=\"noopener noreferrer\">Jeremy Howard<\/a> and <a href=\"https:\/\/www.fast.ai\/about\/#rachel\" target=\"_blank\" rel=\"noopener noreferrer\">Rachel Thomas<\/a>.<\/p>\n<p>The library includes &#8220;out of the box&#8221; support for <strong>computer vision task<\/strong>, <strong>text and <span id=\"urn:batch-analysis-aba2ac39-6564-4036-a439-b6be236de69e\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/natural_language_processing\">natural language processing<\/span><\/strong>, <strong>tabular\/structured data classification or regression<\/strong> and <strong>collaborative filtering<\/strong> models, those at the core of modern recommendation engines.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-2474 size-full\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/fastai.png\" alt=\"\" \/><br \/>\n<em>What you can do with fastai library<\/em><\/p>\n<h2>NLP with fastai library<\/h2>\n<p><strong>The fastai library<\/strong> was the first library to make NLP <span id=\"urn:batch-analysis-11e23630-7a5f-4a36-863f-be77949354b3\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/deep_learning\">Deep Learning<\/span> easy to adopt, with state-of-the-art results back in early 2018, introducing <a href=\"https:\/\/arxiv.org\/abs\/1801.06146\" target=\"_blank\" rel=\"noopener noreferrer\">ULMFiT<\/a> (Universal Language Model Fine-tuning). It mixed various NLP deep learning techniques and <span id=\"urn:batch-analysis-ae518cef-482b-4023-a012-39b304a222f6\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/machine_learning\">machine learning<\/span> architectures derived from previous attempts and research papers, in a new, quite simple <span id=\"urn:enhancement-bd5e4f4a\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/end-to-end_principle\">end-to-end<\/span> pipeline, with two main purposes: to deal with NLP problems where there is not so much annotated <span id=\"urn:batch-analysis-94dd1f52-388d-402d-b8f3-7c511c0783da\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/data\">data<\/span> available and\/or big computational resources and to make NLP classification task easier.<\/p>\n<p>At the core, they have been able to successfully implement <strong>transfer learning and fine-tuning for textual <span id=\"urn:batch-analysis-2299e696-6a9d-4acb-8ba8-41876cf677a0\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/data\">data<\/span><\/strong>. Transfer learning is a <span id=\"urn:batch-analysis-2b52ac3b-8c76-4c8f-973c-c415e20d99cc\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/machine_learning\">machine learning<\/span> method where a model developed for a task is reused as the starting point for a model on a second task. Until a few years ago, it has been, and still is, a popular approach to deep <span id=\"urn:batch-analysis-758881b9-504e-4a5b-84be-288cab1f205c\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/learning\">learning<\/span> for computer vision tasks, where pre-trained models, such as ImageNet or Microsoft COCO, are used as the starting point, given the vast compute and time resources required to develop neural network models on these problems and from the huge jumps in skill and accuracy that they provide on related, more domain-specific problems. One common way to do this is by <em>fine-tuning<\/em> the original model. Because the fine-tuned model doesn\u2019t have to learn from scratch, it can generally reach higher accuracy with much less <span id=\"urn:batch-analysis-bad6e252-dbf5-4bf6-a41e-74ab77b6d175\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/data\">data<\/span> and computation time than models that don\u2019t use transfer learning. Until then, the problem to apply this technique to textual <span id=\"urn:batch-analysis-67fac7ef-cfd4-4b9b-a00c-0e5a1ccb77d8\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/data\">data<\/span> was that there was a lack of <span id=\"urn:batch-analysis-0a4b0c04-c54b-4788-8232-3cf94df19918\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/knowledge\">knowledge<\/span> of <em>how to train pre-trained models effectively<\/em> and this has been hindering wider adoption. This idea has been tried before, but required millions of <span id=\"urn:batch-analysis-6db75c67-32ec-4302-bb12-20bcbde1a21e\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/document\">documents<\/span> for adequate <span id=\"urn:batch-analysis-937fa101-ad5a-4af3-ad6c-28b1153199fe\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/performance\">performance<\/span>. fast.ai researchers applied a variant of <a href=\"https:\/\/arxiv.org\/pdf\/1708.02182.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">Stephen Merity\u2019s Language Model<\/a> (Salesforce Research), combined with other training and regularisation strategies, obtaining practical transfer learning for text applications.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-2474 size-full\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/TransferLearning.png\" alt=\"\" \/><br \/>\n<em>Transfer learning<\/em><\/p>\n<p>In general, a language model is an NLP model which learns to <em>predict the next word in a sentence<\/em>. It seems a trivial task, but this is very important, because for a language model to be good at guessing what someone says next, it needs a lot of <em>world knowledge<\/em> and a deep understanding of grammar, semantics and other elements of natural language. This is exactly the kind of <span id=\"urn:batch-analysis-b368584a-b784-4e4d-a873-3550c83cd399\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/knowledge\">knowledge<\/span> that we, as <span id=\"urn:batch-analysis-762d29ab-8c20-4e19-bd21-8e439ac904d1\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/human\">humans<\/span>, leverage implicitly when we read and classify a <span id=\"urn:batch-analysis-496966b4-d023-49fe-aedd-95048317fe8e\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/document\">document<\/span>. Once a language model is trained on a very big text corpus, for example <span id=\"urn:batch-analysis-1d59d79a-7995-42a3-a27a-d1a9b1e17b7a\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/wikipedia\">Wikipedia<\/span> (as done by the fast.ai <span id=\"urn:batch-analysis-8149cd53-9d26-486d-b6b7-1a3fe071ec0f\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/team\">team<\/span>, making it available for everyone to use), we can then adapt it to perform other tasks, such as classifying a <span id=\"urn:batch-analysis-ad8baf93-b5e6-4466-bde8-a185aa63f1ab\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/document\">document<\/span>, or estimating the sentiment of a phrase.<\/p>\n<p>As previously stated, the <strong>fastai library<\/strong> provides some high-level <span id=\"urn:enhancement-f8a4f922\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/application_programming_interface\">APIs<\/span> and objects to quickly and easily train models on your own <span id=\"urn:enhancement-da0e6e70\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/data_set\">datasets<\/span>, quite similar for each supported data type (images, text, tabular <span id=\"urn:batch-analysis-0d729a0d-1c30-4d62-941d-c99737299402\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/data\">data<\/span> or collaborative filters).<\/p>\n<p>Without entering in the details, for example, these few lines of code taken from the <strong>fastai library<\/strong> documentation let you train a text classifier (sentiment predictor) in few minutes, with a good level of accuracy, even if your <span id=\"urn:enhancement-663d1f90\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/data_set\">dataset<\/span> is not so big, thanks to transfer <span id=\"urn:batch-analysis-ea1338fe-2c75-4b73-8660-5f6706f27c51\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/learning\">learning<\/span> and the pre-trained English model based on <span id=\"urn:batch-analysis-32293a55-5d7a-4975-a7ac-1f0973eef067\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/wikipedia\">Wikipedia<\/span>.<\/p>\n<p><script src=\"https:\/\/pastebin.com\/embed_js\/VTJUumTh\"><\/script><\/p>\n<p>In addition, to provide all the best practice and techniques for deep learning NLP, the library provides text pre-processing modules for ingesting text in neural networks, such as <a href=\"https:\/\/nlp.stanford.edu\/IR-book\/html\/htmledition\/tokenization-1.html\" target=\"_blank\" rel=\"noopener noreferrer\">tokenisation<\/a> (based on the amazing <a href=\"https:\/\/spacy.io\/\" target=\"_blank\" rel=\"noopener noreferrer\">spaCy<\/a> library, but still totally customisable, if needed) and <strong>numericalisation<\/strong> \u2013 mapping words to unique ids. So, you only need to prepare your text <span id=\"urn:enhancement-df7c5534\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/data_set\">datasets<\/span> according to the task you want to perform, load them in a DataBunch and train your model. That\u2019s all!<\/p>\n<h2>Additional Resources<\/h2>\n<p>To get started with the <strong>fastai library<\/strong>, the most useful resource is its <a href=\"https:\/\/docs.fast.ai\/\" target=\"_blank\" rel=\"noopener noreferrer\">documentation<\/a>.<\/p>\n<p>For an in-depth general introduction to deep <span id=\"urn:batch-analysis-d36f6e97-eca2-453e-b76a-1cd68d9faf6a\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/learning\">learning<\/span>, you can follow the official fast.ai free MOOCs: they are amazing <em>practical<\/em> courses for <span id=\"urn:enhancement-8920185\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/programmer\">coders<\/span>, taught in a \u201ctop-down\u201d approach: Jeremy Howard starts from hands-on real-world examples, and then explores the theory behind each technique, developing some of the most recent research papers with PyTorch from scratch.<\/p>\n<ul>\n<li><a href=\"https:\/\/course.fast.ai\/\" target=\"_blank\" rel=\"noopener noreferrer\">Practical Deep Learning for Coders<\/a><\/li>\n<li><a href=\"http:\/\/course18.fast.ai\/part2.html\" target=\"_blank\" rel=\"noopener noreferrer\">Cutting Edge Deep Learning for Coders<\/a><\/li>\n<li><a href=\"http:\/\/course18.fast.ai\/ml\" target=\"_blank\" rel=\"noopener noreferrer\">Introduction to Machine Learning for Coders<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/fastai\/numerical-linear-algebra\/blob\/master\/README.md\" target=\"_blank\" rel=\"noopener noreferrer\">Computational Linear Algebra<\/a><\/li>\n<\/ul>\n<p>Instead, if you wish to know more about NLP deep learning processing with fastai, with examples and code to bring your models to production, or how to train your own language models, here you can find my new <a href=\"https:\/\/www.pluralsight.com\/courses\/getting-started-nlp-deep-learning-pytorch-fastai\" target=\"_blank\" rel=\"noopener noreferrer\">Pluralsight course<\/a> on the topic.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nowadays, Natural Language Processing (NLP) is one of the most important fields of research. It has seen a phenomenal rise in interest in the last few years. The basics of NLP are widely known and easy to master, but things start to get complex when the text corpus becomes huge. That\u2019s where deep learning comes&#8230; <a class=\"more-link\" href=\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/machine-learning\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\/\">Read more<\/a><\/p>\n","protected":false},"author":22,"featured_media":129,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","_uag_custom_page_level_css":"","_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[35],"tags":[],"collections":[],"class_list":{"0":"post-128","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-machine-learning","8":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Quick and easy deep learning for NLP with fastai - Codemotion Magazine<\/title>\n<meta name=\"description\" content=\"Codemotion and Facebook organized the Tech Leadership Training boot camp, heres a personal reportage from one of our attendees.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/machine-learning\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Quick and easy deep learning for NLP with fastai\" \/>\n<meta property=\"og:description\" content=\"Codemotion and Facebook organized the Tech Leadership Training boot camp, heres a personal reportage from one of our attendees.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/machine-learning\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\/\" \/>\n<meta property=\"og:site_name\" content=\"Codemotion Magazine\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Codemotion.Italy\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-05-10T01:16:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-06-25T15:35:44+00:00\" \/>\n<meta name=\"author\" content=\"Gianni Rosa Gallina\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/header.jpg\" \/>\n<meta name=\"twitter:creator\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:site\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Gianni Rosa Gallina\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/machine-learning\\\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/machine-learning\\\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\\\/\"},\"author\":{\"name\":\"Gianni Rosa Gallina\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/person\\\/33ed0e38801d0cd49b022620096944b3\"},\"headline\":\"Quick and easy deep learning for NLP with fastai\",\"datePublished\":\"2019-05-10T01:16:54+00:00\",\"dateModified\":\"2020-06-25T15:35:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/machine-learning\\\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\\\/\"},\"wordCount\":1166,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/machine-learning\\\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/header.jpg\",\"articleSection\":[\"Machine Learning\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/machine-learning\\\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\\\/\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/machine-learning\\\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\\\/\",\"name\":\"Quick and easy deep learning for NLP with fastai - Codemotion Magazine\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/machine-learning\\\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/machine-learning\\\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/header.jpg\",\"datePublished\":\"2019-05-10T01:16:54+00:00\",\"dateModified\":\"2020-06-25T15:35:44+00:00\",\"description\":\"Codemotion and Facebook organized the Tech Leadership Training boot camp, heres a personal reportage from one of our attendees.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/machine-learning\\\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/machine-learning\\\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/machine-learning\\\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/header.jpg\",\"contentUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/header.jpg\",\"width\":1013,\"height\":675},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/machine-learning\\\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AI\\\/ML\",\"item\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Machine Learning\",\"item\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/machine-learning\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Quick and easy deep learning for NLP with fastai\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#website\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/\",\"name\":\"Codemotion Magazine\",\"description\":\"We code the future. Together\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#organization\",\"name\":\"Codemotion\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/codemotionlogo.png\",\"contentUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/codemotionlogo.png\",\"width\":225,\"height\":225,\"caption\":\"Codemotion\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/Codemotion.Italy\\\/\",\"https:\\\/\\\/x.com\\\/CodemotionIT\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/person\\\/33ed0e38801d0cd49b022620096944b3\",\"name\":\"Gianni Rosa Gallina\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/71052ae4a5cf8280a9fbaa94b74ce8db20e94d15b866962a23aac8aeb2d5e615?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/71052ae4a5cf8280a9fbaa94b74ce8db20e94d15b866962a23aac8aeb2d5e615?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/71052ae4a5cf8280a9fbaa94b74ce8db20e94d15b866962a23aac8aeb2d5e615?s=96&d=mm&r=g\",\"caption\":\"Gianni Rosa Gallina\"},\"description\":\"Gianni is a Microsoft Windows Development MVP since 2011, focused on emerging technologies, AI and Virtual\\\/Augmented\\\/Mixed realities since 2013. Currently he is involved in Deltatre Innovation Lab, designing and prototyping solutions for next generation sport experiences and business services. Beyond that, he's active member of a local tech user group (TTG) and online trainer for Pluralsight.\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/author\\\/gianni-rosa-gallina\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Quick and easy deep learning for NLP with fastai - Codemotion Magazine","description":"Codemotion and Facebook organized the Tech Leadership Training boot camp, heres a personal reportage from one of our attendees.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/machine-learning\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\/","og_locale":"en_US","og_type":"article","og_title":"Quick and easy deep learning for NLP with fastai","og_description":"Codemotion and Facebook organized the Tech Leadership Training boot camp, heres a personal reportage from one of our attendees.","og_url":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/machine-learning\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\/","og_site_name":"Codemotion Magazine","article_publisher":"https:\/\/www.facebook.com\/Codemotion.Italy\/","article_published_time":"2019-05-10T01:16:54+00:00","article_modified_time":"2020-06-25T15:35:44+00:00","author":"Gianni Rosa Gallina","twitter_card":"summary_large_image","twitter_image":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/header.jpg","twitter_creator":"@CodemotionIT","twitter_site":"@CodemotionIT","twitter_misc":{"Written by":"Gianni Rosa Gallina","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/machine-learning\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\/#article","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/machine-learning\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\/"},"author":{"name":"Gianni Rosa Gallina","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/33ed0e38801d0cd49b022620096944b3"},"headline":"Quick and easy deep learning for NLP with fastai","datePublished":"2019-05-10T01:16:54+00:00","dateModified":"2020-06-25T15:35:44+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/machine-learning\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\/"},"wordCount":1166,"publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/machine-learning\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/header.jpg","articleSection":["Machine Learning"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/machine-learning\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\/","url":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/machine-learning\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\/","name":"Quick and easy deep learning for NLP with fastai - Codemotion Magazine","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/machine-learning\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\/#primaryimage"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/machine-learning\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/header.jpg","datePublished":"2019-05-10T01:16:54+00:00","dateModified":"2020-06-25T15:35:44+00:00","description":"Codemotion and Facebook organized the Tech Leadership Training boot camp, heres a personal reportage from one of our attendees.","breadcrumb":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/machine-learning\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codemotion.com\/magazine\/ai-ml\/machine-learning\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/machine-learning\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\/#primaryimage","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/header.jpg","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/header.jpg","width":1013,"height":675},{"@type":"BreadcrumbList","@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/machine-learning\/quick-and-easy-deep-learning-for-nlp-with-fast-ai\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codemotion.com\/magazine\/"},{"@type":"ListItem","position":2,"name":"AI\/ML","item":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/"},{"@type":"ListItem","position":3,"name":"Machine Learning","item":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/machine-learning\/"},{"@type":"ListItem","position":4,"name":"Quick and easy deep learning for NLP with fastai"}]},{"@type":"WebSite","@id":"https:\/\/www.codemotion.com\/magazine\/#website","url":"https:\/\/www.codemotion.com\/magazine\/","name":"Codemotion Magazine","description":"We code the future. Together","publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codemotion.com\/magazine\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codemotion.com\/magazine\/#organization","name":"Codemotion","url":"https:\/\/www.codemotion.com\/magazine\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","width":225,"height":225,"caption":"Codemotion"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Codemotion.Italy\/","https:\/\/x.com\/CodemotionIT"]},{"@type":"Person","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/33ed0e38801d0cd49b022620096944b3","name":"Gianni Rosa Gallina","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/71052ae4a5cf8280a9fbaa94b74ce8db20e94d15b866962a23aac8aeb2d5e615?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/71052ae4a5cf8280a9fbaa94b74ce8db20e94d15b866962a23aac8aeb2d5e615?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/71052ae4a5cf8280a9fbaa94b74ce8db20e94d15b866962a23aac8aeb2d5e615?s=96&d=mm&r=g","caption":"Gianni Rosa Gallina"},"description":"Gianni is a Microsoft Windows Development MVP since 2011, focused on emerging technologies, AI and Virtual\/Augmented\/Mixed realities since 2013. Currently he is involved in Deltatre Innovation Lab, designing and prototyping solutions for next generation sport experiences and business services. Beyond that, he's active member of a local tech user group (TTG) and online trainer for Pluralsight.","url":"https:\/\/www.codemotion.com\/magazine\/author\/gianni-rosa-gallina\/"}]}},"featured_image_src":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/header-600x400.jpg","featured_image_src_square":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/header-600x600.jpg","author_info":{"display_name":"Gianni Rosa Gallina","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/gianni-rosa-gallina\/"},"uagb_featured_image_src":{"full":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/header.jpg",1013,675,false],"thumbnail":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/header-150x150.jpg",150,150,true],"medium":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/header-300x200.jpg",300,200,true],"medium_large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/header-768x512.jpg",768,512,true],"large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/header.jpg",1013,675,false],"1536x1536":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/header.jpg",1013,675,false],"2048x2048":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/header.jpg",1013,675,false],"small-home-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/header.jpg",100,67,false],"sidebar-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/header-180x128.jpg",180,128,true],"genesis-singular-images":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/header-896x504.jpg",896,504,true],"archive-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/header-400x225.jpg",400,225,true],"gb-block-post-grid-landscape":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/header-600x400.jpg",600,400,true],"gb-block-post-grid-square":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/05\/header-600x600.jpg",600,600,true]},"uagb_author_info":{"display_name":"Gianni Rosa Gallina","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/gianni-rosa-gallina\/"},"uagb_comment_info":0,"uagb_excerpt":"Nowadays, Natural Language Processing (NLP) is one of the most important fields of research. It has seen a phenomenal rise in interest in the last few years. The basics of NLP are widely known and easy to master, but things start to get complex when the text corpus becomes huge. That\u2019s where deep learning comes&#8230;&hellip;","lang":"en","_links":{"self":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/comments?post=128"}],"version-history":[{"count":5,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/128\/revisions"}],"predecessor-version":[{"id":6082,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/128\/revisions\/6082"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media\/129"}],"wp:attachment":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media?parent=128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/categories?post=128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/tags?post=128"},{"taxonomy":"collections","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/collections?post=128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}