Skip to content
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

use fprintf for diagnostic output, keep printf only for printing model output #48

Merged
merged 1 commit into from
Mar 13, 2023
Merged

Conversation

prusnak
Copy link
Collaborator

@prusnak prusnak commented Mar 12, 2023

one can use ./main ... 2>/dev/null to suppress any diagnostic output

Fixes #5

Copy link
Owner

@ggerganov ggerganov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to modify ggml.c and ggml.h - it does not print anything.

Keep only the rest of the changes

keep printf only for printing model output

one can now use ./main ... 2>dev/null to suppress any diagnostic output
@prusnak
Copy link
Collaborator Author

prusnak commented Mar 13, 2023

Rebased on top of current master, kept only changes in main.cpp

@ggerganov ggerganov merged commit 671d5ca into ggerganov:master Mar 13, 2023
@prusnak prusnak deleted the info-stderr branch March 13, 2023 16:40
@Godwinnna
Copy link

one can use ./main ... 2>dev/null to suppress any diagnostic output

Fixes #5

@Godwinnna
Copy link

Hello

@linonetwo
Copy link

linonetwo commented Mar 20, 2023

What does this mean?

./chat --model "../model/ggml-alpaca-7b-q4.bin"  --prompt "Tell me a joke. End with Joke EOF." 2>dev/null  
zsh: no such file or directory: dev/null

The command 2>dev/null is used to redirect the standard error (stderr) output of a command to /dev/null, which is a special file in Unix-like systems that discards any data written to it. This is often used to suppress error messages or diagnostic output that may be displayed on the terminal.

In your case, it seems like there is a typo in the command. The correct syntax is /dev/null with a slash before dev, not dev/null. So the corrected command would be:

javascript
Copy code
./chat --model "../model/ggml-alpaca-7b-q4.bin" --prompt "Tell me a joke. End with Joke EOF." 2>/dev/null

This should redirect the stderr output of the ./chat command to /dev/null, effectively suppressing any diagnostic output that may be displayed on the terminal.


In Windows PowerShell, you can achieve a similar result of redirecting stderr output to null using the > operator to redirect the output stream and 2>&1 to redirect the error stream to the output stream.

Here's an example command:

java
Copy code
.\chat.exe --model "..\model\ggml-alpaca-7b-q4.bin" --prompt "Tell me a joke. End with Joke EOF." 2>&1 > $null

In this example, 2>&1 redirects the stderr stream to the stdout stream and > $null redirects the stdout stream to $null, which is a PowerShell automatic variable representing a null or empty value. This effectively discards any output from the command, including both stdout and stderr streams.

Note that the path separators in Windows PowerShell use a backslash () instead of a forward slash (/), and the executable extension for Windows is .exe instead of no extension.

@prusnak
Copy link
Collaborator Author

prusnak commented Mar 20, 2023

What does this mean?

Yes, there was a typo in my original post, it should read /dev/null, I updated the post.

@linonetwo
Copy link

linonetwo commented Mar 20, 2023

Thanks, this helps when I was writing a function to call alpaca.cpp/llama.cpp from JS

https://github.com/linonetwo/langchain-alpaca/blob/1c519c206ea5152269c3d82d160a2567bbc9e69f/src/index.ts#L222-L282

rooprob pushed a commit to rooprob/llama.cpp that referenced this pull request Aug 2, 2023
44670 pushed a commit to 44670/llama.cpp that referenced this pull request Aug 2, 2023
ggerganov#48)

* This commit changes the naming conventioins of the shared object files. This modificatioin will produce libfalcon.so instead of liblibfalcon.so which would create downstreem bugs.

* This commit renames the falcon.cpp and falcon.h files the libfalcon.cpp and libfalcon.h. It produces shared object files that maintain the standard file format of libfalcon.so
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suppress output that isn't from the model
4 participants