Skip to content

Commit

Permalink
Fix string UTF-8 misformatting PANIC
Browse files Browse the repository at this point in the history
  • Loading branch information
Peiyang-Song committed Aug 14, 2024
1 parent d7ad9f5 commit 7e4910c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion LeanCopilot/Models/ByT5.lean
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,9 @@ def tokenize (text : String) : Array String :=


def detokenize (tokens : Array String) : String :=
String.fromUTF8! ⟨tokens.map tokenToByte!⟩
match (String.fromUTF8? ⟨tokens.map tokenToByte!⟩) with
| some s => s
| none => ""


def eosToken := "</s>"
Expand Down

0 comments on commit 7e4910c

Please sign in to comment.