]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
llama : suppress conversion from 'size_t' to 'int' (#9046)
authorDaniel Bevenius <redacted>
Wed, 16 Oct 2024 17:34:28 +0000 (19:34 +0200)
committerGitHub <redacted>
Wed, 16 Oct 2024 17:34:28 +0000 (20:34 +0300)
commit9e041024481f6b249ab8918e18b9477f873b5a5e
tree3fade6062d0cad12c5e4b96eb99d8d1dab9751ca
parentdbf18e4de9e7aa496871f1555f9f0c8d84567108
llama : suppress conversion from 'size_t' to 'int' (#9046)

* llama : suppress conversion from 'size_t' to 'int'

This commit updates llm_tokenizer_spm.tokenize to suppress/remove the
following warnings that are generated on Windows when using MSVC:

```console
src\llama-vocab.cpp(211,1): warning C4267: 'argument':
    conversion from 'size_t' to 'int', possible loss of data
src\llama-vocab.cpp(517,1): warning C4267: 'argument':
    conversion from 'size_t' to 'int', possible loss of data
```

This is done by adding a cast for the size_t returned from
symbols.size(). I believe this is safe as it seems unlikely that
symbols, which stores an entry for each UTF8 character, would become
larger than INT_MAX.

The motivation for this change is to reduce the number of warnings that
are currently generated when building on Windows.

* squash! llama : suppress conversion from 'size_t' to 'int'

Move cast into for loop.
src/llama-vocab.cpp