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

Deprecation warning to assist with migration to new binary names #8283

Merged
merged 5 commits into from
Jul 9, 2024

Conversation

HanClinto
Copy link
Collaborator

@HanClinto HanClinto commented Jul 3, 2024

As discussed previously, there seems to be a fair bit of confusion still arising from the name change made in #7809. This PR attempts to mitigate some of that confusion by applying a (temporary) fix to help encourage users to migrate to the new filenames.

First suggested here, this PR is merely a dirt-simple program to provide a deprecation warning to point people to the new filenames.

I have mixed feelings about cluttering up the build space with legacy binary filenames, so I only included replacement binaries for the things that I feel are most likely to be included in a pipeline somewhere and the upgrade go un-noticed.

Suggestions for better ways to handle this, or which binaries should be included / excluded are very welcome.

Thank you!

Usage

Previously, continuing to updated source and make would leave the old binaries in place, and a common pitfall is for users to continue running old binaries without realizing that names have changed.

Now, this is the behavior that one sees:

(base) ➜  llama.cpp git:(legacy-binaries) ✗ ./main

WARNING: The binary 'main' is deprecated.
 Please use 'llama-cli' instead.
 See https://github.com/ggerganov/llama.cpp/tree/master/examples/deprecation-warning/README.md for more information.

or:

(base) ➜  llama.cpp git:(master) ✗ ./server

WARNING: The binary 'server' is deprecated.
 Please use 'llama-server' instead.
 See https://github.com/ggerganov/llama.cpp/tree/master/examples/deprecation-warning/README.md for more information.

Guidelines

…st to help people notice the binary name change from ggerganov#7809 and migrate to the new filenames.
@ngxson
Copy link
Collaborator

ngxson commented Jul 4, 2024

I'm not opposing this change, but can we just print out error from makefile, instead of compiling a new binary?

Makefile

main:
	@echo "The binary 'main' is deprecated."
	@echo "Please run 'make llama-cli' instead."
	@exit 1
$ make main

The binary 'main' is deprecated.
Please run 'make llama-cli' instead.
make: *** [Makefile:1477: main] Error 1

@bartowski1182
Copy link
Contributor

That won't solve when users do just make right?

Also this will replace their old binary, many were building and accidentally using the main that stuck around rather than the new correct binary, I think this is a more reasonable solution. It doesn't have to be permanent, just for a month or so to reduce the issue clutter

@HanClinto
Copy link
Collaborator Author

HanClinto commented Jul 5, 2024

I'm not opposing this change, but can we just print out error from makefile, instead of compiling a new binary?

Makefile

main:
	@echo "The binary 'main' is deprecated."
	@echo "Please run 'make llama-cli' instead."
	@exit 1
$ make main

The binary 'main' is deprecated.
Please run 'make llama-cli' instead.
make: *** [Makefile:1477: main] Error 1

If I'm understanding @ngxson 's suggestion, we would add this main target to the default build, so it would still fire off if people just simply typed make.

That said, we could also add a filename check to this, and only output this warning if the file exists. I agree with @bartowski1182 -- this is a good thing, but it addresses a slightly different case.

I think we could combine the two approaches, and it might be best to do the filename check for this. I.E., only build the replacement binary (and output the warning) if the old one exists -- otherwise, don't build anything new, and don't send any messages.

@ngxson
Copy link
Collaborator

ngxson commented Jul 7, 2024

IMO to address the issue of someone forget to clean up old binaries, we can just remove all old binaries if someone run "make". If they run "make main", then we show the error in my last comment, so eventually no need to compile a new target.

@bartowski1182
Copy link
Contributor

Maybe only if it's successful, don't want make to fail and leave users with no way to run anything

…or their existence every time so that they are not ignored.
@HanClinto
Copy link
Collaborator Author

HanClinto commented Jul 8, 2024

Okay, new update to integrate some suggestions, and we now build the legacy replacement binaries more intelligently.

Now, the deprecation-warning binaries are ONLY built if a previous version of main (or server or other legacy binaries) already exists. It's not quite as good as what @bartowski1182 was suggesting with only building the replacements if the llama-cli build was successful, but I think this is a reasonable compromise?

If one is building from a fresh / updated build, then nothing new is printed or built. Only llama--prefixed binaries are added to the build folder.

However, if one is building with legacy binaries present, then for each legacy binary, it will output a message like the following:

I ccache not found. Consider installing it for faster compilation.
I llama.cpp build info:
I UNAME_S:   Darwin
I UNAME_P:   arm
I UNAME_M:   arm64
I CFLAGS:    -Iggml/include -Iggml/src -Iinclude -Isrc -Icommon -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE -DNDEBUG -DGGML_USE_ACCELERATE -DGGML_USE_BLAS -DACCELERATE_NEW_LAPACK -DACCELERATE_LAPACK_ILP64 -DGGML_USE_LLAMAFILE -DGGML_USE_METAL -DGGML_METAL_EMBED_LIBRARY  -std=c11   -fPIC -O3 -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wshadow -Wstrict-prototypes -Wpointer-arith -Wmissing-prototypes -Werror=implicit-int -Werror=implicit-function-declaration -pthread -Wunreachable-code-break -Wunreachable-code-return -Wdouble-promotion
I CXXFLAGS:  -std=c++11 -fPIC -O3 -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wmissing-declarations -Wmissing-noreturn -pthread   -Wunreachable-code-break -Wunreachable-code-return -Wmissing-prototypes -Wextra-semi -Iggml/include -Iggml/src -Iinclude -Isrc -Icommon -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE -DNDEBUG -DGGML_USE_ACCELERATE -DGGML_USE_BLAS -DACCELERATE_NEW_LAPACK -DACCELERATE_LAPACK_ILP64 -DGGML_USE_LLAMAFILE -DGGML_USE_METAL -DGGML_METAL_EMBED_LIBRARY
I NVCCFLAGS: -std=c++11 -O3
I LDFLAGS:   -framework Accelerate -framework Foundation -framework Metal -framework MetalKit
I CC:        Apple clang version 15.0.0 (clang-1500.3.9.4)
I CXX:       Apple clang version 15.0.0 (clang-1500.3.9.4)

c++ -std=c++11 -fPIC -O3 -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wmissing-declarations -Wmissing-noreturn -pthread   -Wunreachable-code-break -Wunreachable-code-return -Wmissing-prototypes -Wextra-semi -Iggml/include -Iggml/src -Iinclude -Isrc -Icommon -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE -DNDEBUG -DGGML_USE_ACCELERATE -DGGML_USE_BLAS -DACCELERATE_NEW_LAPACK -DACCELERATE_LAPACK_ILP64 -DGGML_USE_LLAMAFILE -DGGML_USE_METAL -DGGML_METAL_EMBED_LIBRARY  -c examples/deprecation-warning/deprecation-warning.cpp -o examples/deprecation-warning/deprecation-warning.o
c++ -std=c++11 -fPIC -O3 -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wmissing-declarations -Wmissing-noreturn -pthread   -Wunreachable-code-break -Wunreachable-code-return -Wmissing-prototypes -Wextra-semi -Iggml/include -Iggml/src -Iinclude -Isrc -Icommon -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE -DNDEBUG -DGGML_USE_ACCELERATE -DGGML_USE_BLAS -DACCELERATE_NEW_LAPACK -DACCELERATE_LAPACK_ILP64 -DGGML_USE_LLAMAFILE -DGGML_USE_METAL -DGGML_METAL_EMBED_LIBRARY   examples/deprecation-warning/deprecation-warning.o -o main -framework Accelerate -framework Foundation -framework Metal -framework MetalKit
#########
WARNING: The 'main' binary is deprecated. Please use 'llama-cli' instead.
  Remove the 'main' binary to remove this warning.
#########

And the old main binary is replaced with the new deprecation warning, so running it displays the same message as previously:

% ./main

WARNING: The binary 'main' is deprecated.
 Please use 'llama-cli' instead.
 See https://github.com/ggerganov/llama.cpp/tree/master/examples/deprecation-warning/README.md for more information.

Because of make change-detection, I marked the legacy build targets as .PHONY so that they would check every time. However, it's fast enough and small enough that I don't think it's a problem to check / build every time.

I'm pretty happy with this latest version, because it is nicely future-proof, and doesn't clutter up the build folder with a bunch of legacy binaries if they're not needed. Now, there's no rush to remove this fix later, and it feels much cleaner to me.

How do people feel about this one?

@HanClinto
Copy link
Collaborator Author

HanClinto commented Jul 8, 2024

Just realized that a downside to the latest version is that -- if one is building with make main, then nothing will be built, and no error message will be printed. I would guess that most people build with default make rather than make main, but if anyone does make main, then it's not going to be a good workflow for them.

How best to handle that? I made this change to try and avoid cluttering the build log and build folder with unnecessary messages / binaries if they're not needed.

@bartowski1182
Copy link
Contributor

I think that's a great implementation!

It may be worth cluttering the log for now by including the main target and having it error stating that it's deprecated, it can be removed after a few updates to give people time to transition, though probably less relevant now since this has been in the wild for a month or so already

@HanClinto
Copy link
Collaborator Author

HanClinto commented Jul 9, 2024

Thanks for the feedback!

I think that's a great implementation!

It may be worth cluttering the log for now by including the main target and having it error stating that it's deprecated, it can be removed after a few updates to give people time to transition, though probably less relevant now since this has been in the wild for a month or so already

I tried experimenting with a few always-logging options (to try and handle the make main case), but nothing seemed to work out very well in practicality. The messages were always lost in the clutter, or running into cases where they weren't displaying at all. Practically speaking, I think the current PR may be the best balance we're going to strike.

To reply to my earlier concern:

if one is building with make main, then nothing will be built, and no error message will be printed. I would guess that most people build with default make rather than make main, but if anyone does make main, then it's not going to be a good workflow for them.

At the end of the day, if someone is typing make main and not getting anything, then at least they can't continue while thinking that everything is okay (which is the main source of confusion with leftover legacy main binaries), and they're realistically going to come to this repo and look for root cause rather quickly. That's far better than spending a week on ones' own thinking everything is okay and wondering why the results aren't good -- that's the main workflow that this PR will help users to avoid.

I propose that we move forward with the PR as-is -- I think it's ready for review.

@HanClinto HanClinto merged commit e500d61 into ggerganov:master Jul 9, 2024
53 checks passed
arthw pushed a commit to arthw/llama.cpp that referenced this pull request Jul 13, 2024
…rganov#8283)

* Adding a simple program to provide a deprecation warning that can exist to help people notice the binary name change from ggerganov#7809 and migrate to the new filenames.

* Build legacy replacement binaries only if they already exist. Check for their existence every time so that they are not ignored.
arthw pushed a commit to arthw/llama.cpp that referenced this pull request Jul 13, 2024
…rganov#8283)

* Adding a simple program to provide a deprecation warning that can exist to help people notice the binary name change from ggerganov#7809 and migrate to the new filenames.

* Build legacy replacement binaries only if they already exist. Check for their existence every time so that they are not ignored.
@fairydreaming
Copy link
Collaborator

Possibly connected to this: #8776

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants