Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - JohnClaw

#1
Off-Topic Discussions / Re: JAN.AI
January 11, 2025, 03:30:23 AM
I love qwen 2.5 coder 7b instruct too. I haven't tried it bcx skills yet though. But it can generate code for simple VisualBasic 6.0 applications. However, i use  more interesting tool than jan.ai.

Q4 quant has acceptable quality but it's not enough for best results in code generation. I found pure c llm engine made from scratch by talented coder/scientist.

Here's it's github repo: https://github.com/pierrel55/llama_st

This engine allows to run qwen 2.5 coder 7b instruct in fp12 mode which makes code generation much better (qwen makes less mistakes). I don't have gpu and run qwen on cpu (ryzen 7 4700u) and 16gb ram. It is slow but brings me happiness when after long waiting i finally get working code. llama_st also supports fp8 quantization which is worse than fp12 but still much more clever than q4. It is obvious that qwen in fp8 mode requires less ram and runs faster than in fp12 mode.

Jan.ai can't work without llama.cpp/ggml backend, it also can't work in fp12 mode. llama_st doesn't require any backend like llama.cpp/ggml. it can be compiled in w64devkit 1.21.0 or in Microsoft Visual Studio Express 2012. It has only one disadvantage: it loads unquantatized weights of qwen which requires much more free space on your ssd.

I was so fascinated with coolness of llama_st.exe that used Deepseek (https://chat.deepseek.com/) to modify llama_st source code in such way that it can be compiled and used as dll which has single-shot question-answer function.

I called this function from bcx code, sent random question to llama_st.dll and qwen answered my question. Unfortunately, my bcx and c skills are too low for porting chatting functionality from llama_st.exe to llama_st.dll. Deepseek probably could do that but forcing Deepseek completing such task requires decent English skills (my native language is different) and sufficient coding experience because Deepseek needs mindful guidance from it's human master otherwise it generates non-working code.

I attached llama_st.zip to this post. It contains minimal bcx bas file needed to run dll, llama_st.dll, modified main.c source file of llama_st.exe (modifications were done to make it possible to compile it to dll instead of exe), llama_st.exe (compiled minimal bcx bas), build_dll.bat, modified json file containing qwen parameters.

First of all you need to download llama_st zipped source files archive (https://github.com/pierrel55/llama_st/archive/refs/heads/main.zip), unpack it to some folder, replace original main.c with modified main.c, place build_dll.bat to folder where your lama_st source files are.

Then you need to download and install w64devkit 1.21.0 (https://github.com/skeeto/w64devkit/releases/download/v1.21.0/w64devkit-1.21.0.zip). After installing it you should launch w64devkit.exe.

Inside console window of w64devkit.exe you should type and execute something like cd C:\\llama_st (assuming that you unpacked source of llama_st there). Then you should type and execute build_dll.bat. W64devkit.exe will use commands from build_dll.bat for llama_st.dll compilation.

You will need to download unquantatized weights of qwen - https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct/tree/main All downloaded weights files should be put into some folder. You should edit modified_qwen_json.json accordingly. By default weights folder path specified in modified_qwen_json.json is C:/mdl2. Original llama_st.exe uses unmodified json file which has ability to load three different qwen models. And weights folder path is specified for each qwen model. But in our case we use only one qwen. However, we should specify weights folder path three times in modified_qwen_json.json.

So what we have for the moment?
1) compiled llama_st.dll
2) downloaded qwen weights files in C:\mdl2 (json file requires different slash in path: /)

Now we should do several more things:
1) create run_json subfolder This subfolder should be created in the same folder where llama_st.dll is.
2) move modified_qwen_json.json to run_json subfolder
3) launch BED
4) open llama_st.bas in BED (llama_st.bas can be found in zip archive attached to this post)
5) compile llama_st.bas 6) launch llama_st.exe

Here's code of llama_st.bas:

DECLARE FUNCTION ai$ LIB "llama_st.dll" ALIAS "get_answer_from_ai"(sent_question$, command_line$)
ai$("Why cats can't bark?", "run_json/modified_qwen_json.json")

As far as i know none of Python/Rust/C++ llm engines can run qwen 7b model in fp12 mode on 16gb ram. Only C-coded llama_st can. And the most amazing thing: conversion from fp16 (original format of qwen weights) to fp12 is made in few seconds and in ram without any Python scripts and writing quantatized weights to ssd. It's pure magic. Glory to standard C (and BCX, of course)!

P.S: my attempt to convert code of exe to code of dll using Deepseek isn't perfect. It has some weak places due to my lack of understanding coding etc. For example, qwen doesn't stop text generation in some cases. So you should just close llama_st.exe window. If you're experienced C coder it will not be a problem for you to fix main.c. Also maybe i broke something in json file unwillingly, by accident.

So if you will encounter non-stoping qwen text generation you should probably try original qwen_json.json from llama_st source archive. However, in any case you will need to modify 3 pathes to weights files folder. Original llama_st.exe hasn't problem with unstopping qwen text generation.
#2
I like BED's updates but i use BED's version dated by november 2023 because it's fonts are clear and latest BED has blurry fonts (my eyes become tired when i look at blurry fonts for long time). I attached screenshot which shows differences in fonts appearance in different versions of BED.

It looks like latest BED's DPI works wrong on my laptop with AMD igpu Vega 7.

#3
Thanks for update. Sorry for stupid questions from a newbie: what about MSYS clang? Is it different from ms vs clang? will you add support for msys clang to BED?

And one more question: w64devkit is more lightweight than MINGW. Maybe it would be better to support w64devkit instead of MINGW?
#4
Quote from: airr on March 07, 2024, 08:07:02 PM
64bit only, working here with BED (limited testing), I got it down to 242MB.  YMMV....just trying this to see if it can be done.  :)

https://share.binarymagic.net/-8uQSGMAx5e

AIR.

Link doesn't work anymore. Re-upload it, please.
#5
Thank you very much, MrBcx. Now my code compiles without errors.
#6
I have some problems with this subject. For example, i has Test.dll, Test.lib and Test.h. So when i try to call C function declared in Test.h: TestFunction(L"info") BCX translates it's code to C like this: TestFunction(L "info"). So BCX adds a space after L and it makes compilation to fail. How can i fix that? Help me, please.
#7
Questions & Answers / Re: Problems with UTF-8
May 06, 2024, 04:03:17 AM
tinyBigGAMES improved Dllama source by reducing number of exported functions from 39 to just 10. So now it's much easier to make bindings for those who undertstand Delphi/C/C++ code. I wish i would be one of those lucky persons.
#8
Questions & Answers / Re: Problems with UTF-8
April 29, 2024, 09:16:50 PM
I told Dllama's developer about your problem. He said that your card is up to the task but you need enable/update/configure vulkan drivers.
#9
Questions & Answers / Re: Problems with UTF-8
April 29, 2024, 04:40:26 PM
If you have decent NVIDIA GPU that supports CUDA technology and Vulkan backend, you can turn on GPU acceleration to make inference work much faster:

Just change fourth argument to TRUE value like this and re-compile exe:

answer = LLM(LLM_Path, "models.json", LModelName, True, 1024, 27, question)
#10
Questions & Answers / Re: Problems with UTF-8
April 29, 2024, 01:09:39 AM
Dear Mr. BCX. The creator of Dllama.dll has just registered on this forum. Please, activate his registration. His nickname is tinyBigGAMES. He wants to discuss the problem in this thread but can't do that without account activation/approvement.
#11
Questions & Answers / Re: Problems with UTF-8
April 29, 2024, 01:05:38 AM
Could you share those magic bat files, please? ::)
#12
Questions & Answers / Re: Problems with UTF-8
April 29, 2024, 12:56:27 AM
You are lucky person. I asked Dllama_BCX_GUI the same question and got Chinese letters instead of Russian characters. What compiler do you use? Pelles C? MINGW? LCC? MSVC? Did you add -u parameter to BC.exe command line? Or maybe you added /utf-8 command line option for Pelles C (pocc.exe), did you?
#13
Questions & Answers / Re: Problems with UTF-8
April 29, 2024, 12:42:13 AM
Cool. Please, ask him: "Почему луна желтая?" "Why moon is yellow?" I bet he wouldn't answer or will answer in Chinese instead of Russian. It may be caused by wrong encoding.
#15
Questions & Answers / Re: Problems with UTF-8
April 29, 2024, 12:26:00 AM
And the most important one: Dllama.h (attached to post).