GithubHelp home page GithubHelp logo

prem-daemon's People

Contributors

biswaroop1547 avatar casperdcl avatar dependabot[bot] avatar filopedraz avatar janaka-steph avatar msanjeevkumar avatar nsosio avatar pre-commit-ci[bot] avatar sekulicd avatar tiero avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

prem-daemon's Issues

Prem Plugins

Description

Enable the possibility to use Plugins in Prem Chat.

Support multiple GPUs

Description

When fetching system resources, get info from all the GPUs in the system.

Prem Wallet

Description

  • Expose endpoint to encrypt data.
  • Encrypt user data
  • Backup data in s3 bucket
  • Nostr login

Prem Michelangelo

Description

Expose the following models using dall-e wrapper.

  • CompVis/stable-diffusion-v1-4
  • runwayml/stable-diffusion-v1-5
  • stabilityai/stable-diffusion-2-base
  • stabilityai/stable-diffusion-2-1-base
  • OFA-Sys/small-base-diffusion-v0

Update premd if new version available

Description

  • Expose an endpoint GET /update-available : bool

Return True if there is a new version available for premd container.

  • Expose an endpoint POST /update-daemon

The endpoint should restart premd with the latest version.

Download events not ignored

Download events sent to the frontend should ignore those status:

 if (
                status == Status.ALREADY_EXISTS.value
                or status == Status.DOWNLOAD_COMPLETE.value
                or status.startswith("Pulling from")
                or status.startswith("Pulling fs layer")
            ):
                continue
Screenshot 2023-11-02 at 08 05 24

docker buildx not working on Mac M1

I am trying to build a cross-architecture image from the main branch but I have the following problem using docker buildx

docker buildx build --push --file Dockerfile --tag ghcr.io/premai-io/premd:7af3782b00f6176b34840f608327c051502511ce --platform linux/arm64,linux/amd64 .

TRUNCATED

13.71       gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPSUTIL_POSIX=1 
-DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=595 -DPy_LIMITED_API=0x03060000 -DPSUTIL_ETHTOOL_MISSING_TYPES=1 -DPSUTIL_LINUX=1 
-I/usr/local/include/python3.10 -c psutil/_psutil_common.c -o build/temp.linux-aarch64-cpython-310/psutil/_psutil_common.o
13.71       In file included from /usr/lib/gcc/aarch64-linux-gnu/10/include/syslimits.h:7,
13.71                        from /usr/lib/gcc/aarch64-linux-gnu/10/include/limits.h:34,
13.71                        from /usr/local/include/python3.10/Python.h:11,
13.71                        from psutil/_psutil_common.c:9:
13.71       /usr/lib/gcc/aarch64-linux-gnu/10/include/limits.h:195:15: fatal error: limits.h: No such file or directory
13.71         195 | #include_next <limits.h>  /* recurse down to the real one */
13.71             |               ^~~~~~~~~~
13.71       compilation terminated.
13.71       psutil could not be installed from sources. Perhaps Python header files are not installed. Try running:
13.71         sudo apt-get install gcc python3-dev
13.71       error: command '/usr/bin/gcc' failed with exit code 1
13.71       [end of output]
13.71
13.71   note: This error originates from a subprocess, and is likely not a problem with pip.
13.71   ERROR: Failed building wheel for psutil
13.71   Building wheel for gputil (setup.py): started
13.89   Building wheel for gputil (setup.py): finished with status 'done'
13.89   Created wheel for gputil: filename=GPUtil-1.4.0-py3-none-any.whl size=7392 
sha256=8f6ed156a2f152a786e47693db546f331bd4d07aa8b0ac4c54ba9b1df21cffda
13.89   Stored in directory: 
/tmp/pip-ephem-wheel-cache-cwcq8rvs/wheels/a9/8a/bd/81082387151853ab8b6b3ef33426e98f5cbfebc3c397a9d4d0
13.89 Successfully built gputil
13.89 Failed to build psutil
13.89 ERROR: Could not build wheels for psutil, which is required to install pyproject.toml-based projects
14.12
14.12 [notice] A new release of pip is available: 23.0.1 -> 23.3.1
14.12 [notice] To update, run: pip install --upgrade pip
------
Dockerfile:9
--------------------
   7 |         && rm -rf /var/lib/apt/lists/*
   8 |     COPY requirements.txt .
   9 | >>> RUN pip install --no-cache-dir -r requirements.txt
  10 |
  11 |     COPY . .
--------------------
ERROR: failed to solve: process "/bin/sh -c pip install --no-cache-dir -r requirements.txt" did not complete successfully: exit 
code: 1

Finetuning capabilities

Description

Expose endpoint and logic in order to finetune a model. Same interface as OpenAI APIs.

Implement Dynamic Docker Labeling in predmd for Proxy Support

Summary

premd needs to adapt its container orchestration method based on different deployment types. Specifically, premd should consider whether API calls from premapp to premd are coming through a proxy or not. If they are, then premd should start services with specific Docker labels to help Traefik configure routes to prem-services.

DNS-Dependent Labels

If a DNS record has been created for the domain, the following labels should be added when starting the Docker container:

  • "traefik.enable=true"
  • "traefik.http.routers.dnsd.rule=Host(`{SERVICE_ID}.domain`)"
  • "traefik.http.routers.{SERVICE_ID}.entrypoints=websecure"
  • "traefik.http.routers.{SERVICE_ID}.tls.certresolver=myresolver"
  • "traefik.http.routers.{SERVICE_ID}.entrypoints=websecure"

If a DNS record has not been created:

  • "traefik.http.routers.dnsd.rule=Host({SERVICE_ID}.docker.localhost)"
  • "traefik.enable=true"

Suggestions

  1. Introduce New Variable: Add a new environment variable called PROXY_ENABLED.
  2. Method Update: If PROXY_ENABLED=true, update the run_container_with_retries method to send the specific Docker labels as outlined above.
  3. DNSD Endpoint: Reaching dnsd should be possible at http://dnsd:8080.
  4. Optimization: Cache the first successful check for an existing DNS record in memory to avoid unnecessary, repeated calls to dnsd.

Additional Resources

For a comprehensive list of all relevant deployment types for premd, refer here, also note that for premd it is only relevant if PROXY is enabled or not.

Prem Cookiecutter Template

Description

Cookiecutter template for Prem Services.

NOTES

Potentially prem package should be a CLI module too and handle this part.

Example notebook

Description

Create a simple talk to your data use case with a Python notebook using entirely prem-box.

  • Create a new directory notebooks in order to store these examples.

Prem Summary

Description

Expose services in order to compute summary of a text

docker save to show tar download updates

Currently, the percentage doesn't reflect the real state of the download, It's a hacky solution for now.
the best approach would be to move to download the image as tar.gz via the docker save command.

We may need to check what the native SDK of Pythong allows to monitor the advancement of the file download, otherwise, we can check the file size on disk by checking polling the size.

Consider using SSE (Server Side Events to use EventSource browser API) but would be helpful to make sure that if a browser client re-connects to the same image download request, it keeps downloading in the background and return the updated progress.

Nomad as Orchestrator

Description

In order to avoid Docker as a dependency for what concerns the services orchestration, we can use Nomad.

Benefits

  • No need to leverage Docker as a dependency on Prem App while running on Desktop. You can just run nomad as a binary and spawn the services as binaries. Check here
  • We can still leverage the use of Docker when Prem running on a Server/Cluster.
  • Same orchestrator for Local env and Production env.
  • It exposes resource management APIs, no need to handle this aspect using docker stats or psutil library. You can check some of the commands here

Task List

  • Investigate if we can completely remove the daemon and interact with Nomad from Prem App without missing any functionality both short and long term.
  • Explore k8s integration. How Nomad can run in a k8s cluster? What's the currently available integration?
  • Reimplement all the methods interacting with the docker client to use Nomad instead.
  • In order to avoid breaking changes, keep both docker and nomad methods. Pass ORCHESTRATOR=docker | nomad as the environment variable to decide which orchestrator to use.
  • Compile the Daemon using pyinstaller

Notes

There is a nomad python client available here.

Additional Notes related to UX

  1. If we run Nomad as binary and the Daemon too, then we can run Prem App in Swarm Mode using the Daemon instead of using Tauri commands.
  2. Both Daemon and Nomad can be run using Tauri Sidecar

Data augmentation

Description

Expose data augmentation endpoints. Use self-instruct method or similar methods.

Prem Upscaler

Description

Expose diffusers pipelines in order to upscale images

support multi-GPU systems

on a system with 2xV100s, the Prem App seems to ignore the second GPU. It thinks there isn't enough GPU RAM for some small models even though the second GPU is unused.

Enhance get_service_object for Dynamic URL Construction Based on DNS

Summary

In relation to issue 128, the get_service_object function needs an update to return the full URL for prem-service. The URL will be dependent on whether PROXY_ENABLED is true and if a DNS record exists.

DNS Dependent URL Construction

  1. If DNS is created: Construct the URL in the format {SERVICE_ID}.domain
  2. If DNS is not created: Construct the URL in the format {SERVICE_ID}.docker.localhost

Invoke service based on URL suffix

Applications that are to invoke running prem-service will know, based on if url contains suffix 'docker.localhost', how to 'reach' it.

  • With .docker.localhost suffix: Applications should add a Host: {URL} header and send the request to {HOST}.
  • Without .docker.localhost suffix: Applications should directly send the request to {URL} without adding a Host header.

Check if NVIDIA drivers are properly installed & initialized on startup

2023-10-03 00:36:22 ERROR    Failed to start 500 Server Error for http+docker://localhost/v1.42/containers/4bfddf496e65aeafd1c042e6900f107874c96c220908af2ccdc56c6458d3c89f/start: Internal Server Error ("failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook #0: error running hook: exit status 1, stdout: , stderr: Auto-detected mode as 'legacy'
nvidia-container-cli: initialization error: nvml error: driver/library version mismatch: unknown")
2023-10-03 00:36:23 ERROR    Failed to start 500 Server Error for http+docker://localhost/v1.42/containers/20e9304c1b1a8b85401b7d825d123f1d0dd1b08ed01478df8928cc5e609e5042/start: Internal Server Error ("failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook #0: error running hook: exit status 1, stdout: , stderr: Auto-detected mode as 'legacy'
nvidia-container-cli: initialization error: nvml error: driver/library version mismatch: unknown")

Mobile App

Description

Mobile app that uses Mac as a server.

Run tests on arm

Description

An error involving sentry_sdk appeared on ARM hardware. In order to avoid similar issues, we should run the tests on both AMD and ARM in the CI/CD pipeline.

[0.0.24] PROXY_ENABLED seems buggy

On daemon 0.0.24, running without -e PROXY_ENABLED=False

 let _child = thread::spawn(move || {
        let status = Command::new("/usr/local/bin/docker")
            .args(&[
                "run",
                "-d",
                "-v",
                "/var/run/docker.sock:/var/run/docker.sock",
                "-p",
                "54321:8000",
                "--name",
                "premd",
                "-e",
                "PREM_REGISTRY_URL=https://raw.githubusercontent.com/premAI-io/prem-registry/main/manifests.json",
                "--rm",
                image.as_str(),
            ])
            .status();

results in error

2023-09-27 14:29:22 pydantic.error_wrappers.ValidationError: 32 validation errors for ServiceResponse
2023-09-27 14:29:22 response -> 0 -> invokeMethod
2023-09-27 14:29:22   field required (type=value_error.missing)
2023-09-27 14:29:22 response -> 1 -> invokeMethod
2023-09-27 14:29:22   field required (type=value_error.missing)
...

Even though PROXY_ENABLED=False should be the default.

Running with -e PROXY_ENABLED=False results in error:

2023-09-27 14:26:54 2023-09-27 12:26:54 ERROR    An error occurred: HTTPConnectionPool(host='dnsd', port=8080): Max retries exceeded with url: /dns/existing (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xffff6ab4e1d0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
2023-09-27 14:26:54 2023-09-27 12:26:54 ERROR    An error occurred: HTTPConnectionPool(host='dnsd', port=8080): Max retries exceeded with url: /dns/ip (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xffff6ab4e560>: Failed to establish a new connection: [Errno -2] Name or service not known'))

Prem Package

Description

Python package to handle multi modal pipelines

Notes

Some Services to Integrate

  • Deepgram
  • Play.ht
  • 11labs

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.