Instructions to use xaviergillard/digita with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use xaviergillard/digita with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/meta-llama-3.1-8b-instruct-bnb-4bit") model = PeftModel.from_pretrained(base_model, "xaviergillard/digita") - Transformers
How to use xaviergillard/digita with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="xaviergillard/digita") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("xaviergillard/digita") model = AutoModelForCausalLM.from_pretrained("xaviergillard/digita") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - llama-cpp-python
How to use xaviergillard/digita with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="xaviergillard/digita", filename="digita-q4_k_m.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use xaviergillard/digita with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf xaviergillard/digita:Q4_K_M # Run inference directly in the terminal: llama-cli -hf xaviergillard/digita:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf xaviergillard/digita:Q4_K_M # Run inference directly in the terminal: llama-cli -hf xaviergillard/digita:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf xaviergillard/digita:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf xaviergillard/digita:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf xaviergillard/digita:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf xaviergillard/digita:Q4_K_M
Use Docker
docker model run hf.co/xaviergillard/digita:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use xaviergillard/digita with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "xaviergillard/digita" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xaviergillard/digita", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/xaviergillard/digita:Q4_K_M
- SGLang
How to use xaviergillard/digita with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "xaviergillard/digita" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xaviergillard/digita", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "xaviergillard/digita" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xaviergillard/digita", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use xaviergillard/digita with Ollama:
ollama run hf.co/xaviergillard/digita:Q4_K_M
- Unsloth Studio new
How to use xaviergillard/digita with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for xaviergillard/digita to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for xaviergillard/digita to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for xaviergillard/digita to start chatting
- Pi new
How to use xaviergillard/digita with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf xaviergillard/digita:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "xaviergillard/digita:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use xaviergillard/digita with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf xaviergillard/digita:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default xaviergillard/digita:Q4_K_M
Run Hermes
hermes
- Docker Model Runner
How to use xaviergillard/digita with Docker Model Runner:
docker model run hf.co/xaviergillard/digita:Q4_K_M
- Lemonade
How to use xaviergillard/digita with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull xaviergillard/digita:Q4_K_M
Run and chat with the model
lemonade run user.digita-Q4_K_M
List all available models
lemonade list
Install from WinGet (Windows)
winget install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama-server -hf xaviergillard/digita:# Run inference directly in the terminal:
llama-cli -hf xaviergillard/digita:Use pre-built binary
# Download pre-built binary from:
# https://github.com/ggerganov/llama.cpp/releases# Start a local OpenAI-compatible server with a web UI:
./llama-server -hf xaviergillard/digita:# Run inference directly in the terminal:
./llama-cli -hf xaviergillard/digita:Build from source code
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
cmake -B build
cmake --build build -j --target llama-server llama-cli# Start a local OpenAI-compatible server with a web UI:
./build/bin/llama-server -hf xaviergillard/digita:# Run inference directly in the terminal:
./build/bin/llama-cli -hf xaviergillard/digita:Use Docker
docker model run hf.co/xaviergillard/digita:Model Card for Digita
Digita has been fine-tuned (qlora) on a proprietary dataset so as to respond similarly to the Belgian State Archive customer support. It was essentially trained using data from the "digit" mailbox from the DiVa section.
Model Details
Model Description
Digita has been trained in the context of the Arkey project conjointly held by the Belgian State Archive and UCLouvain. The purpose of this project is to ease access to the archives held at both institutions for the general public.
In that context, Digita has been trained as an experiment to tune a chatbot that would be able to talk and reply to user request in a way that feels similar to the actual people dealing with the matter at the BSA.
- Developed by: Xavier GILLARD
- Funded by BELSPO: Arkey project
- Model type: Conversational (Fine Tuned from Llama-3.1-8b-Instruct-bnb-4bit)
- Language(s) (NLP): Dutch, French, German, English
- License: MIT License
- Finetuned from model Llama-3.1-8b-Instruct: unsloth/meta-llama-3.1-8b-instruct-bnb-4bit
Model Sources
All scripts, notebooks, etc.. (except the dataset data) that have been used to prepare the dataset and fine tune the model are available on github
Repository: xgillard/corpus_digit
Uses
Prototype a chatbot to help the users of the Belgian State Archive in the context of the Arkey project.
Limitations
This model has been fine tuned on data from the 2022-2024 period. Which means the majority of the data predates the introduction of the AGATHA platform. This means that, while some of the info provided by this model can be useful, it is essentially going to be stale at this point.
The second major limitation I envision for this model stems from the sheer size of the model: 8b is probably not going to cut it for a majority of cases. Especially if one envisions to use the quantized versions. However, I think that this model is a good proof of concept and that it shows what could be achieved if resources were allocated to perform the same task on a more up-to-date dataset (or limited to 2024) using a larger model. This was however not feasible on my personal machine.
Recommendations
If anyone is serious about using this model as a basis to help the BSA personnel of to deploy an user facing chatbot at the BSA, I would recommend to completely redo all the finetuning using a larger model and an updated (more recent) version of the dataset.
How to Get Started with the Model
I do recommend that you use the QLoRA adapter directly using unsloth as this is the asset that seemed to yield the best result while maintaining a similar VRAM footprint (about 7G). Here is how you get started:
from unsloth import (
FastLanguageModel,
train_on_responses_only,
)
from unsloth.chat_templates import (
get_chat_template,
)
from transformers import TextStreamer
model, tok = FastLanguageModel.from_pretrained("xaviergillard/digita", load_in_4bit=True)
model = FastLanguageModel.for_inference(model)
Training Details
Training Data
Original training data consists of a curated dataset of response emails sent by the DiVa cusomer service. The details of this dataset will not be disclosed.
Training Procedure
Preprocessing
- Cleaning up the encoding
- Conversation restructuration
- Conversation classification
- Data Augmentation
- Filtering
Training Hyperparameters
- Training regime: QLoRA adapter based on a 4bit quantization of Llama-3.1-8b-Instruct by unsloth.
- LoRA rank:
rank = 16 - LoRA alpha:
alpha = 16 - Base model quantization:
4 bits
All training/eval metrics can be consulted here.
Evaluation
So far, evaluation has not been very thorough: it mostly consisted of
- comparing the eval loss to the training loss during training
- ensuring the curves seemed ok
- peforming a few manual tests on the trained & quantized models.
Model Card Authors
Xavier Gillard
Framework versions
- PEFT 0.18.0
- Downloads last month
- 8
Install from brew
# Start a local OpenAI-compatible server with a web UI: llama-server -hf xaviergillard/digita:# Run inference directly in the terminal: llama-cli -hf xaviergillard/digita: