New type annotation for serialize

This commit is contained in:
Samuel Sloniker 2022-12-23 10:33:56 -08:00
parent 7e7b5f3e9c
commit 9916744801
Signed by: kj7rrv
GPG Key ID: 1BB4029E66285A62

View File

@ -3,7 +3,7 @@
import gptc.tokenizer
from gptc.exceptions import InvalidModelError
import gptc.weighting
from typing import Iterable, Mapping, List, Dict, Union, cast
from typing import Iterable, Mapping, List, Dict, Union, cast, BinaryIO
import json
@ -76,7 +76,7 @@ class Model:
for index, category in enumerate(self.names)
}
def serialize(self, file):
def serialize(self, file: BinaryIO):
file.write(b"GPTC model v4\n")
file.write(
json.dumps(