How to contribute to fastai

This is a summary how-to wiki thread/post - that means you can edit and improve it!
For discussion and questions about it please use this thread instead: How to contribute to fastai [Discussion]. If you’re a fairly experienced developer, feel free to also join the Discord chat for fastai development.


As you know, fastai is open source. That means you can freely look at the source code and use it for whatever you like, but it also means to you can easily contribute to the codebase!

This post is intended as an introduction to contributing to the development of fastai, with explanations, links and a FAQ. It’s also a wiki, which means you can contribute to this very post.

Please don’t feel intimidated by the length of this post. You only need to read “Areas where you can help” and points 1 to 4 of “How to get started”, the rest is just bonus information :slight_smile:

Why contribute to fastai you may ask? It has several advantages :

  • You progressively get familiar with the code base. That means it becomes easier and easier for you to navigate through it, understand how it’s working and debug your own code.

  • fastai is the perfect size to start contributing to an open source project. It’s not too big (can be intimidating and hard to make significant contributions) and not too small (it’s quite well-known in the Machine Learning world, and has a few very active maintainers that will quickly help you if needed).

  • If you’re not a software developer, it can be the perfect occasion to get familiar with git (version control) and GitHub - the most popular git hosted service, and how working on a rather large project looks and feels like.

  • From a practical standpoint, contributing to open-source looks good on a resume. All your contributions are registered in the system via PRs (Pull Requests), which is just a way to communicate your contributions to the developers who then integrate (merge) your changes into the project.

  • The community is amazing! They are very kind and helpful, and warmly accept all useful contributions!

And there’s probably many other advantages I missed. Still interested, but wondering where to start? Don’t worry, there’s plenty of resources to help you out!

Areas where you can help

  • Documentation: The documentation is always in need of being updated, clarified and expanded.

  • New features: If you have a new feature in mind, it’s best to discuss it over at the developer’s chat before starting to implement it, and get validation from the maintainers of fastai (mainly Sylvain and Jeremy)

How to get started ?

  1. Find something you’d be interested to contribute to in the above list

  2. If you’re not familiar with git and GitHub, don’t worry! The developer guide are very well made and explain everything you need in an accessible way. That document provides easy step by step instructions for creating a forked clone of fastai (and a tool to do it in one command) and submitting your contributions via github PR (Pull Request).

  3. You can also quickly Jeremy’s note on fastai’s coding style

  4. If needed, ask for help by creating a post in the fastai user category, dev section, or by asking in the developer chat. Please note it’s best no to at-mention any admins unless necessary. You’re very encouraged to support others - you may not realize that even if you have just watched a few lessons or got those lessons running on your desktop or via an online service, you already know a way more than a new user, who has just discovered fastai and you can be of great help to them, while freeing time for other more advanced users to answer more advanced questions.

  5. Often the best way to find what to contribute to is not to go and look for things to do/fix, but to simply observe your own work and study:

    • Every time you encounter a problem and you solve it, see if the solution can be documented in the fastai docs.
    • If you had to write a test case to reproduce a bug in fastai, consider contributing that test to the fasti test suite.
    • If you see someone submitted a bug report, but failed to supply a reproducible test help them to do so.
    • If the reported bug was fixed, but no test was added with it, it means that it can break again - figure out how to write a test that validates the fix, even after the fix was applied.
    • Every time someone answers your question, either in the forums or in the github issue, contribute that answer to the fastai documentation.
    • Every time you read other people’s answers and you realize that a few of them can be compiled into a nice entry in the documentation, do so. Especially, so, if you see the same question is being answered again and again.
    • When you see typos in both code and documentation, fix those.

    As you can see a lot of those suggestions don’t require much expertise and can be done by even a total beginner. And the more you contribute, the faster you will figure things out and quicker move on beyond being a beginner. And, of course, it feels good when you know your contribution affects thousands of other users.

    But, of course, if you have no real problems that you encounter then see if you find some interesting problems to work on from the documentation and testing todo lists.

    • Do pick interesting to you problems first, so that you will be enjoying the process of figuring out.
    • Try not to pick too complicated problems at first, since otherwise, the guiding you through figuring out the solution will take much more effort than doing it directly for someone who knows.
    • Consider teaming up and working together with someone else on a problem you and her are interested in.

And finally, thank you for wanting to contribute to fastai!

Useful links

FAQ

When can I submit a PR?

Whenever you feel like your work is ready to be merged with fastai you can submit a PR. If you submitted a PR and then realized it needs more work close it, do the work and submit it when it’s ready. Please don’t use an already submitted PR as a playground - each commit takes maintainer’s attention. If you need help, you can head over to the developer’s chat and ask.

What to do if my PR needs more work?

Don’t worry, it happens all the time! The maintainers will tell you what they would want to be able to merge it with fastai master. If it’s just a small modification, do it directly on the PR. If you feel you have to do larger modifications that will have many commits, it’s best to close your PR for now, continue to work on it on your own branch, and then reopen a new PR when you are comfortable with it.

I’m stuck. Where do I get help?

Head over to the developer’s chat, it’s a friendly place ! You can ask all of your questions there.


Please feel free to ask any question you have in mind that will help you to find a way to contribute back to fastai. Please use this thread How to contribute to fastai [Discussion] and once you get an answer please add it here in the FAQ section.

45 Likes

hi everyone, i need help about the architecture of basic_critic.

1 Like

Is this advice current with nbdev and fastai2?

1 Like

Jeremy will be making a post soon (heavy works on the docs currently otherwise I’d post a link to it), however there is a tutorial notebook for your first PR:

If you need more assistance with learning about nbdev see the tutorial:

http://nbdev.fast.ai/tutorial.html

2 Likes

Thanks! Is there a best-practice for cloning fastai for a research project and then keeping your additions and modifications cleanly separated for publication or for further distribution? Or is this implied in the tutorial you referenced? (If so… I presume I’ll find it.) Thanks again.

I would build a seperate nbdev library so nothing is impacted. See Jeremy’s note below

1 Like

No need for that @muellerzr. Just use a fork (which is covered in the guide).

1 Like

This is a resource I am working on that might be useful to people looking to contribute. I have unofficially categorized most the fastai issues here: https://docs.google.com/spreadsheets/d/1CchBT5swpbzxbcVtKMxLcLdicAqkCKTrBH7lgd2_Nfo/edit?usp=sharing

I will be periodically updating this as it is useful to me as well.

If interested follow up here: Categorized github issues

4 Likes

Fastai helps a lot!. Thanks for this wonderful lib!

I’d like to inquire about the citation information if I write some articles implemented with fastai.

Shall I cite the website, or are there any articles for this?

Thanks for your help!

This is the latest response[2] from Jeremy regarding fastai citation.

It is best to cite fastai paper[1] published in this peer reviewed journal

[1] Information | Free Full-Text | Fastai: A Layered API for Deep Learning
[2] UNOSAT used fastai.ai for their FloodAI model - Discussion on how to move forward - #5 by jeremy

1 Like

Thanks for the help!

1 Like

How do I create a new topic in the forums? I have tried searching all over, but cannot find a button to “Create Post/Topic” anywhere in the UI. What am I missing?

This is probably the wrong place to post this question, but I do not know where else to post it. I would post a question as a new topic, but I do not know how to do that!

Hi,
Can anyone help in using SegmentationDataLoaders in fastai for segmenting dataset containing image and mask folders

There are three excellent resources: the FastAI API docs, the FastAI Book examples, and Zachary’s Walk With FastAI series which has a tutorial.

If you’re using the mid-level datablock API, you’re looking for an ImageBlock for input and a MaskBlock for output. The more specialized your use-case, the more you’ll want to look into the datablock API. Note the get_y and get_x functions you’ll come across return file paths. If you do any kind of multi-stage or intermediary data processing you’ll be editing those. I don’t have a quick link for them right now.

3 Likes

How to create post on this forum?

2 Likes

same question… how? i see a new redesign of forum.