Comments (1)
Hi @paulcx thanks for pointing this out, we should be more clear about generation
and templates in the docs.
In TGI the chat_template
is applied when the chat endpoint is used, in the example above the generate
endpoint is used and no template is applied.
Chat can used with the chat_completion
method like below.
from huggingface_hub import InferenceClient
client = InferenceClient("http://127.0.0.1:3000")
chat = client.chat_completion(
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Whats in this image?"},
{
"type": "image_url",
"image_url": {
"url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rabbit.png"
},
},
],
},
],
seed=42,
max_tokens=100,
)
print(chat)
# ChatCompletionOutput(choices=[ChatCompletionOutputComplete(finish_reason='length', index=0, message=ChatCompletionOutputMessage(role='assistant', content=" The image you've provided features an anthropomorphic rabbit in spacesuit attire. This rabbit is depicted with human-like posture and movement, standing on a rocky terrain with a vast, reddish-brown landscape in the background. The spacesuit is detailed with mission patches, circuitry, and a helmet that covers the rabbit's face and ear, with an illuminated red light on the chest area.\n\nThe artwork style is that of a", name=None, tool_calls=None), logprobs=None)], created=1714589614, id='', model='llava-hf/llava-v1.6-mistral-7b-hf', object='text_completion', system_fingerprint='2.0.2-native', usage=ChatCompletionOutputUsage(completion_tokens=100, prompt_tokens=2943, total_tokens=3043))
Note that when using the chat endpoint images are sent as typed messages rather than markdown format.
I hope this helps clarify! please let me know if you have any questions
from text-generation-inference.
Related Issues (20)
- ROCm: Server error: transport error when running batch size >=2 (Falcon-11B) HOT 2
- ROCm: Support models with head_dim>128
- ROCm: mismatch in generation for gpt2 HOT 1
- Poor/inconsistent results from Phi-3-mini-128k HOT 1
- idefics2: Sizes of tensors must match except in dimension 0. Expected size 448 but got size 447 for tensor number 2 in the list. HOT 2
- Some typo error in the picture of flash_attention.md HOT 2
- Unable to run TGI following the instructions on the readme HOT 5
- docker-compose throws `flash attention is not installed` error HOT 3
- Phi-3-mini-128k crashes on simple query HOT 2
- Add Environment Variable for OTLP Service Name HOT 2
- ImportError: libcuda.so.1: cannot open shared object file: No such file or directory HOT 10
- Tree-attention for medusa HOT 2
- get stucked when run text-generation-benchmark on AMD gpu HOT 2
- Unable to load Qwen2-72B-Instruct-exl2 model HOT 2
- `mistralai/Mixtral-8x22B-Instruct-v0.1`: Getting `RuntimeError: 'ptxas' failed with error code 127` while warming up on 8 GPUs HOT 2
- `mistralai/Mixtral-8x22B-Instruct-v0.1`: Successful warmup, crashes on inference HOT 2
- Long install report HOT 1
- P40 with USE_FLASH_ATTENTION=False HOT 2
- Sparse Marlin HOT 3
- protobuf version not compatible HOT 1
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 text-generation-inference.