567-labs / fastllm

A collection of LLM services you can self host via docker or modal labs to support your applications development
MIT License
182 stars 23 forks source link

[Draft] initial affine transformation model #19

Closed justinliang1020 closed 10 months ago

justinliang1020 commented 11 months ago

Initial code for adding an affine transformation onto a base embedding model (in this case BAAI/bge-small-en-v1.5

Based on the finetune model found here: https://github.com/567-labs/fastllm/blob/main/applications/finetune-embedding/model.py

This is currently draft code, only the forward pass an init functions have been modified so far to add in the base embedding model

Main.py is just sample code on running the model

To run, run python main.py in the directory

EDIT:

Refactored the entire PR. It's now mainly based on the finetune-embeddings directory. The logic behind this is that the base embedding model doesn't need to be inside the model.py file since the base embedding weights are frozen and we're just training on the liner adapter model on top of it.

TODO:

justinliang1020 commented 11 months ago

Pushed some new code for just getting training/inference on modal, no need to review it yet cause it's just proof of concept

justinliang1020 commented 10 months ago

Pushed the commits that I had thought I had pushed earlier (but accidentally didn't). What I did:

What I plan on doing:

justinliang1020 commented 10 months ago

Closing PR since we are pivoting from pytorch to sentence transformers implementation