Giter Site home page Giter Site logo

flyte-banana's Introduction

Model Development and Inference with Flyte and Banana

A fine-tuned version of bert-base-uncased model orchestrated with Flyte and deployed on Banana.

๐Ÿฅž Stack

The technology stack comprises Flyte, Banana and HuggingFace.

Flyte

Flyte is a workflow orchestration platform that allows you to build production-grade data and ML pipelines. The code for Flyte is located in the flyte directory.

Banana

Banana provides inference hosting for ML models on serverless GPUs. The code for Banana is located in the banana directory.

HuggingFace

The HuggingFace Hub provides a seamless way to store and retrieve models, complete with built-in versioning.

๐Ÿ› ๏ธ Setup

  1. Make a copy of this repository by forking it.
  2. Configure your Banana account by creating a deployment and linking to the forked GitHub repo. This can be done by navigating to Team > Integrations > GitHub > Manage Repos, and Deploy > Deploy from GitHub > your repo.
  3. Create a virtual environment and install the required Flyte and Banana dependencies.
  4. Obtain access tokens for HuggingFace and GitHub and store them in files within a secrets directory, as follows:
<your-secrets-dir>/deployments-secrets/flyte-banana-creds
<your-secrets-dir>/hf-secrets/flyte-banana-hf-creds
  1. Within a .env file, set the following two variables to enable local code execution:
FLYTE_SECRETS_DEFAULT_DIR=<your-secrets-dir>
DEMO="1"
  1. The flyte/workflows/ml_pipelines.py file contains tasks and workflows. To verify that everything is functioning properly, run the file locally as follows:
pyflyte run ml_pipelines.py --gh_owner <your-github-username> --gh_repo <your-github-repo> --gh_branch <your-github-repo-branch> --hf_user <your-huggingface-username>
  1. To test if you can properly deploy on Banana, you can also run the Banana server locally. Navigate to the banana directory and execute the command python server.py. Then, confirm that the Banana API endpoint is functional by running the banana/test.py file.
  2. To run the Flyte workflow on an actual Flyte backend, set up a Flyte cluster. The simplest way to get started is by running flytectl demo start command, which spins up a mini-replica of the Flyte deployment.
  3. Register tasks and workflows using the following command, which can leverage the docker registry included with the demo cluster for image pushing and pulling:
pyflyte register --image <flyte-docker-image> ml_pipeline.py
  1. Create Kubernetes secrets to store GitHub and HuggingFace tokens as follows:
kubectl create secret generic deployment-secrets --namespace flytesnacks-development --from-file=flyte-banana-creds=<your-secrets-dir>/deployment-secrets/flyte-banana-creds

kubectl create secret generic hf-secrets --namespace flytesnacks-development --from-file=flyte-banana-hf-creds=<your-secrets-dir>/hf-secrets/flyte-banana-hf-creds
  1. Launch the registered workflow on the UI.
  2. To deploy the retrained model on Banana, select "Yes".
  3. This action saves the model metadata, such as the latest commit SHA, Flyte execution ID, and HuggingFace username, in the corresponding GitHub repository.
  4. The GitHub push operation then triggers the Banana deployment process.
  5. Copy your Banana API and model keys, and store them in .env file.
  6. Once the deployment is complete, confirm that the Banana API endpoint is operational by executing banana/test_banana_api.py file.

flyte-banana's People

Contributors

samhita-alla 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.