Giter Club home page Giter Club logo

ravop's Introduction

Ravop

Ravop is one of the crucial build blocks of Ravenverse. It is a library for requesters to create and interact with ops, perform mathematical calculations, and write algorithms.

Installation

pip install ravop

Usage

This section covers how a requester can create a simple graph and include Ops for adding 2 Tensors using Ravop module.

Note: The complete scripts of the functionalities demonstrated in this document are available in the Ravop Repository in the examples folders.

Setting Environment Variables

Create a .env file and add the following environment variables:

RAVENVERSE_URL=http://0.0.0.0:9999
RAVENVERSE_FTP_HOST=0.0.0.0

Load environment variables at the beginning of your code using:

from dotenv import load_dotenv
load_dotenv()

Authentication and Graph Definition

The Requester must connect to the Ravenverse using a unique token that they can generate by logging in on Raven's Website using their MetaMask wallet credentials.

import ravop as R
R.initialize('<TOKEN>')

Defining a Graph

In the Ravenverse, each script executed by a requester is treated as a collection of Ravop Operations called Graph.

Note: In the current release, the requester can execute only 1 graph with their unique token. Therefore, to clear any previous/existing graphs, the requester must use R.flush() method.

The next step involves the creation of a Graph...

R.flush()

R.Graph(name='test', algorithm='addition', approach='distributed')

Note: name and algorithm parameters can be set to any string. However, the approach needs to be set to either "distributed" or "federated".

Creating Math Operations (Ops)

a = R.t([1, 2, 3])
b = R.t([4, 5, 6])
c = a + b

Making Ops Persist

Persisting Ops are a special category of Ops that stay in the ravenverse once the graph gets executed. The requester must explicitly mention which ops they want to save in their code. It is a good idea to write the code such that persisting ops contain the relevant results (in this case, variable - c).

Note: Make sure that the name parameter for each persisting Op is unique within a graph so that later it can be retrieved.

c.persist_op(name='c_output')

Activate the Graph

Once all Ops of the graph have been defined, the requester must activate their graph. This step completes the compilation procedure and makes the graph ready for execution. No more Ops can be added to the graph after this.

R.activate()

Execute the Graph

On execution, the graph will be split into smaller subgraphs which will be distributed to the participating compute nodes in the network. The requester can also track the progress of the graph.

R.execute()
R.track_progress()

Fetching Results

The Requester can now fetch the computed results of the Ops that they had previously set to persist.

output = R.fetch_persisting_op(op_name="c_output")
print(output)

Documentation

Ravop documentation

License

This project is licensed under the MIT License - see the LICENSE file for details

ravop's People

Contributors

kailashahirwar avatar 7entropy7 avatar axe76 avatar kailashmatelabs avatar pranitabhinav avatar cleanpegasus 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.