mirror of
https://github.com/epfl-dlab/dlab-utils.git
synced 2026-12-04 09:48:42 +00:00
Read-only mirror of https://github.com/epfl-dlab/dlab-utils — EPFL Data Science & AI Lab (dlab). Issues & pull requests at the source.
- Python 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| dlabutils | ||
| pyproject.toml | ||
| README.md | ||
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())