Views
No views yet
grammarly/coedit-large, packaged for local seq2seq generation with Transformers.js and ONNX Runtime WebGPU.onnx/encoder_model.onnxonnx/decoder_model_merged.onnx1import {
2 AutoModelForSeq2SeqLM,
3 AutoTokenizer,
4} from "@huggingface/transformers";
5
6const modelId = "imrahamed/coedit-large-webgpu-onnx";
7const tokenizer = await AutoTokenizer.from_pretrained(modelId);
8const model = await AutoModelForSeq2SeqLM.from_pretrained(modelId, {
9 device: "webgpu",
10 dtype: "fp32",
11});
12
13const input = await tokenizer(
14 "Paraphrase the sentence: The application performs all inference locally.",
15);
16const output = await model.generate({
17 inputs: input.input_ids,
18 attention_mask: input.attention_mask,
19 max_new_tokens: 64,
20});
21console.log(tokenizer.decode(output.tolist()[0], {
22 skip_special_tokens: true,
23}));| Feature | Prompt |
|---|---|
| Grammar | Fix grammatical errors in this sentence: {text} |
| Formal | Make the sentence formal: {text} |
| Casual | Change the style to casual: {text} |
| Simplify | Make the sentence simpler: {text} |
| Rewrite | Paraphrase the sentence: {text} |
text2text-generation-with-pastO2