/ Модель

Характеристики

Контекст
128 токенов
Параметры
18 млн
Лицензия
Apache 2.0
Архитектура
urdu-english-words2sentence · dense
Библиотека
pytorch
Опубликована
19 ноя 2026

urdu-english-words2sentence-19m

Генерация текстаТекст → текст
259скачиваний за 30 дней0лайковвеса обновлены2 дек 2026

Описание модели

Составлено на русском по карточке модели и метаданным Hugging Face

Компактная модель генерирует предложение на урду по ключевым словам, а затем его английский эквивалент.

syedtaha22/urdu-english-words2sentence-19m — авторская небольшая модель на основе декодерного трансформера с 18,8 млн параметров. Она принимает от одного до четырёх ключевых слов на урду и генерирует предложение на урду, затем предложение на английском с тем же значением. Для урду используется общая матрица эмбеддингов и выходных весов, для английского — отдельная выходная матрица. Архитектура включает 8 слоёв, ширину 384, 6 голов внимания, RMSNorm, SwiGLU и обучаемые позиционные представления; родная длина контекста — 128 токенов.

Модель предназначена для построения коротких предложений по ключевым словам и создания параллельной английской версии. В карточке перечислены датасеты CC-100, Wikimedia Wikipedia и Tatoeba. Модель поддерживает смешанное использование урду и английского и распространяется под лицензией Apache-2.0. Это компактная специализированная модель; её качество за пределами формата «от одного до четырёх ключевых слов» и генерации коротких пар предложений карточкой не подтверждено.

Сценарии применения

  • Составление предложения на урду по одному или нескольким ключевым словам
  • Генерация английского перевода предложения на урду
  • Создание пар предложений на урду и английском для учебных материалов
  • Построение коротких примеров для двуязычных словарей

Ограничения

Модель рассчитана на вход из одного–четырёх ключевых слов и короткие предложения; родной контекст ограничен 128 токенами. Карточка не приводит оценок качества или результатов сравнительных тестов.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

Бенчмарки пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь рядом с другими моделями теста

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Текст» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы по шкале 0–100.

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

urdu-english-words2sentence-19m

A decoder-only transformer with 18.8 million parameters that writes an Urdu sentence from one to four Urdu keywords, and then the English sentence with the same meaning. One model and one set of weights write both languages. It extends urdu-words2sentence-17m.

Model

PropertyValue
ArchitectureDecoder-only transformer, pre-norm, RMSNorm, SwiGLU, learned positions, tied output head for Urdu, separate output head for English
Layers, width, heads8, 384, 6
Parameters18,819,456 (14,930,304 outside the embeddings)
Vocabulary10,000 pieces: 8000 Urdu pieces (SentencePiece, tokenizer.model) and 2000 English pieces (english_tokenizer.model)
Context128 tokens
Precisionfloat32 weights, 75 MB

The English pieces take the ids 8000 to 9999 (English piece id plus english_token_offset). The Urdu pieces and the end token use the tied embedding matrix as output matrix. The English pieces use the separate matrix english_head.weight.

Input and output format

The prompt is the BOS token, the keywords joined by +, and the <sep> token. The model writes the Urdu sentence, then the marker token (marker_token_id, the English BOS piece), then the English sentence, then the EOS token. config.json holds the token ids.

Usage

modeling.py holds the base model, joint.py the model with the English output matrix and generation.py the beam search. The beam search ends each sentence at the marker, and the English sentence is then written greedily.

import json
import sentencepiece as spm
from safetensors.torch import load_file

from generation import beam_search
from joint import JointTransformer, write_english

config = json.load(open("config.json"))
urdu = spm.SentencePieceProcessor(model_file="tokenizer.model")
english = spm.SentencePieceProcessor(model_file="english_tokenizer.model")
model = JointTransformer.from_state_dict(load_file("model.safetensors"))

offset, marker = config["english_token_offset"], config["marker_token_id"]
keywords = ["میں", "پانی", "چاہیے"]
prompt = [config["bos_token_id"], *urdu.encode(" + ".join(keywords)), config["sep_token_id"]]

beams = beam_search(model, prompt, marker, beams=5, max_new=40, length_alpha=0.7)

for tokens in beams[:3]:
    sentence = urdu.decode([t for t in tokens if t < offset])
    ids = write_english(model, prompt + urdu.encode(sentence) + [marker], config["eos_token_id"], 30)
    print(sentence, "|", english.decode([t - offset for t in ids]))

Output:

مجھے پانی چاہیے۔ | I need water.
مجھے پانی چاہیے، میں پانی چاہتا ہوں۔ | I need water, I want water.
مجھے پانی چاہیے ہے۔ | I need water.

The evaluation below used beam search with 5 beams and returned the three best sentences.

Browser use

The folder onnx/ holds the model for use in a web browser with ONNX Runtime Web.

FileContent
model.int8.onnxOne decoding step with 8-bit weights in the matrix multiplications (22.8 MB)
meta.jsonNumber of layers, heads, positions and vocabulary pieces, the id of <sep> and the file sizes
tokenizer.json, english_tokenizer.jsonThe pieces and scores of the two SentencePiece models, for a tokenizer in JavaScript

The graph takes the new tokens, the row of the cache that each beam continues (beam_idx) and the key and value tensors of the eight blocks (past_k_0, past_v_0 and so on). It returns the logits of the last position and the extended cache. The beam search and the English continuation run outside the graph. On the 125 cases the 8-bit graph reaches exact match at 3 of 0.736, and a request takes about 70 to 83 ms in WebAssembly on a laptop processor (two runs). The graph with float32 weights gave the same candidates as the PyTorch model on 250 requests.

Training

  1. Start from the weights of urdu-words2sentence-17m, which was pretrained on 280 million tokens of Urdu text and fine-tuned on keyword and sentence pairs.
  2. Fine-tune for 12 epochs on 20,929 pairs of keywords, Urdu sentence and English sentence, with learning rate 1e-3, dropout 0.2 and seed 1. The learning rate of the transformer blocks is 0.1 times the rate of the English parts (the English embedding rows and the English output matrix), and the Urdu embedding rows are kept fixed. This keeps the Urdu of the starting model.
  3. Keep the checkpoint with the lowest mean of the Urdu and the English validation loss (1.963 and 1.101).

The English sentences were written by gemma4:e4b for the Urdu sentences of the training pairs (19,423 of 19,479 distinct sentences, and pairs without an English sentence were not used for English). The model does not call gemma4:e4b when it runs.

Evaluation

The same 125 held-out keyword selections (93 Urdu, 32 code-mixed) as for the Urdu model. English exact match and word F1 compare the English sentence of the top Urdu sentence with the reference English sentences.

MetricSeed 1 (this model)Mean of seeds 0 to 3
Urdu exact match at 10.360
Urdu exact match at 30.7360.730 (sd 0.014)
Urdu cases, exact match at 30.8060.801
Code-mixed cases, exact match at 30.5310.523
English exact match0.5040.504
English word F10.7880.772
Latency, median of beam search and English39 ms

The Urdu-only model reaches exact match at 3 of 0.728. For the English sentence of the reference Urdu sentence, gemma4:e4b reaches exact match 0.520 and word F1 0.795 at a median of 589 ms.

Intended use and limitations

  • The sentences should be read and checked before they are used.
  • The model can leave out a keyword or add words that were not selected, in both languages.
  • The English sentence is written from the Urdu sentence. It can be wrong when the Urdu sentence is wrong.
  • The evaluation set is small (125 cases), so the numbers carry wide uncertainty.
  • The English sentences are from a language model, so the model reproduces that model's phrasing.
  • The model was trained on one to four keywords from a fixed set of Urdu labels. Other inputs are outside what it was trained on.

Data

Pretraining text: CC-100 (Urdu), Urdu Wikipedia (wikimedia/wikipedia, snapshot 20231101.ur) and Tatoeba. Fine-tuning pairs: keyword selections with an Urdu sentence from Tatoeba, web sentences and sentences written by gemma4:e4b, and English sentences written by gemma4:e4b. The data and the code are in https://github.com/syedtaha22/goyai-experiments, folder models/.

License

Apache License 2.0. The text is in LICENSE, and the sources of the training text are credited in NOTICE.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · pytorch

Можно запустить

Подбираем GPU…

Класс архитектуры
JointTransformer
Ревизия весов
9296359

0 моделей