update readme and repo dependency

This commit is contained in:
Zizheng Pan 2024-12-18 19:54:05 +08:00
parent cd4bb743e2
commit 8bde1c1ae1
5 changed files with 19 additions and 2 deletions

View File

@ -124,6 +124,23 @@ conversation = [
{"role": "<|Assistant|>", "content": ""}, {"role": "<|Assistant|>", "content": ""},
] ]
# multiple images/interleaved image-text
conversation_multi_images = [
{
"role": "<|User|>",
"content": "This is image_1: <image>\n"
"This is image_2: <image>\n"
"This is image_3: <image>\n If I am a vegetarian, what can I cook with these ingredients?",
"images": [
"images/multi_image_1.png",
"images/multi_image_2.jpg",
"images/multi_image_3.jpg",
],
},
{"role": "<|Assistant|>", "content": ""}
]
# load images and prepare for inputs # load images and prepare for inputs
pil_images = load_pil_images(conversation) pil_images = load_pil_images(conversation)
prepare_inputs = vl_chat_processor( prepare_inputs = vl_chat_processor(
@ -148,7 +165,7 @@ outputs = vl_gpt.language.generate(
use_cache=True use_cache=True
) )
answer = tokenizer.decode(outputs[0].cpu().tolist(), skip_special_tokens=True) answer = tokenizer.decode(outputs[0].cpu().tolist(), skip_special_tokens=False)
print(f"{prepare_inputs['sft_format'][0]}", answer) print(f"{prepare_inputs['sft_format'][0]}", answer)
``` ```

BIN
images/multi_image_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 KiB

BIN
images/multi_image_2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

BIN
images/multi_image_3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

View File

@ -1,5 +1,5 @@
torch==2.0.1 torch==2.0.1
transformers>=4.38.2 transformers==4.38.2
timm>=0.9.16 timm>=0.9.16
accelerate accelerate
sentencepiece sentencepiece