Update README.md
Browse files
README.md
CHANGED
@@ -37,8 +37,25 @@ res = model.chat(
|
|
37 |
image=image,
|
38 |
msgs=msgs,
|
39 |
tokenizer=tokenizer,
|
40 |
-
sampling=True,
|
41 |
-
temperature=0.7
|
|
|
42 |
)
|
43 |
print(res)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
```
|
|
|
37 |
image=image,
|
38 |
msgs=msgs,
|
39 |
tokenizer=tokenizer,
|
40 |
+
sampling=True, # if sampling=False, beam_search will be used by default
|
41 |
+
temperature=0.7,
|
42 |
+
# system_prompt='' # pass system_prompt if needed
|
43 |
)
|
44 |
print(res)
|
45 |
+
|
46 |
+
## if you want to use streaming, please make sure sampling=True and stream=True
|
47 |
+
## the model.chat will return a generator
|
48 |
+
res = model.chat(
|
49 |
+
image=image,
|
50 |
+
msgs=msgs,
|
51 |
+
tokenizer=tokenizer,
|
52 |
+
sampling=True,
|
53 |
+
temperature=0.7,
|
54 |
+
stream=True
|
55 |
+
)
|
56 |
+
|
57 |
+
generated_text = ""
|
58 |
+
for new_text in res:
|
59 |
+
generated_text += new_text
|
60 |
+
print(new_text, flush=True, end='')
|
61 |
```
|