<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Wayde Gilliam on Medium]]></title>
        <description><![CDATA[Stories by Wayde Gilliam on Medium]]></description>
        <link>https://medium.com/@wgilliam?source=rss-c657a07d0514------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*kKxW3TgF1PXrtaRV.</url>
            <title>Stories by Wayde Gilliam on Medium</title>
            <link>https://medium.com/@wgilliam?source=rss-c657a07d0514------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 14:37:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@wgilliam/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Finding Data Block Nirvana (a journey through the fastai data block API) — Part 2]]></title>
            <link>https://medium.com/analytics-vidhya/finding-data-block-nirvana-a-journey-through-the-fastai-data-block-api-part-2-9b23ea5d83ee?source=rss-c657a07d0514------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b23ea5d83ee</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[fastai]]></category>
            <category><![CDATA[data-block-api]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Wayde Gilliam]]></dc:creator>
            <pubDate>Thu, 31 Oct 2019 19:22:29 GMT</pubDate>
            <atom:updated>2019-11-05T09:22:38.071Z</atom:updated>
            <content:encoded><![CDATA[<h3>Finding Data Block Nirvana (a journey through the fastai data block API) — Part 2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*XkSANUIJi-WY-smq0LvvGA.jpeg" /></figure><p>This article describes how to train the custom fast.ai ItemList (and other custom DataBlock API bits) we built in <a href="https://blog.usejournal.com/finding-data-block-nirvana-a-journey-through-the-fastai-data-block-api-c38210537fe4">part 1 of this series</a>. If you haven’t done so already, make sure you read the first it and can run the companion code located <a href="https://localhost:8889/tree/medium-finding-data-block-nirvana">here</a> in the yelp-00 notebook.</p><p><strong>The code for part 2 is </strong><a href="https://github.com/ohmeow/dl-experiments/tree/master/medium-finding-data-block-nirvana"><strong>here</strong></a><strong> (see the yelp-01 notebook).</strong></p><p>What I said here in the first article bears repeating:</p><blockquote>I am a firm believer that <em>one will learn more about using this framework by first reading and running the associated code, and then coding it themselves by hand (no copy&amp;paste), than by any other means</em>. This doesn’t mean reading the docs, highlighting and underlining important concepts isn’t important (believe me I do more than my fair share of this), only that for it to take a solid hold in your brain you have to <strong>do it</strong>. So get the code, run the code, and love the code. Utilizing it and the contents of this article, make it your goal to demonstrate individual understanding by coding everything up yourself.</blockquote><p>With that said, let me highlight some of the more interesting parts of the part 2 code.</p><h3>Keep things DRY</h3><p>I moved all the DataBlock API related code in the utils.py file which I then import all from at the top of the notebook. Since I’m likely to want to reuse this code elsewhere, it’s good to remember one of the golden maxims of programming: <strong>D</strong>on’t <strong>R</strong>epeat <strong>Y</strong>ourself.</p><h3>Fixes to the DataBlock API bits</h3><p>When I first attempted training my model I noticed that the tensors weren’t quite being grouped right in the mixed_tabular_pad_collate function. I fixed that in both the part 1 notebook and utils.py file, <em>but</em> I also left the old, wrong code, in the part 1 file so you can review what the output should, and should not, look like. <strong>I recommend</strong> you run the yelp-00-custom-itemlist notebook with both the corrected version or previous version to see the difference yourself.</p><h3>Fine-tuning the LM</h3><p>Since we are working with text, I figured it made sense to actually fine-tune the AWD LSTM based <a href="https://arxiv.org/abs/1801.06146">ULMFit model</a> using the target text available in our dataset. See the <strong>LM Fine-tuning</strong> section of the notebook. I illustrate the basic steps required to do this, and I’m sure its one of the many places where improvements can be made.</p><h3>Building the MixedTabular DataBunch</h3><p>Remember all that code we wrote in part 1? Well, all that hard work has made it as simple as this to actually use it in our modeling task at hand.</p><pre>data_cls = (MixedTabularList.from_df(<br>                            train_df, cat_cols, cont_cols, txt_cols,<br>                            vocab=data_lm.train_ds.vocab, <br>                            procs=procs, path=PATH)<br>          .split_by_rand_pct(valid_pct=0.1, seed=42)<br>          .label_from_df(dep_var)<br>          .databunch(bs=32))</pre><p>This should look very familiar to anyone using the fast.ai framework. Notice how we are using the vocab from our fine-tuned language model above.</p><h3>TabularTextNN</h3><p>How do we use this <a href="https://docs.fast.ai/basic_data.html#DataBunch">DataBunch</a>? We’ll, I’m sure there are better ways than the one I present here, but I was able to get decent results from merely utilizing the models created from tabular_learner and text_classifier_learner fast.ai Learners. I definitely believe the approach is at least novel (at least I haven’t seen this anywhere) and can likely be improved upon.</p><p>As for the configuration required by both learners above, I decided to use a simply dictionary to make experimentation simple. See the respective tabular_args and text_args variables declared just above the definition of the TabularTextNN module.</p><p>The module’s init is where all the interesting things are:</p><pre>def __init__(self, data, tab_layers, tab_args={}, text_args={}):<br>        super().__init__()<br>        <br>        tab_learner = tabular_learner(data, tab_layers, **tab_args)<br>        tab_learner.model.layers = tab_learner.model.layers[:-1]<br>        self.tabular_model = tab_learner.model</pre><pre>        text_class_learner = text_classifier_learner(data, AWD_LSTM, <br>                                                     **text_args)<br>        text_class_learner.load_encoder(&#39;lm_ft_enc&#39;)<br>        self.text_enc_model = /         <br>                        list(text_class_learner.model.children())[0]<br>        <br>        self.bn_concat = nn.BatchNorm1d(400*3+100)<br>        <br>        self.lin = nn.Linear(400*3+100, 50)<br>        self.final_lin = nn.Linear(50, data.c)</pre><p>If you look at the model returned by the tabular leaner here, you’ll see that the last layer is a linear that outputs the number of expected label the model needs to predict. As we’re going to be merging the outputs of this model with the text outputs before getting the probabilities for our labels, we just chop it off by setting the model layers equal to tabular_learner.model.layers[:-1].</p><p>Similarly, we only need the text classification learner’s encoder for our purposes here, and so we remove the PoolingClassifier from it via list(text_class_learner.model.children())[0]. <em>Learning how to manipulate the PyTorch models as I have here is extremely helpful to understand and I’ve included a few resources below that were instructive for me.</em></p><p>The final step in our forward() function is to concatenate the results from both models, run them through a batch normalization layer and a couple of linear layers to get our predicted values. Notice how I also employ the concat pooling trick used in fast.ai to take advantage of <em>all</em> the information returned by the text encoder.</p><h3>Training</h3><p>Guess what? You train this just like any other fast.ai model. That means there really isn’t anything new to learn here. You can just stick this model in a learner as such:</p><pre>model = TabularTextNN(data_cls, tab_layers, tabular_args, text_args)<br>learn = Learner(data_cls, model, metrics=[accuracy])</pre><p>Nice, huh?</p><h3>Next Steps</h3><p>Can you beat my best accuracy of .673?</p><p>I’m happy to accept any and all pull requests with your own notebooks that utilize the MixedTabular ItemList to improve upon my results (and they can surely be improved upon). Maybe some of you would like to submit a notebook with some EDA work? Or maybe a notebook that demonstrates a solid approach in determining what features should, and shouldn’t, be included based on feature importance? Or maybe someone can illustrate something helpful in the way of feature engineering and/or data augmentation that helps to improve upon my results?</p><p>Either way, <strong>I’d love to see some work from the community that have benefited from these articles</strong> … work that can in turn benefit myself and everyone else. That’s my challenge to you.</p><p>As always, I hope the two articles benefit you in your work and feel free to follow me on twitter either way at <a href="https://twitter.com/waydegilliam">@wgilliam </a>. Over the next couple of months I’ll be publishing a series of articles showing you how to do all this with the upcoming version 2 of the fast.ai framework, so stay tuned.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*QsTDODtzrfENg9qJ6DY0qQ.jpeg" /></figure><h3>Resources</h3><p><strong>DataBlock API</strong><br><a href="https://docs.fast.ai/data_block.html">The fast.ai documentation</a><br><a href="https://blog.usejournal.com/finding-data-block-nirvana-a-journey-through-the-fastai-data-block-api-c38210537fe4">Finding DataBlock Nirvana — Part 1</a></p><p><strong>Modifying PyTorch models</strong><br><a href="https://discuss.pytorch.org/t/how-to-delete-layer-in-pretrained-model/17648">How to delete layer in pretrained model?</a><br><a href="https://discuss.pytorch.org/t/how-to-replace-last-layer-in-sequential/14422">How to replace last layer in Sequential</a><br><a href="https://stackoverflow.com/questions/52548174/how-to-remove-the-last-fc-layer-from-a-resnet-model-in-pytorch">This stackoverflow articles has some good info</a><br><a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module.add_module">See the add_module method in the official docs</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b23ea5d83ee" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/finding-data-block-nirvana-a-journey-through-the-fastai-data-block-api-part-2-9b23ea5d83ee">Finding Data Block Nirvana (a journey through the fastai data block API) — Part 2</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Finding Data Block Nirvana (a journey through the fastai data block API)]]></title>
            <link>https://medium.com/@wgilliam/finding-data-block-nirvana-a-journey-through-the-fastai-data-block-api-c38210537fe4?source=rss-c657a07d0514------2</link>
            <guid isPermaLink="false">https://medium.com/p/c38210537fe4</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[data-block-api]]></category>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[fastai]]></category>
            <dc:creator><![CDATA[Wayde Gilliam]]></dc:creator>
            <pubDate>Tue, 15 Jan 2019 02:32:41 GMT</pubDate>
            <atom:updated>2019-11-03T18:55:01.331Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*c8FvOS8Gyvkf-cvgofTEaw.jpeg" /></figure><p>If you’re using the fastai library to train your PyTorch models, you’re using the data block API whether you realize it or not.</p><p>The API is pretty straightforward insofar as to how the basics work, but as you start getting deeper into the docs and into what is happening at each point, it gets a little confusing on how all the pieces fit together (at least it was for me). There are a number of classes that play a part in the API and different things that are happening at each step, things like pre-processing, data augmentation, splitting of data, etc….</p><p><strong><em>How is one to really understand what these classes are and what is happening (and why) at each step?</em></strong></p><p>May I suggest what worked for me … building your own custom ItemBase and ItemList subclasses following the <a href="https://docs.fast.ai/tutorial.itemlist.html">Custom ItemList tutorial</a> in the fastai docs. This is what I’m calling the pathway towards data block nirvana, and it is this approach I have tried to demonstrate in code (available from <a href="https://github.com/ohmeow/dl-experiments/tree/master/medium-finding-data-block-nirvana">this GitHub repository</a>) and from which I highlight lessons learned in the article before you.</p><p><strong>NOTE</strong>: I am a firm believer that <em>one will learn more about using this framework by first reading and running the associated code, and then coding it themselves by hand (no copy&amp;paste), than by any other means</em>. This doesn’t mean reading the docs, highlighting and underlining important concepts isn’t important (believe me I do more than my fair share of this), only that for it to take a solid hold in your brain you have to <strong>do it</strong>. So get the code, run the code, and love the code. Utilizing it and the contents of this article, make it your goal to demonstrate individual understanding by coding everything up yourself.</p><p><strong><em>UPDATE: </em></strong><a href="https://medium.com/@wgilliam/finding-data-block-nirvana-a-journey-through-the-fastai-data-block-api-part-2-9b23ea5d83ee"><strong><em>Part 2 in now available</em></strong></a><strong><em>. See the yelp-01-custom-itemlist notebook </em></strong><a href="https://github.com/ohmeow/dl-experiments/tree/master/medium-finding-data-block-nirvana"><strong><em>here</em></strong></a><strong><em>.</em></strong></p><h3>The API from 50,000 feet</h3><h4>What is the data block API?</h4><p>The fastai data block API defines a chainable mechanism for transforming raw data (e.g., in image files, .csv files, pandas DataFrames, etc…) into the requisite PyTorch Datasets and Dataloaders that are fed into the forwardfunction of your nn.Module subclass. In less than 10 lines of code, you can define everything you need to split your data into training, validation, and optionally test datasets, apply transforms, and package their respective dataloaders into something called a DataBunch for training. The API also provides a way to save your transformations and pre-processing for use against future datasets/dataloaders you later want to use at inference time.</p><h4>How does the data block API work?</h4><p>Here’s an example of how it works from the core <a href="https://docs.fast.ai/data_block.html">documentation</a>:</p><pre>data = (ImageItemList.from_folder(path)<br>                     .split_by_folder()<br>                     .label_from_folder()<br>                     .add_test_folder()<br>                     .transform(tfms, size=64)<br>                     .databunch())</pre><p>Essentially the process is this:</p><ol><li><strong>Define the source of your inputs</strong> (that is your X values) using an ItemList subclass pertinent to your data. This can be just about anything you have (e.g., a .csv, a pandas DataFrame, a text file, images, etc…). There are several built-in ItemList subclasses that you can use out of the box for image, tabular, collaborative, and text based data. You can also build your own as we will do here by subclassing one of these built-in ItemList classes or the ItemList class itself.</li><li><strong>Define how you want to split your inputs into training and validation datasets </strong>using one of the built-in mechanisms for doing so.</li><li><strong>Define the source of your targets (that is your y values) and combine them with the inputs of your training and validation datasets in the form of fastai </strong><strong>LabelList objects.</strong> LabelList subclasses the PyTorch Dataset class.</li><li><strong>Add a test dataset</strong> (optional).</li><li><strong>Add transforms to your </strong><strong>LabelList objects</strong> (optional). Here you can apply data augmentation to either, or both, your inputs and targets.</li><li><strong>Build PyTorch DataLoaders from the Datasets defined above and package them up into a fastai </strong><strong>DataBunch</strong>.</li></ol><p>Once this is done, you’ll have everything you need to train, validate, and test any PyTorch nn.Module using the fastai library. You’ll also have everything you need to later do inference on future data.</p><h3>The API from 1,000 feet</h3><h4>What are all these classes and what is happening, and why, at each step in the API described above?</h4><p>The docs are a bit confusing in describing some of these elements so let me break down my understanding of what is what after several reads, multiple code reviews, and finishing off my own custom `ItemList` implementation.</p><h4>ItemBase:</h4><p>The ItemBase class defines what an “item” in your inputs or your targets looks like. For example, our code example includes a custom <em>input</em> ItemBase subclass whereby an item is defined as consisting of both tabular (continuous and categorical data) and numericalized text tokens. If we were doing a classification problem, our <em>target</em> items would be defined as a Category ItemBase subclass (see its definition <a href="https://github.com/fastai/fastai/blob/master/fastai/core.py#L253">here</a>).</p><p>The point to remember here is that your input (your x’s) and your target (your y’s) are both item’s as defined by separateItemBase subclasses.</p><h4>ItemList:</h4><p>An ItemList defines a collections of “items” (e.g., ItemBase objects) including how they are individually fetched and displayed. Separate ItemList classes are used to define your inputs (your X values) and also your targets (your y values). You’ll find a number of built-in ItemList subclasses for each in the library that can likely be used as is in most cases.</p><p>The ItemList class also functions as a prototype for building separate ItemList instances for your training, validation, and optionally test datasets. In a sense, when you create an ItemList you are also creating a template for creating training, validation, and optionally test ItemList instances from it. For example, the “split” function below will return a separate ItemList instance for both your training and validation sets in an ItemList<strong>s</strong> object.</p><pre>ImageItemList.from_folder(path)<br>             .split_by_folder()</pre><h4>ItemLists:</h4><p>A collection of ItemList instances for your inputs or targets.</p><h4>LabelList:</h4><p>A LabelList is a PyTorch Dataset that combines your input and target ItemList classes (an inputs ItemList + a targets ItemList = a LabelList). You’ll get a LabelList instance for each of your training and validation ItemList instances returned in a LabelList<strong>s</strong> object when your “label” function runs against your ItemLists object.</p><p>For example:</p><pre>ImageItemList.from_folder(path)<br>             .split_by_folder()<br>             .label_from_folder()</pre><p>At the end of split_by_folder you have an ItemLists object that contains two ItemList objects (one for representing your training items and another your validation). When you call label_from_folder on that ItemLists object, it will build the necessary ItemList instances <em>for your targets</em> and combine them with <em>the input </em>ItemList instances to form LabelList instances for each of your training and validation datasets. These LabelList objects are packaged into and returned in the form of a LabelLists object.</p><p>You can specify what ItemList subclass to use for your targets via the label_cls argument. If you don’t, it will infer what type to use based on your target values.</p><p><strong>Pre-Processing:<br></strong>This is also where any PreProcessor classes you’ve passed into your ItemList class run. These classes define things you want done to your data once before they are turned into PyTorch Datasets/DataLoaders. Examples include things like tokenizing and numericalizing text, filling in missing values in tabular, etc….</p><p><strong><em>Why do we do pre-processing here?<br></em></strong>Because you want whatever pre-processing is required to be defined by your training set and then applied to your validation set, and it is here where your first have both. For example, in the case of pre-processing text data, we want the vocabulary learned in numericalizing the training dataset to be merely used in numericalizing the validation (and optionally test) datasets.</p><p>You can define a default PreProcessor or collection of PreProcessors you want ran by overloading the _processor class variable in your custom ItemList.</p><h4>LabelLists:</h4><p>A collection of LabelList instances you get as a result of your “labeling” function. Again, a LabelList` <strong><em>is</em></strong> a PyTorch Dataset and essentially defines the things, your inputs and optionally targets, fed into the forward function of your model.</p><h4>Transforms:</h4><p>Transforms define data augmentation you want done to either, or both, of your inputs and targets datasets.</p><p><strong><em>How are transforms different from pre-processors?<br></em></strong>Whereas pre-processors are ran only once, transforms are applied on the fly each time we grab an item from our LabelList. What transforms are applied will vary from one call to get an item to the next.</p><h4>DataBunch:</h4><p>A DataBunch is a collection of PyTorch DataLoaders returned when you call the databunch function. It also defines how they are created from your training, validation, and optionally test LabelList instances.</p><h3>So in summary:</h3><ul><li>You will define a separate ItemList for both your inputs and your targets.</li><li>An ItemLists object represents a collection of ItemList objects (you’ll have an ItemList instance for each of your datasets … training, validation, and optionally test).</li><li>A LabelList merges your inputs ItemList instances with your target ItemList instances. LabelList subclasses PyTorch’s Dataset to provide the inputs and optionally targets that are passed into the forward function of your nn.Module subclass.</li><li>A LabelLists object represents a collection of LabelList objects (you’ll have a LabelList instance for your training and validation datasets after your label function runs).</li><li>Any pre-processing happens during the processing of building the LabelLists object. Pre-processing is defined by your training dataset and applied to your validation dataset. If you add a test set, like we do above, the same pre-processing applied to your validation set will be applied to your test.</li><li>Transforms are applied to your inputs and/or targets after you have your final set of LabelLists (which may now include a LabelList for your test dataset if one was added like above).</li><li>The final step in the API is the building of your DataBunch, and object that both defines how PyTorch DataLoaders are created from your LabelList objects (i.e., your PyTorch Datasets) and makes them available for training.</li></ul><p>Again, grab and run the code, keeping this article handy as you work through it. The accompanying notebook is heavily annotated as I code and test the bits line-by-line (the data block API is chainable but its often easier to debug and develop by implementing it line-by-line as I do). Remember that pdb.set_trace is your friend and to print out the shape of things and contents of other things as needed to increase your own understanding of this beautiful API.</p><h4>Resources to reference on your journey to enlightenment</h4><ul><li><a href="https://docs.fast.ai/">fastai docs</a></li><li><a href="https://docs.fast.ai/tutorial.itemlist.html">https://docs.fast.ai/tutorial.itemlist.html</a></li><li><a href="https://github.com/ohmeow/dl-experiments/tree/master/medium-finding-data-block-nirvana">MixedTabularList example</a></li></ul><figure><a href="https://usejournal.com/?utm_source=medium.com&amp;utm_medium=noteworthy_blog&amp;utm_campaign=guest_post_image"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f2IVAl0TbsfES9cFGYr40g.png" /></a></figure><p><strong>This story is published in Noteworthy, where 10,000+ readers come every day to learn about the people &amp; ideas shaping the products we love.</strong></p><p><strong>Follow our publication to see more product &amp; design stories featured by the </strong><a href="https://usejournal.com/?utm_source=medium.com&amp;utm_medium=noteworthy_blog&amp;utm_campaign=guest_post_text"><strong>Journal</strong></a><strong> team.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c38210537fe4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Contributing to fast.ai]]></title>
            <link>https://medium.com/@wgilliam/contributing-to-fast-ai-86f2c05d72aa?source=rss-c657a07d0514------2</link>
            <guid isPermaLink="false">https://medium.com/p/86f2c05d72aa</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Wayde Gilliam]]></dc:creator>
            <pubDate>Sat, 11 Nov 2017 00:26:28 GMT</pubDate>
            <atom:updated>2017-11-11T00:26:28.358Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m a student in the 2nd version of <a href="http://course.fast.ai/">fast.ai’s deep learning MOOC</a> and also a big fan of contributing to open source projects. The latest rendition of the course relies heavily on a new framework built on top of <a href="http://pytorch.org/">PyTorch</a> that is under very active development. Like a number of students in the class, I want to contribute to the project, and so I put together this short post detailing how to make it happen.</p><p><em>Note</em>: Though I’m talking about how to contribute to the fast.ai repository specifically, the approach below can be applied to any git controlled project you would like to contribute to.</p><p><strong>Forking the repository:</strong></p><ol><li>Navigate the the fastai repo here: <a href="https://github.com/fastai/fastai">https://github.com/fastai/fastai</a></li><li>Click the <strong>“Fork”</strong> button in the top-right part of the page, right under the main navigation:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*NMGonhdaBiaw6gfbwVifmw.png" /></figure><p>This will create a copy of the fast.ai repo in <em>your</em> account. Unless you have permissions to commit code to their repo, this is the only way you can contribute to the codebase.</p><p><strong>Get to work:</strong></p><ol><li>Clone <strong><em>your</em></strong> copy of the of the fast.ai repo on your development machine. It’s as simple as opening your terminal and running:</li></ol><pre>cd &lt;into your development directory&gt;<br>git clone https://github.com/&lt;<strong><em>your</em></strong> github username&gt;/fastai.git</pre><p>2. Make your changes, commit locally, and push to your repo</p><pre>git add .<br>git commit -am &#39;something more informative than this&#39;<br>git push</pre><p><strong>Submit a Pull Request:</strong></p><p>This is how you let the owners of the base repo know you have something for them to consider merging in with their codebase.</p><ol><li>Navigate the <strong><em>base</em></strong> repo at <a href="https://github.com/fastai/fastai">https://github.com/fastai/fastai</a> and click the <strong>“New Pull Request”</strong> button</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/1*wmRe2_ILLQ3CMDohSwRHhQ.png" /></figure><p>2. In the <em>Compare Changes</em> panel, base refers to the owner’s repo and compare refers to your fork (e.g., copied version of it). Ensure that both base and compare are set to look at the master branch in each. Essentially, what you are saying is, <em>“Hey fast.ai (base) repo master branch, I have some code in my copy of your project (compare) repo master branch that I’d like you to consider merging into your codebase.”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*g6VbNQuM6JYj0uQ3iZzZQw.png" /></figure><p>3. Click the <strong>“Create Pull Request” </strong>button, update the title for your pull request (if necessary) and an optional description, and submit.</p><p>That’s it!</p><p><strong>Keep your fork up-to-date with the base repo</strong></p><p>One last thing you’ll want to do is be able to pull the latest changes from the base repo into your copy. This will make it easy for you to keep contributing.</p><ol><li>Configure a remote for your copy/fork of the project that points to the base repo named <em>‘upstream’</em>.</li></ol><pre>cd &lt;into your development directory&gt;<br>git remote add upstream https://github.com/<em>&lt;base repo&gt;</em>.git</pre><pre># run the line below to see your remote repositories<br>git remote -v</pre><p>2. Fetch the branches and commits from the base repo’s master branch (what you named ‘upstream’ above):</p><pre>git fetch upstream</pre><p>3. Checkout <em>your</em> master branch and merge any upstream changes (e.g., changes committed into the master branch of the base repository):</p><pre>git checkout master<br>git merge upstream/master</pre><p>And get back to working against the latest from the owner’s repo now incorporated into your fork. Rinse and repeat as necessary!</p><p>More about fast.ai and their courses can be found <a href="http://www.fast.ai/">here</a>.</p><h4><strong>One final note:</strong></h4><p>Jeremy Howard recommends developers new to git check out <strong><em>hub</em></strong> (<a href="https://github.com/github/hub">https://github.com/github/hub7</a>) . I don’t have personal experience with it, but I’m told that forking isn’t required and that you can just clone to contribute to a project.</p><p>Helpful Resources:</p><ol><li><a href="https://yangsu.github.io/pull-request-tutorial/">https://yangsu.github.io/pull-request-tutorial/</a></li><li><a href="https://help.github.com/articles/configuring-a-remote-for-a-fork/">https://help.github.com/articles/configuring-a-remote-for-a-fork/</a></li><li><a href="https://help.github.com/articles/syncing-a-fork/">https://help.github.com/articles/syncing-a-fork/</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86f2c05d72aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>