Skip to main content

OpenChat: Easy to use opensource chatting framework via neural networks

   ____   ____   ______ _   __   ______ __  __ ___   ______
  / __ \ / __ \ / ____// | / /  / ____// / / //   | /_  __/
 / / / // /_/ // __/  /  |/ /  / /    / /_/ // /| |  / /   
/ /_/ // ____// /___ / /|  /  / /___ / __  // ___ | / /    
\____//_/    /_____//_/ |_/   \____//_/ /_//_/  |_|/_/     
  • OpenChat is easy to use opensource chatting framework.
  • OpenChat supports 40+ dialogue model based on neural networks.
  • You can talk with AI with only one line of code.



Installation

pip install openchat



Supported Models

  • OpenChat supports 40+ dialogue models based on neural networks.
  • Use these names as parameter model='name' when you create OpenChat.
  • Click here if you want to check supported models.

    GPT-Neo

    • gptneo.small
    • gptneo.medium
    • gptneo.large
    • gptneo.xlarge

    Blender

    • blender.small
    • blender.medium
    • blender.large
    • blender.xlarge
    • blender.xxlarge

    DialoGPT

    • dialogpt.small
    • dialogpt.medium
    • dialogpt.large

    Dodecathlon

    • dodecathlon.all_tasks_mt
    • dodecathlon.convai2
    • dodecathlon.wizard_of_wikipedia
    • dodecathlon.empathetic_dialogues
    • dodecathlon.eli5
    • dodecathlon.reddit
    • dodecathlon.twitter
    • dodecathlon.ubuntu
    • dodecathlon.image_chat
    • dodecathlon.cornell_movie
    • dodecathlon.light_dialog
    • dodecathlon.daily_dialog

    Reddit

    • reddit.xlarge
    • reddit.xxlarge

    Safety

    • safety.offensive
    • safety.sensitive

    Unlikelihood

    • unlikelihood.wizard_of_wikipedia.context_and_label
    • unlikelihood.wizard_of_wikipedia.context
    • unlikelihood.wizard_of_wikipedia.label
    • unlikelihood.convai2.context_and_label
    • unlikelihood.convai2.context
    • unlikelihood.convai2.label
    • unlikelihood.convai2.vocab.alpha.1e-0
    • unlikelihood.convai2.vocab.alpha.1e-1
    • unlikelihood.convai2.vocab.alpha.1e-2
    • unlikelihood.convai2.vocab.alpha.1e-3
    • unlikelihood.eli5.context_and_label
    • unlikelihood.eli5.context
    • unlikelihood.eli5.label

    Wizard of Wikipedia

    • wizard_of_wikipedia.end2end_generator


Usage

  • Just import and create a object. That's all.
>>> from openchat import OpenChat
>>> OpenChat(model="blender.medium", device="cpu")



  • Set param device='cuda' If you want to use GPU acceleration.
>>> from openchat import OpenChat
>>> OpenChat(model="blender.medium", device="cuda")



  • Set **kwargs if you want to change decoding options.
    • method (str): one of ["greedy", "beam", "top_k", "nucleus"],
    • num_beams (int): size of beam search
    • top_k (int): K value for top-k sampling
    • top_p: (float): P value for nucleus sampling
    • no_repeat_ngram_size (int): beam search n-gram blocking size for removing repetition,
    • length_penalty (float): length penalty (1.0=None, UP=Longer, DOWN=Shorter)
  • Decoding options must be keyword argument not positional argument.
>>> from openchat import OpenChat
>>> OpenChat(
...    model="blender.medium", 
...    device="cpu", 
...    method="top_k",
...    top_k=20,
...    no_repeat_ngram_size=3,
...    length_penalty=0.6,                            
... )
  • For safety.offensive model, parameter method must be one of ["both", "string-match", "bert"]
>>> from openchat import OpenChat
>>> OpenChat(
...     model="safety.offensive",
...     device="cpu"
...     method="both" # ---> both, string-match, bert
... )



Special Tasks

1. GPT-Neo

  • The GPT-Neo model was released in the EleutherAI/gpt-neo repository.
  • It is a GPT2 like causal language model trained on the Pile dataset.
  • Openchat supports the above Prompt based dialogues via GPT-Neo.
  • Below models provides custom prompt setting. (* means all models)
    • gptneo.*

2. ConvAI2

  • ConvAI2 is one of the most famous conversational AI challenges about a persona.
  • Openchat provides custom persona setting like above image.
  • Below models provides custom perona setting. (* means all models)
    • blender.*
    • dodecathlon.convai2
    • unlikelihood.convai2.*


3. Wizard of Wikipedia

  • Wizard of wikipedia is one of most famous knowledge grounded dialogue dataset.
  • Openchat provides custom topic setting like above image.
  • Below models provides custom topic setting. (* means all models)
    • wizard_of_wikipedia.end2end_generator
    • dodecathlon.wizard_of_wikipedia
    • unlikelihood.wizard_of_wikipedia.*

4. Safety Agents

  • Openchat provides a dialog safety model to help you design conversation model.
  • Below models provides dialog safety features.
    • safety.offensive: offensive words classification
    • safety.sensitive: sensitive topic classification

Update plan

  • Openchat is not a finished, but a growing library.
  • I plan to add the following features in the near future.

Plan by versions.

  • v1.0: Support huggingface transformers for DialoGPT and Blender.
  • v1.1: Support parlai for various dialogue generation tasks.
  • v1.2: Support pytorch-lightning for fine-tuning using GPU & TPU.
  • v1.3: Support deepspeed for huge model inference like Reddit 9.4B.
  • v1.4: Add Retrieval-based dialogue models.
  • v1.5: Add non-parlai models (e.g. Baidu PLATO-2, ...)
  • v1.6: Easy deployment to messengers (e.g. Facebook, Whatsapp, ...)
  • v1.7: Support database (e.g. PostgreSQL, MySQL, ...)

License

Copyright 2021 Hyunwoong Ko.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Metadata

Release files for openchat 1.1.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for openchat 1.1.12
File Interpreter ABI Platform
openchat-1.1.12-py3-none-any.whl Python 3 none any Details

Release files / openchat-1.1.12-py3-none-any.whl

Download URL openchat-1.1.12-py3-none-any.whl
Size 28.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
67a2e2f510b82b99ed5a79bddcdc682fb61d33057561850912c8139f84c6c814
BLAKE2b-256 checksum
How to use checksums
e6616dbd02f6c9b0145cdbb7156bc3f35fa1495d7062b28a170c84e624e89655
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.3

Release history Release notifications | RSS feed

This release

1.1.12 This release

1 release file

1.1.11

1 release file

1.1.10

1 release file

1.1.9

1 release file

1.1.8

1 release file

1.1.7

1 release file

1.1.6

1 release file

1.1.5

1 release file

1.1.4

1 release file

1.1.3

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page