Commit Graph

42 Commits

Author SHA1 Message Date
Daniel Bevenius
b02f48a8f5 whisper: remove MSVC warnings pragmas (whisper/3090)
* ggml : remove MSVC warnings pragmas

This commit removes the MSVC-specific pragmas as these are now handled
in CMakeLists.txt.

* whisper : remove MSVC warning pragmas

This commit removes the MSVC-specific pragmas. These are now handled in
the CMakeLists.txt file.
2025-05-07 16:38:55 +03:00
Daniel Bevenius
4b344baace examples : command.wasm updates (whisper/2904)
This commit updates the command.wasm example by adding a server.py script to make it easy to start a local http server to try out the example, updates the build instructions, and also addresses some of the compiler warnings that were being generated.

* emscripten : fix TOTAL_STACK for wasm

This commit moves the TOTAL_STACK setting from the compile flags to the
linker flags. This is because the TOTAL_STACK setting is a linker
setting.

The motivation for this change is that currently the following warnings
are generated when building:
```console
em++: warning: linker setting ignored during compilation: 'TOTAL_STACK' [-Wunused-command-line-argument]
em++: warning: linker setting ignored during compilation: 'TOTAL_STACK' [-Wunused-command-line-argument]
em++: warning: linker setting ignored during compilation: 'TOTAL_STACK' [-Wunused-command-line-argument]
em++: warning: linker setting ignored during compilation: 'TOTAL_STACK' [-Wunused-command-line-argument]
em++: warning: linker setting ignored during compilation: 'TOTAL_STACK' [-Wunused-command-line-argument]
em++: warning: linker setting ignored during compilation: 'TOTAL_STACK' [-Wunused-command-line-argument]
```

* examples : suppress C++17 deprecation warning for std::codecvt_utf8

This commit suppresses the C++17 deprecation warning for
std::codecvt_utf8 similar to what is done in
examples/talk-llama/unicode.cpp.

The motivation for this change is to suppress these warnings:
```console
/Users/danbev/work/ai/whisper-work/examples/common.cpp:251:31: warning: 'codecvt_utf8<wchar_t>' is deprecated [-Wdeprecated-declarations]
  251 |     std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
      |                               ^
/Users/danbev/work/wasm/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/codecvt:193:28: note: 'codecvt_utf8<wchar_t>' has been explicitly marked deprecated here
  193 | class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf8 : public __codecvt_utf8<_Elem> {
      |                            ^
/Users/danbev/work/wasm/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__config:723:41: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX17'
  723 | #    define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
      |                                         ^
/Users/danbev/work/wasm/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__config:688:49: note: expanded from macro '_LIBCPP_DEPRECATED'
  688 | #      define _LIBCPP_DEPRECATED __attribute__((__deprecated__))
      |                                                 ^
/Users/danbev/work/ai/whisper-work/examples/common.cpp:251:10: warning: 'wstring_convert<std::codecvt_utf8<wchar_t>>' is deprecated [-Wdeprecated-declarations]
  251 |     std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
      |          ^
/Users/danbev/work/wasm/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/locale:3145:28: note: 'wstring_convert<std::codecvt_utf8<wchar_t>>' has been explicitly marked deprecated here
 3145 | class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 wstring_convert {
      |                            ^
/Users/danbev/work/wasm/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__config:723:41: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX17'
  723 | #    define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
      |                                         ^
/Users/danbev/work/wasm/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__config:688:49: note: expanded from macro '_LIBCPP_DEPRECATED'
  688 | #      define _LIBCPP_DEPRECATED __attribute__((__deprecated__))
      |                                                 ^
/Users/danbev/work/ai/whisper-work/examples/common.cpp:257:31: warning: 'codecvt_utf8<wchar_t>' is deprecated [-Wdeprecated-declarations]
  257 |     std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
      |                               ^
/Users/danbev/work/wasm/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/codecvt:193:28: note: 'codecvt_utf8<wchar_t>' has been explicitly marked deprecated here
  193 | class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf8 : public __codecvt_utf8<_Elem> {
      |                            ^
/Users/danbev/work/wasm/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__config:723:41: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX17'
  723 | #    define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
      |                                         ^
/Users/danbev/work/wasm/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__config:688:49: note: expanded from macro '_LIBCPP_DEPRECATED'
  688 | #      define _LIBCPP_DEPRECATED __attribute__((__deprecated__))
      |                                                 ^
/Users/danbev/work/ai/whisper-work/examples/common.cpp:257:10: warning: 'wstring_convert<std::codecvt_utf8<wchar_t>>' is deprecated [-Wdeprecated-declarations]
  257 |     std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
      |          ^
/Users/danbev/work/wasm/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/locale:3145:28: note: 'wstring_convert<std::codecvt_utf8<wchar_t>>' has been explicitly marked deprecated here
 3145 | class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 wstring_convert {
      |                            ^
/Users/danbev/work/wasm/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__config:723:41: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX17'
  723 | #    define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
      |                                         ^
/Users/danbev/work/wasm/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__config:688:49: note: expanded from macro '_LIBCPP_DEPRECATED'
  688 | #      define _LIBCPP_DEPRECATED __attribute__((__deprecated__))
      |                                                 ^
4 warnings generated.
```

* ggml : suppress double-promotion warning in GGML_F16x4_REDUCE

This commit adds a cast to `ggml_float` in the `GGML_F16x4_REDUCE` macro
to suppress a double-promotion warning.

Currently the following warning is generated when compiling the
command.wasm example:
```console
/whisper-work/src/ggml-cpu/ggml-cpu.c:1592:5: warning: implicit conversion increases floating-point precision: 'float' to 'ggml_float' (aka 'double') [-Wdouble-promotion]
 1592 |     GGML_F16_VEC_REDUCE(sumf, sum);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/danbev/work/ai/whisper-work/src/ggml-cpu/ggml-cpu.c:932:37: note: expanded from macro 'GGML_F16_VEC_REDUCE'
  932 | #define GGML_F16_VEC_REDUCE         GGML_F16x4_REDUCE
      |                                     ^
/Users/danbev/work/ai/whisper-work/src/ggml-cpu/ggml-cpu.c:920:44: note: expanded from macro 'GGML_F16x4_REDUCE'
  918 |     res = wasm_f32x4_extract_lane(x[0], 0) +       \
      |         ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  919 |           wasm_f32x4_extract_lane(x[0], 1) +       \
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  920 |           wasm_f32x4_extract_lane(x[0], 2) +       \
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
  921 |           wasm_f32x4_extract_lane(x[0], 3);        \
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/whisper-work/src/ggml-cpu/ggml-cpu.c:1640:9: warning: implicit conversion increases floating-point precision: 'float' to 'ggml_float' (aka 'double') [-Wdouble-promotion]
 1640 |         GGML_F16_VEC_REDUCE(sumf[k], sum[k]);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/danbev/work/ai/whisper-work/src/ggml-cpu/ggml-cpu.c:932:37: note: expanded from macro 'GGML_F16_VEC_REDUCE'
  932 | #define GGML_F16_VEC_REDUCE         GGML_F16x4_REDUCE
      |                                     ^
/Users/danbev/work/ai/whisper-work/src/ggml-cpu/ggml-cpu.c:920:44: note: expanded from macro 'GGML_F16x4_REDUCE'
  918 |     res = wasm_f32x4_extract_lane(x[0], 0) +       \
      |         ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  919 |           wasm_f32x4_extract_lane(x[0], 1) +       \
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  920 |           wasm_f32x4_extract_lane(x[0], 2) +       \
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
  921 |           wasm_f32x4_extract_lane(x[0], 3);        \
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
```
wasm_f32x4_extract_lane returns a 32-bit float and this is what the
addition is performed on. But there is an implicit conversion from
32-bit float to 64-bit double when the result is assigned to `res`,
which is of type `ggml_float`. My understanding here is that this is
intentional and adding a cast to `ggml_float` should suppress the
warning.

* emscripten : add -Wno-deprecated to for emscripten

This commit adds -Wno-deprecated to the CMAKE_CXX_FLAGS for emscripten
builds.

The motivation for this is that currently there a number of warnings
generated like the following:
```console
warning: JS library symbol '$print' is deprecated. Please open a bug if you have a continuing need for this symbol [-Wdeprecated]
warning: JS library symbol '$printErr' is deprecated. Please open a bug if you have a continuing need for this symbol [-Wdeprecated]
em++: warning: warnings in JS library compilation [-Wjs-compiler]
em++: warning: linker setting ignored during compilation: 'ENVIRONMENT' [-Wunused-command-line-argument]
warning: JS library symbol '$print' is deprecated. Please open a bug if you have a continuing need for this symbol [-Wdeprecated]
warning: JS library symbol '$printErr' is deprecated. Please open a bug if you have a continuing need for this symbol [-Wdeprecated]
em++: warning: warnings in JS library compilation [-Wjs-compiler]
warning: JS library symbol '$print' is deprecated. Please open a bug if you have a continuing need for this symbol [-Wdeprecated]
warning: JS library symbol '$printErr' is deprecated. Please open a bug if you have a continuing need for this symbol [-Wdeprecated]
em++: warning: warnings in JS library compilation [-Wjs-compiler]
em++: warning: linker setting ignored during compilation: 'ENVIRONMENT' [-Wunused-command-line-argument]
em++: warning: linker setting ignored during compilation: 'ENVIRONMENT' [-Wunused-command-line-argument]
```

The downside of this is that we might miss other deprecation warnings
in the future so I'm not sure if this is acceptable. But it make the
wasm examples cleaner without the warnings.

* examples : fix tautological-compare warning in stb_vorbis.c [no ci]

This commit applies a fix to address a tautological-compare warning
in stb_vorbis.c.

The motivation for this is that currently the following warning is
generated when compiling the commmand-wasm example:
```console
/Users/danbev/work/ai/whisper-work/examples/stb_vorbis.c:1404:75: warning: pointer comparison always evaluates to false [-Wtautological-compare]
 1404 |       if (f->stream_start + loc >= f->stream_end || f->stream_start + loc < f->stream_start) {
      |                                                                           ^
1 warning generated.
```

This fix was taken from an open pull request on the stb repository
that addreses this issue:
https://github.com/nothings/stb/pull/1746

* squash! examples : update command.wasm instructions [no ci]

This commit adds a Python script to serve the the wasm examples build
in the `build-em` directory. Initially I thought that it would be enough
to start a simple python server but I did not notice that there was an
error in the browser console when I did that:
```console
command.js:1 Uncaught (in promise) DataCloneError: Failed to execute 'postMessage' on 'Worker': SharedArrayBuffer transfer requires self.crossOriginIsolated.
    at command.js:1:1206224
    at new Promise (<anonymous>)
    at loadWasmModuleToWorker (command.js:1:1204981)
    at Array.map (<anonymous>)
    at Object.loadWasmModuleToAllWorkers (command.js:1:1206428)
    at command.js:1:1204318
    at callRuntimeCallbacks (command.js:1:1202062)
    at preRun (command.js:1:6136)
    at run (command.js:1:1294094)
    at removeRunDependency (command.js:1:7046)
```
We need a few CORS headers to be set and in order hopefully make this
easy for users a Python script is added to the examples directory.
This should be able to server all the wasm examples provided they have
been built. command.wasm's README.md is updated to reflect this change.

* examples : remove unused functions

This commit removed the unused functions convert_to_utf8 and
convert_to_wstring from examples/common.cpp.

* Revert "examples : fix tautological-compare warning in stb_vorbis.c [no ci]"

This reverts commit 8e3c47d96141c7675c985562ebdc705e839e338a.

We should not make this change here and instead when the upstream PR is
merged we can sync with it.

Refs: https://github.com/ggerganov/whisper.cpp/issues/2784
2025-03-28 21:58:15 +02:00
Dmitry Atamanov
a1af459fd8 common : fix audio loading by miniaudio (whisper/2862) 2025-03-08 15:18:10 +02:00
Georgi Gerganov
9d7ee68f84 common : separate whisper sources (whisper/2846)
* common : separate whisper sources

* examples : add chrono

* examples : add more headers
2025-02-27 13:12:11 +02:00
Georgi Gerganov
a96038a625 common : fix build min/max (whisper/2845)
* common : try to fix build

* cont : try another fix
2025-02-27 13:12:11 +02:00
Dmitry Atamanov
3a3f945be1 examples : use miniaudio for direct decoding flac, mp3, ogg and wav (whisper/2759) 2025-02-27 13:12:11 +02:00
Georgi Gerganov
d4679578a1
examples : fix compile warnings [no ci] (whisper/0) 2024-07-08 14:54:20 +03:00
Georgi Gerganov
fb19b676cc
whisper : disable CUDA mel + fix FFMPEG 2024-06-26 23:26:03 +03:00
William Tambellini
9ed11f300a
examples : add support for decoding input with ffmpeg (Linux) (whisper/2133)
- search for ffmpeg libs/headers at cmake time
- added ffmpeg-transcode.cpp into libcommon if ffmpeg on
- hooked ffmpeg trancoding in common read_wav(...)
- passed test:
./main -m ggml-base.en.bin -f samples/jfk.mp3
2024-06-16 20:30:48 +03:00
ulatekh
15a3b2601c
common : fix file-handle leak in read_wav() (whisper/2026)
Now it cleans up in case of error.
2024-04-09 20:28:27 +03:00
Rotem Dan
af93689475
main : set stdin to binary mode on Windows (whisper/2025) 2024-04-09 20:28:27 +03:00
Tamotsu Takahashi
aea49a6117
talk, talk-llama : pass text_to_speak as a file (whisper/1865)
* talk-llama: pass file instead of arg

it is too hard to quote text in a portable way

* talk-llama: pass heard_ok as a file

* talk-llama: let eleven-labs.py accept options

Options: -v voice, -s savefile, -p (--play)

* talk-llama: check installed commands in "speak"

Pass "-q" to eleven-labs.py to skip checking whether elevenlabs is installed

* talk-llama: pass voice_id again

in order to sync talk with talk-llama

* talk: sync with talk-llama

Passing text_to_speak as a file is safer and more portable
cf. https://stackoverflow.com/a/59036879/45375

* talk and talk-llama: get all installed voices in speak.ps1

* talk and talk-llama: get voices from api

* talk and talk-llama: add more options to eleven-labs.py

and remove DEFAULT_VOICE because it is deprecated (https://www.reddit.com/r/ElevenLabs/comments/1830abt/what_happened_to_bella/)

```
usage: eleven-labs.py [-q] [-l] [-h] [-n NAME | -v NUMBER] [-f KEY=VAL] [-s FILE | -p] [TEXTFILE]

options:
  -q, --quick           skip checking the required library

action:
  TEXTFILE              read the text file (default: stdin)
  -l, --list            show the list of voices and exit
  -h, --help            show this help and exit

voice selection:
  -n NAME, --name NAME  get a voice object by name (default: Arnold)
  -v NUMBER, --voice NUMBER
                        get a voice object by number (see --list)
  -f KEY=VAL, --filter KEY=VAL
                        filter voices by labels (default: "use case=narration")
                        this option can be used multiple times
                        filtering will be disabled if the first -f has no "=" (e.g. -f "any")

output:
  -s FILE, --save FILE  save the TTS to a file (default: audio.mp3)
  -p, --play            play the TTS with ffplay
```

* examples: add speak_with_file()

as suggested in the review

* talk and talk-llama: ignore to_speak.txt
2024-02-28 13:04:28 +02:00
Felix
390cdf8fdf
examples : clean up common code (whisper/1871)
move some utility functions into common.h
2024-02-19 15:55:13 +02:00
JacobLinCool
1bde655624
common : fix wav buffer detection (whisper/1819) 2024-01-30 21:27:29 +02:00
Georgi Gerganov
04f6c246d0
common : fix input buffer check (whisper/1812) 2024-01-27 17:33:43 +02:00
Ryan Hitchman
4298fbc66e
server : implement "verbose_json" format with token details (whisper/1781)
* examples/server: implement "verbose_json" format with token details.

This is intended to mirror the format of openai's Python
whisper.transcribe() return values.

* server: don't write WAV to a temporary file if not converting

* server: use std::lock_guard instead of manual lock/unlock
2024-01-27 17:33:43 +02:00
Georgi Gerganov
f25addb9e8
gpt-2 : add ignore-eos flag 2023-10-20 10:05:28 +03:00
Georgi Gerganov
6a4e20f530
gpt-2 : allow setting custom context size (i.e. large KV cache) 2023-10-20 09:57:04 +03:00
Yavor Ivanov
8e82832536
gpt-2 : add batched decoding example (#572)
* Initial attempt to make gpt2 do parallel decoding

* Fix crash on trying to use empty embd

* Make it work for n_parallel=1

* Add short way of passing n_parallel argument

* Move gpt-2 batched to a separate target and cpp file

* Add batched sample output to README and remove hardcoded model path and prompt

* gpt-2-batched : fix n_kv heuristic

* Free batch at end of example

* gpt-2-batched : simplify kv cache stuff (#574)

ggml-ci

* Fix not generating n_predict tokens and fix warn

* minor : readme

* Add check for end token and mark the stream as finished

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
Co-authored-by: YavorGIvanov <yavorgivanov@gmail.com>
2023-10-12 17:08:09 +03:00
Georgi Gerganov
c06cb61f66
sync : whisper (POSIX) (#511)
* sync : whisper (POSIX)

ggml-ci

* sync : llama (HBM + Metal + style)

ggml-ci
2023-09-08 17:57:04 +03:00
Cebtenzzre
37b5dbaa3b
cmake : fix MSVC build (#479)
* examples : fix use of M_PI on MSVC

* cmake : make -Werror=vla global

* tests : fix CPU feature options on MSVC

* tests : fix __m256 casts on MSVC
2023-08-28 14:36:16 +03:00
Georgi Gerganov
8da5be2ce5
examples : add sample SAM inference (#74)
* sam : image + prompt encoder, store embeddings

* sam : add the dense img pe in SAM state (#401)

* Add SAM decoder & output masks as png (#418)

* Add loading of decoder layers in Model

* Multiply by hypernet_layer_cnt for ctx_size on model load

* Add decoder layers to py conversion script

* Fix wrong and reversed tensor sizes for decoder

* Add decoder transformer implementation

* Add decoder hypernet and iou prediction mlps

* Add transpose convolution operation and unit test

* Finish mask decoder and write the decoder output in the model state

* Output masks to png after removing padding and upsampling to original size

- Also filter based on the iou treshold
- Additionally filtering based on the stability score and crop boxes
should be done

* Add stb image write in order to output masks from SAM

* Add transpose convolution 2d name and symbol to ggml ops static arrays

* Comment out debug print in transpose convolution test to fix compilation

ggml-ci

* Multithread GGML_OP_ADD_REL_POS operation

* ggml : fix GGML_OP_NAME array

* Disable and comment out debug prints in SAM example

* Add README for the SAM example

* Calculate & filter based on stability score and calculate bounding box

ggml-ci

---------

Co-authored-by: Yavor Ivanov <yivanov@viewray.com>
2023-08-18 14:50:25 +03:00
Reza Rezvan
f1c5a11547
common : fix param parsing (#391) 2023-07-23 18:12:47 +03:00
johnson442
d2b178ee74
starcoder : mmap (and gpu) example (#338)
* Add basic mmap & GPU offload starcoder example

* starcode-mmap : adapt to new ggml API

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
2023-07-14 20:58:51 +03:00
Jakob Frick
965568dcd7
dolly : add interactive prompt and port mode (#319)
* update basic function to execute prompt

* try to factor our prediciton loop

* update code

* update prompt things

* only render at the end

* add basic server port

* refactor

* fix client file descriptor

* undo common.h style changes

* undo sytle changes to main.cpp

* fix check for interactive port
2023-07-02 21:48:02 +03:00
Georgi Gerganov
eea1d89ea7
examples : remove whitespace 2023-07-02 21:41:23 +03:00
the-crypt-keeper
dfef9c61a0
starcoder : add repeat penalty (#311)
* implement repeat penalty processing for starcoder

* show effective parameters at starcoder startup

---------

Co-authored-by: Mike Ravkine <kryptk@gmail.com>
2023-07-02 17:52:52 +03:00
Georgi Gerganov
bc696b38c4
whisper : sync latest whisper.cpp 2023-06-25 14:31:01 +03:00
Borislav Stanimirov
c1bb712a04
build : fix compilation errors and warnigns when building with MSVC (#275) 2023-06-24 19:11:35 +03:00
Ravindra Marella
e456108433
starcoder : add support for starchat special tokens (#246)
* starcoder : add support for starchat special tokens

* examples : fix `gpt_tokenize()` for special tokens
2023-06-18 10:37:09 +03:00
Eldar Yusupov
35accb12c6
common : fix compilation on Linux (#212) 2023-05-29 19:47:57 +03:00
jaeminSon
765c9bce37
examples : add tokenization tests and refactor codes (#186)
* examples : [refactor] remove unnecessary lines and segments

* examples : [feature] add tokenization test for gpt-neox

* examples : [feature] handle multibyte character set

* examples : [refactor] find the longest token for word

* examples : [refactor] move test_tokenizer to common.cpp as the function affects other models

* add 'test_tokenizer' function after loading the model

* examples : [feature] add test cases for checking tokenization

* examples : [feature] tokenize with huggingface tokenizers for currently supported models

* examples : add tokenization test cases for each model

* revert conversion from string to utf-8 encoded byte strings

* [refactor] make util functions for testing tokenizers available

* [bug fix] test replit using functions and variables (e.g. tokenizer struct, tokenization method) defined in its main.cpp

* [refactor] modify function name test_tokenizer -> test_gpt_tokenizer

* [refactor] put parenthesis on single line for-loops and if-statements

* [refactor] withdraw <filesystem> and use <iostream> and <dirent.h>

* [refactor] remove 'find_test_file' function and directly set test file path from 'test_gpt_tokenizer' function

* call a function for testing tokenizer with filename specified

* revert test tokenizer in replit (replit uses seperate methods for tokenzation and decoding)

* compare vector of id to check if two tokenizations are identical.

* write token ids instead of strings.

* [refactor] use --token_test rather than --test for token-test argument

* add english test cases

* update test cases with more english prompts

* examples : tokenizer testing fixes

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
2023-05-27 11:47:34 +03:00
Georgi Gerganov
47ff7d6885
common : add missing declarations 2023-05-24 10:40:27 +03:00
klosax
9276285583
mpt : utf-8 support, perplexity testing, repeat penalty sampling (#184)
* common: utf-8 decoder, reverted gpt_toeknize utf-8 convert

* Update common.h

* main: decode utf-8 tokens on load

* mpt import: bug fix

* common: style fixes

* common: style fix

* Update common.h

* common: revert gpt_tokenize utf-8 convert

* Update common.cpp

* Update common.cpp

* Update common.cpp

* Add perplexity to mpt

* Update CMakeLists: perplexity

* mpt-perplexity: fixes

* Update perplexity.cpp

* common: add sampling with repeat penalty

* mpt-main: add repeat penalty sampling, add commandline parameters

* Update common.h

* mpt-main: style fixes

* Update perplexity.cpp

* Delete perplexity.cpp

* mpt: move perplexity to main

* mpt: move perplexity to main

* common.cpp: Use codecvt utf-8 converter

* main.cpp: Use codecvt utf-8 converter

* mpt : code style changes

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
2023-05-24 10:27:36 +03:00
klosax
36a005c930
common : support utf-8 + fix gpt_tokenize + fix MPT model import (#179)
* Update convert-h5-to-ggml.py

* Import tokens correctly

* gpt_tokenize: Convert input to utf-8 + bug fix

* common : minor style fixes

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
2023-05-21 11:21:51 +03:00
Georgi Gerganov
3fe20826ac
common : force --top_k to be at least 1 2023-05-20 17:45:49 +03:00
Georgi Gerganov
8b3a7210cf
common : fix gpt_tokenize (ref #170) 2023-05-20 17:22:58 +03:00
Georgi Gerganov
3ce3145501 examples : use inplace calls explicitly 2023-05-14 15:18:34 +03:00
Georgi Gerganov
fa8665fbe7
whisper : sync whisper.cpp minor changes 2023-05-14 10:11:09 +03:00
Nevin
65ed751fb0
common : allow prompts to be loaded from file (#102)
* common: allow prompts to be loaded from file

* common : extra help for -f

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
2023-05-13 11:41:43 +03:00
Michael Verrilli
ff6e03cbcd
examples : add dolly-v2 sample inference (#132)
* Vocab support for special tokens

* Initial dolly-v2 commit

* update README
2023-05-06 08:51:45 +03:00
Georgi Gerganov
e433b73f48
examples : utils -> common 2023-04-22 14:59:42 +03:00