humanizer-tr / README.md
ekremcet's picture
Update README for standalone ekremcet/humanizer-tr (Qwen3-1.7B 4-bit ONNX)
76c05fd verified
|
Raw History Blame Contribute Delete
3.99 kB
---
language:
- tr
license: apache-2.0
base_model: Qwen/Qwen3-1.7B
library_name: transformers.js
pipeline_tag: text-generation
tags:
- turkish
- humanizer
- text-editing
- style-transfer
- qwen3
- onnx
- transformers.js
- webgpu
- conversational
---
# Humanizer TR (`ekremcet/humanizer-tr`)
A compact, browser-ready Turkish editorial text humanizer built on **Qwen3-1.7B**, exported as a single-file **4-bit FP16 ONNX (`onnx/model_q4f16.onnx`, 1.52 GB)** ready for **100% client-side WebGPU inference** via [`@huggingface/transformers`](https://huggingface.co/docs/transformers.js) as well as CPU/GPU inference via ONNX Runtime.
## Highlights
- **Runs locally in the browser:** Single-file `onnx/model_q4f16.onnx` (`1.52 GB`, 4-bit block-32 symmetric `MatMulNBits` quantization, FP16 KV-cache, FP32 logits) works out of the box with `Transformers.js` v3 WebGPU — text never leaves the user's device.
- **Clean editorial Turkish:** Strips markdown headings, bold spans, bullet lists, em-dashes, and AI clichés while keeping facts, numbers, dates, and negations intact.
- **Zero punctuation glitches & preserves human writing:** `0.0%` punctuation artifacts across all benchmarks and `0.998` E5 similarity (`100%` number retention) on human Turkish text.
## Benchmark Results
Evaluated on held-out Turkish benchmarks (60 samples per split, `max_new_tokens=1200`, `temperature=0.40`, judged by Qwen3.5-35B-A3B):
| Split (`n=60`) | Faithfulness | Turkish | Human-like | `all ≥ 4` | Markdown Leak | Bad Punct | Loops | E5 Sim | Num Ret |
|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
| **Held-out AI Dev** | **4.88** | **4.58** | **4.40** | **80.0%** | **0.0%** | **0.0%** | **0.0%** | 0.980 | **99.3%** |
| **Trendyol LLM** (unseen) | **4.72** | **4.48** | **4.33** | **78.3%** | **0.0%** | **0.0%** | 1.7% | 0.987 | **97.7%** |
| **Long Markdown Essays** (unseen) | **4.20** | **3.78** | **3.55** | **41.7%** | **1.7%** | **0.0%** | **0.0%** | 0.973 | 85.0% |
| **Human Turkish** (`n=40`, identity) | — | — | — | — | **0.0%** | **0.0%** | — | **0.998** | **100.0%** |
## Usage in the Browser (`@huggingface/transformers` + WebGPU)
```js
import { AutoTokenizer, AutoModelForCausalLM, TextStreamer } from "@huggingface/transformers";
const MODEL_ID = "ekremcet/humanizer-tr";
const SYSTEM_PROMPT =
"Sen Türkçe metinleri doğallaştıran deneyimli bir editörsün. Verilen metindeki tüm olguları, " +
"sayıları, tarihleri, özel adları ve olumsuzlukları %100 eksiksiz koruyarak; yapay zekâ " +
"kalıplarını, markdown başlık/kalın vurgu/madde listesi/uzun tire biçimlendirmesini ve klişe " +
"geçişleri kaldırıp metni gerçek bir insanın yazdığı doğal, düzgün ve akıcı Türkçeyle yeniden " +
"yaz. Yeni bilgi ekleme, anlamı değiştirme, açıklama yapma; yalnızca yeniden yazılmış metni döndür.";
const tokenizer = await AutoTokenizer.from_pretrained(MODEL_ID);
const model = await AutoModelForCausalLM.from_pretrained(MODEL_ID, {
dtype: "q4f16",
device: "webgpu",
});
const messages = [
{ role: "system", content: SYSTEM_PROMPT },
{ role: "user", content: "**Not:** 2026 yılında Türkiye ihracatı %8 arttı — bu önemli bir başarıdır." },
];
const inputs = tokenizer.apply_chat_template(messages, {
add_generation_prompt: true,
return_dict: true,
enable_thinking: false,
});
const streamer = new TextStreamer(tokenizer, { skip_prompt: true, skip_special_tokens: true });
await model.generate({
...inputs,
max_new_tokens: 1024,
do_sample: true,
temperature: 0.30,
top_p: 0.90,
repetition_penalty: 1.05,
streamer,
});
```
## Model Files
- `onnx/model_q4f16.onnx` (`1.52 GB`) — 4-bit block-32 symmetric `MatMulNBits` quantized ONNX graph with FP16 KV-cache (`kv_cache_dtype: float16`) and FP32 logits for browser WebGPU (`Transformers.js` v3) and ONNX Runtime.
- **Base model:** `Qwen/Qwen3-1.7B` (`enable_thinking=False`)
- **License:** Apache 2.0 (matching `Qwen/Qwen3-1.7B`).