Skip to content

Instantly share code, notes, and snippets.

@veer66
Created July 15, 2021 09:16
Show Gist options
  • Save veer66/5eac891a66cc16d591c758308d48bee2 to your computer and use it in GitHub Desktop.
Save veer66/5eac891a66cc16d591c758308d48bee2 to your computer and use it in GitHub Desktop.
import torch
from attacut import Tokenizer
tok = Tokenizer()
txt = "กาก้ากูกู้"
tokens, features = tok.dataset.make_feature(txt)
inputs = (features, torch.Tensor(0))
x, _, _ = tok.dataset.prepare_model_inputs(inputs)
m = torch.jit.trace(tok.model, (x,))
m.save("attacut-sc.pt")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment