File size: 2,513 Bytes
489e3fa
264e02e
489e3fa
 
 
 
 
 
 
 
264e02e
 
 
 
 
 
9a7baaa
 
 
 
 
 
 
 
 
264e02e
 
9a7baaa
264e02e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7c4332a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
title: Fine-Tuning Service
emoji: 🦀
colorFrom: green
colorTo: yellow
sdk: docker
pinned: false
license: other
---

# Pimcore Fine-Tuning Service

This app provides endpoints to showcase fine-tuning of models for image and text classification tasks.
It is possible to execute one training at a time and to get status information via the `/get_training_status` endpoint.
Via the `/stop_training` endpoint stopping the currently running training is possible. After the training, the fine-tuned model is uploaded to huggingface hub. 

![Swagger UI](./docs/swagger.png)

Further details for parameters of the endpoints see: https://your-domain/docs

## Deployments
This app can be deployed on hugging face spaces or run on any docker environment. Regardless on the infrastructure, it is recommended to use GPUs for executing the trainings. 
- Hugging face spaces: Duplicate the space and run it on a GPU. 
- Docker environments: Use the docker-compose file in the repository to run the app locally. 

## Neccesary Environment Variables
- `AUTHENTICATION_TOKEN`: Secret that is necessary to authorize calling the apps endpoints. 
   When running as private hugging face space, this needs to be the same as a hugging face token. 
- `HUGGINGFACE_TOKEN`: Huggingface token to be used for accessing the huggingface hub and uploading the models. 
- `HUGGINGFACE_ORGANIZATION`: Organization to be used for uploading the fine-tuned models.

## Image Classification

Use `/training/image_classification` for fine tuning a model for image classification tasks. 

#### Important Parameters 
- `training_data_zip`: The ZIP file containing the training data, with a folder per class which contains images belonging to that class.
- `project_name`: The name of the project. Will also be used as name of resulting model that will be created after fine tuning and as the name of the repository at huggingface.
- `source_model_name`: The source model to be used as basis for fine tuning. 


## Text Classification 
Use `/training/text_classification` for fine tuning a model for text classification tasks. 

#### Important Parameters 
- `training_data_csv`: The CSV file containing the training data, necessary columns `value` (text data) and `target` (classification).
- `project_name`: The name of the project. Will also be used as name of resulting model that will be created after fine tuning and as the name of the repository at huggingface.
- `source_model_name`: The source model to be used as basis for fine tuning.