Giter Site home page Giter Site logo

r00kkie / rnn-sim Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yashbonde/rnn-sim

0.0 0.0 0.0 1.18 MB

Running massive simulations using RNNs on CPUs for building bots and all kinds of things.

License: GNU General Public License v3.0

Jupyter Notebook 96.21% Python 3.79%

rnn-sim's Introduction

RNN-sim

Running large number of simulations before making a decision is the best approach to solving problems and hoes hand in had with MCTS style tree search algorithms. In this repo we explore methods that can be used in this direction.

All notebooks are available in notebooks/ folder. Check out interactive graphs on my website.

Finetuning Pretrained Transformers into RNNs arxiv

Find code in folder t2rmodel.py. Run $python3 t2rmodel.py to perform tests as well. These are the results from paper:

With ONNX Runtime you can generate 1024 tokens in just 0.8504s (2.5Mn Params), Insane! You can find all the data in notebooks/times.json. Infact 166 Mn parameter network generates 1024 tokens almost 3.5x faster than model.generate(1024) for 2.5 Mn params. Code for this is complete and available in t2rmodel.py and you can use like this:

model = T2R.from_pretrained("gpt2", feature_size = 32) # load the model from pretrained GPT2 model
model.infer_init()                                     # prepare for inference by fusing layers
model.generate(
  input_ids = input_ids,     # input tokens
  max_length = 128,          # length to generate
  num_return_sequences = 10  # how many sequences you want
)

You can run the app using streamlit:

streamlit run t2r_app.py

License

GNU GENERAL PUBLIC LICENSE v3

rnn-sim's People

Contributors

yashbonde 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.