Use a context manager when reading model (fix
@@ -324,7 +324,8 @@ cdef class TrainablePipe(Pipe):
def load_model(p):
try:
- self.model.from_bytes(p.open("rb").read())
+ with open(p, "rb") as mfile:
+ self.model.from_bytes(mfile.read())
except AttributeError:
raise ValueError(Errors.E149) from None
