replicate/replicate-python

Invalid version: 'dev'

nguyenquocthaoolli opened this issue · 3 comments

Step:
python

output = replicate.run(
        "paper11667/clipstyler:f2d6b24e6002f25f77ae89c2b0a5987daa6d0bf751b858b94b8416e8542434d1",
        input={
        "image":"https://replicate.delivery/mgxm/e4500aa0-f71b-42ff-a540-aadb44c8d1b2/face.jpg",
        "text":"sketch with crayon",
        "iterations":10
    }
        )

Expected: run normally
Error: raise Exception "Invalid version: 'dev'"

mattt commented

Thanks for reporting this, @nguyenquocthaoolli. The exception is being raised because that specific version of paper11667/clipstyler was built with an invalid version of Cog:

'cog_version': 'dev'
Full JSON response ``` {'id': 'f2d6b24e6002f25f77ae89c2b0a5987daa6d0bf751b858b94b8416e8542434d1', 'created_at': '2022-03-16T00:35:56.210272Z', 'cog_version': 'dev', 'openapi_schema': {'info': {'title': 'Cog', 'version': '0.1.0'}, 'paths': {'/': {'get': {'summary': 'Root', 'responses': {'200': {'content': {'application/json': {'schema': {}}}, 'description': 'Successful Response'}}, 'operationId': 'root__get'}}, '/predictions': {'post': {'summary': 'Predict', 'responses': {'200': {'content': {'application/json': {'schema': {'$ref': '#/components/schemas/Response'}}}, 'description': 'Successful Response'}, '422': {'content': {'application/json': {'schema': {'$ref': '#/components/schemas/HTTPValidationError'}}}, 'description': 'Validation Error'}}, 'description': 'Run a single prediction on the model.', 'operationId': 'predict_predictions_post', 'requestBody': {'content': {'application/json': {'schema': {'$ref': '#/components/schemas/Request'}}}}}}}, 'openapi': '3.0.2', 'components': {'schemas': {'Input': {'type': 'object', 'title': 'Input', 'required': ['image', 'text'], 'properties': {'text': {'type': 'string', 'title': 'Text', 'x-order': 1, 'description': 'text for style transfer'}, 'image': {'type': 'string', 'title': 'Image', 'format': 'uri', 'x-order': 0, 'description': 'Input image (will be cropped before style transfer)'}, 'iterations': {'type': 'integer', 'title': 'Iterations', 'default': 100, 'x-order': 2, 'description': 'training iterations'}}}, 'Output': {'type': 'array', 'items': {'type': 'string', 'format': 'uri'}, 'title': 'Output'}, 'Status': {'enum': ['processing', 'success', 'failed'], 'type': 'string', 'title': 'Status', 'description': 'An enumeration.'}, 'Request': {'type': 'object', 'title': 'Request', 'properties': {'input': {'$ref': '#/components/schemas/Input'}, 'output_file_prefix': {'type': 'string', 'title': 'Output File Prefix'}}}, 'Response': {'type': 'object', 'title': 'Response', 'required': ['status'], 'properties': {'error': {'type': 'string', 'title': 'Error'}, 'output': {'$ref': '#/components/schemas/Output'}, 'status': {'$ref': '#/components/schemas/Status'}}, 'description': 'The status of a prediction.'}, 'ValidationError': {'type': 'object', 'title': 'ValidationError', 'required': ['loc', 'msg', 'type'], 'properties': {'loc': {'type': 'array', 'items': {'type': 'string'}, 'title': 'Location'}, 'msg': {'type': 'string', 'title': 'Message'}, 'type': {'type': 'string', 'title': 'Error Type'}}}, 'HTTPValidationError': {'type': 'object', 'title': 'HTTPValidationError', 'properties': {'detail': {'type': 'array', 'items': {'$ref': '#/components/schemas/ValidationError'}, 'title': 'Detail'}}}}}}} ```

The exception is being raised when we try to parse that version as a valid SemVer here:

return version.parse(cog_version) < version.parse("0.3.9")

This should be an easy fix, and I'll get working on this now.

mattt commented

@nguyenquocthaoolli This should be fixed in 0.15.2. Please upgrade your installation of the replicate package and let me know if you're still having this issue. Thanks!

Thank you for quick response