Clarifai/clarifai-java

[BUG] exception thrown for requests to NSFW model

peterlitvak opened this issue · 0 comments

Our tests started failing with requests to NSFW model with the following:

clarifai2.exception.ClarifaiException: Deserialization of UNKNOWN is not implemented
	at clarifai2.dto.model.output.ClarifaiOutput.deserializePredictions(ClarifaiOutput.java:120)
	at clarifai2.dto.model.output.ClarifaiOutput.deserialize(ClarifaiOutput.java:56)
	at clarifai2.api.request.model.PredictRequest$1.unmarshalerGrpc(PredictRequest.java:166)
	at clarifai2.api.request.model.PredictRequest$1.unmarshalerGrpc(PredictRequest.java:114)
	at clarifai2.api.request.ClarifaiRequest$Impl.executeSync(ClarifaiRequest.java:310)
	at clarifai2.api.request.ClarifaiRequest$Builder.executeSync(ClarifaiRequest.java:211)

We are using the following Clarifai client:

<dependency>
    <groupId>com.clarifai.clarifai-api2</groupId>
    <artifactId>core</artifactId>
    <version>2.8.1</version>
</dependency>

This happens in response to the following call:

clarifaiClient
    .getDefaultModels()
    .nsfwModel()
    .predict()
    .withInputs(images.stream().map(ClarifaiInput::forImage).collect(Collectors.toList()))
    .executeSync();

The response JSON comes as valid, however the model/output_info section seems to be empty:

"model": {
        "id": "e9576d86d2004ed1a38ba0cf39ecb4b1",
        "name": "nsfw-v1.0",
        "createdAt": "2016-09-17T22:18:59.955626Z",
        "appId": "main",
        "outputInfo": {
          "outputConfig": {
          },
          "message": "Show output_info with: GET /models/{model_id}/output_info"
        },
        "modelVersion": {
          "id": "aa47919c9a8d4d94bfa283121281bcc4",
          "createdAt": "2018-01-23T19:25:09.618692Z",
          "status": {
            "code": "MODEL_TRAINED",
            "description": "Model is trained and ready"
          }
        },
        "displayName": "nsfw-v1-visual-classifier"
      }

Which causes the above exception during parcing.

This started happening 12/20/2021 before that everything was working fine.