aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorPavol Rusnak <pavol@rusnak.io>2023-04-11 21:45:44 +0200
committerGitHub <noreply@github.com>2023-04-11 19:45:44 +0000
commit8b679987cdce292ff36bd741f6715e4927e26f9b (patch)
treef6b913d90283ec662004818846e0a14357c0209e /examples
parent3e6e70d8e8917b5bd14c7c9f9b89a585f1ff0b31 (diff)
Fix whitespace, add .editorconfig, add GitHub workflow (#883)
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/Miku.sh12
-rw-r--r--examples/common.cpp14
-rw-r--r--examples/embedding/README.md6
-rw-r--r--examples/main/README.md6
-rw-r--r--examples/main/main.cpp2
-rw-r--r--examples/perplexity/README.md6
6 files changed, 23 insertions, 23 deletions
diff --git a/examples/Miku.sh b/examples/Miku.sh
index 352478a..c4cbf80 100755
--- a/examples/Miku.sh
+++ b/examples/Miku.sh
@@ -19,15 +19,15 @@ GEN_OPTIONS=(--batch_size 1024
--top_p 0.5)
if [ -n "$N_THREAD" ]; then
- GEN_OPTIONS+=(--threads "$N_THREAD")
+ GEN_OPTIONS+=(--threads "$N_THREAD")
fi
./main "${GEN_OPTIONS[@]}" \
- --model "$MODEL" \
- --n_predict "$N_PREDICTS" \
- --color --interactive \
- --reverse-prompt "${USER_NAME}:" \
- --prompt "
+ --model "$MODEL" \
+ --n_predict "$N_PREDICTS" \
+ --color --interactive \
+ --reverse-prompt "${USER_NAME}:" \
+ --prompt "
This is a transcript of a 1000 page, never ending conversation between ${USER_NAME} and the cute and helpful AI assistant ${AI_NAME}. ${AI_NAME} is a girl who is an AI running on the users computer.
${AI_NAME} can think for herself without the user seeing her thoughts by adding a /think prefix to her output. She uses this to reason about the world and to think about what she should say next.
${AI_NAME} is always coherent and makes sense, but if she isn't sure if what she is saying is correct she will ask the user for help.
diff --git a/examples/common.cpp b/examples/common.cpp
index f909eed..91d96ef 100644
--- a/examples/common.cpp
+++ b/examples/common.cpp
@@ -22,9 +22,9 @@ extern "C" __declspec(dllimport) int __stdcall GetConsoleMode(void* hConsoleHand
extern "C" __declspec(dllimport) int __stdcall SetConsoleMode(void* hConsoleHandle, unsigned long dwMode);
extern "C" __declspec(dllimport) int __stdcall SetConsoleCP(unsigned int wCodePageID);
extern "C" __declspec(dllimport) int __stdcall SetConsoleOutputCP(unsigned int wCodePageID);
-extern "C" __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int CodePage, unsigned long dwFlags,
- const wchar_t * lpWideCharStr, int cchWideChar,
- char * lpMultiByteStr, int cbMultiByte,
+extern "C" __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int CodePage, unsigned long dwFlags,
+ const wchar_t * lpWideCharStr, int cchWideChar,
+ char * lpMultiByteStr, int cbMultiByte,
const char * lpDefaultChar, bool * lpUsedDefaultChar);
#define CP_UTF8 65001
#endif
@@ -328,9 +328,9 @@ void win32_console_init(bool enable_color) {
// Convert a wide Unicode string to an UTF8 string
void win32_utf8_encode(const std::wstring & wstr, std::string & str) {
- int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);
- std::string strTo(size_needed, 0);
- WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &strTo[0], size_needed, NULL, NULL);
- str = strTo;
+ int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);
+ std::string strTo(size_needed, 0);
+ WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &strTo[0], size_needed, NULL, NULL);
+ str = strTo;
}
#endif
diff --git a/examples/embedding/README.md b/examples/embedding/README.md
index 21d8be6..fe8f5dc 100644
--- a/examples/embedding/README.md
+++ b/examples/embedding/README.md
@@ -1,3 +1,3 @@
-# embedding
-
-TODO
+# embedding
+
+TODO
diff --git a/examples/main/README.md b/examples/main/README.md
index 4701aa5..f09e7ba 100644
--- a/examples/main/README.md
+++ b/examples/main/README.md
@@ -1,3 +1,3 @@
-# main
-
-TODO
+# main
+
+TODO
diff --git a/examples/main/main.cpp b/examples/main/main.cpp
index bf756c1..ba153cb 100644
--- a/examples/main/main.cpp
+++ b/examples/main/main.cpp
@@ -168,7 +168,7 @@ int main(int argc, char ** argv) {
}
// enable interactive mode if reverse prompt or interactive start is specified
- if (params.antiprompt.size() != 0 || params.interactive_start) {
+ if (params.antiprompt.size() != 0 || params.interactive_start) {
params.interactive = true;
}
diff --git a/examples/perplexity/README.md b/examples/perplexity/README.md
index a932275..eacfb17 100644
--- a/examples/perplexity/README.md
+++ b/examples/perplexity/README.md
@@ -1,3 +1,3 @@
-# perplexity
-
-TODO
+# perplexity
+
+TODO