From d479f2d6eb4d07b43016b68907d63040b4ae7dcc Mon Sep 17 00:00:00 2001 From: Alvaro Bartolome <36760800+alvarobartt@users.noreply.github.com> Date: Thu, 5 Sep 2024 10:44:46 +0200 Subject: [PATCH] Add `containers/pytorch/inference/TASKS.md` (WIP) --- containers/pytorch/inference/TASKS.md | 84 +++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 containers/pytorch/inference/TASKS.md diff --git a/containers/pytorch/inference/TASKS.md b/containers/pytorch/inference/TASKS.md new file mode 100644 index 00000000..48f170e8 --- /dev/null +++ b/containers/pytorch/inference/TASKS.md @@ -0,0 +1,84 @@ +## Hugging Face PyTorch DLC for Inference - Supported Tasks + +Please find below all the supported tasks for each library at the time of writing this document: + +### Transformers (WIP) + +
+ text-classification +
+ +### Sentence Transformers + +
+ sentence-similarity + Sentence Similarity is the task of determining how similar two texts are. Sentence similarity models convert input texts into vectors (embeddings) that capture semantic information and calculate how close (similar) they are between them. This task is particularly useful for information retrieval and clustering/grouping. + +It can be used via the [`huggingface-inference-toolkit`](https://github.com/huggingface/huggingface-inference-toolkit) (running on top of the `SentenceTransformer` class from the [`sentence-transformers`](https://github.com/UKPLab/sentence-transformers) library) by setting the `HF_TASK` environment variable to `sentence-similarity` and the `HF_MODEL_ID` to the model ID of the model you want to deploy. + +Below you can find an example with the environment variable values: + +```bash +HF_MODEL_ID=BAAI/bge-m3 +HF_TASK=sentence-similarity +``` + +More information about the sentence-similarity task at [Hugging Face Documentation - Sentence Similarity](https://huggingface.co/tasks/sentence-similarity) and at [Sentence Transformers Documentation - Sentence Transformer](https://sbert.net/docs/quickstart.html#sentence-transformer), and explore [all the supported sentence-similarity models on the Hugging Face Hub](https://huggingface.co/models?pipeline_tag=sentence-similarity&library=sentence-transformers&sort=trending). + +
+ +
+ sentence-embeddings + Sentence Embeddings is the task of converting input texts into vectors (embeddings) that capture semantic information. Sentence embeddings models are useful for a wide range of taskssuch as semantic textual similarity, semantic search, clustering, classification, paraphrase mining, and more. + +It can be used via the [`huggingface-inference-toolkit`](https://github.com/huggingface/huggingface-inference-toolkit) (running on top of the `SentenceTransformer` class from the [`sentence-transformers`](https://github.com/UKPLab/sentence-transformers) library) by setting the `HF_TASK` environment variable to `sentence-embeddings` and the `HF_MODEL_ID` to the model ID of the model you want to deploy. + +Below you can find an example with the environment variable values: + +```bash +HF_MODEL_ID=BAAI/bge-m3 +HF_TASK=sentence-embeddings +``` + +More information about the sentence-embeddings task at [Sentence Transformers Documentation - Sentence Transformer](https://sbert.net/docs/quickstart.html#sentence-transformer), and explore [all the supported sentence-similarity models on the Hugging Face Hub](https://huggingface.co/models?library=sentence-transformers&sort=trending). + +
+ +
+ sentence-ranking + Sentence Ranking is the task of determining the relevance of a text to a query. Sentence ranking models convert input texts into vectors (embeddings) that capture semantic information and calculate how relevant they are to a query. This task is particularly useful for information retrieval and search engines. + +It can be used via the [`huggingface-inference-toolkit`](https://github.com/huggingface/huggingface-inference-toolkit) (running on top of the `CrossEncoder` class from the [`sentence-transformers`](https://github.com/UKPLab/sentence-transformers) library) by setting the `HF_TASK` environment variable to `sentence-ranking` and the `HF_MODEL_ID` to the model ID of the model you want to deploy. + +Below you can find an example with the environment variable values: + +```bash +HF_MODEL_ID=BAAI/bge-reranker-v2-m3 +HF_TASK=sentence-ranking +``` + +More information about the sentence-ranking task at [Sentence Transformers Documentation - Cross Encoder](https://sbert.net/docs/quickstart.html#cross-encoder), and explore [all the supported sentence-ranking models on the Hugging Face Hub](https://huggingface.co/models?pipeline_tag=text-classification&library=sentence-transformers&sort=trending). + +
+ +### Diffusers + +
+ text-to-image + Text-to-Image is a task that generates images from input text. These models can be used to generate and modify images based on text prompts. + +It can be used via the [`huggingface-inference-toolkit`](https://github.com/huggingface/huggingface-inference-toolkit) (running on top of the `AutoPipelineForText2Image` from the [`diffusers`](https://github.com/huggingface/diffusers) library) by setting the `HF_TASK` environment variable to `text-to-image` and the `HF_MODEL_ID` to the model ID of the model you want to deploy. + +Below you can find an example with the environment variable values: + +```bash +HF_MODEL_ID=black-forest-labs/FLUX.1-dev +HF_TASK=text-to-image +``` + +More information about the text-to-image task at [Hugging Face Documentation - Text to Image](https://huggingface.co/tasks/text-to-image), and explore [all the supported text-to-image models on the Hugging Face Hub](https://huggingface.co/models?pipeline_tag=text-to-image&library=diffusers&sort=trending). + +
+ +> [!NOTE] +> More tasks and models will be supported in the future, so please check [`huggingface-inference-toolkit`](https://github.com/huggingface/huggingface-inference-toolkit) for the latest updates.