Coder Social home page Coder Social logo

localllm's People

Contributors

bdmorgan avatar bobcatfish avatar jerop avatar jordanh avatar kmontg avatar wauplin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

localllm's Issues

Suggest picking a name other than "llm" for the CLI tool

setup(
name='llm',
version='0.0.1',
py_modules=[
'llm',

And:

entry_points={
'console_scripts': [
'llm = llm:cli',
],
},

I'm the author of https://pypi.org/project/llm/ which installs a package called llm and a CLI tool called llm as well. My llm tool is similar to localllm in as much as my tool lets you execute prompts in the terminal, against both remote models and local models (using llama-cpp-python).

As it stands using my tool and this tool in the same environment won't work, because of the namespace clash.

If you pick a different name for this you can also publish it to PyPI, which would make for a more convenient installation experience for end users.

https://llm.datasette.io/ has more about how my tool works and what it does.

erro0r: Maven config is not supported f

Could you please check what could be wrong here?
I am running this on MAC M1

MacBook-M1 % cd localllm
-MacBook-M1 localllm % gcloud artifacts repositories create $LOCALLLM_REGISTRY
--repository-format=docker
--location=$REGION
--description="DESCRIPTION"
ERROR: (gcloud.artifacts.repositories.create) INVALID_ARGUMENT: Maven config is not supported for format "DOCKER"

ERROR: gcloud crashed (AttributeError): May not assign arbitrary value disableSsh to message GceInstance

I was running the standard command as given in the tutorial to this error, i tried googling this and didn't find much. Could anyone help me out?

iampoppyxx@iampoppyxx:~/new/localllm$ gcloud workstations configs create $LOCALLLM_WORKSTATION \
--region=$REGION \
--cluster=$CLUSTER \
--machine-type=e2-standard-32 \
--container-custom-image=us-central1-docker.pkg.dev/${PROJECT_ID}/${LOCALLLM_REGISTRY}/${LOCALLLM_IMAGE_NAME}:latest

image

Capture (stderr) logs from llama-cpp-python cleanly

When we start the process running llama-cpp-python, we provide a pipe for stderr and then promptly close it. This means if llama-cpp-python tries to write to stderr, a broken pipe exception is thrown, which for example happens if there is a prefix cache hit when processing a prompt.

#19 is a quick fix for this but it's a bit icky b/c we're still breaking stderr.

What we need to do here is:

  1. not provide a broken pipe for stderr
  2. actually capture logs from llama-cpp-python so they end up in the same place as the logs from uvicorn (added in #18)

Some ideas for how to do this:

  • Contribute a fix back to llama-cpp-python that updates writes to stderr to write to a logger instead so the logger can be configured
  • Instead of just spawning the llama-cpp-python process, fork another process that itself spawns that process, captures stderr as the process runs and streams it to a log

Followed the instruction - running locally. Runs once then fails afterward

Install the tools

pip3 install openai
pip3 install ./llm-tool/.

llm run TheBloke/Llama-2-13B-Ensemble-v5-GGUF 8000

python3 querylocal.py

Actual Result: Works!

Run python3 querylocal.py again

Fails

http://localhost:8000/v1
Traceback (most recent call last):
File "/home/username/localllm/querylocal.py", line 40, in
chat_completion = client.chat.completions.create(
File "/home/username/miniconda3/envs/localllm/lib/python3.10/site-packages/openai/_utils/_utils.py", line 271, in wrapper
return func(*args, **kwargs)
File "/home/username/miniconda3/envs/localllm/lib/python3.10/site-packages/openai/resources/chat/completions.py", line 659, in create
return self._post(
File "/home/username/miniconda3/envs/localllm/lib/python3.10/site-packages/openai/_base_client.py", line 1200, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
File "/home/username/miniconda3/envs/localllm/lib/python3.10/site-packages/openai/_base_client.py", line 889, in request
return self._request(
File "/home/username/miniconda3/envs/localllm/lib/python3.10/site-packages/openai/_base_client.py", line 965, in _request
return self._retry_request(
File "/home/username/miniconda3/envs/localllm/lib/python3.10/site-packages/openai/_base_client.py", line 1013, in _retry_request
return self._request(
File "/home/username/miniconda3/envs/localllm/lib/python3.10/site-packages/openai/_base_client.py", line 965, in _request
return self._retry_request(
File "/home/username/miniconda3/envs/localllm/lib/python3.10/site-packages/openai/_base_client.py", line 1013, in _retry_request
return self._request(
File "/home/username/miniconda3/envs/localllm/lib/python3.10/site-packages/openai/_base_client.py", line 980, in _request
raise self._make_status_error_from_response(err.response) from None
openai.InternalServerError: Internal Server Error

llm commands do not gracefully handle zombie processes in ps list

I'll submit a PR shortly for this trivial fix.

Running llm ps or llm kill on my poor, tired development system resulted in:

$ llm ps
Traceback (most recent call last):
  File "/Users/jrhusney/.miniforge3/lib/python3.10/site-packages/psutil/_psosx.py", line 352, in wrapper
    return fun(self, *args, **kwargs)
  File "/Users/jrhusney/.miniforge3/lib/python3.10/site-packages/psutil/_psosx.py", line 413, in environ
    return parse_environ_block(cext.proc_environ(self.pid))
ProcessLookupError: [Errno 3] assume no such process (originated from sysctl(KERN_PROCARGS2) -> EINVAL)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jrhusney/.miniforge3/bin/llm", line 8, in <module>
    sys.exit(cli())
  File "/Users/jrhusney/.miniforge3/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/Users/jrhusney/.miniforge3/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/Users/jrhusney/.miniforge3/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/jrhusney/.miniforge3/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/jrhusney/.miniforge3/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/jrhusney/.miniforge3/lib/python3.10/site-packages/llm.py", line 115, in ps
    m = modelserving.running_models()
  File "/Users/jrhusney/.miniforge3/lib/python3.10/site-packages/modelserving.py", line 39, in running_models
    env = p.environ()
  File "/Users/jrhusney/.miniforge3/lib/python3.10/site-packages/psutil/__init__.py", line 889, in environ
    return self._proc.environ()
  File "/Users/jrhusney/.miniforge3/lib/python3.10/site-packages/psutil/_psosx.py", line 355, in wrapper
    raise ZombieProcess(self.pid, self._name, self._ppid)
psutil.ZombieProcess: PID still exists but it's a zombie (pid=2599, ppid=1071, name='launcher')

This exception needs to be caught and ignored.

Offending process looked like:

ps ax | grep 2599
 2599   ??  Z      0:00.00 <defunct>

Option to enable the GPU

Hi All,

First of all thank you for this excellent tool which makes it very to easy to run the LLM models without any hassle.

I am aware that the main purpose of the localllm is to eliminate the dependency on GPUs and run the models using CPU. However I wanted to know if there is an option to offload the layers to the GPU.

Machine : Compute engine created in GCP
OS : Ubuntu 22.04 LTS
GPU : Tesla T4

Steps I followed thus far is as given below:

  1. Installed the Nvidia driver in the compute engine. nvidia-smi output as given below
    image
  2. Assuming localllm does not directly provide an option to enable GPU ( I may be wrong here), I clone the llama-cpp-python repository, and updated the n_gpu_layers to 4 in llama_cpp/server/settings.py.
  3. Built the package by running pip install -e ., complete step is given here
  4. Killed the localllm and started again.

However I still see that the GPUs are not being utilized.

Are the above steps correct or did I miss anything here?

Thank you,
KK

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.