-
Notifications
You must be signed in to change notification settings - Fork 13
No such thing as CreateFile2? A MinGW problem #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey JG-Adams, Please see the Readme as it answers all of your questions. Specifically, the section at the top labeled Quick Start will show you how to use this library: https://github.com/jmont-dev/ollama-hpp?tab=readme-ov-file#quick-start This is a header-only library. You just need to include the single-header include file and you can use it; no additional linking is required. This is also detailed in the Readme. I've checked main.cpp in the main branch and latest release and they are already correct as "sleep". You may have changed this on your own during testing, but it appears correct in the library and has no issues building. If you can give me some details on your platform and compiler I can help debug other issues that you're running into. This was tested and built on Rocky Linux 8.10 using gcc (GCC) 8.5.0. It should be broadly compatible with most other Linux distros; I haven't tested it on Windows but it may work there as well. |
I have read the readme. It's just saying compile the example. I tried both make and cmake they both have this error where CreateFile2 is undefined. |
Ok, found a solution for this issue. But another arise. It fix CreateFile2. But, not sleep. With it being Sleep it compile, but it has undefined error for some network. This compile. So, it is not truly a header only library. At least, not on window. But, that's easy to fix. However. Running the program. I have no idea what is going on and what's supposed to happen, but, it fails on everything. [doctest] doctest version is "2.4.11"
|
Whatever that test was supposed to do, something isn't consistent so it fail to pass. But, I'm able to have a working program with this. |
Thanks for your feedback. A lot of the issues you ran into originate from your platform being different from the unix-based platform that I developed on. This was developed on Rocky Linux 8.9 and haven't had a chance to try it on Windows. I'll test it with minGW and Visual C++ when I have the opportunity.
This compiles on Linux with GCC without any special linkages. I don't see httplib documentation from YujiRose mentioning that winSock32 has to be linked on Windows; his documentation for httplib which is used in this library is here: https://github.com/yhirose/cpp-httplib. If wSock32 was required for linkage on your platform I can note that for other users. Several of those tests are looking for precise text to be returned from a specific model with a specified seed; this was correct on creation but the base model weights have since been updated on huggingface which changed this output. I'm going to refactor these tests so that they don't rely on matching an exact response to be valid. Blobs are files used to store model weights and parameters that are used in Ollama. I don't think any user will need to manually interact with these but they were included in the Ollama API spec so I added support for them. Even when I structure the query as stated in the API I'm getting a failure response from the server; this may be an issue upstream in Ollama or there may be something else going on. This will be addressed with lower priority since it isn't a feature that will be frequently used. I have an upcoming release targeting the new Ollama tool support in 0.3.0 and will factor in some of your recommendations for changes. Thanks for doing some of the pathfinding to get this tested on Windows. |
Glad to hear you were able to get it working though. Let me know if there are any other issues that you find during testing. |
Thank you for making this! It's easier than Boost::asio :) Is the function, chat supposed to return an AI response? Because it's not outputting anything. It's just outputting a bunch of newline. Oddly enough, after running it a couple time there is a small chance it would actually output something. Chat1 {"format":"json","keep_alive":"5m","messages":[{"content":"What are nimbus clouds?","role":"user"}],"model":"llama3.1:latest","stream":false} I don't get why this is happening. |
I even got this. {"smallGrid":"true","smallScreen":{"width":480,"height":200},"bigGrid":"false","bigScreen":{"width":1600,"height":1200},"articleType":"article" , "content":" Nimbus clouds, also known as dark rain clouds or cumulonimbus clouds, are tall, dense, and dark clouds that can produce heavy precipitation, thunderstorms, and even tornadoes. They form when warm, moist air rises rapidly into cold air, creating towering vertical growth. These clouds have a characteristic anvil-shaped base and a flat, anvil-like top. They can reach heights of over 10,000 meters (33,000 feet), making them the tallest type of cloud. Nimbus clouds are associated with severe weather conditions, including heavy rain, hail, lightning, and strong winds. They Nimbus clouds can be further classified into different types based on their height, shape, and other characteristics. They are an important part of the weather cycle and play a crucial role in shaping our climate and environment. ","@type":"Article" , "image":{"@type":"ImageObject","url":"https://cdn.vox-cdn.com/thumbor/4fQgCtqTmzXK1xwZsUv8V7WJ6I=/0x0:1203x675/1600×900/filters:format(jpeg):quality(90)/crop/0x0:1203x675/https://cdn.vox-cdn.com/thumbor/4fQgCtqTmzXK1xwZsUv8V7WJ6I=/0x0:1203x675/1600×900/filters:format(jpeg):quality(90)/crop/0x0:1203x675/https://cdn.vox-cdn.com/uploads/2022/06/164f4e2d-8d41-4067-b5c6-a9dd44b0f1eb-1140.jpg","width":1203,"height":675}} Why is it trying to give me an image and link? This is llama3.1 I have no clue if it was supposed to have that capability or how to handle it. |
Yes, the chat endpoint should return a response just like generate. It looks like the issue is specific to the model; llama3.1/3 is returning no response or malformed responses from the server while other models look good. I'm not sure why this is happening; the query to the server looks good but ollama is immediately returning a blank reply containing the stop flag. I'll do some investigating and will talk to the folks in the main Ollama project to see if anyone else is seeing the same issues. It may be that a special flag or option has to be set for llama3. In the meantime, the generate endpoint appears to work fine with 3.1. You can still structure your prompt as a question/answer series and generate an assistant reply using that method. This is the chat response that I get from mistral, which looks good (debug logging for the server request and reply included): ollama::message message1("user", "What are nimbus clouds?");
std::cout << ollama::chat("mistral", message1) << std::endl; {"format":"json","keep_alive":"5m","messages":[{"content":"What are nimbus clouds?","role":"user"}],"model":"mistral","stream":false} Multi-message chat also looks good with mistral: ollama::message message1("user", "What are nimbus clouds?");
ollama::message message2("assistant", "Nimbus clouds are dense, moisture-filled clouds that produce rain.");
ollama::message message3("user", "What are some other kinds of clouds?");
ollama::messages messages = {message1, message2, message3};
std::cout << ollama::chat("mistral", messages) << std::endl; {"format":"json","keep_alive":"5m","messages":[{"content":"What are nimbus clouds?","role":"user"},{"content":"Nimbus clouds are dense, moisture-filled clouds that produce rain.","role":"assistant"},{"content":"What are some other kinds of clouds?","role":"user"}],"model":"mistral","stream":false} I'll track this in another issue. |
I don't think Llama 3.1 is supposed to respond with links or images. That looks like hallucinated text with the model just regurgitating something similar to the web pages it trained on, probably a symptom of improper formatting between ollama and the model when using the chat endpoint. It could also be that the default options for the model have something like high temperature or top-k which will result in more random and less structured output. I'll do some experimenting and see if I can reign it in for Llama 3.1 so that the chat endpoint is producing reliable output like |
The issues appears to be caused by the I've addressed the issue by removing the formatting tag entirely from the requests made to the chat endpoint. This was merged with #11 and is included in the maintenance release 0.9.1 that was just issued. If you comment out line 253 in Ollama.hpp you should get normal behavior from chat when using Llama 3:
Tracking this in #9 and will close once I hear back from the Ollama devs. |
Very interesting. Thank you for looking into this! You're doing great! |
On line 2858, inside httplib.h.
hFile_ = ::CreateFile2(wpath.c_str(), GENERIC_READ, FILE_SHARE_READ,
OPEN_EXISTING, NULL);
Is an error, '::CreateFile2' has not been declared; did you mean 'CreateFileW'? GCC
Also, in main.cpp sleep appeared to be mispelled for Sleep.
Is there a library I'm supposed to link to?
I would like to be able to try this. So please offer solution.
The text was updated successfully, but these errors were encountered: