chatting-chatbots

A library for running experiments of conversing chatbots.

https://github.com/centre-for-humanities-computing/chatbot-conversations

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.8%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

A library for running experiments of conversing chatbots.

Basic Info
  • Host: GitHub
  • Owner: centre-for-humanities-computing
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 165 KB
Statistics
  • Stars: 1
  • Watchers: 0
  • Forks: 2
  • Open Issues: 14
  • Releases: 0
Created over 4 years ago · Last pushed over 3 years ago
Metadata Files
Readme License Citation

README.md

Chatting Chatbots

A library for running experiments of multiple genarative language models having conversations with each other.

python version Code style: black pytorch version

Installation

Install chatting chatbots from PiPy:

bash pip install chatting_chatbots

or directly from GitHub:

bash pip install git+https://github.com/centre-for-humanities-computing/chatbot-conversations

Overview of Implementation

Usage

The package currently works only with PyTorch and GPT-based models. Models tested: gpt2, gpt-j, gpt-neo, distilgpt2.

Open In Colab

An example of usage (seen in tutorials/examples.ipynb):

```python import chatting_chatbots as cc

cc.Experiment( population = {"John" : "gpt2", "Margaret" : "gpt2"}, cycles = 2, initialcontext="Hi. Why are you late?", conversationlength=10, verbose = True, usegpu=-1, usefiles=True ).run() ```

Output from this example: ``` A conversation between John and Margaret:

John: Hi. Why are you late?

Margaret: Oh, it's because I had an appointment at work today and now I want to do some shopping in the morning.

John: Oh, yes?

Margaret: Oh, yes.

John: No no, I really don't like shopping in the morning.

Margaret: I like shopping in the evenings. ```

Parameters for Experiment

| parameter | type | default | description | | --------------------- | ----------------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | population | dict | required parameter | A dictionary, where each element is an agent, defined as "Agent_Name" : "Agent_Model". The model can either be the name of a model available on HuggingFace, or a list [tokenizer, model] of a tokenizer and a model you have already created. | | cycles | int | 1 | The number of cycles of conversation, where one cycle is each agent in the population talking to each other agent twice (starting the conversation once, and being second once). | | initialcontext | str | "Hello." | The initial context the first agent in a conversation uses i.e. each conversation starts with this sentence. | | conversationlength | int | 10 | The length of the conversation in turns (excluding the initial context). | | randomlength | int | 0 | A randomisation variable for the length; the length is taken from a uniform distribution of `[conversationlength - randomlength, conversationlength + randomlength]`. | | trainingargs | TrainingArguments | None | A TrainingArguments parameter passed to the HuggingFace Trainer() class. If None, some default parameters are used. | | verbose | bool | False | If set to True, class outputs some extra text about what is happening. | | usefiles | bool | True | If set to True, during training, conversations are saved to files in the `outputpathdirectory, and all of the files in theoutputpathwill be used for training. Otherwise, only the conversations generated during a single.run()` are used. | | usegpu | int | -1 | If not set, uses cpu, otherwise, uses the gpu specified. | | generationparameters | list | None | A list of parameters used for the model.generate() function (not tested). If not used, some default parameters are used instead. | | contextsize | int | 600 | How many tokens should be used on each generation. If set to 0, uses the entire conversation as context. Note that this is prone to crashing as some models cannot handle large contexts. | | fullconversation | bool | True | If set to True, uses the entire conversation for training. If set to False, uses only the _other agent's text for training. | | batchsize | int | 128 | The batch size used for training. If the experiment crashes because of no examples for training, you should either decrease this value or increase the conversation length. | | trainafterrun | bool | True | If set to True, every agent is trained after a .run(). | | outputpath | str | "outputs" | The path where the conversation files should be saved. | | cache_path | str | ".cache/huggingface/transformers" | The path where the models (if they are downloaded from HuggingFace) should be stored. |

Functions available

| function | arguments | return | description | | ------------------------- | -------------------------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | | conversationgeneration() | str speakerone, str speakertwo | str conversation | Generates a conversation between `speakeroneandspeakertwo. Returns the conversation. Note that the speakers must be in the population of theExperiment`. | | run() | - | - | Runs the experiment by having each agent speak with each other agent for the set number of cycles, optionally training them afterwards. | | trainparticipant() | str participant | - | Trains the participant specified. Note that the participant must be part of the population of the Experiment. | | return_model | str participant | model | Returns the current model of the specified participant. |

Credits

This package was created using the Name project template.

Owner

  • Name: Center for Humanities Computing Aarhus
  • Login: centre-for-humanities-computing
  • Kind: organization
  • Email: chcaa@cas.au.dk
  • Location: Aarhus, Denmark

Citation (citation.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Maksevičius"
  given-names: "Rokas"
title: "chatting_chatbots"
version: 0.0.1
date-released: 2022-04-20
url: "https://github.com/centre-for-humanities-computing/chatbot-conversations"

GitHub Events

Total
Last Year

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 14
  • Total pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: 6 days
  • Total issue authors: 2
  • Total pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • rbroc (13)
  • KennethEnevoldsen (1)
Pull Request Authors
  • KennethEnevoldsen (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 13 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
  • Total maintainers: 1
pypi.org: chatting-chatbots

A library for running experiments of multiple chatbots having conversations with each other.

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 13 Last month
Rankings
Dependent packages count: 10.0%
Forks count: 22.6%
Stargazers count: 31.9%
Average: 38.4%
Downloads: 59.7%
Dependent repos count: 67.5%
Maintainers (1)
Last synced: 7 months ago

Dependencies

requirements.txt pypi
  • black >=22.3.0
  • datasets >=1.14.0
  • numpy >=1.21.2
  • pandas >=1.3.4
  • pytorch-ignite >=0.4.8
  • scikit-learn >=1.0.2
  • scipy >=1.7.3
  • torch >=1.9.1
  • transformers >=4.12.2
.github/workflows/black_formatter.yml actions
  • actions/checkout v3 composite
  • psf/black stable composite
.github/workflows/publish_to_pypi.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
  • pypa/gh-action-pypi-publish master composite
setup.py pypi