Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public InferenceResults processResult(TokenizationResult tokenization, PyTorchIn
if (pyTorchResult.getInferenceResult().length % 2 != 0) {
throw new ElasticsearchStatusException(
"question answering result has invalid dimension, number of dimensions must be a multiple of 2 found [{}]",
RestStatus.INTERNAL_SERVER_ERROR,
RestStatus.CONFLICT,
pyTorchResult.getInferenceResult().length
);
}
Expand All @@ -138,7 +138,7 @@ public InferenceResults processResult(TokenizationResult tokenization, PyTorchIn
if (numberOfSpans != tokensList.size()) {
throw new ElasticsearchStatusException(
"question answering result has invalid dimensions; the number of spans [{}] does not match batched token size [{}]",
RestStatus.INTERNAL_SERVER_ERROR,
RestStatus.CONFLICT,
numberOfSpans,
tokensList.size()
);
Expand All @@ -153,7 +153,7 @@ public InferenceResults processResult(TokenizationResult tokenization, PyTorchIn
if (starts.length != ends.length) {
throw new ElasticsearchStatusException(
"question answering result has invalid dimensions; start positions [{}] must equal potential end [{}]",
RestStatus.INTERNAL_SERVER_ERROR,
RestStatus.CONFLICT,
starts.length,
ends.length
);
Expand Down Expand Up @@ -222,7 +222,7 @@ static void topScores(
if (start.length != end.length) {
throw new ElasticsearchStatusException(
"question answering result has invalid dimensions; possible start tokens [{}] must equal possible end tokens [{}]",
RestStatus.INTERNAL_SERVER_ERROR,
RestStatus.CONFLICT,
start.length,
end.length
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static InferenceResults processResult(
if (result.length != labels.size()) {
throw new ElasticsearchStatusException(
"Expected exactly [{}] values in text classification result; got [{}]",
RestStatus.INTERNAL_SERVER_ERROR,
RestStatus.CONFLICT,
labels.size(),
result.length
);
Expand All @@ -108,7 +108,7 @@ static InferenceResults processResult(
Map<Integer, List<TokenizationResult.Tokens>> windowedSeq = tokenization.getTokensBySequenceId();
// TODO adjust logic when batch is allowed
if (windowedSeq.size() > 1) {
throw new ElasticsearchStatusException("Unexpected batch input for text classification", RestStatus.INTERNAL_SERVER_ERROR);
throw new ElasticsearchStatusException("Unexpected batch input for text classification", RestStatus.CONFLICT);
}
double[] normalizedScores = new double[labels.size()];
for (int i = 0; i < pyTorchResult.getInferenceResult()[0].length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public InferenceResults processResult(TokenizationResult tokenization, PyTorchIn
if (result.length != 1) {
throw new ElasticsearchStatusException(
"Expected exactly [1] value in text_similarity result; got [{}]",
RestStatus.INTERNAL_SERVER_ERROR,
RestStatus.CONFLICT,
result.length
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public InferenceResults processResult(TokenizationResult tokenization, PyTorchIn
if (pyTorchResult.getInferenceResult()[0].length != labels.length) {
throw new ElasticsearchStatusException(
"Expected exactly [{}] values in zero shot classification result; got [{}]",
RestStatus.INTERNAL_SERVER_ERROR,
RestStatus.CONFLICT,
labels.length,
pyTorchResult.getInferenceResult().length
);
Expand All @@ -160,7 +160,7 @@ public InferenceResults processResult(TokenizationResult tokenization, PyTorchIn
if (vals.length != 3) {
throw new ElasticsearchStatusException(
"Expected exactly [{}] values in inner zero shot classification result; got [{}]",
RestStatus.INTERNAL_SERVER_ERROR,
RestStatus.CONFLICT,
3,
vals.length
);
Expand All @@ -177,7 +177,7 @@ public InferenceResults processResult(TokenizationResult tokenization, PyTorchIn
if (vals.length != 3) {
throw new ElasticsearchStatusException(
"Expected exactly [{}] values in inner zero shot classification result; got [{}]",
RestStatus.INTERNAL_SERVER_ERROR,
RestStatus.CONFLICT,
3,
vals.length
);
Expand Down