Instructions to use FemkeBakker/AmsterdamDocClassificationGEITje200T2Epochs with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use FemkeBakker/AmsterdamDocClassificationGEITje200T2Epochs with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="FemkeBakker/AmsterdamDocClassificationGEITje200T2Epochs") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("FemkeBakker/AmsterdamDocClassificationGEITje200T2Epochs") model = AutoModelForCausalLM.from_pretrained("FemkeBakker/AmsterdamDocClassificationGEITje200T2Epochs") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use FemkeBakker/AmsterdamDocClassificationGEITje200T2Epochs with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "FemkeBakker/AmsterdamDocClassificationGEITje200T2Epochs" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FemkeBakker/AmsterdamDocClassificationGEITje200T2Epochs", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/FemkeBakker/AmsterdamDocClassificationGEITje200T2Epochs
- SGLang
How to use FemkeBakker/AmsterdamDocClassificationGEITje200T2Epochs 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 "FemkeBakker/AmsterdamDocClassificationGEITje200T2Epochs" \ --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": "FemkeBakker/AmsterdamDocClassificationGEITje200T2Epochs", "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 "FemkeBakker/AmsterdamDocClassificationGEITje200T2Epochs" \ --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": "FemkeBakker/AmsterdamDocClassificationGEITje200T2Epochs", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use FemkeBakker/AmsterdamDocClassificationGEITje200T2Epochs with Docker Model Runner:
docker model run hf.co/FemkeBakker/AmsterdamDocClassificationGEITje200T2Epochs
AmsterdamDocClassificationGEITje200T2Epochs
As part of the Assessing Large Language Models for Document Classification project by the Municipality of Amsterdam, we fine-tune Mistral, Llama, and GEITje for document classification. The fine-tuning is performed using the AmsterdamBalancedFirst200Tokens dataset, which consists of documents truncated to the first 200 tokens. In our research, we evaluate the fine-tuning of these LLMs across one, two, and three epochs. This model is a fine-tuned version of Rijgersberg/GEITje-7B-chat-v2 and has been fine-tuned for two epochs.
It achieves the following results on the evaluation set:
- Loss: 0.5796
Training and evaluation data
- The training data consists of 9900 documents and their labels formatted into conversations.
- The evaluation data consists of 1100 documents and their labels formatted into conversations.
Training procedure
See the GitHub for specifics about the training and the code.
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 1e-05
- train_batch_size: 2
- eval_batch_size: 8
- seed: 42
- gradient_accumulation_steps: 8
- total_train_batch_size: 16
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: cosine
- lr_scheduler_warmup_ratio: 0.1
- num_epochs: 2
Training results
| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 0.7664 | 0.1988 | 123 | 0.6890 |
| 0.6617 | 0.3976 | 246 | 0.6347 |
| 0.3825 | 0.5964 | 369 | 0.6028 |
| 0.4427 | 0.7952 | 492 | 0.5913 |
| 0.6739 | 0.9939 | 615 | 0.5906 |
| 0.4407 | 1.1939 | 738 | 0.5918 |
| 0.6671 | 1.3927 | 861 | 0.5835 |
| 0.4845 | 1.5915 | 984 | 0.5802 |
| 0.4699 | 1.7903 | 1107 | 0.5796 |
| 0.5434 | 1.9891 | 1230 | 0.5796 |
Training time: it took in total 1 hour and 36 minutes to fine-tune the model for two epochs.
Framework versions
- Transformers 4.41.1
- Pytorch 2.3.0+cu121
- Datasets 2.19.1
- Tokenizers 0.19.1
Acknowledgements
This model was trained as part of [insert thesis info] in collaboration with Amsterdam Intelligence for the City of Amsterdam.
- Downloads last month
- 2
Model tree for FemkeBakker/AmsterdamDocClassificationGEITje200T2Epochs
Base model
mistralai/Mistral-7B-v0.1