Backprop makes it simple to use, finetune, and deploy state-of-the-art ML models.

Overview

Backprop

Backprop makes it simple to use, finetune, and deploy state-of-the-art ML models.

Solve a variety of tasks with pre-trained models or finetune them in one line for your own tasks.

Out of the box tasks you can solve with Backprop:

  • Conversational question answering in English
  • Text Classification in 100+ languages
  • Image Classification
  • Text Vectorisation in 50+ languages
  • Image Vectorisation
  • Summarisation in English
  • Emotion detection in English
  • Text Generation

For more specific use cases, you can adapt a task with little data and a single line of code via finetuning.

Getting started Installation, few minute introduction
💡 Examples Finetuning and usage examples
📙 Docs In-depth documentation about task inference and finetuning
⚙️ Models Overview of available models

Getting started

Installation

Install Backprop via PyPi:

pip install backprop

Basic task inference

Tasks act as interfaces that let you easily use a variety of supported models.

import backprop

context = "Take a look at the examples folder to see use cases!"

qa = backprop.QA()

# Start building!
answer = qa("Where can I see what to build?", context)

print(answer)
# Prints
"the examples folder"

You can run all tasks and models on your own machine, or in production with our inference API, simply by specifying your api_key.

See how to use all available tasks.

Basic finetuning and uploading

Each task implements finetuning that lets you adapt a model for your specific use case in a single line of code.

A finetuned model is easy to upload to production, letting you focus on building great applications.

import backprop

tg = backprop.TextGeneration("t5-small")

# Any text works as training data
inp = ["I really liked the service I received!", "Meh, it was not impressive."]
out = ["positive", "negative"]

# Finetune with a single line of code
tg.finetune({"input_text": inp, "output_text": out})

# Use your trained model
prediction = tg("I enjoyed it!")

print(prediction)
# Prints
"positive"

# Upload to Backprop for production ready inference
# Describe your model
name = "t5-sentiment"
description = "Predicts positive and negative sentiment"

tg.upload(name=name, description=description, api_key="abc")

See finetuning for other tasks.

Why Backprop?

  1. No experience needed

    • Entrance to practical AI should be simple
    • Get state-of-the-art performance in your task without being an expert
  2. Data is a bottleneck

    • Solve real world tasks without any data
    • With transfer learning, even a small amount of data can adapt a task to your niche requirements
  3. There are an overwhelming amount of models

    • We offer a curated selection of the best open-source models and make them simple to use
    • A few general models can accomplish more with less optimisation
  4. Deploying models cost effectively is hard work

    • If our models suit your use case, no deployment is needed: just call our API
    • Adapt and deploy your own model with just a few lines of code
    • Our API scales, is always available, and you only pay for usage

Examples

Documentation

Check out our docs for in-depth task inference and finetuning.

Model Hub

Curated list of state-of-the-art models.

Demos

Zero-shot image classification with CLIP.

Credits

Backprop relies on many great libraries to work, most notably:

Feedback

Found a bug or have ideas for new tasks and models? Open an issue.

Comments
  • Finetuning & Cuda

    Finetuning & Cuda

    Hello Backprop Team!

    Great job on the library.

    I was trying to replicate the Generate Questions Fine-tuning example: https://github.com/backprop-ai/backprop/blob/main/examples/Finetuning_GettingStarted.ipynb

    However, I'm facing the following error:

    Exception: You need a cuda capable (Nvidia) GPU for fine-tuning.

    image

    When I add the following line to my code while calling the TextGeneration Model device="cuda" the error changes to No CUDA GPUs are available

    image

    I'm using the following AWS EC2 instance which claims to have NVIDIA CUDA: https://aws.amazon.com/marketplace/pp/Amazon-Web-Services-AWS-Deep-Learning-Base-AMI-Ubu/B07Y3VDBNS#pdp-overview

    Moreover, when I run the command nvcc --version, I see the following output: image

    Please help. Where am I going wrong?

    Best, Karan

    opened by karan-jgu 6
  • self._tokenizer.no_truncation() RuntimeError: Already borrowed`

    self._tokenizer.no_truncation() RuntimeError: Already borrowed`

    Hi,

    I am running the emotion service on cuda and I get this following RuntimeError:

    I am sending a batch_size of 256 to extract emotions.
    and generate(text, do_sample=False, max_length=512)
    Is this something related to max seq length?
    

    File "/opt/conda/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app response = self.full_dispatch_request() File "/opt/conda/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request rv = self.handle_user_exception(e) File "/opt/conda/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception reraise(exc_type, exc_value, tb) File "/opt/conda/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise raise value File "/opt/conda/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request rv = self.dispatch_request() File "/opt/conda/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request return self.view_functionsrule.endpoint File "/root/sales_emotion/main.py", line 34, in task_level_emotion response = emotion_task_to_db(task_id) File "/root/sales_emotion/src/services/emotion_task_level.py", line 67, in emotion_task_to_db df_insert = task_level_emo(task_id) File "/root/sales_emotion/src/services/emotion_task_level.py", line 40, in task_level_emo emotion_labels.extend(kiri.emotion(text)) File "/root/sales_emotion/core.py", line 50, in emotion return self._emotion(input_text) File "/root/sales_emotion/models/tasks/emotion.py", line 42, in call return self.model.emotion(text) File "/root/sales_emotion/models/custom_models.py", line 25, in emotion return self.generate(text, do_sample=False, max_length=512) File "/root/sales_emotion/models/models.py", line 138, in generate features = self.tokenizer(text, return_tensors="pt") File "/opt/conda/lib/python3.7/site-packages/transformers/tokenization_utils_base.py", line 2356, in call **kwargs, File "/opt/conda/lib/python3.7/site-packages/transformers/tokenization_utils_base.py", line 2426, in encode_plus **kwargs, File "/opt/conda/lib/python3.7/site-packages/transformers/tokenization_utils_fast.py", line 465, in _encode_plus **kwargs, File "/opt/conda/lib/python3.7/site-packages/transformers/tokenization_utils_fast.py", line 372, in _batch_encode_plus pad_to_multiple_of=pad_to_multiple_of, File "/opt/conda/lib/python3.7/site-packages/transformers/tokenization_utils_fast.py", line 325, in set_truncation_and_paddi ng self._tokenizer.no_truncation() RuntimeError: Already borrowed

    Please help.

    Chirag Sanghvi

    opened by chiragsanghvi10 6
  • Documentation of training on Emotion

    Documentation of training on Emotion

    Hi,

    First of all thanks a ton for this repository, the results that I am looking for is quite promising without any down-stream task training. :)

    Are you planning to publish the paper/documentation on the data T5 is trained for emotion ?

    Best, Chirag Sanghvi

    opened by chiragsanghvi10 4
  • How can I execute this on GPU?

    How can I execute this on GPU?

    Hi

    I am trying to run this code below on GPU, where should I specify device and what is the command like ?

    device='gpu' or device='cuda' and where should I be mentioning it ?

    This is your old code bit :

    from transformers import T5ForConditionalGeneration, T5Tokenizer
    
    MODEL = "kiri-ai/t5-base-qa-summary-emotion"
    TOKENIZER = "t5-base"
    
    def generate(input_text, model_name: str = None, tokenizer_name: str = None):
        # Refer to global variables
        global model
        global tokenizer
        # Setup
        # Initialise model
        if model == None:
            # Use the default model
            if model_name == None:
                model = T5ForConditionalGeneration.from_pretrained(MODEL)
            # Use the user defined model
            else:
                model = T5ForConditionalGeneration.from_pretrained(model_name)
    
        # Initialise tokenizer
        if tokenizer == None:
            # Use the default tokenizer
            if tokenizer_name == None:
                tokenizer = T5Tokenizer.from_pretrained(TOKENIZER)
            # Use the user defined tokenizer
            else:
                tokenizer = T5Tokenizer.from_pretrained(tokenizer_name)
    
        is_list = False
        if isinstance(input_text, list):
            is_list = True
    
        features = tokenizer(input_text, padding=True, return_tensors='pt')
        tokens = model.generate(input_ids=features['input_ids'],
                                attention_mask=features['attention_mask'], max_length=512)
        if is_list:
            return [tokenizer.decode(tokens, skip_special_tokens=True) for tokens in tokens]
        else:
            return tokenizer.decode(tokens[0], skip_special_tokens=True)
    
    def process_item(item):
        return f"emotion: {item}"
    
    def emotion(input_text, model_name: str = None, tokenizer_name: str = None):
    
        if isinstance(input_text, list):
            input_text = [process_item(item) for item in input_text]
        else:
            input_text = process_item(input_text)
    
        return generate(input_text, model_name=model_name,
                        tokenizer_name=tokenizer_name)
    

    Best, Chirag

    opened by chiragsanghvi10 2
  • Can't use the ai

    Can't use the ai

    Hello, whenever i go to clip.backprop.co and put a picture with some labels and click on "Predict image" i get "something went wrong, try again". Why is that?

    Thank you

    opened by Mattdinina 0
  • Finetuning Image Text Vectorizer with CLIP

    Finetuning Image Text Vectorizer with CLIP

    Hello, I tried finetuning Image-Text Vectorizer CLIP model using above approach. But I get stuck with the error -

    image

    Link to full code - Colab

    What I need is something which gives cosine similarity between an image and a text, shall I finetune with triplet, or with cosine similarity? if its cosine similarity, then how will I get those cosine similarity?

    The triplet variant takes text and image and gives one normalised vector, I am bit confused because I thought it would give a cosine similarity.

    opened by singularity014 1
  • Example for Fine Tuning of CLIP

    Example for Fine Tuning of CLIP

    Hi, thank you for the amazing work.

    Could you please add the example notebook/code for fine-tuning of the CLIP model?

    How can I finetune the CLIP model for the image classification task? could you please add an example notebook other than EfficientNet finetuning?

    opened by singularity014 1
  • PDF issue

    PDF issue

    Hello, I have multiple PDFs and I convert them from pdftotext library, I have 2 questions:

    1. QA: If I pass the entire PDF object it shows unknown whereas checking each page shows the correct result i.e for page in pdf works if page is context for QA whereas pdf itself as the context shows 'unknown' as result
    2. Is there a way to use multiple docs/PDF in some way and generate the result based on the most likely answer?
    opened by VaibhavDS19 0
Owner
Backprop
Making machine learning easy for every developer.
Backprop
Tangram makes it easy for programmers to train, deploy, and monitor machine learning models.

Tangram Website | Discord Tangram makes it easy for programmers to train, deploy, and monitor machine learning models. Run tangram train to train a mo

Tangram 1.4k Jan 5, 2023
TensorFlow Decision Forests (TF-DF) is a collection of state-of-the-art algorithms for the training, serving and interpretation of Decision Forest models.

TensorFlow Decision Forests (TF-DF) is a collection of state-of-the-art algorithms for the training, serving and interpretation of Decision Forest models. The library is a collection of Keras models and supports classification, regression and ranking. TF-DF is a TensorFlow wrapper around the Yggdrasil Decision Forests C++ libraries. Models trained with TF-DF are compatible with Yggdrasil Decision Forests' models, and vice versa.

null 538 Jan 1, 2023
Automated machine learning: Review of the state-of-the-art and opportunities for healthcare

Automated machine learning: Review of the state-of-the-art and opportunities for healthcare

null 42 Dec 23, 2022
Apache Liminal is an end-to-end platform for data engineers & scientists, allowing them to build, train and deploy machine learning models in a robust and agile way

Apache Liminals goal is to operationalise the machine learning process, allowing data scientists to quickly transition from a successful experiment to an automated pipeline of model training, validation, deployment and inference in production. Liminal provides a Domain Specific Language to build ML workflows on top of Apache Airflow.

The Apache Software Foundation 121 Dec 28, 2022
A Tools that help Data Scientists and ML engineers train and deploy ML models.

Domino Research This repo contains projects under active development by the Domino R&D team. We build tools that help Data Scientists and ML engineers

Domino Data Lab 73 Oct 17, 2022
SmartSim makes it easier to use common Machine Learning (ML) libraries like PyTorch and TensorFlow

SmartSim makes it easier to use common Machine Learning (ML) libraries like PyTorch and TensorFlow, in High Performance Computing (HPC) simulations and workloads.

Cray Labs 139 Jan 1, 2023
Exemplary lightweight and ready-to-deploy machine learning project

Exemplary lightweight and ready-to-deploy machine learning project

snapADDY GmbH 6 Dec 20, 2022
#30DaysOfStreamlit is a 30-day social challenge for you to build and deploy Streamlit apps.

30 Days Of Streamlit ?? This is the official repo of #30DaysOfStreamlit — a 30-day social challenge for you to learn, build and deploy Streamlit apps.

Streamlit 53 Jan 2, 2023
DeepSpeed is a deep learning optimization library that makes distributed training easy, efficient, and effective.

DeepSpeed is a deep learning optimization library that makes distributed training easy, efficient, and effective. 10x Larger Models 10x Faster Trainin

Microsoft 8.4k Dec 30, 2022
The Simpsons and Machine Learning: What makes an Episode Great?

The Simpsons and Machine Learning: What makes an Episode Great? Check out my Medium article on this! PROBLEM: The Simpsons has had a decline in qualit

null 1 Nov 2, 2021
Python library which makes it possible to dynamically mask/anonymize data using JSON string or python dict rules in a PySpark environment.

pyspark-anonymizer Python library which makes it possible to dynamically mask/anonymize data using JSON string or python dict rules in a PySpark envir

null 6 Jun 30, 2022
Made in collaboration with Chris George for Art + ML Spring 2019.

Deepdream Eyes Made in collaboration with Chris George for Art + ML Spring 2019.

Francisco Cabrera 1 Jan 12, 2022
learn python in 100 days, a simple step could be follow from beginner to master of every aspect of python programming and project also include side project which you can use as demo project for your personal portfolio

learn python in 100 days, a simple step could be follow from beginner to master of every aspect of python programming and project also include side project which you can use as demo project for your personal portfolio

BDFD 6 Nov 5, 2022
A collection of interactive machine-learning experiments: 🏋️models training + 🎨models demo

?? Interactive Machine Learning experiments: ??️models training + ??models demo

Oleksii Trekhleb 1.4k Jan 6, 2023
easyNeuron is a simple way to create powerful machine learning models, analyze data and research cutting-edge AI.

easyNeuron is a simple way to create powerful machine learning models, analyze data and research cutting-edge AI.

Neuron AI 5 Jun 18, 2022
High performance, easy-to-use, and scalable machine learning (ML) package, including linear model (LR), factorization machines (FM), and field-aware factorization machines (FFM) for Python and CLI interface.

What is xLearn? xLearn is a high performance, easy-to-use, and scalable machine learning package that contains linear model (LR), factorization machin

Chao Ma 3k Jan 8, 2023
Causal Inference and Machine Learning in Practice with EconML and CausalML: Industrial Use Cases at Microsoft, TripAdvisor, Uber

Causal Inference and Machine Learning in Practice with EconML and CausalML: Industrial Use Cases at Microsoft, TripAdvisor, Uber

EconML/CausalML KDD 2021 Tutorial 124 Dec 28, 2022
Machine-care - A simple python script to take care of simple maintenance tasks

Machine care An simple python script to take care of simple maintenance tasks fo

null 2 Jul 10, 2022
Uber Open Source 1.6k Dec 31, 2022