caikit-convert 0.1.0
caikit-convert is a command-line interface (CLI) tool designed to convert models from HuggingFace to a format compatible with Caikit. Additionally, it supports uploading the converted models to an AWS S3 bucket using the s5cmd command-line tool.
License: MIT
Requires Python: >=3.9

[![Python package](https://github.com/aspirina765/caikit_convert/actions/workflows/python-package.yml/badge.svg?branch=main)](https://github.com/aspirina765/caikit_convert/actions/workflows/python-package.yml)
# caikit-convert CLI

`caikit-convert` is a command-line interface (CLI) tool designed to convert models from HuggingFace to a format compatible with Caikit. Additionally, it supports uploading the converted models to an AWS S3 bucket using the `s5cmd` command-line tool.

## Supported Models

The following models from HuggingFace can be converted:

- Idefics 2 (Multimodal)
- Llava Next (1.6) (Multimodal)
- Llama
- Phi 3
- Gemma
- Cohere
- Dbrx
- Mamba
- Mistral
- Mixtral
- Gpt Bigcode
- Phi
- Baichuan
- Falcon
- StarCoder 2
- Qwen 2
- Opt
- T5
- Galactica
- SantaCoder
- Bloom
- Mpt
- Gpt2
- Gpt Neox
- Idefics (Multimodal)

## Installation

### Prerequisites

Ensure you have the following dependencies installed:

- `git`
- `git lfs`
- `s5cmd`
- `python`
- `pip`

### Setup

1. Clone the repository:

    ```bash
    git clone https://github.com/aspirina765/caikit_convert.git
    cd caikit_convert
    ```

2. Install Git LFS:

    ```bash
    git lfs install
    ```

3. Install the dependencies listed in `setup.py`:

    ```bash
    pip install -e .
    ```

4. Install `s5cmd` by following the instructions from the [s5cmd GitHub repository](https://github.com/peak/s5cmd):

    ```bash
    git clone https://github.com/peak/s5cmd.git
    cd s5cmd
    go build
    cp s5cmd /usr/local/bin
    ```

## Configuration

### HuggingFace Login

You need to log in to HuggingFace using your HuggingFace token. You can do this via the terminal or by setting environment variables.

#### Using the terminal:

```bash
huggingface-cli login
```

#### Using environment variables:

Set the following environment variable with your HuggingFace token:

```bash
export HUGGINGFACE_TOKEN=<your-huggingface-token>
```

### AWS Credentials

Ensure you have AWS credentials configured. You can set them using environment variables:

```bash
export AWS_ACCESS_KEY_ID=<your-access-key-id>
export AWS_SECRET_ACCESS_KEY=<your-secret-access-key>
export AWS_DEFAULT_REGION=<your-default-region>
```

Alternatively, you can configure AWS credentials using the AWS CLI:

```bash
aws configure
```

## Usage

To convert a model from HuggingFace to Caikit format and upload it to an AWS S3 bucket, use the following command:

```bash
caikit-convert <model-name>
```

For example, to convert the `google/flan-t5-small` model:

```bash
caikit-convert google/flan-t5-small
```

## Contributing

Contributions are welcome! Please open an issue or submit a pull request for any bugs, feature requests, or improvements.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

## Contact

For any questions or issues, please open an issue in this repository or contact the maintainer at [your-email@example.com].