Giter VIP home page Giter VIP logo

actions-sdk's People

Contributors

adrianvrj avatar emmanuelar avatar franalgaba avatar gerson2102 avatar gonmeso avatar jwarmuz99 avatar lancenonce avatar raphaeldkhn avatar shivam6862 avatar shyamjayakannan avatar silent-cipher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

actions-sdk's Issues

Improve Type Hints

Type hinting is inconsistent throughout the code.

We should aim to improve this and make it more consistent and thus, useful in development.

To check which functions have missing hints or hints are not appropriate we can rely on the usage of mypy. We can run the following to have an overview:

mypy giza_actions --disallow-untyped-defs

This will show multiple hinting errors that we should aim to solve.

We can omit the errors coming from external packages that do not have type hints, for example:

giza_actions/utils.py:5: error: Skipping analyzing "giza": module is installed, but missing library stubs or py.typed marker  [import-untyped]```

Add a cache for already downloaded models

When we create a model we have multiple places where the original model (onnx) could be downloaded. Currently, these downloads happen again and again as there is no cache or we dont look if we already downloaded it.

Some functions that download a model:

  • _get_output_dtype: used to get the output type so users do not have to add it into the predict method. This could be potentially executed in each prediction
  • _download_model: if an output_path is added into the instantiation of the model or agent, the model is downloaded

Prior to download the model we should check if we have the model already downloaded locally.

On-chain deployment

Feature request for a blockchain deployer for actions. Here are the specifications:

  • Enables developers to use a private key to structure calldata based on inferences and use it in their smart contract
  • Fetches proof and inference data from GCP
  • Sets up an example with the verifiable flag raised in prediction so that the proof can be verified by Starkex or wrapped platinum verifier

Fix typos

Check the scripts and/or documentation to find typos to fix. This is highly appreciated!

Some places to look for typos:

  • Docstrings of the code
  • Example notebooks, specially agents

Add an example of an Agent using Polygon

Currently we have an example of agents working with Arbitrum (see notebook).

The idea will be to create another example using Polygon instead of Arbitrum, for this it will be good to check the ape-polygon plugin as it should be necessary to install it to use it with ape.

This should come in a form of a notebook and add it in the examples/agents/ folder. Once merged this tutorial will be added to the official documentation!

Refactor GizaModel

When creating the tests for the GizaModel there were a lot of patching involved, multiple client calls, and thus in makes it harder also to test GizaAgent as it is an extension of the model.

When encountering such needs for patching in the test, that also indicates that we might have over complicated the design of GizaModel, specially the __init__.

We should aim to improve the design of this entity to:

  • Provide a better public API
  • Ease testing
  • Add corner cases handling
  • Create specific exceptions regarding model usage

This changes should not affect the current usage if the predict method, as it is basically the entrypoint used by the users, but the underlying logic can be greatly improved.

Endpoint returns 500 when following examples

While following the examples in the decision_tree.ipynb and linear_regression.ipynb tutorials, I got the following error when calling model.predict() on the GizaModel object:

14:48:23.097 | ERROR   | giza_actions.model - An error occurred in predict: 500 Server Error: Internal Server Error for url: https://endpoint-cesar-[endpoint id].a.run.app/cairo_run

14:48:23.099 | ERROR   | giza_actions.model - Deployment predict error: Running the Cairo  programm failed

All previous cells ran successfully (transpilation, login, deployment, getting the workspace, etc.). Furthermore, calling model.predict() when verifiable=False seems to work, since I'm able to see the successful deployment in the dashboard.

I've tried to send the input myself using the requests library:

import requests
payload = " ".join(
    [
        serializer(create_tensor_from_array(
            input,
            "FP16x16"
        ))
    ]
)
response = requests.post("https://endpoint-cesar-[endpoint id].a.run.app/cairo_run", json=payload)

However, the same error persists.

Add tests for `utils.py`

Currently, only models.py and agents.py have some kind of testing, the focus of this issue is to add tests to the utils.py script.

Some tips on this:

  • Use patch or patch.object for the clients
  • When patching return a value of the schema needed. These schemas can be found in the cli repo
  • Make sure to test exceptions

An example:

from giza.schemas import SchemaClass

schema_object = SchemaClass(
    ...
)

@patch("giza_actions.utils.ClientToPatch.method", return_value=schema_object)
def test_something(mock_schema):
    # Test Here
    ...
    # Assert result
    mock_schema.assert_called_once()

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.