Model schema is invalid: invalid components: schema "Output": extra sibling fields: [title]
I am attempting to push a new model to Replicate, but it's failing during the schema validation stage.
Validating model schema...
ⅹ Model schema is invalid: invalid components: schema "Output": extra sibling fields: [title]
The output model used is:
class ModelOutput(BaseModel):
preview: str
srt_file: Path
vtt_file: Path
Looking at the cog source, it seems it generates a schema based on the model output, and each field includes a title field:
"properties":{"preview":{"title":"Preview","type":"string"},"srt_file": etc..
But the validator is complaining about this field.
What can I do to resolve this?
Having the same issue today. An update would be appreciated.
Having the same issue today. An update would be appreciated.
I was able to "solve" it, by downgrading to version 0.8.3
@stri8ed could you state how you downgraded to 0.8.3? I've been trying with brew and it just keeps throwing other errors.
@xaksis I am on Linux (via Windows WSL), so used curl:
sudo curl -o /usr/local/bin/cog -L "https://github.com/replicate/cog/releases/download/v0.8.3/cog_$(uname -s)_$(uname -m)"
sudo chmod +x /usr/local/bin/cog
Got same error as below Validating model schema...
ⅹ Model schema is invalid: invalid components: schema "Output": extra sibling fields: [title]
ⅹ
ⅹ {"components":{"schemas":{"Embedding":{"properties":{"embedding":{"items":{"type":"number"},"title":"Embedding","type":"array"},"shape":{"items":{"type":"integer"},"title":"Shape","type":"array"}},"required":["shape","embedding"],"title":"Embedding","type":"object"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"title":"Detail","type":"array"}},"title":"HTTPValidationError","type":"object"},"Input":{"properties":{"source_image":{"description":"input image file handler","format":"uri","title":"Source Image","type":"string","x-order":0}},"required":["source_image"],"title":"Input","type":"object"},"Output":{"$ref":"#/components/schemas/Embedding","title":"Output"},"PredictionRequest":{"properties":{"created_at":{"format":"date-time","title":"Created At","type":"string"},"id":{"title":"Id","type":"string"},"input":{"$ref":"#/components/schemas/Input"},"output_file_prefix":{"title":"Output File Prefix","type":"string"},"webhook":{"format":"uri","maxLength":65536,"minLength":1,"title":"Webhook","type":"string"},"webhook_events_filter":{"default":["start","output","logs","completed"],"items":{"$ref":"#/components/schemas/WebhookEvent"},"type":"array"}},"title":"PredictionRequest","type":"object"},"PredictionResponse":{"properties":{"completed_at":{"format":"date-time","title":"Completed At","type":"string"},"created_at":{"format":"date-time","title":"Created At","type":"string"},"error":{"title":"Error","type":"string"},"id":{"title":"Id","type":"string"},"input":{"$ref":"#/components/schemas/Input"},"logs":{"default":"","title":"Logs","type":"string"},"metrics":{"title":"Metrics","type":"object"},"output":{"$ref":"#/components/schemas/Output"},"started_at":{"format":"date-time","title":"Started At","type":"string"},"status":{"$ref":"#/components/schemas/Status"},"version":{"title":"Version","type":"string"}},"title":"PredictionResponse","type":"object"},"Status":{"description":"An enumeration.","enum":["starting","processing","succeeded","canceled","failed"],"title":"Status","type":"string"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"WebhookEvent":{"description":"An enumeration.","enum":["start","output","logs","completed"],"title":"WebhookEvent","type":"string"}}},"info":{"title":"Cog","version":"0.1.0"},"openapi":"3.0.2","paths":{"/":{"get":{"operationId":"root__get","responses":{"200":{"content":{"application/json":{"schema":{"title":"Response Root Get"}}},"description":"Successful Response"}},"summary":"Root"}},"/health-check":{"get":{"operationId":"healthcheck_health_check_get","responses":{"200":{"content":{"application/json":{"schema":{"title":"Response Healthcheck Health Check Get"}}},"description":"Successful Response"}},"summary":"Healthcheck"}},"/predictions":{"post":{"description":"Run a single prediction on the model","operationId":"predict_predictions_post","parameters":[{"in":"header","name":"prefer","required":false,"schema":{"title":"Prefer","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PredictionRequest"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PredictionResponse"}}},"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation Error"}},"summary":"Predict"}},"/predictions/{prediction_id}":{"put":{"description":"Run a single prediction on the model (idempotent creation).","operationId":"predict_idempotent_predictions__prediction_id__put","parameters":[{"in":"path","name":"prediction_id","required":true,"schema":{"title":"Prediction ID","type":"string"}},{"in":"header","name":"prefer","required":false,"schema":{"title":"Prefer","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PredictionRequest"}],"title":"Prediction Request"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PredictionResponse"}}},"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation Error"}},"summary":"Predict Idempotent"}},"/predictions/{prediction_id}/cancel":{"post":{"description":"Cancel a running prediction","operationId":"cancel_predictions__prediction_id__cancel_post","parameters":[{"in":"path","name":"prediction_id","required":true,"schema":{"title":"Prediction ID","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"title":"Response Cancel Predictions Prediction Id Cancel Post"}}},"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation Error"}},"summary":"Cancel"}},"/shutdown":{"post":{"operationId":"start_shutdown_shutdown_post","responses":{"200":{"content":{"application/json":{"schema":{"title":"Response Start Shutdown Shutdown Post"}}},"description":"Successful Response"}},"summary":"Start Shutdown"}}}}
Does 0.8.6 cog fix it? Do I have to downgrade to 0.8.3?
6 weeks later, this seems to still be happening. To replicate (hah) - clone and try to push the Bark repo: https://replicate.com/suno-ai/bark
Gives the same error as above.
I was also able to eliminate the error in 0.8.6 by not using the BaseModel in my output class so that seems to be the culprit. Instead I consolidated multiple Paths into a single zip file:
# Started with this non-working version
class ModelOutput(BaseModel):
prompt_npz: Optional[Path]
audio_out: Path
class Predictor(BasePredictor):
# setup code
def predict(.....) -> ModelOutput
# Non-ideal but working version
class Predictor(BasePredictor):
# setup code
def predict(.....) -> Path
had the same problem with -
class MattingOutput(BaseModel):
success: bool
error: Optional[str]
segmentedImage: Optional[Path]
renaming MattingOutput to Output fixed it for me
A gentler error message from cog/replicate would be useful, since this is an easy fix once you find this github issue.
renaming MattingOutput to Output fixed it for me
Same here
Confirmed workaround:
renaming MattingOutput to Output fixed it for me
looking into the issue
Same here with bark model ( https://github.com/chenxwh/bark.git ). Any solutions? There's no just "Output" or "Matting".
Same here with bark model ( https://github.com/chenxwh/bark.git ). Any solutions? There's no just "Output" or "Matting".
@trogwarz The fix has been merged into mainline. The bark model build is ok:
bark$ cog build
....
=> => naming to docker.io/library/cog-bark 0.0s
Validating model schema...
Adding labels to image...
Unable to determine Git tag
Image built as cog-bark
$ cog --version
cog version v0.9.5+dev
This new cog v0.9.5 has not been released yet. @nickstenning - this issue should be closed.
Meanwhile you could try to build cog yourself.
Interesting, because i'm using exactly v0.9.5.
Prerequisites:
brew install cog
cog --version # cog version 0.9.5 (built 2024-03-15T18:18:50+0000)
git clone https://github.com/chenxwh/bark.git ./chenxwh_bark
cd ./chenxwh_bark
Actual result after doing cog push r8.im/some/model (but i get the same result with cog build too) :
Building Docker image from environment in cog.yaml as r8.im/some/model...
[+] Building 1082.5s (25/25) FINISHED docker:desktop-linux
... skipped a ton of lines about downloading ...
View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/t7r0b6zbr68kpdcy0u373xerb
Validating model schema...
ⅹ Model schema is invalid: invalid components: schema "Output": extra sibling fields: [title]
ⅹ
ⅹ {"components":{"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"title":"Detail","type":"array"}},"title":"HTTPValidationError","type":"object"},"Input":{"properties":{"custom_history_prompt":{"description":"Provide your own .npz file with history choice for audio cloning, this will override the previous history_prompt setting","format":"uri","title":"Custom History Prompt","type":"string","x-order":2},"history_prompt":{"allOf":[{"$ref":"#/components/schemas/history_prompt"}],"description":"history choice for audio cloning, choose from the list","x-order":1},"output_full":{"default":false,"description":"return full generation as a .npz file to be used as a history prompt","title":"Output Full","type":"boolean","x-order":5},"prompt":{"default":"Hello, my name is Suno. And, uh — and I like pizza. [laughs] But I also have other interests such as playing tic tac toe.","description":"Input prompt","title":"Prompt","type":"string","x-order":0},"text_temp":{"default":0.7,"description":"generation temperature (1.0 more diverse, 0.0 more conservative)","title":"Text Temp","type":"number","x-order":3},"waveform_temp":{"default":0.7,"description":"generation temperature (1.0 more diverse, 0.0 more conservative)","title":"Waveform Temp","type":"number","x-order":4}},"title":"Input","type":"object"},"ModelOutput":{"properties":{"audio_out":{"format":"uri","title":"Audio Out","type":"string"},"prompt_npz":{"format":"uri","title":"Prompt Npz","type":"string"}},"required":["audio_out"],"title":"ModelOutput","type":"object"},"Output":{"$ref":"#/components/schemas/ModelOutput","title":"Output"},"PredictionRequest":{"properties":{"created_at":{"format":"date-time","title":"Created At","type":"string"},"id":{"title":"Id","type":"string"},"input":{"$ref":"#/components/schemas/Input"},"output_file_prefix":{"title":"Output File Prefix","type":"string"},"webhook":{"format":"uri","maxLength":65536,"minLength":1,"title":"Webhook","type":"string"},"webhook_events_filter":{"default":["start","output","logs","completed"],"items":{"$ref":"#/components/schemas/WebhookEvent"},"type":"array"}},"title":"PredictionRequest","type":"object"},"PredictionResponse":{"properties":{"completed_at":{"format":"date-time","title":"Completed At","type":"string"},"created_at":{"format":"date-time","title":"Created At","type":"string"},"error":{"title":"Error","type":"string"},"id":{"title":"Id","type":"string"},"input":{"$ref":"#/components/schemas/Input"},"logs":{"default":"","title":"Logs","type":"string"},"metrics":{"title":"Metrics","type":"object"},"output":{"$ref":"#/components/schemas/Output"},"started_at":{"format":"date-time","title":"Started At","type":"string"},"status":{"$ref":"#/components/schemas/Status"},"version":{"title":"Version","type":"string"}},"title":"PredictionResponse","type":"object"},"Status":{"description":"An enumeration.","enum":["starting","processing","succeeded","canceled","failed"],"title":"Status","type":"string"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"WebhookEvent":{"description":"An enumeration.","enum":["start","output","logs","completed"],"title":"WebhookEvent","type":"string"},"history_prompt":{"description":"An enumeration.","enum":["announcer","de_speaker_0","de_speaker_1","de_speaker_2","de_speaker_3","de_speaker_4","de_speaker_5","de_speaker_6","de_speaker_7","de_speaker_8","de_speaker_9","en_speaker_0","en_speaker_1","en_speaker_2","en_speaker_3","en_speaker_4","en_speaker_5","en_speaker_6","en_speaker_7","en_speaker_8","en_speaker_9","es_speaker_0","es_speaker_1","es_speaker_2","es_speaker_3","es_speaker_4","es_speaker_5","es_speaker_6","es_speaker_7","es_speaker_8","es_speaker_9","fr_speaker_0","fr_speaker_1","fr_speaker_2","fr_speaker_3","fr_speaker_4","fr_speaker_5","fr_speaker_6","fr_speaker_7","fr_speaker_8","fr_speaker_9","hi_speaker_0","hi_speaker_1","hi_speaker_2","hi_speaker_3","hi_speaker_4","hi_speaker_5","hi_speaker_6","hi_speaker_7","hi_speaker_8","hi_speaker_9","it_speaker_0","it_speaker_1","it_speaker_2","it_speaker_3","it_speaker_4","it_speaker_5","it_speaker_6","it_speaker_7","it_speaker_8","it_speaker_9","ja_speaker_0","ja_speaker_1","ja_speaker_2","ja_speaker_3","ja_speaker_4","ja_speaker_5","ja_speaker_6","ja_speaker_7","ja_speaker_8","ja_speaker_9","ko_speaker_0","ko_speaker_1","ko_speaker_2","ko_speaker_3","ko_speaker_4","ko_speaker_5","ko_speaker_6","ko_speaker_7","ko_speaker_8","ko_speaker_9","pl_speaker_0","pl_speaker_1","pl_speaker_2","pl_speaker_3","pl_speaker_4","pl_speaker_5","pl_speaker_6","pl_speaker_7","pl_speaker_8","pl_speaker_9","pt_speaker_0","pt_speaker_1","pt_speaker_2","pt_speaker_3","pt_speaker_4","pt_speaker_5","pt_speaker_6","pt_speaker_7","pt_speaker_8","pt_speaker_9","ru_speaker_0","ru_speaker_1","ru_speaker_2","ru_speaker_3","ru_speaker_4","ru_speaker_5","ru_speaker_6","ru_speaker_7","ru_speaker_8","ru_speaker_9","tr_speaker_0","tr_speaker_1","tr_speaker_2","tr_speaker_3","tr_speaker_4","tr_speaker_5","tr_speaker_6","tr_speaker_7","tr_speaker_8","tr_speaker_9","zh_speaker_0","zh_speaker_1","zh_speaker_2","zh_speaker_3","zh_speaker_4","zh_speaker_5","zh_speaker_6","zh_speaker_7","zh_speaker_8","zh_speaker_9"],"title":"history_prompt","type":"string"}}},"info":{"title":"Cog","version":"0.1.0"},"openapi":"3.0.2","paths":{"/":{"get":{"operationId":"root__get","responses":{"200":{"content":{"application/json":{"schema":{"title":"Response Root Get"}}},"description":"Successful Response"}},"summary":"Root"}},"/health-check":{"get":{"operationId":"healthcheck_health_check_get","responses":{"200":{"content":{"application/json":{"schema":{"title":"Response Healthcheck Health Check Get"}}},"description":"Successful Response"}},"summary":"Healthcheck"}},"/predictions":{"post":{"description":"Run a single prediction on the model","operationId":"predict_predictions_post","parameters":[{"in":"header","name":"prefer","required":false,"schema":{"title":"Prefer","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PredictionRequest"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PredictionResponse"}}},"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation Error"}},"summary":"Predict"}},"/predictions/{prediction_id}":{"put":{"description":"Run a single prediction on the model (idempotent creation).","operationId":"predict_idempotent_predictions__prediction_id__put","parameters":[{"in":"path","name":"prediction_id","required":true,"schema":{"title":"Prediction ID","type":"string"}},{"in":"header","name":"prefer","required":false,"schema":{"title":"Prefer","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PredictionRequest"}],"title":"Prediction Request"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PredictionResponse"}}},"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation Error"}},"summary":"Predict Idempotent"}},"/predictions/{prediction_id}/cancel":{"post":{"description":"Cancel a running prediction","operationId":"cancel_predictions__prediction_id__cancel_post","parameters":[{"in":"path","name":"prediction_id","required":true,"schema":{"title":"Prediction ID","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"title":"Response Cancel Predictions Prediction Id Cancel Post"}}},"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation Error"}},"summary":"Cancel"}},"/shutdown":{"post":{"operationId":"start_shutdown_shutdown_post","responses":{"200":{"content":{"application/json":{"schema":{"title":"Response Start Shutdown Shutdown Post"}}},"description":"Successful Response"}},"summary":"Start Shutdown"}}}}
expected, v0.9.5 release was cut before my PR merge, on same day. Here is what was included in 0.9.5:
https://github.com/replicate/cog/releases/tag/v0.9.5.
so the fix will be in 0.9.6 cog release. note - local build from source still reports 0.9.5-dev. yes, confusing.
expected, v0.9.5 release was cut before my PR merge, on same day. Here is what was included in 0.9.5:
https://github.com/replicate/cog/releases/tag/v0.9.5.
so the fix will be in 0.9.6 cog release. note - local build from source still reports 0.9.5-dev. yes, confusing.
Oh wow, that was not obvious, i agree. Thanks for the clarification!
Do you have any ETA of 0.9.6 release? I'll try 0.9.5-dev if it's too long for my task, otherwise will wait for 0.9.6.
ps: also, would be helpful to get a link to docs on how to build cog from dev branch.
@trogwarz 0.9.6 released.
Awesome, thanks, problem solved 🚀 At least, for me.