Coder Social home page Coder Social logo

lightning-universe / research-template Goto Github PK

View Code? Open in Web Editor NEW
38.0 10.0 4.0 3.23 MB

Quickest way to share everything about your research within a single app

Home Page: https://docs.google.com/presentation/d/1eOrRB8a3IdhhxnMdm9R84tEluAWsrbbEOXiaLzKwk6s

Python 26.43% Jupyter Notebook 70.61% Makefile 2.96%

research-template's Introduction

⚡️ Lightning Research Poster Template 🔬

Lightning license

Use this app to share your research paper results. This app lets you connect a blogpost, arxiv paper, and a jupyter notebook and even have an interactive demo for people to play with the model. This app also allows industry practitioners to reproduce your work.

Getting started

To create a Research Poster you can install this app via the Lightning CLI or use the template from GitHub and manually install the app as mentioned below.

Installation

With Lightning CLI

lightning install app lightning/research_poster

Use GitHub template

Click on the "Use this template" button at the top, name your app repo, and GitHub will create a fork of this app to your account.

use-template.png

You can clone the forked app repo and follow the steps below to install the app.

git clone https://github.com/Lightning-Universe/Research-template.git
cd Research-template
pip install -r requirements.txt

Once you have installed the app, you can goto the LAI-research-template-App folder and run lightning run app app.py --cloud from terminal. This will launch the template app in your default browser with tabs containing research paper, blog, Training logs, and Model Demo.

You should see something like this in your browser:

image

Steps to customize to your research

You can modify the content of this app and customize it to your research. At the root of this template, you will find app.py that contains the ResearchApp class. This class provides arguments like a link to a paper, a blog, and whether to launch a Gradio demo. You can read more about what each of the arguments does in the docstrings.

1. Poster Component

This component lets you make research posters using markdown files. The component comes with a predefined poster.md file in the resources folder that contains markdown content for building the poster. You can directly update the existing file with your research content.

2. Link to Paper, blog and Training Logs

You can add your research paper, a blog post, and training logs to your app. These are usually static web links that can be directly passed as optional arguments within app.py

3. A view only Jupyter Notebook

You can provide the path to your notebook and it will be converted into static HTML.

4. Model Demo

To create an interactive demo you’d need to implement the build_model and predict methods of the ModelDemo class present in the research_app/demo/model.py module.

5. JupyterLab Component

This component runs and adds a JupyterLab instance to your app. You can provide a way to edit and run your code for quick audience demonstrations. However, note that sharing a JupyterLab instance can expose the cloud instance to security vulnerability.

Highlights

  • Provide the link for paper, blog, or training logger like WandB as an argument, and ResearchApp will create a tab for each.
  • Make a poster for your research by editing the markdown file in the resources folder.
  • Add interactive model demo with Gradio app, update the gradio component present in the [research_app ( ./research_app/demo/model.py) folder.
  • View a Jupyter Notebook or launch a fully-fledged notebook instance (Sharing a Jupyter Notebook instance can expose the cloud instance to security vulnerability.)
  • Reorder the tab layout using the tab_order argument.

Example

# update app.py at the root of the repo
import lightning as L

app = L.LightningApp(
    ResearchApp(
        poster_dir="resources",
        paper="https://arxiv.org/pdf/2103.00020.pdf",
        blog="https://openai.com/blog/clip/",
        training_log_url="https://wandb.ai/aniketmaurya/herbarium-2022/runs/2dvwrme5",
        github="https://github.com/mlfoundations/open_clip",
        notebook_path="resources/Interacting_with_CLIP.ipynb",
        launch_jupyter_lab=False,
        launch_gradio=True,
        tab_order=[
            "Poster",
            "Blog",
            "Paper",
            "Notebook",
            "Training Logs",
            "Model Demo",
        ],
    )
)

FAQs

  1. How to pull from the latest template code? Answer

research-template's People

Contributors

aniketmaurya avatar stanbiryukov avatar pre-commit-ci[bot] avatar manskx avatar krshrimali avatar dependabot[bot] avatar borda avatar otaj avatar zippeurfou avatar

Stargazers

Mustafa Taha Koçyiğit avatar  avatar Chahat Raj avatar Anjishnu avatar 罗德 avatar Naiyarah Hussain avatar Robin Cole avatar JierunChen avatar  avatar Zun Wang avatar Satyananda Kashyap avatar Bing Han avatar  avatar  avatar Jian Jiang avatar Michael Vinyard avatar Alvin Qin avatar Cameron Smith avatar Tai Duc Nguyen avatar Moses Bomera avatar Andres Algaba avatar Eddie Zhang avatar Jacob A Rose avatar Anil Radhakrishnan avatar Abhik Sarkar avatar Jatin Nainani avatar Arghyadeep Das avatar Rahul avatar Maaz Karim avatar YONG-XIANG LIN avatar  avatar Lukas avatar Simon avatar Charles Dufour avatar  avatar Wei Ji avatar Kevin M Jablonka avatar

Watchers

Luca Antiga avatar William Falcon avatar  avatar  avatar Noha Alon avatar Ethan Harris avatar thomas chaton avatar Luca Furst avatar Rick Izzo avatar  avatar

research-template's Issues

Fails on start?

[flow] 2022-07-22T13:36:09.122Z AttributeError: module 'lightning.app.frontend' has no attribute 'web'
[flow] 2022-07-22T13:36:09.154Z ERROR: Found an exception when loading your application from app.py. Please, resolve it to run your app.
[flow] 2022-07-22T13:36:09.154Z Traceback (most recent call last):
[flow] 2022-07-22T13:36:09.154Z   File "app.py", line 145, in <module>
[flow] 2022-07-22T13:36:09.154Z     app = L.LightningApp(
[flow] 2022-07-22T13:36:09.154Z   File "/content/venv/lib/python3.8/site-packages/lightning_app/core/app.py", line 102, in __init__
[flow] 2022-07-22T13:36:09.154Z     self._update_layout()
[flow] 2022-07-22T13:36:09.154Z   File "/content/venv/lib/python3.8/site-packages/lightning_app/core/app.py", line 415, in _update_layout
[flow] 2022-07-22T13:36:09.154Z     layout = _collect_layout(self, component)
[flow] 2022-07-22T13:36:09.154Z   File "/content/venv/lib/python3.8/site-packages/lightning_app/utilities/layout.py", line 30, in _collect_layout
[flow] 2022-07-22T13:36:09.154Z     layout = flow.configure_layout()
[flow] 2022-07-22T13:36:09.154Z   File "app.py", line 27, in configure_layout
[flow] 2022-07-22T13:36:09.154Z     return frontend.web.StaticWebFrontend(serve_dir=self.serve_dir)
[flow] 2022-07-22T13:36:09.154Z AttributeError: module 'lightning.app.frontend' has no attribute 'web'
[flow] 2022-07-22T13:36:09.247Z INFO: Found dead components ['Flow', 'Server', 'root.notebook_viewer'], Exiting execution!!!

image

version v.0.0.1

Make Jupyter Optional

From an offline conversation, we discussed that it is better to make Jupyter optional.

It may be best to just view the poster and show other resources. It's good we have it as an option and can be leveraged in other apps too.


cc: @stanbiryukov

App parameterization

We can have a API with parameter for Github urls:

paper = "https://arxiv.org/pdf/1811.06965.pdf"
blog = "https://openai.com/blog/clip/"
github = "https://github.com/mlfoundations/open_clip"

app = LightningApp(Flow(paper=paper, blog=blog, github=github))

We can dynamically control the tabs to open from this constructor.

reorganize layout when every work is ready

ManagedWork dynamically add the tabs for Jupyter, Poster, and Gradio. This result in Poster tab at random position. It would be good to have it as the first tab in the app.

error with mkposters while running app

Here is the error trace

Process Process-4:
Traceback (most recent call last):
  File "/Users/aniket/miniconda3/envs/lightning/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/Users/aniket/miniconda3/envs/lightning/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/aniket/github/lightning/lightning/utilities/proxies.py", line 222, in __call__
    raise e
  File "/Users/aniket/github/lightning/lightning/utilities/proxies.py", line 214, in __call__
    self.run_once()
  File "/Users/aniket/github/lightning/lightning/utilities/proxies.py", line 295, in run_once
    self.work.on_exception(e)
  File "/Users/aniket/github/lightning/lightning/core/lightning_work.py", line 391, in on_exception
    raise exception
  File "/Users/aniket/github/lightning/lightning/utilities/proxies.py", line 289, in run_once
    ret = work_run(*args, **kwargs)
  File "/Users/aniket/github/lightning-template-research-app/research_app/components/poster_work.py", line 31, in run
    mkposter(
TypeError: mkposter() got an unexpected keyword argument 'background_color'

cc: @stanbiryukov

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.