Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Barba is a multilingual natural language inference model for textual entailment and zero-shot text classification, available as an end-to-end service through TensorFlow Serving.

License

hyperonym/barba

Repository files navigation

Barba

Barba is a multilingual natural language inference model for textual entailment and zero-shot text classification, available as an end-to-end service through TensorFlow Serving. Based on XLM-RoBERTa, it is trained on selected subsets of publicly available English (GLUE), Chinese (CLUE), Japanese (JGLUE), Korean (KLUE) datasets, as well as other private datasets.

Quick Start

Installation

Docker images are available on Docker Hub and GitHub Packages.

For GPU acceleration, you also need to install the NVIDIA Driver and NVIDIA Container Runtime. Barba's image already comes with related libraries such as CUDA and cuDNN, so there is no need to install them manually.

Basic Usage

Replace X.Y.Z with the latest version, then run:

docker run -p 8501:8501 hyperonym/barba:X.Y.Z

Textual Entailment

curl -X POST \
  'http://127.0.0.1:8501/v1/models/barba:predict' \
  --data-raw '{
  "instances": [
    {
      "hypothesis": "Leonardo da Vinci never painted on walnut wood",
      "premise": "The Lady with an Ermine is a portrait painting widely attributed to the Italian Renaissance artist Leonardo da Vinci. Dated to around 1489 to 1491, the work is painted in oils on a panel of walnut wood."
    },
    {
      "hypothesis": "最长的黄鳝能有1米长",
      "premise": "黄鳝(学名:Monopterus albus):又名鳝鱼,古代称为蝉鱼、黄蝉等。体细长呈蛇形,体长约20-70厘米,最长可达1米。体前圆后部侧扁,尾尖细。"
    }
  ]
}'

Zero-shot Text Classification

curl -X POST \
  'http://127.0.0.1:8501/v1/models/barba:predict' \
  --data-raw '{
  "signature_name": "cartesian",
  "inputs": {
    "hypothesis": [
      "foreign policy",
      "Europe",
      "elections",
      "business",
      "outdoor recreation",
      "politics"
    ],
    "premise": [
      "Who are you voting for in 2020?",
      "北欧有很多不错的滑雪场"
    ]
  }
}'

License

Barba is available under the MIT License.


© 2023 Hyperonym