Read-only mirror of https://github.com/epfl-dlab/dlab-utils — EPFL Data Science & AI Lab (dlab). Issues & pull requests at the source.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2024-11-12 16:05:35 +01:00
dlabutils added better folder naming 2024-11-12 16:05:35 +01:00
pyproject.toml added autodownload and new directory format 2024-11-12 15:27:20 +01:00
README.md Update README.md 2024-11-12 16:03:51 +01:00

DLAB utils

Python Library for DLAB utils

Installation

You can install the dlabutils package using pip:

pip install git+https://github.com/epfl-dlab/dlab-utils.git

Usage

Model Paths

The model_path function returns the path to the model weights given the huggingface identifier, if the model is available in the DLAB LLM weights directory, and defaults to the hf model name if it is not. The available_models function returns a list of all available models. Here's a quick tutorial:

from dlabutils import model_path, available_models
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained(model_path("meta-llama/Meta-Llama-3-8B-Instruct"))
tokenizer = AutoTokenizer.from_pretrained(model_path("meta-llama/Meta-Llama-3-8B-Instruct"))

print(available_models())