Commit bc755c6
authored
[Llava] Add max_context_len CLI arg (#14599)
### Summary
Add a required max_context_len argument to the Llava example model
export. When set to 768, this reduces the memory consumption (~6GiB ->
~4.8GiB RSS) at the cost of a smaller context length and thus fixes
#14474.
### Test plan
Ran ./test_llava.sh and validated the reported memory consumption on an
x86 Linux machine.
```
I 00:00:18.433471 executorch:main.cpp:172] Starting generation...
I 00:00:18.433500 executorch:multimodal_runner.cpp:95] RSS after loading model: 4746.726562 MiB (0 if unsupported)
I 00:00:18.433554 executorch:multimodal_runner.cpp:119] Prefilling input 0/3, type: text
I 00:00:19.484581 executorch:multimodal_runner.cpp:119] Prefilling input 1/3, type: image
I 00:00:19.484710 executorch:multimodal_prefiller.cpp:83] Image tensor dim: 3, dtype: Byte
I 00:00:30.442685 executorch:multimodal_runner.cpp:119] Prefilling input 2/3, type: text
I 00:00:30.951938 executorch:multimodal_runner.cpp:138] RSS after multimodal input processing: 4847.933594 MiB (0 if unsupported)
I 00:00:30.952000 executorch:multimodal_runner.cpp:148] Max new tokens resolved: 153, pos_ 615, max_context_len 768
```1 parent bef9555 commit bc755c6
File tree
4 files changed
+18
-4
lines changed- .ci/scripts
- examples/models/llava
4 files changed
+18
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
| 284 | + | |
284 | 285 | | |
285 | 286 | | |
286 | 287 | | |
| |||
296 | 297 | | |
297 | 298 | | |
298 | 299 | | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
299 | 306 | | |
300 | 307 | | |
301 | 308 | | |
| |||
325 | 332 | | |
326 | 333 | | |
327 | 334 | | |
328 | | - | |
| 335 | + | |
329 | 336 | | |
330 | 337 | | |
331 | 338 | | |
332 | 339 | | |
333 | 340 | | |
| 341 | + | |
334 | 342 | | |
335 | 343 | | |
336 | 344 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| |||
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| 91 | + | |
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
| |||
300 | 302 | | |
301 | 303 | | |
302 | 304 | | |
303 | | - | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
304 | 308 | | |
| 309 | + | |
305 | 310 | | |
306 | 311 | | |
307 | 312 | | |
| |||
348 | 353 | | |
349 | 354 | | |
350 | 355 | | |
| 356 | + | |
351 | 357 | | |
352 | 358 | | |
353 | 359 | | |
| |||
0 commit comments