Giter Club home page Giter Club logo

flash-pix2struct-azureml's Introduction

flash-pix2struct-azureml

This repo contains the code to run pix2struct in Azure ML using flash attention. There is only flash attention in the encoder, because the decoder has an attention bias mechanism that isn't compatible. Flash attention can help save memory when training with a large number of patches (2k+).

The existing code uses a public dataset, so you'll likely want to point it to a local directory of files. I do not do any processing on the dataset: the model will try to generate json code. Some other approaches will add special tokens that delimit the generated text to make it easier to parse.

This uses the PyTorch NGC Container from April of 2023 (nvcr.io/nvidia/pytorch:23.04-py3). To use prompts for the model, the following was added to the Dockerfile.

RUN apt-get update && apt-get -y install libfreetype6-dev
RUN pip uninstall -y pillow && \
    pip install --no-cache-dir pillow

The default font file is also included.

Running this is a simple as executing each cell in the notebook. Everything else should be self-explanatory, but if you have a question please open an issue.

flash-pix2struct-azureml's People

Contributors

nbroad1881 avatar

Stargazers

CodeAdventurer avatar Younes Belkada avatar

Watchers

 avatar

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.