pytorch / serve

Serve, optimize and scale PyTorch models in production
https://pytorch.org/serve/
Apache License 2.0
4.16k stars 843 forks source link

add support for SeTFiT models #2107

Open maccarini opened 1 year ago

maccarini commented 1 year ago

🚀 The feature

Add support for setfit models which currently is unsupported and throwing Dependency installation stderr: error.

Motivation, pitch

SOTA is quickly moving to few-shot approaches and the SeTFiT library provides a fast and easy way to finetune sentence-transformers-based models with little labeled data. Would strongly appreaciate this feature to be considered.

Alternatives

No response

Additional context

No response

msaroufim commented 1 year ago

You can pass in custom dependencies via a requirements.txt https://github.com/pytorch/serve/tree/master/model-archiver#arguments

You then might need to create the right text handler - some examples which might help

Although granted, I think it's a great idea to have this example in so will mark this is a good first issue, happy to help out anyone looking to make a first contribution to torchserve

maccarini commented 1 year ago

Hello! Im passing setfit via requirements.txt and its the only lib that causes trouble. I've served models from the sentence-transformers library before and there is no problem passing that library, there just seems to be something odd with setfit library. The weird error im getting is after registering this setfit model is the following

"code": 400,
  "type": "ModelException",
  "message": "Custom pip package installation failed for my_setfit_model"

Also my handler is adapted to this logic as i've done it before for SBERT models. Any thoughts on why could this be happening?

lxning commented 1 year ago

@maccarini can you check "Dependency installation stderr" in ts_log.log to see the detailed error?

nihiluis commented 1 year ago

Hello! Im passing setfit via requirements.txt and its the only lib that causes trouble. I've served models from the sentence-transformers library before and there is no problem passing that library, there just seems to be something odd with setfit library. The weird error im getting is after registering this setfit model is the following

"code": 400,
 "type": "ModelException",
 "message": "Custom pip package installation failed for my_setfit_model"

Also my handler is adapted to this logic as i've done it before for SBERT models. Any thoughts on why could this be happening?

did you have any success?