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

lmql serve-model llama.cpp:<PATH TO WEIGHTS>.gguf only works with an absolute path #344

Open
filippobistaffa opened this issue Mar 29, 2024 · 1 comment

Comments

@filippobistaffa
Copy link

It's probably not a "bug", but <PATH TO WEIGHTS> in the docs should probably be <ABSOLUTE PATH TO WEIGHTS>. I tried to run lmql serve-model llama.cpp:vicuna-13b-v1.5-16k.Q4_K_M.gguf inside a directory with vicuna-13b-v1.5-16k.Q4_K_M.gguf, but I got a ValueError: Model path does not exist: vicuna-13b-v1.5-16k.Q4_K_M.gguf. Providing the full absolute path solves the problem.

The reason is that, in my case, the current directory gets changed to <root directory of the virtual environment>/lib/python3.11/site-packages when running the lmql command. Maybe that's the expected behavior, but at least specifying that the path should be absolute could cause less head-scratching for newbies :)

@finnless
Copy link

finnless commented Oct 21, 2024

The behavior should probably allow relative paths to be used. This class method might be able to be modified to allow for this usage.

@classmethod
def load(self, model_name, **kwargs) -> 'LMTPModel':
if ":" in model_name:
backend_name = model_name.split(":")[0]
if backend_name in LMTPModel.registry.keys():
return LMTPModel.registry[backend_name](model_name, **kwargs)
if not model_name in LMTPModel.registry.keys():
if not "transformers" in LMTPModel.registry.keys():
if "LMQL_BROWSER" in os.environ:
assert False, "The browser distribution of LMQL does not support HuggingFace Transformers models." + \
" Please use other model backends or install lmql locally with 'transformers' support (pip install lmql[hf])."
else:
assert False, "Your distribution of LMQL does not support HuggingFace Transformers models." + \
" Please use other model backends or install lmql with the 'transformers' support (pip install lmql[hf])."
return LMTPModel.registry["transformers"](model_name, **kwargs)
return LMTPModel.registry[model_name](**kwargs)

model_name is passed as model_identifier here:

self.llm = Llama(model_path=model_identifier[len("llama.cpp:"):], logits_all=True, **kwargs)

model_identifier could just be appended to ../../../../ if it is not a absolute path.

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

No branches or pull requests

2 participants