Skip to main content

Welcome to fastpapers

Play LEGO with papers.

#all_slow

fastpapers is a python library where I use fastai to reproduce papers on Jupyter Notebooks. I use nbdev to turn these notebooks into modules.

Install

pip install fastpapers

How to use

Train DETR in 3 lines of code

Download the data

path = download_coco(force_download=False)

Create the DataLoaders, the Learner, and fit.

dls = CocoDataLoaders.from_sources(path, vocab=coco_vocab, num_workers=0)
learnd = detr_learner(dls)
learnd.fit(1, lr=[1e-5, 1e-5, 1e-5])
epoch train_loss valid_loss AP AP50 AP75 AP_small AP_medium AP_large AR1 AR10 AR100 AR_small AR_medium AR_large time
0 5.892842 7.636298 0.475381 0.574125 0.506063 0.297741 0.458006 0.560994 0.355018 0.545646 0.560374 0.375141 0.541728 0.630330 2:05:24

Show the results

with learnd.removed_cbs(learnd.coco_eval): learnd.show_results(max_n=8, figsize=(10,10))

png

Superresolution in 4 lines of code

Download the data

path = untar_data(URLs.IMAGENETTE)

Create the DataLoaders, the Learner adn fit.

#hide_output
db = DataBlock(blocks=(ResImageBlock(72), ResImageBlock(288)),
               get_items=get_image_files,
               batch_tfms=Normalize.from_stats([0.5]*3, [0.5]*3))
dls = db.dataloaders(path, bs=4, num_workers=4)
learn = superres_learner(dls)
learn.fit(16, lr=1e-3, wd=0)
learn.show_results()

png

Library structure

The name of each module is the bibtexkey of the corresponing paper. For example, if you want to use the FID metric from Heusel, Martin, et al. 2017, you can import it like so:

from fastpapers.heusel2017gans import FIDMetric

If you want to train a pix2pix model from Isola, Phillip, et al you can import a pix2pix_learner

from fastpapers.isola2017image import pix2pix_learner

The core module contains functions and classes that are useful for several papers. For example, you have a ImageNTuple to work with an arbitrary amount of images as input.

path = untar_data(URLs.PETS)
files = get_image_files(path/"images")
it = ImageNTuple.create((files[0], files[1], files[2]))
it = Resize(224)(it)
it = ToTensor()(it)
it.show();

png

Or useful functions for debuging like explode_shapes or explode_ranges

explode_shapes(it)
[(3, 224, 224), (3, 224, 224), (3, 224, 224)]

Metadata

Release files for fastpapers 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastpapers 0.0.8
File Size Uploaded
fastpapers-0.0.8.tar.gz 28.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fastpapers 0.0.8
File Interpreter ABI Platform
fastpapers-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 57.0 kB

Release files / fastpapers-0.0.8.tar.gz

Download URL fastpapers-0.0.8.tar.gz
Size 28.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f0a39c92482e6e1b30da6ff76a3757e4cba970a6615d7d81818f4e286052891f
BLAKE2b-256 checksum
How to use checksums
6206057e42be702a137aca416a218be8a33b066d719fef1b091cd4d6fac0cb66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.2

Release files / fastpapers-0.0.8-py3-none-any.whl

Download URL fastpapers-0.0.8-py3-none-any.whl
Size 28.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0a7b2615e6aeacf615e5aea4150623040612ebe1f02fd385876e531814b06b4
BLAKE2b-256 checksum
How to use checksums
9cd0689a192bb0e0f2700d95faf72cae2fc7706db494dee3195eb719c51d7154
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

0.0.8 This release

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page