Skip to content

vagos/llm-interpolate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

llm-interpolate

LLM plugin for interpolating between embeddings

Installation

Install this plugin in the same environment as LLM.

llm install llm-interpolate

Usage

The plugin adds a new command, llm interpolate. This command takes the name of an embedding collection and two ids from that collection that will act as start and end points.

First, populate a collection. In this case we are embedding a song library using the CLAP model.

llm embed-multi -m clap songs --files mysongs "*.wav" 

Now we can interpolate between those song embeddings with five intermediate points:

llm interpolate songs "MyRapSong.wav" "MyContrySong.wav" -n 5

You can use the -d option to use a different embeddings database.

What this will do is try and find points in the embedding space in-between the given points.

The output should look something like this (truncated):

[
    "MyRapSong.wav",
    "HipHopMeetsCountry.wav",
    "SmoothCountryRap.wav",
    "CountryVibes.wav",
    "MyCountrySong.wav"
]

This output can then be used to build a cohesive playlist using only a starting and ending song.

llm interpolate songs "MyRapSong.wav" "MyContrySong.wav" -n 5 | jq .[] > playlist.m3u

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd llm-interpolate
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest

About

Interpolate between embedding points with llm

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages