diff --git a/src/eynollah/predictor.py b/src/eynollah/predictor.py index 6b7fe96..9121ffe 100644 --- a/src/eynollah/predictor.py +++ b/src/eynollah/predictor.py @@ -195,6 +195,10 @@ class Predictor(mp.context.SpawnProcess): # convert tf.string/np.object to fixed-length bytes # (because object segfaults in shm) if x.dtype is np.dtype(object): + # ONNX conversion for some reason decodes bytes into str already + # so here we undo this, too + if x[0].dtype is np.dtype(object) and isinstance(x[0, 0], str): + x = np.char.encode(x.astype(str), 'utf-8') return x.astype(bytes) return x if isinstance(result, (list, tuple)):