Commit graph

3034 commits

Author SHA1 Message Date
HanishKVC
8165bd4035 ChatON:WIP:chaton_tmpl_apply_single build on multi msg tagging
To avoid having to duplicate any hardcoding in future, wrt any new
model/chat-template-standard, at multiple locations, remove the
single message templating code with a wrapper which does the same
but using the multi-msg templating helper.
2024-05-14 00:44:47 +05:30
HanishKVC
fe0c9ce646 ChatON:BasicCheck+:return a string with info, dont directly log 2024-05-14 00:25:00 +05:30
HanishKVC
efbb87dba6 ChatON:ChatTemplates:TmplBasicCheck 2024-05-13 17:50:15 +05:30
HanishKVC
0cfe99076d ChatON:ChatTemplates: TmplExists, TmplGetKey, TmplRoleGetKeys
ChatTemplate directly supports these now, as well as the existing
global instance based corresponding helpers depend on same.
2024-05-13 17:30:47 +05:30
HanishKVC
184ac322e3 ChatON: Make json_get efficient and flexible wrt its calling
Also explicitly indicate that we are looking at a chain of keys
2024-05-13 16:21:02 +05:30
HanishKVC
eb7554ca3b ChatON: Avoid -> to match simpcfg as well as corresponding keys 2024-05-13 10:37:14 +05:30
HanishKVC
d5b0bfbaec SimpCfg: Remove now unused SC_DEBUG, rather GroupKV uses equiv
The code which was using SC_DEBUG moved to GroupKV and inturn
GKV_DEBUG
2024-05-13 00:33:36 +05:30
HanishKVC
857570f8f8 SimpCfgTest: Update dump usage to GKV return string semantic 2024-05-13 00:20:58 +05:30
HanishKVC
9249649fb3 ChatON+TestPrgs: Use specific log files 2024-05-12 23:59:48 +05:30
HanishKVC
3d33d62924 SimpCfg: Move testing code into its own file in tests
Also set functions to inline or static as appropriate
2024-05-12 22:53:48 +05:30
HanishKVC
f2dd1263fd GroupKV: Move test code into its own file in tests 2024-05-12 22:33:48 +05:30
HanishKVC
6048218383 SimpCFG: COnvert to GroupKV extended version
Reuse the code already moved into GroupKV

Add explicit get and set wrt int32_t, which was added after move
to GroupKV wrt basic MapOfMapOfVariant logic.
2024-05-12 21:58:59 +05:30
HanishKVC
db2ffabb18 ChatON: use templated json_get when loading bool key-value fields
With this now even loading chaton_meta.json file will generate
more informative exception, so that user can know which field
is missing, if any.
2024-05-12 18:26:58 +05:30
HanishKVC
470b8885f3 ChatON: Switch to templated json_get for str/bool/etal 2024-05-12 18:19:18 +05:30
HanishKVC
0249c07e6b ChatON:Switch to json_get_str to help identify missing keys better
The json library generates less informative exception message,
which doesnt help one identify which key is missing, so switch to
the new json_get_str helper added in the last commit. It generates
more informative exception message.
2024-05-12 17:44:13 +05:30
HanishKVC
4eae05a6b7 ChatON: json access helper which raises exception if key missing 2024-05-12 17:34:04 +05:30
HanishKVC
f94fed92d3 ChatON+MetaHpp: Had forgotten to conv reverse-prompt
Also has dump was using get_value calls with fallback to default,
so it wasnt identifying the missed field.

Have fixed both of those. Also reconverted meta json file.

Misc: interesting avesham and aattam
2024-05-12 16:20:28 +05:30
HanishKVC
4232ec1fb9 Main: Load json meta file only if specified
This should be ok, given that there is a version of the chat tmpl
meta data already included with the library.

So only if user wants to change the chat template info wrt a existing
model/template-standard or add a new one, then there is need to
pass a json file with info for that model/standard.
2024-05-12 14:53:37 +05:30
HanishKVC
a3285e8e25 ChatON:Include auto converted ChatONMeta.hpp chat template data
This should allow for using this generic chat templating code flow
along with the included chat template data, without needing to
load any json file at runtime.

However If user wants to change the already included chat template
data, or add new chat template standard/model related data, one can
explicitly load json file.

TODO: Need to cross check this flow once, but logically should work
2024-05-12 14:08:09 +05:30
HanishKVC
b8590e3e57 ChatON:P5:meta json to hpp: Add required c++ inc and global var
Also comment to indicate that the hpp file is auto converted from
the chaton_meta.json file
2024-05-12 14:06:24 +05:30
HanishKVC
b5b274a44b ChatON:P4:meta json to hpp: Insert kv bool
Rename kv helpers to match their semantic.
* whether working with string or bool value
* whether two keys or a single key

Add support for kv with bool value

inturn add the kv boolean pairs used in the chaton_meta.json file

Add the closing bracket
2024-05-12 13:33:54 +05:30
HanishKVC
7b5fb0a2fa ChatON:P3:meta json to hpp: Retain esc seqs and more kv pairs
Use repr to retain the escape sequences in the read string.
And parallely skip the single quote around strings wrt repr.

Bring in more k-v pairs wrt chaton_meta.json
2024-05-12 13:06:22 +05:30
HanishKVC
078e04d32b ChatON:P2:meta json to hpp conversion - add k-v pairs skeleton 2024-05-12 12:42:53 +05:30
HanishKVC
0c21a0084f ChatON:p1: meta json to hpp conversion - Initial skeleton
load the json file and put the template ids
2024-05-12 12:42:23 +05:30
HanishKVC
1574201f71 ChatON:LoadJSon:ChatTemplates: revPrompt, system-user flags
WIP:NOTE:

Initial go converting from json driven flow to ChatTemplatesGroupKV
related flow done. Needs to be tested.

A optional helper added to load ChatTemplates from a specified
json file.

Need to add a compile time initialized MapOfMapOfVariants wrt
the chat template details of models/standards already known
to the program. So that one can use the llama.cpp and this new
chat template logic, even without json dependency, if one doesnt
want to.
2024-05-12 01:45:19 +05:30
HanishKVC
444d2ccf9c ChatON:LoadJSON: ChatTemplates - global/system/user/assistant
Manually iterate the json object items using begin-end explicitly,
because the implicit iteration for loop related helpers for the
used json lib gives only the values and not a key-value pair.
2024-05-12 01:35:31 +05:30
HanishKVC
2efc09f2d0 ChatON: Unnecessarily indirect nlohmann json
code used for exploring/testing commited just for future reference
2024-05-12 00:42:17 +05:30
HanishKVC
b9d9700de3 CMakeLists.txt: Compile C++ code for -std=c++20 2024-05-11 23:42:08 +05:30
HanishKVC
b944d04d08 ChatON: Add constructor for ChatTemplates which chains into GKV 2024-05-11 23:42:08 +05:30
HanishKVC
d9959b74e7 GroupKV: Get ready for use in llama.cpp ++
Avoid defining GKV_TEST_PRG, used for self testing, by default

Add it to common library
2024-05-11 23:40:03 +05:30
HanishKVC
4a9a6ce256 ChatON: ChatONMetaDump switch to GKV/ChatTemplates based flow 2024-05-11 22:53:45 +05:30
HanishKVC
484c710eab GroupKV:Add GetValue which throws exception 2024-05-11 20:49:51 +05:30
HanishKVC
9d4450d51a GroupKV: Let dump return a string, rather than printing/logging 2024-05-11 19:43:34 +05:30
HanishKVC
e999934e91 ChatON:WIP: initial go at GroupKV based flow, instead of json 2024-05-11 19:41:58 +05:30
HanishKVC
f294fddf43 GroupKV: Add group_exists checker 2024-05-11 19:18:19 +05:30
HanishKVC
dde72df9d3 GroupKV: Rename the internal map 2024-05-11 18:23:06 +05:30
HanishKVC
fdefb39518 GroupKV:Make LDBUG macros conditional, avoid condition at usage site
Also change LWARN to LDBUG wrt previously GKV_DEBUG conditional
code
2024-05-11 13:30:56 +05:30
HanishKVC
7f03dd0d4b GroupKV: Add int32_t to variant list, to simplify int use
So that no need to explicitly specify <int64_t> or LL wrt int
literals, which dont need 64bit space by default.

Which also means one shouldnt/cant mix up type of value stored and
default type specified when getting.
2024-05-11 12:45:58 +05:30
HanishKVC
0342124946 GroupKV: Add to_str wrt vectors, help avoid compiler confusion 2024-05-11 12:27:42 +05:30
HanishKVC
7d7c59ec50 GroupKV:Simplify:P2: Rename tags, Make debug logs conditional
Rename all the log messages to have GKV and not SC.

The log messages in get_vector made conditional to GKV_DEBUG, this
was missed out earlier in simpcfg itself.
2024-05-11 11:57:27 +05:30
HanishKVC
d764a9d395 GroupKV: Simplify code to the minimal needed for GroupKV - P1 2024-05-11 11:37:06 +05:30
HanishKVC
86b842b172 GroupKV: Duplicate SimpCfg to chop down into GroupKV
IE a minimal MapOfMapOfVariant, with some basic helpers.

This can be the basis of a ChatTemplates object, as well as
SimpCfg built on top of it.
2024-05-11 10:57:32 +05:30
HanishKVC
c0506f94bf SimpCfg: Allow for direct initialization lists based init
This should pave way for having a default chat templates dataset
in the code, without needing to load it from a config file, if
one doesnt want to.

TODO: allow for loading config from json into simpcfg, so that
a program which uses llama.cpp can decide, whether it is ok with
what is already there in the internal dataset, or allow for loading
template info at runtime using the simpcfg's simple text file or
additionally include the json code to load template info at runtime
from json file.
2024-05-11 00:33:31 +05:30
HanishKVC
fe27902964 SimpCfg: Avoid iostream/cout and format for direct library use
It appears like std::format is not supported in older g++/lib still
in wide use like current debian stable, so avoiding same wrt direct
library use.

Allow for empty VAARGS

NOTE: However test program mode of the same uses cout and format
2024-05-10 22:27:07 +05:30
HanishKVC
1f9a0eb8ce ChatON: Remove unneeded iostream 2024-05-10 21:10:44 +05:30
HanishKVC
abb406b888 Merge branch 'master' into hkvc_chaton_v3
Have merged master branch has of 20240510IST12XY with chaton_v3
branch.

As part of same had to update the flow in examples/main/main.cpp
wrt conversion related commit in master branch and my chaton related
commits in this branch.
2024-05-10 13:14:26 +05:30
Andrei
d11afd6652
llava : fix moondream support (#7163)
* Revert "Revert "llava : add support for moondream vision language model (#6899)""

This reverts commit 9da243b36a.

* Fix num_positions and embeddings initialization
2024-05-10 09:41:10 +03:00
Ouadie EL FAROUKI
8c570c9496
Minor arithmetic improvement to mmvq wrapper kernel (#7172) 2024-05-10 08:32:15 +08:00
slaren
eaf4bd8b39
eval-callback : fix conversion to float (#7184) 2024-05-10 01:04:12 +02:00
0cc4m
befddd0f15
Vulkan Bugfixes and Improvements (#7084)
* Modify mat mat mul shader for mul_mat_id, modify mat vec mul shaders for single call batch operation

* Further work towards MoE, disabled for now

* Disable MoE code (not ready yet), fix a number of bugs in shaders and Vulkan code

* Add softmax with f16 mask and pos buffer support

* Disable mul_mat_id shaders for now

* Fix flake8

* Fix validation errors caused by empty buffers on larger batch sizes
2024-05-09 20:39:54 +02:00