GithubHelp home page GithubHelp logo

yhvh1413 / pyfra Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eleutherai/pyfra

0.0 0.0 0.0 1.13 MB

Python Research Framework

License: MIT License

Python 79.48% CSS 8.47% HTML 10.19% JavaScript 0.65% Mako 0.45% Dockerfile 0.76%

pyfra's Introduction

pyfra

The Python Framework for Research Applications.

Documentation Status

Design Philosophy

Research code has some of the fastest shifting requirements of any type of code. It's nearly impossible to plan ahead of time the proper abstractions, because it is exceedingly likely that in the course of the project what you originally thought was your main focus suddenly no longer is. Further, research code (especially in ML) often involves big and complicated pipelines, typically involving many different machines, which are either run by hand or using shell scripts that are far more complicated than any shell script ever should be.

Therefore, the objective of pyfra is to make it as fast and low-friction as possible to write research code involving complex pipelines over many machines. This entails making it as easy as possible to implement a research idea in reality, at the cost of fine-grained control and the long-term maintainability of the system. In other words, pyfra expects that code will either be rapidly obsoleted by newer code, or rewritten using some other framework once it is no longer a research project and requirements have settled down.

Pyfra is in its very early stages of development. The interface may change rapidly and without warning.

Features:

  • Extremely elegant shell integration—run commands on any server seamlessly. All the best parts of bash and python combined
  • Handle files on remote servers with a pathlib-like interface the same way you would local files (WIP, partially implemented)
  • Automated remote environment setup, so you never have to worry about provisioning machines by hand again
  • Idempotent resumable data and training pipelines with no cognitive overhead
  • Spin up an internal webserver complete with a permissions system using only a few lines of code
  • (Coming soon) High level API for experiment management/scheduling and resource provisioning

Want to dive in? See the documentation.

Example code

(This example obviously doesn't run as-is, it's just an illustrative example)

from pyfra import *

rem1 = Remote("[email protected]")
rem2 = Remote("[email protected]")

# env creates an environment object, which behaves very similarly to a Remote (in fact Env inherits from Remote), 
# but comes with a fresh python environment in a newly created directory (optionally initialized from a git repo)
# also, anything you run in an env will resume where it left off, with semantics similar to dockerfiles.
env1 = rem1.env("tokenization")
env2 = rem2.env("training", "https://github.com/some/repo")

# path creates a RemotePath object, which behaves similar to a pathlib Path.
raw_data = local.path("training_data.txt")
tokenized_data = env2.path("tokenized_data")

# tokenize
copy("https://goose.com/files/tokenize_script.py", env1.path("tokenize.py")) # copy can copy from local/remote/url to local/remote
env1.sh(f"python tokenize.py --input {raw_data} --output {tokenized_data}") # implicitly copy files just by using the path object in an f-string

# start training run
env2.path("config.json").jwrite({...})
env2.sh("python train.py --input tokenized_data --config config.json")

Installation

pip3 install pyfra

Webserver screenshots

image image

pyfra's People

Contributors

leogao2 avatar jprester avatar researcher2 avatar sdtblck 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.