ChatOn:Main: Load and dump any specified chaton meta file
This commit is contained in:
parent
35f25196a0
commit
dc56be951d
3 changed files with 78 additions and 0 deletions
|
@ -19,4 +19,34 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <json.hpp>
|
||||||
|
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
|
using json = nlohmann::json;
|
||||||
|
|
||||||
|
json conMeta;
|
||||||
|
|
||||||
|
inline bool chaton_meta_load(std::string &fname) {
|
||||||
|
std::ifstream f(fname);
|
||||||
|
conMeta = json::parse(f);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool chaton_meta_ok() {
|
||||||
|
if (conMeta == nullptr) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void chaton_meta_dump() {
|
||||||
|
if (!chaton_meta_ok()) {
|
||||||
|
LOG_TEELN("ERRR:%s:ChatOn Meta: Not loaded yet...", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LOG_TEELN("\n\nINFO:%s:ChatOn Meta\n%s", __func__, conMeta.dump(4).c_str());
|
||||||
|
}
|
||||||
|
|
42
examples/chaton_meta.json
Normal file
42
examples/chaton_meta.json
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
|
||||||
|
{
|
||||||
|
"llama2": {
|
||||||
|
"global": {
|
||||||
|
"prefix": "[INST] ",
|
||||||
|
"suffix": " [/INST]",
|
||||||
|
},
|
||||||
|
"system": {
|
||||||
|
"prefix": " <<SYS>>\n",
|
||||||
|
"suffix": "\n<</SYS>>\n\n",
|
||||||
|
},
|
||||||
|
"user": {
|
||||||
|
"prefix": "",
|
||||||
|
"suffix": "",
|
||||||
|
},
|
||||||
|
"assistant": {
|
||||||
|
"prefix": "",
|
||||||
|
"suffix": "",
|
||||||
|
},
|
||||||
|
"reverse-prompt": "</s>",
|
||||||
|
},
|
||||||
|
"llama3": {
|
||||||
|
"global": {
|
||||||
|
"prefix": "",
|
||||||
|
"suffix": "",
|
||||||
|
},
|
||||||
|
"system": {
|
||||||
|
"prefix": "<|start_header_id|>system<|end_header_id|>\n\n",
|
||||||
|
"suffix": "<|eot_id|>\n\n",
|
||||||
|
},
|
||||||
|
"user": {
|
||||||
|
"prefix": "<|start_header_id|>user<|end_header_id|>\n\n",
|
||||||
|
"suffix": "<|eot_id|>\n\n",
|
||||||
|
},
|
||||||
|
"assistant": {
|
||||||
|
"prefix": "<|start_header_id|>assistant<|end_header_id|>\n\n",
|
||||||
|
"suffix": "",
|
||||||
|
},
|
||||||
|
"reverse-prompt": "<|eot_id|>",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "chaton.hpp"
|
||||||
|
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "llama.h"
|
#include "llama.h"
|
||||||
|
@ -141,6 +142,11 @@ int main(int argc, char ** argv) {
|
||||||
console::init(params.simple_io, params.use_color);
|
console::init(params.simple_io, params.use_color);
|
||||||
atexit([]() { console::cleanup(); });
|
atexit([]() { console::cleanup(); });
|
||||||
|
|
||||||
|
if (params.chaton) {
|
||||||
|
chaton_meta_load(params.chaton_json);
|
||||||
|
chaton_meta_dump();
|
||||||
|
}
|
||||||
|
|
||||||
if (params.logits_all) {
|
if (params.logits_all) {
|
||||||
printf("\n************\n");
|
printf("\n************\n");
|
||||||
printf("%s: please use the 'perplexity' tool for perplexity calculations\n", __func__);
|
printf("%s: please use the 'perplexity' tool for perplexity calculations\n", __func__);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue