Commit 2b6dfe8
authored
llama : remove write/read of output ids/logits/embeddings (ggml-org#18862)
* llama : remove write/read of output ids/logits/embeddings
This commit removes the write/read of output ids, logits and
embeddings from the llama context state.
Refs: ggml-org#18862 (comment)
* completion : add replying of session state
This commit updates the session handing in the completion tool to handle
the that logits are no longer stored in the session file. Instead, we
need to replay the last token to get the logits for sampling.
* common : add common_prompt_batch_decode function
This commit adds a new function which is responsible for decoding prompt
and optionally handle the saving for session data.
* update save-state.cpp to use llama_state_load_file
This commit updates the save-load-state example to utilize the new
llama_state_load_file function for loading the model state from a file.
And it also replays the last token after loading since this state is now
stored before the last token is processed.
* examples : set n_seq_max = 2 for ctx3
This commit updates the save-load-state example to set the n_seq_max
parameter to 2 when initializing the ctx3 context.
The motivation for this change is that using 1 as n_parallel/n_seq_max
the context only supports one sequence, but the test laster tries to
use a second sequence which results in the following error:
```console
main : loaded state with 4 tokens
main : seq 0 copied, 225760 bytes
main : kv cache cleared
find_slot: seq_id=1 >= n_seq_max=1 Try using a bigger --parallel value
state_read_meta: failed to find available cells in kv cache
```
This seems to only happen for recurrent/hybrid models.1 parent e8e2616 commit 2b6dfe8
File tree
5 files changed
+132
-200
lines changed- common
- examples/save-load-state
- src
- tools/completion
5 files changed
+132
-200
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1760 | 1760 | | |
1761 | 1761 | | |
1762 | 1762 | | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
804 | 804 | | |
805 | 805 | | |
806 | 806 | | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
807 | 824 | | |
808 | 825 | | |
809 | 826 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| |||
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
77 | 62 | | |
78 | 63 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | 64 | | |
83 | 65 | | |
84 | 66 | | |
| 67 | + | |
| 68 | + | |
85 | 69 | | |
86 | 70 | | |
87 | 71 | | |
| |||
111 | 95 | | |
112 | 96 | | |
113 | 97 | | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
129 | 101 | | |
130 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
131 | 105 | | |
132 | 106 | | |
| 107 | + | |
| 108 | + | |
133 | 109 | | |
134 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
135 | 115 | | |
136 | 116 | | |
137 | 117 | | |
| |||
160 | 140 | | |
161 | 141 | | |
162 | 142 | | |
163 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
164 | 146 | | |
165 | 147 | | |
166 | 148 | | |
| |||
169 | 151 | | |
170 | 152 | | |
171 | 153 | | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
| 154 | + | |
181 | 155 | | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
188 | 159 | | |
189 | 160 | | |
| 161 | + | |
| 162 | + | |
190 | 163 | | |
191 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
192 | 169 | | |
193 | 170 | | |
194 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2440 | 2440 | | |
2441 | 2441 | | |
2442 | 2442 | | |
2443 | | - | |
2444 | | - | |
2445 | | - | |
2446 | | - | |
2447 | | - | |
2448 | | - | |
2449 | | - | |
2450 | | - | |
2451 | | - | |
2452 | | - | |
2453 | | - | |
2454 | | - | |
2455 | | - | |
2456 | | - | |
2457 | | - | |
2458 | | - | |
2459 | | - | |
2460 | | - | |
2461 | | - | |
2462 | | - | |
2463 | | - | |
2464 | | - | |
2465 | | - | |
2466 | | - | |
2467 | | - | |
2468 | | - | |
2469 | | - | |
2470 | | - | |
2471 | | - | |
2472 | | - | |
2473 | | - | |
2474 | | - | |
2475 | | - | |
2476 | | - | |
2477 | | - | |
2478 | | - | |
2479 | | - | |
2480 | | - | |
2481 | | - | |
2482 | | - | |
2483 | | - | |
2484 | | - | |
2485 | | - | |
2486 | | - | |
2487 | | - | |
2488 | | - | |
2489 | | - | |
2490 | | - | |
2491 | | - | |
2492 | | - | |
2493 | | - | |
2494 | | - | |
2495 | | - | |
2496 | | - | |
2497 | | - | |
2498 | | - | |
2499 | | - | |
2500 | | - | |
2501 | 2443 | | |
2502 | 2444 | | |
2503 | 2445 | | |
| |||
2523 | 2465 | | |
2524 | 2466 | | |
2525 | 2467 | | |
2526 | | - | |
2527 | | - | |
2528 | | - | |
2529 | | - | |
2530 | | - | |
2531 | | - | |
2532 | | - | |
2533 | | - | |
2534 | | - | |
2535 | | - | |
2536 | | - | |
2537 | | - | |
2538 | | - | |
2539 | | - | |
2540 | | - | |
2541 | | - | |
2542 | | - | |
2543 | | - | |
2544 | | - | |
2545 | | - | |
2546 | | - | |
2547 | | - | |
2548 | | - | |
2549 | | - | |
2550 | | - | |
2551 | | - | |
2552 | | - | |
2553 | | - | |
2554 | | - | |
2555 | | - | |
2556 | | - | |
2557 | | - | |
2558 | | - | |
2559 | | - | |
2560 | | - | |
2561 | | - | |
2562 | | - | |
2563 | | - | |
2564 | | - | |
2565 | | - | |
2566 | | - | |
2567 | | - | |
2568 | | - | |
2569 | | - | |
2570 | | - | |
2571 | | - | |
2572 | | - | |
2573 | | - | |
2574 | | - | |
2575 | | - | |
2576 | | - | |
2577 | | - | |
2578 | | - | |
2579 | | - | |
2580 | | - | |
2581 | | - | |
2582 | | - | |
2583 | | - | |
2584 | | - | |
2585 | | - | |
2586 | | - | |
2587 | | - | |
2588 | | - | |
2589 | | - | |
2590 | 2468 | | |
2591 | 2469 | | |
2592 | 2470 | | |
| |||
0 commit comments