int main(int argc, char ** argv) {
gpt_params params;
if (argc == 1 || argv[1][0] == '-') {
printf("usage: %s MODEL_PATH [PROMPT]\n" , argv[0]);
return 1 ;
}
if (argc >= 2) {
params.model = argv[1];
}
if (argc >= 3) {
params.prompt = argv[2];
}
if (params.prompt.empty()) {
params.prompt = "Hello my name is";
}
// total length of the sequence including the prompt
const int n_len = 32;
typedef void (*PFUNC) (char* szToken);
extern "C" __declspec (dllexport) int Llama(char* szModel, char* szPrompt, PFUNC pCallBack) {
gpt_params params;
params.model = szModel;
params.prompt = szPrompt;
params.sparams.temp = 0.7;
// total length of the sequence including the prompt
const int n_len = 512;
// LOG_TEE("%s", llama_token_to_piece(ctx, new_token_id).c_str());
pCallBack((char*)llama_token_to_piece(ctx, new_token_id).c_str());
Antonio Linares wrote:solved,
please download this llama64.dll:
https://github.com/FiveTechSoft/FWH_tools/blob/master/llama64.dll
alerchster wrote:I only ever had error 0 in the program with the downloaded DLL.
Then I created llama64.dll myself according to the information above and it worked immediately.
Jimmy wrote:hi,
need Help to create llama64.dll
have download and install "GIT for Windows"
after Setup a small Bash Console Window open
but i got stuck at "5. cmake .."
please advice me what to do
#include "Fivewin.ch"
function Main()
local oDlg, cPrompt := PadR( "List 10 possible uses of AI from my Windows apps.", 200 )
local cAnswer := "", oAnswer, oBtn
DEFINE DIALOG oDlg SIZE 700, 500 TITLE "FWH AI"
@ 1, 1 GET cPrompt SIZE 300, 15
@ 3, 1 GET oAnswer VAR cAnswer MULTILINE SIZE 300, 200
@ 0.7, 52.5 BUTTON oBtn PROMPT "start" ;
ACTION ( oBtn:Disable(), Llama( "phi-2_Q4_K_M.gguf", RTrim( cPrompt ),;
CallBack( { | cStr | oAnswer:SetFocus(), oAnswer:Append( cStr ) } ) ),;
oBtn:Enable(), oBtn:SetFocus() )
@ 2.2, 52.5 BUTTON "Clear" ACTION oAnswer:SetText( "" )
ACTIVATE DIALOG oDlg CENTERED
return nil
DLL FUNCTION Llama( cModel AS LPSTR, cPrompt AS LPSTR, pFunc AS PTR ) AS VOID PASCAL LIB "llama64.dll"
alerchster wrote:cmake is part of VS!
After step 4 at the latest, depending on the VS version, "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64 should be executed, otherwise "cmake .." would not work.
Antonio Linares wrote:Could you kindly adapt this code to HMG ?
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot], SantaCroya and 35 guests