Fix model loading from stream (#7067)

Fix bug introduced in 17913713b5 (allow loading from byte array)

When loading model from stream, only last buffer read from the input stream is used to construct the model.

This may work for models smaller than 1 MiB (if you are lucky enough to read the whole model at once), but will always fail if the model is larger.
This commit is contained in:
Martin Petříček
2021-08-15 15:04:33 +02:00
committed by GitHub
parent 6bcbc77226
commit 46c46829ce

View File

@@ -61,7 +61,7 @@ public class XGBoost {
os.write(buf, 0, size);
}
in.close();
return Booster.loadModel(buf);
return Booster.loadModel(os.toByteArray());
}
/**