Skip to content

Remove java.io.Serializable #389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Craigacp
Copy link
Member

@Craigacp Craigacp commented Jan 10, 2025

Description

Removes support for java.io.Serializable from all main Tribuo types. The only supported serialization mechanism is protobuf. Fixes #391.

Motivation

java.io.Serializable makes it difficult to migrate classes.

@Craigacp Craigacp added the Oracle employee This PR is from an Oracle employee label Jan 10, 2025
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jan 10, 2025
throw new IllegalArgumentException("Unknown class in serialised model", e);
}
}
Model<?> tmpModel = Model.deserializeFromFile(modelPath);
Model<Label> model = tmpModel.castModel(Label.class);
logger.info(String.format("Loading data from %s", datasetPath));
Dataset<Label> test;
switch (o.inputFormat) {
case SERIALIZED:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this kind of a breaking change? Code that previously expected java serialization would not inadvertently be using a proto serialization path.

/**
* Load in the model in protobuf format.
*/
@Option(longName = "protobuf-model", usage = "Load the model from a protobuf. Optional")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again isn't this a breaking change? Code that was using this arg will now crash, even though it was doing things the 'right' way

@@ -217,30 +210,6 @@ public <T extends Output<T>> Pair<Dataset<T>,Dataset<T>> load(OutputFactory<T> o
char separator;
switch (inputFormat) {
case SERIALIZED:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another breaking change, as above

/**
* Is the model stored in protobuf format?
*/
@Option(longName="model-protobuf",usage="Is the model stored in protobuf format?")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another breaking change as the option one above

/**
* Is the serialized dataset in protobuf format?
*/
@Option(longName="dataset-protobuf",usage="Is the serialized dataset a protobuf?")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ibid

/**
* Read and write protobuf formatted models.
*/
@Option(longName = "model-protobuf", usage = "Read and write protobuf formatted models.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breaking change

Copy link
Member

@JackSullivan JackSullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a couple of places here where behavior changes for people who were already using protobuf models. We should think about how to handle that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement. Oracle employee This PR is from an Oracle employee
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove all uses of java.io.Serializable
2 participants