[U] Update usage instructions
This commit is contained in:
@@ -8,16 +8,10 @@ CLAP (Contrastive Language-Audio Pretraining) is a model that learns acoustic co
|
|||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
Install the dependencies: `pip install -r requirements.txt` using Python 3 to get started.
|
First, install python 3.8 or higher (3.11 recommended). Then, install CLAP:
|
||||||
|
|
||||||
If you have [conda](https://www.anaconda.com) installed, you can run the following:
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
git clone https://github.com/microsoft/CLAP.git && \
|
pip install git+https://github.com/microsoft/CLAP.git
|
||||||
cd CLAP && \
|
|
||||||
conda create -n clap python=3.10 && \
|
|
||||||
conda activate clap && \
|
|
||||||
pip install -r requirements.txt
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## NEW CLAP weights
|
## NEW CLAP weights
|
||||||
@@ -31,9 +25,9 @@ In `CLAP\src\`:
|
|||||||
|
|
||||||
- Zero-Shot Classification and Retrieval
|
- Zero-Shot Classification and Retrieval
|
||||||
```python
|
```python
|
||||||
# Load model (Choose between versions '2022' or '2023')
|
from msclap import CLAP
|
||||||
from CLAPWrapper import CLAPWrapper as CLAP
|
|
||||||
|
|
||||||
|
# Load model (Choose between versions '2022' or '2023')
|
||||||
clap_model = CLAP("<PATH TO WEIGHTS>", version = '2023', use_cuda=False)
|
clap_model = CLAP("<PATH TO WEIGHTS>", version = '2023', use_cuda=False)
|
||||||
|
|
||||||
# Extract text embeddings
|
# Extract text embeddings
|
||||||
@@ -48,9 +42,9 @@ similarities = clap_model.compute_similarity(audio_embeddings, text_embeddings)
|
|||||||
|
|
||||||
- Audio Captioning
|
- Audio Captioning
|
||||||
```python
|
```python
|
||||||
# Load model (Choose version 'clapcap')
|
from msclap import CLAP
|
||||||
from CLAPWrapper import CLAPWrapper as CLAP
|
|
||||||
|
|
||||||
|
# Load model (Choose version 'clapcap')
|
||||||
clap_model = CLAP("<PATH TO WEIGHTS>", version = 'clapcap', use_cuda=False)
|
clap_model = CLAP("<PATH TO WEIGHTS>", version = 'clapcap', use_cuda=False)
|
||||||
|
|
||||||
# Generate audio captions
|
# Generate audio captions
|
||||||
|
|||||||
Reference in New Issue
Block a user