Downloads · 30 days
19
5% of all-time downloads
amunozo/pixel-base-german
pixel-base-german is a machine learning model from amunozo. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
pixel-base-german is a PIXEL model trained on the German DBMDZ BERT Corpus.
Downloads · 30 days
19
5% of all-time downloads
All-time downloads
351
Public
Repo size
914 MB
Likes
2
Public
Click a slice to open those files.
.bin449 MB · 97%
From the Hugging Face model README
pixel-base-german is a PIXEL model trained on the German DBMDZ BERT Corpus.
We trained the model using the architecture and codebase proposed in the 2023 Rust et al. paper Language Modelling with Pixels.
This German model was introduced and evaluated in the paper Evaluating Pixel Language Models on Non-Standardized Languages, presented at COLING 2025.
Description from https://huggingface.co/Team-PIXEL/pixel-base
PIXEL consists of three major components: a text renderer, which draws text as an image; an encoder, which encodes the unmasked regions of the rendered image; and a decoder, which reconstructs the masked regions at the pixel level. It is built on ViT-MAE.
During pretraining, the renderer produces images containing the training sentences. Patches of these images are linearly projected to obtain patch embeddings (as opposed to having an embedding matrix like e.g. in BERT), and 25% of the patches are masked out. The encoder, which is a Vision Transformer (ViT), then only processes the unmasked patches. The lightweight decoder with hidden size 512 and 8 transformer layers inserts learnable mask tokens into the encoder's output sequence and learns to reconstruct the raw pixel values at the masked positions.
After pretraining, the decoder can be discarded leaving an 86M parameter encoder, upon which task-specific classification heads can be stacked. Alternatively, the decoder can be retained and PIXEL can be used as a pixel-level generative language model (see Figures 3 and 6 in the paper for examples).
For more details on how PIXEL works, please check the paper and the codebase linked above.
This model has been trained renderized German text from https://huggingface.co/datasets/stefan-it/german-dbmdz-bert-corpus.
The following hyperparameters were used during training:
Before being able to use this model, it is necessary to clone and configure the codebase.
Instructions from https://github.com/xplip/pixel
This codebase is built on Transformers for PyTorch. We also took inspiration from the original ViT-MAE codebase. The default font GoNotoCurrent.ttf that we used for all experiments is a merged Noto font built with go-noto-universal.
You can set up this codebase as follows to get started with using PIXEL models:
<details> <summary><i>Show Instructions</i></summary> git clone https://github.com/xplip/pixel.git
cd pixel
git submodule update --init --recursive
conda create -n pixel-env python=3.9
conda activate pixel-env
conda install pytorch torchvision cudatoolkit=11.3 -c pytorch
conda install -c conda-forge pycairo pygobject manimpango
pip install --upgrade pip
pip install -r requirements.txt
pip install ./datasets
pip install -e .
git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
# Create a folder in which we keep the data
mkdir -p data
# Get and extract the UD data for parsing and POS tagging
wget -qO- https://lindat.mff.cuni.cz/repository/xmlui/bitstream/handle/11234/1-4758/ud-treebanks-v2.10.tgz | tar xvz -C data
python scripts/training/run_pos.py \
--model_name_or_path="Team-PIXEL/pixel-base-finetuned-pos-ud-vietnamese-vtb" \
--data_dir="data/ud-treebanks-v2.10/UD_Vietnamese-VTB" \
--remove_unused_columns=False \
--output_dir="sanity_check" \
--do_eval \
--max_seq_length=256 \
--overwrite_cache
If everything is configured correctly, you should expect to see results similar to the following:
***** eval metrics *****
eval_accuracy = 0.8632
eval_loss = 1.2375
</details>
Once everything is set up properly, pixel-base-german can be used with the codebase. To load the model:
from pixel import PIXELConfig, PIXELForPreTraining
config = PIXELConfig.from_pretrained("amunozo/pixel-base-german")
model = PIXELForPreTraining.from_pretrained("amunozo/pixel-base-german", config=config)
@inproceedings{munoz-ortiz-etal-2025-evaluating,
title = "Evaluating Pixel Language Models on Non-Standardized Languages",
author = "Mu{\~n}oz-Ortiz, Alberto and Blaschke, Verena and Plank, Barbara",
editor = "Rambow, Owen and Wanner, Leo and Apidianaki, Marianna and Al-Khalifa, Hend and Eugenio, Barbara Di and Schockaert, Steven",
booktitle = "Proceedings of the 31st International Conference on Computational Linguistics",
month = jan,
year = "2025",
address = "Abu Dhabi, UAE",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2025.coling-main.427/",
pages = "6412--6419",
}
This work was funded by the European Research Council (ERC) Consolidator Grant DIALECT 101043235; SCANNER-UDC (PID2020-113230RB-C21) funded by MICIU/AEI/10.13039/501100011033; Xunta de Galicia (ED431C 2024/02); GAP (PID2022-139308OA-I00) funded by MICIU/AEI/10.13039/501100011033/ and by ERDF, EU; Grant PRE2021-097001 funded by MICIU/AEI/10.13039/501100011033 and by ESF+ (predoctoral training grant associated to project PID2020-113230RB-C21); LATCHING (PID2023-147129OB-C21) funded by MICIU/AEI/10.13039/501100011033 and ERDF; and Centro de Investigación de Galicia ‘‘CITIC’’, funded by the Xunta de Galicia through the collaboration agreement between the Consellería de Cultura, Educación, Formación Profesional e Universidades and the Galician universities for the reinforcement of the research centres of the Galician University System (CIGUS).