Metadata-Version: 2.4
Name: livecc-utils
Version: 0.0.2
Summary: LiveCC Vision Language Model Utils - PyTorch
Project-URL: Homepage, https://github.com/showlab/LiveCC/tree/main/livecc-utils
Project-URL: Repository, https://github.com/showlab/LiveCC.git
Project-URL: Issues, https://github.com/showlab/LiveCC/issues
Author-email: Joya Chen <joyachen@u.nus.edu>
License: Apache-2.0
Keywords: large language model,livecc,pytorch,qwen-vl,vision language model
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.8
Requires-Dist: decord
Requires-Dist: qwen-vl-utils
Description-Content-Type: text/markdown

# livecc-utils

LiveCC Utils is a supplement to qwen-vl-utils, which contains a set of helper functions for processing and integrating visual language information with LiveCC Model.

## Install

```bash
pip install qwen-vl-utils livecc-utils
```

## Feature

### Decord Video Reader Plus
Compared to ```_read_video_decord``` in ```qwen-vl-utils```, we provide ```_read_video_decord_plus``` that can handle video with ```video_start```, ```video_end```, and support both smart nframe and strict fps. Please refer to [src/livecc_utils/video_process_patch.py](src/livecc_utils/video_process_patch.py)

#### Usage
Easy. Just put the import of  ```livecc-utils``` before ```qwen_vl_utils```.

```
import livecc_utils
from qwen_vl_utils import ...
```

### Easy KV Cache for Multi-turn
Original Qwen2VL has some bugs during multi-turn conversation with past_key_values. We provide a patch ```prepare_multiturn_multimodal_inputs_for_generation``` at [src/livecc_utils/generation_patch.py](src/livecc_utils/generation_patch.py). During inference, using ```model.prepare_inputs_for_generation = functools.partial(prepare_multiturn_multimodal_inputs_for_generation, model)``` then do faster inference with past_key_values!

#### Usage
Easy. Just let ```model.prepare_inputs_for_generation = functools.partial(prepare_multiturn_multimodal_inputs_for_generation, model)```.

