Comments (3)
Hi @advaitraut do I understand correctly that you want to convert the output of your model (a tensor) into a string which you want to send back to the client? This would go into the postprocess step. You can just create any string you would like and return this in the postprocess method. Just make sure that you return a list of strings where each entry corresponds to a batch entry.
Something like this should work:
#assuming you get a (8, 1) tensor and batch size is 8
def postprocess(model_output: torch.Tensor):
return [f"Element {idx}: {model_output[idx].item()}" for idx in range(model_output.size(0))]
Let me know if you get stuck.
from serve.
Hi @mreso , Thank you for reponse.
Your code helped me to realize that postprocess() needs a list to be returned.
It solved my problem.
from serve.
Great to hear @advaitraut will close this issue as you solved your problem but feel free to reopen if you have further question.
from serve.
Related Issues (20)
- Metrics REST API doesn't return custom metric HOT 3
- Model results are inconsistent between preheating and after preheating HOT 1
- Model with name <name> is not ready. HOT 22
- Improve configuration handling with KServe
- Broken Link to the debug-torchserve-backend page HOT 1
- Setup custom metric with Kubernetes dimensions HOT 1
- Configuration of gRPC MAX_CONNECTION_AGE and MAX_CONNECTION_AGE_GRACE HOT 1
- Clean up metrics documentation
- How to 'Create model archive pod and run model archive file generation script' in the ‘User Guide’ HOT 3
- [RFC]: Deprecation notice for TorchServe macOS x86 builds, binaries & testing
- very high QueueTime
- Add support for MPS in the basehandler HOT 1
- Exception when using torchserve to deploy hugging face model: java.lang.InterruptedException: null HOT 4
- Real-time Object Detection HOT 7
- PyTorch Serve: Custom handler not saving inference results HOT 6
- PyTorch serve with custom translators returning Unknown exception HOT 4
- Newer Base Image KServe Container fails with exec /usr/local/bin/dockerd-entrypoint.sh: exec format error HOT 7
- Reduce or remove worker retries for specific failures HOT 6
- Update describe model management API to show all model configuration options
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serve.