A package for converting chat messages to and from ChatML format
Project description
pychatml
The pychatml
package allows you to convert chat interfaces from and to the ChatML format.
Installation
You can install the pychatml
package using pip:
pip install pychatml
What
Makes it easy to integrate between different chat formats and models.
from pychatml.llama2_converter import Llama2
PROMPT = """[INST] Hi, how are you? [/INST] Good thanks!
[INST] Can you help me with this math program? [/INST]"""
converter = Llama2()
converter.to_chatml(PROMPT)
[
{"role": "user", "content": "Hi, how are you?"},
{"role": "assistant", "content": "Good thanks!"},
{"role": "user", "content": "Can you help me with this math program?"},
]
Supported formats
- Llama 2
- Anthropic
- Alpaca
- Vicuna/ShareGPT (from https://github.com/lm-sys/FastChat/blob/e67b21dcbde91a5ad9740b081c59c433093f54da/fastchat/conversation.py#L394C1-L404C2)
Why?
https://github.com/OpenAccess-AI-Collective/axolotl/pull/982
Questions?
Create an issue or discussion in this repository.
Or, reach out to our team! @jakob_frick, @__anjor, @maxnajork on X or team@radiantai.com.
How to create a new release
A new release will automatically be published to pypi. For this to happen you need to
- update the version specificed in
setup.py
- create a
git tag
with the version you want to release and push it viagit push --tags
- create a new release in Github
A Github action will automatically publish the new version to pypi.
Contributing Guidelines
Thank you for your interest in contributing to our project! Before you begin writing code, it would be helpful if you read these contributing guidelines. Following them will make the contribution process easier and more efficient for everyone involved.
Please note that the project is released with an MIT License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pychatml-0.0.6.tar.gz
.
File metadata
- Download URL: pychatml-0.0.6.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3846a80679e1ae95f1f2f6fc28f936a35622afef8867fd14c1d78802ffa8579a |
|
MD5 | 49a010661922a46d60f4d379107563be |
|
BLAKE2b-256 | 38afb67b21ec5269107ba74ac1c301b9a6f3866db5bc1c02dd1ada1192bf73fd |
File details
Details for the file pychatml-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: pychatml-0.0.6-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c1a1c6e1529632ed8b912524d02cf7fc93552a4b819666c0690fc07c15e8936 |
|
MD5 | 946cfca0e998a8bf4af4042b937fd90b |
|
BLAKE2b-256 | 09e9c3fad0cd9b1ee2db4adb82e28329df4af5e66d39a43352a93dc04d4f03c4 |