Translation
Transformers
Safetensors
Polish
German
marian
text2text-generation

Model Card for Model ID

Input = Polish toponym (say Stare Miasto, literally Old city)

Output = Equivalent toponym (say Altstadt, meaning Old city)

Table of sample outputs at the bottom

Inference Code

from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
import torch

model_path = "DebasishDhal99/polish-to-german-toponym-model-opus-mt-pl-de"

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

model = AutoModelForSeq2SeqLM.from_pretrained(model_path).to(device)
tokenizer = AutoTokenizer.from_pretrained(model_path)

polish_name = "Stare miasteczko" #Change this to any polish place name

inputs = tokenizer(polish_name, return_tensors="pt", padding=True, truncation=True)
inputs = {k: v.to(device) for k, v in inputs.items()}

with torch.no_grad():
    outputs = model.generate(**inputs, max_length=50)

german_name = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(german_name)

Model Details

  • Total epochs = 10

  • Loss data

    • Epoch 1/10, Loss: 0.1758
    • Epoch 2/10, Loss: 0.0997
    • Epoch 3/10, Loss: 0.0810
    • Epoch 4/10, Loss: 0.0673
    • Epoch 5/10, Loss: 0.0556
    • Epoch 6/10, Loss: 0.0455
    • Epoch 7/10, Loss: 0.0364
    • Epoch 8/10, Loss: 0.0298
    • Epoch 9/10, Loss: 0.0246
    • Epoch 10/10, Loss: 0.0197
  • Time = Approx. 30 minutes

  • Device = 1 × P100 (Available on Kaggle)

  • Further training is needed for better performance, I'll make one more such model with more epochs.

Output Samples

Polish Input German Output Notes
Warszawa Warschau Accurate, Capital of Poland
Kraków Krakau Accurate, Historical City
Poznań Posen Accurate, Port City
Stare Miasteczko Ebersberg Inaccurate, "Stare Miasteczko" means "Old Town"
Stary rynek Altmarker Accurate, means "Old Market"
Szczecin Stettin Accurate, Historic name for Szczecin
Olsztyn Ellerstein Inaccurate, correct name is "Allenstein"
Rybowo Riebowen Inaccurate, Fischdorf would be more accurate
Głogowo Gögenhagen Inaccurate, historical translation is Glogau
Wrocław Breslau Accurate, Historic German name for Wrocław
Downloads last month
44
Safetensors
Model size
75.1M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 1 Ask for provider support

Model tree for DebasishDhal99/polish-to-german-toponym-model-opus-mt-pl-de

Finetuned
(1)
this model

Datasets used to train DebasishDhal99/polish-to-german-toponym-model-opus-mt-pl-de

Space using DebasishDhal99/polish-to-german-toponym-model-opus-mt-pl-de 1