scripts: Use local gguf package when running from repo#2927
scripts: Use local gguf package when running from repo#2927KerfuffleV2 merged 5 commits intoggml-org:masterfrom
Conversation
monatis
left a comment
There was a problem hiding this comment.
a better workaround than symlinking
|
I'm gonna need a second opinion that I don't suck. |
|
Related: #2697 (comment) I had an issue previously, and I think this PR would've solved it (maybe even without my noticing). Thanks in general! |
cebtenzzre
left a comment
There was a problem hiding this comment.
Could the paths be made relative to __file__ so you can run the scripts from any directory, and so we don't have to check whether gguf-py exists?
Also, 'NO_LOCAL_GGUF' not in os.environ is a more typical way of writing the env variable check.
|
Sounds reasonable. Is edit: # Use local gguf module if available.
if 'NO_LOCAL_GGUF' not in os.environ and (Path(__file__).parent.absolute().joinpath('gguf-py', 'gguf', '__init__.py')).is_file():
sys.path.insert(1, str(Path(__file__).parent.absolute().joinpath('gguf-py', 'gguf'))) |
|
I don't see why we're using In other words, I think we should just do this (with additional if 'NO_LOCAL_GGUF' not in os.environ:
sys.path.insert(1, str(Path(__file__).parent / 'gguf-py' / 'gguf')) |
Sure, that's no problem. I was just trying to be careful and avoid any potential weirdness, especially since I don't know exactly how stuff is going to work on Windows.
Just a habit I acquired (the hard way) of checking conditions only doing work if necessary. Makes it less likely for strange stuff to happen in the future. In this particular case it's very unlikely to cause a problem though. |
* scripts: Use local gguf when running from repo
* scripts: Use local gguf when running from repo
You can get the default behavior by setting the
NO_LOCAL_GGUFenvironment variable.Personally I find the new behavior of ignoring the in-repo version of GGUF kind of unintuitive. This simple pull just adds the local
gguftosys.pathif it exists andNO_LOCAL_GGUFis unset. That way one can use theggufversion that's in sync with the scripts without having to worry about setting up environments or manually syncing.I didn't apply this to the convert-llama scripts because of #2906