[{"propertyName1":"OpenChatKit\n\nOpenChatKit provides a powerful, open-source base to create both specialized and general purpose chatbots for various applications. The kit includes an instruction-tuned 20 billion parameter language model, a 6 billion parameter moderation model, and an extensible retrieval system for including up-to-date responses from custom repositories. It was trained on the OIG-43M training dataset, which was a collaboration between Together, LAION, and Ontocord.ai. Much more than a model release, this is the beginning of an open source project. We are releasing a set of tools and processes for ongoing improvement with community contributions.\n\nIn this repo, you'll find code for:\n\nTraining an OpenChatKit model\nTesting inference using the model\nAugmenting the model with additional context from a retrieval index\nContents\nRequirements\nPre-trained Weights\nDatasets\nData Contributions\nPretrained Base Model\nTraining and Finetuning\n(Optional) 8bit Adam\nTrain GPT-NeoX-Chat-Base-20B\nConverting Weights to Huggingface Format\nInference\nMonitoring\nLoguru\nWeights & Biases\nExperimental: Retrieval-Augmented Models\nLicense\nCiting OpenChatKit\nAcknowledgements\nRequirements\n\nBefore you begin, you need to install PyTorch and other dependencies.\n\nInstall Miniconda from their website.\nCreate an environment called OpenChatKit using the environment.yml file at the root of this repo.\nconda env create -f environment.yml\n\nThis repo also uses Git LFS to manage some files. Install it using the instructions on their site then run:\n\ngit lfs install\nPre-trained Weights\n\nGPT-NeoXT-Chat-Base-20B is a 20B-parameter variant of GPT-NeoX, fine-tuned on conversational datasets. We are releasing pre-trained weights for this model as togethercomputer/GPT-NeoXT-Chat-Base-20B on Huggingface.\n\nMore details can be found on the model card for GPT-NeoXT-Chat-Base-20B on Huggingface.\n\nDatasets\n\nThe chat model was trained on the OIG dataset built by LAION, Together, and Ontocord.ai. To download the dataset from Huggingface run the command below from the root of the repo.\n\npython data/OIG/prepare.py\n\nOnce the command completes, the data will be in the data/OIG/files directory.\n\nData Contributions\n\nYou can help make this chat model better by contributing data! See the OpenDataHub repo for more details.\n\nPretrained Base Model\n\nAs mentioned above, the chat model is a fine-tuned variant of GPT-NeoX-20B from Eleuther AI. To download GPT-NeoX-20B and prepare it for fine tuning, run this command from the root of the repo.\n\npython pretrained/GPT-NeoX-20B/prepare.py\n\nThe weights for this model will be in the pretrained/GPT-NeoX-20B/EleutherAI_gpt-neox-20b.\n\nTraining and Finetuning\n(Optional) 8bit Adam\n\nTo use 8bit-adam during training, install the bitsandbytes package.\n\npip install bitsandbytes # optional, to use 8bit-adam\nTrain GPT-NeoX-Chat-Base-20B\n\nThe training/finetune_GPT-NeoXT-Chat-Base-20B.sh script configures and runs the training loop. After downloading the dataset and the base model, run:\n\nbash training/finetune_GPT-NeoXT-Chat-Base-20B.sh\n\nThe script launches 8 processes with a pipeline-parallel degree of 8 and a data-parallel degree of 1.\n\nAs the training loop runs, checkpoints are saved to the model_ckpts directory at the root of the repo.\n\nPlease see the training README for more details about customizing the training run.\n\nConverting Weights to Huggingface Format\n\nBefore you can use this model to perform inference, it must be converted to the Hugginface format.\n\nmkdir huggingface_models \\\n&& python tools/convert_to_hf_gptneox.py \\\n --ckpt-path model_ckpts/GPT-Neo-XT-Chat-Base-20B/checkpoint_5 \n --save-path /huggingface_models/GPT-NeoXT-Chat-Base-20B \n --n-stages 8 \n --n-layer-per-stage 6\nInference\n\nTo help you test the model, we provide a simple test command line test harness to interact with the bot.\n\npython inference/bot.py\n\nBy default the script will load the model named GPT-NeoXT-Chat-Base-20B model under the huggingface_models directory, but you can override that behavior by specifying --model.\n\nFor example, if you want to load the base model from our Huggingface, repo, you can run the following command which downloads the weights from HuggingFace.\n\npython inference/bot.py --model togethercomputer/GPT-NeoXT-Chat-Base-20B\n\nOnce the model has loaded, enter text at the prompt and the model will reply.\n\n$ python inference/bot.py \nLoading /home/csris/src/github.com/togethercomputer/OpenChatKit/inference/../huggingface_models/GPT-NeoXT-Chat-Base-20B to cuda:1...\nWelcome to OpenChatKit shell. Type /help or /? to list commands.\n\n>>> Hello.\nSetting `pad_token_id` to `eos_token_id`:0 for open-end generation.\nHello human.\n\n>>> \n\nCommands are prefixed with a /, and the /quit command exits.\n\nMonitoring\n\nBy default, the training script simply prints the loss as training proceeds, but it can also output metrics to a file using loguru or report them to Weights & Biases.\n\nLoguru\n\nAdd the flag --train-log-backend loguru to your training script to log to ./logs/file_{time}.log\n\nWeights & Biases\n\nTo use Weights & Biases, first login with your Weights & Biases token.\n\nwandb login\n\nAnd set --train-log-backend wandb in the training script to enable logging to Weights & Biases.\n\nExperimental: Retrieval-Augmented Models\n\nNote: Retrieval is still experimental.\n\nThe code in /retrieval implements a python package for querying a Faiss index of Wikipedia. The following steps explain how to use this index to augment queries in the test harness with context from the retriever.\n\nDownload the Wikipedia index.\npython data/wikipedia-3sentence-level-retrieval-index/prepare.py\nRun the bot with the --retrieval flag.\npython inference/bot.py --retrieval\n\nAfter starting, the bot will load both the chat model and the retrieval index, which takes a long time. Once the model and the index are loaded, all queries will be augmented with extra context.\n\n$ python inference/bot.py --retrieval\nLoading /OpenChatKit/inference/../huggingface_models/GPT-NeoXT-Chat-Base-20B to cuda:0...\nLoading retrieval index...\nWelcome to OpenChatKit shell. Type /help or /? to list commands.\n\n>>> Where is Zurich?\nSetting `pad_token_id` to `eos_token_id`:0 for open-end generation.\nWhere is Zurich?\nZurich is located in Switzerland.\n\n>>>\nLicense\n\nAll code in this repository was developed by Together Computer except where otherwise noted. Copyright (c) 2023, Together Computer. All rights reserved. The code is licensed under the Apache 2.0 license.\n\nCopyright 2023 Together Computer\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n\nThis repository also contains code written by a number of other authors. Such contributions are marked and the relevant licensing is included where appropriate.\n\nFor full terms, see the LICENSE file. If you have any questions, comments, or concerns about licensing please contact us.\n\nCiting OpenChatKit\n@software{openchatkit,\n title = {{OpenChatKit: An Open Toolkit and Base Model for Dialogue-style Applications}},\n author = {Together Computer},\n url = {https://github.com/togethercomputer/OpenChatKit}\n month = {3},\n year = {2023},\n version = {0.15},\n}\nAcknowledgements\n\nOur model is a fine-tuned version of gpt-neox-20b, a large language model trained by Eleuther AI. We evaluated our model on HELM provided by the Center for Research on Foundation Models. And we collaborated with both CRFM and HazyResearch at Stanford to build this model.\n\nWe collaborated with LAION and Ontocord.ai to build the training data used to fine tune this model."}]