diff --git a/js/js.go b/js/js.go index 209b4a2..990c238 100644 --- a/js/js.go +++ b/js/js.go @@ -8,7 +8,7 @@ import ( "log" ) -var encoder = gpt_bpe.GPT2Encoder +var encoder gpt_bpe.GPTEncoder func Tokenize(text string) gpt_bpe.Tokens { return *encoder.Encode(&text) @@ -20,6 +20,7 @@ func Decode(arr []byte) string { } func init() { + encoder = gpt_bpe.NewGPT2Encoder() js.Module.Get("exports").Set("decode", Decode) js.Module.Get("exports").Set("tokenize", Tokenize) log.Printf("GPT-2 BPE Decoder Loaded")