EDAN20 lab 6: Swedish β†’ English character-level transformer

These are the weights for an encoder-decoder transformer (nn.Transformer with shared, weight-tied character embeddings) from the notebook 17_02_translation_transformer_shared_embs.ipynb in Python for Natural Language Processing (P. Nugues). The model was trained on the Tatoeba swe-eng pairs from manythings.org/anki.

File Build d_model Layers (enc+dec) FF Heads Max len Params Epochs Val. acc. BLEU
gpu_model.pth + gpu_translator.vocab GPU (RTX 5070 Ti) 512 3+3 2048 8 122 22.1 M 80 0.913 0.505
pico_model.pth + pico_translator.vocab Laptop CPU 256 2+2 1024 8 62 3.7 M 5 0.637 0.043

The .vocab files are JSON token2idx maps: characters, plus <pad>=0, <unk>=1, <s>=2 and </s>=3. Decoding is greedy, one character at a time.

Demo: https://huggingface.co/spaces/IsacEP/swe-eng-pico-translator

Browser version

gpu.npz/gpu.json and laptop.npz/laptop.json contain the same weights as NumPy arrays (float32), plus a config with the vocabulary. The static demo loads them and runs a NumPy re-implementation of the model in the browser through Pyodide. It gives the same translations as the PyTorch model. fc.weight is left out because it is tied to embedding.input_embedding.weight.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Space using IsacEP/edan20-lab6-swe-eng-translator 1