Update README.md
Browse files
README.md
CHANGED
|
@@ -85,7 +85,7 @@ full_prompt = f'{instruction}'
|
|
| 85 |
messages = [
|
| 86 |
{
|
| 87 |
"role": "system",
|
| 88 |
-
"content":
|
| 89 |
},
|
| 90 |
{
|
| 91 |
"role": "user",
|
|
@@ -102,20 +102,20 @@ messages = [
|
|
| 102 |
input_text = tokenizer.apply_chat_template(messages,
|
| 103 |
add_generation_prompt=True,
|
| 104 |
tokenize=False)
|
| 105 |
-
inputs =
|
| 106 |
text=[input_text],
|
| 107 |
images=[image],
|
| 108 |
videos=None,
|
| 109 |
padding=True,
|
| 110 |
return_tensors="pt",
|
| 111 |
-
).to(
|
| 112 |
|
| 113 |
-
|
| 114 |
|
| 115 |
generated_ids_trimmed = [
|
| 116 |
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
| 117 |
]
|
| 118 |
-
response =
|
| 119 |
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
| 120 |
)[0]
|
| 121 |
|
|
|
|
| 85 |
messages = [
|
| 86 |
{
|
| 87 |
"role": "system",
|
| 88 |
+
"content": GroundNext_GROUNDER_SYS_PROMPT.format(img_width=img_width, img_height=img_height)
|
| 89 |
},
|
| 90 |
{
|
| 91 |
"role": "user",
|
|
|
|
| 102 |
input_text = tokenizer.apply_chat_template(messages,
|
| 103 |
add_generation_prompt=True,
|
| 104 |
tokenize=False)
|
| 105 |
+
inputs = processor(
|
| 106 |
text=[input_text],
|
| 107 |
images=[image],
|
| 108 |
videos=None,
|
| 109 |
padding=True,
|
| 110 |
return_tensors="pt",
|
| 111 |
+
).to(model.device)
|
| 112 |
|
| 113 |
+
generated_ids = model.generate(**inputs, max_new_tokens=64)
|
| 114 |
|
| 115 |
generated_ids_trimmed = [
|
| 116 |
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
| 117 |
]
|
| 118 |
+
response = processor.batch_decode(
|
| 119 |
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
| 120 |
)[0]
|
| 121 |
|