Fix model loading from stream (#7067)

Fix bug introduced in 17913713b554d820a8ce94226d854b4a5f1d8bbc (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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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());
}
/**