#How do I enable hardware acceleration for ml and transcoding?

1 messages ยท Page 1 of 1 (latest)

vapid salmon
#

I have a ds224+ with Intel Celeron J4125. I read on reddit that they were able to enable hw accelaration on this nas but forgot how they did it.

Please help me with setting up this part of compose.yml:

services:
immich-server:
container_name: immich_server
user: 1026:100
image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
# extends:
# file: hwaccel.transcoding.yml
# service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
volumes:
# Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
- ${UPLOAD_LOCATION}:/data
- /etc/localtime:/etc/localtime:ro
- /volume1/homes/abhirham/Photos:/usr/src/app/external:ro

immich-machine-learning:
container_name: immich_machine_learning
# For hardware acceleration, add one of -[armnn, cuda, rocm, openvino, rknn] to the image tag.
# Example tag: ${IMMICH_VERSION:-release}-cuda
image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
# extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
# file: hwaccel.ml.yml
# service: cpu # set to one of [armnn, cuda, rocm, openvino, openvino-wsl, rknn] for accelerated inference - use the -wsl version for WSL2 where applicable

exotic yachtBOT
#

:wave: Hey @vapid salmon,

Thanks for reaching out to us. Please carefully read this message and follow the recommended actions. This will help us be more effective in our support effort and leave more time for building Immich immich.

References

#

Checklist

I have...

  1. :blue_square: verified I'm on the latest release(note that mobile app releases may take some time).
  2. :blue_square: read applicable release notes.
  3. :blue_square: reviewed the FAQs for known issues.
  4. :blue_square: reviewed Github for known issues.
  5. :blue_square: tried accessing Immich via local ip (without a custom reverse proxy).
  6. :blue_square: uploaded the relevant information (see below).
  7. :blue_square: tried an incognito window, disabled extensions, cleared mobile app cache, logged out and back in, different browsers, etc. as applicable

(an item can be marked as "complete" by reacting with the appropriate number)

Information

In order to be able to effectively help you, we need you to provide clear information to show what the problem is. The exact details needed vary per case, but here is a list of things to consider:

  • Your docker-compose.yml and .env files.
  • Logs from all the containers and their status (see above).
  • All the troubleshooting steps you've tried so far.
  • Any recent changes you've made to Immich or your system.
  • Details about your system (both software/OS and hardware).
  • Details about your storage (filesystems, type of disks, output of commands like fdisk -l and df -h).
  • The version of the Immich server, mobile app, and other relevant pieces.
  • Any other information that you think might be relevant.

Please paste files and logs with proper code formatting, and especially avoid blurry screenshots.
Without the right information we can't work out what the problem is. Help us help you ;)

If this ticket can be closed you can use the /close command, and re-open it later if needed.

sly hill
vapid salmon
sly hill
#

How much ram does your synology have? By the looks of it, not enough

vapid salmon
#

I have 18gb ram @sly hill

sly hill
#

Did you change anything to the concurrency for the jobs?

vapid salmon
sly hill
#

If you don't know you probably didn't change anything ๐Ÿ™‚

#

Possibly it's missing some permissions/device access

#

What does the rest of the compose look like? I notice you put user: 1026:100 for the server container

vapid salmon
sly hill
#

Why not have that for the ML container as well?

vapid salmon
vapid salmon
sly hill
#

For instance

...
  immich-machine-learning:
    user: 1026:100
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}-openvino
    extends: 
      file: hwaccel.ml.yml
      service: openvino # set to one of [armnn, cuda, rocm, openvino, openvino-wsl, rknn] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    volumes:
      - model-cache:/cache
      - ml-config:/.config
    env_file:
      - .env
    restart: always
    healthcheck:
      disable: false
...
volumes:
  model-cache:
  ml-config:
#

Don't forget to add it to the bottom

sly hill
#

If you know the render and video groups, you can add those

vapid salmon
sly hill
#

it's usually 44 and something

vapid salmon
#

I dont see a render group here. Is this expected? @sly hill

sly hill
#

For ds224? Not sure no

#

Could be 'videodriver'

vapid salmon
sly hill
#

that's curious because it literally lists 'videodriver' as group in your screenshot ๐Ÿ‘€

sly hill
#

or videodriver or render

#

probably just missing sudo

#

try sudo synogroup --get videodriver

vapid salmon
#

now it works. 993 is the group for videodriver. render and video dont exist

sly hill
#

You'll want that in a group_add command

vapid salmon
#

can I do this in the compose.yml instead?

sly hill
#

Under the image line, add group_add with the same indentation:

    image: ghcr.io/immich-app/ (both server and machine learning)
    group_add:
      - "993"
#

Yes ๐Ÿ˜›

vapid salmon
#

added group_add to both server and ml. Do I just build the container now?

sly hill
#

yes

#

any changes to the compose require a rebuild to take effect

#

It also means that as long as you don't rebuild you can recover from accidentally ruining your compose ๐Ÿ˜›

vapid salmon
#

when you say rebuid, do you mean "clean -> build". or just "build" @sly hill

sly hill
#

I wouldn't know what the difference is for Synology, sorry.
It's the equivalent of docker compose up -d

vapid salmon
#

@sly hill getting this error now. the user 1026 has rw permissions to all folders

#

Also I want to mention that you are being extremely helpful and patient. Really appreciate it. thank you so so much

#

not a lot of poeple like you around here

sly hill
#

wdym there's a bunch of us :3

sly hill
vapid salmon
#

not sure about immich but hotio channel has a lot of impatient people. had my fair share of rude messages there

sly hill
#
...
  immich-machine-learning:
    group_add:
      - "993"
    user: 1026:100
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}-openvino
    extends: 
      file: hwaccel.ml.yml
      service: openvino # set to one of [armnn, cuda, rocm, openvino, openvino-wsl, rknn] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    volumes:
      - model-cache:/cache
      - ml-config:/.config
      - mplib:/.config/matplotlib
    env_file:
      - .env
    restart: always
    healthcheck:
      disable: false
...
volumes:
  model-cache:
  ml-config:
  mplib:
vapid salmon
sly hill
#

Just the volumes section I wager ๐Ÿ‘€

#

I don't think this has HWA though?

vapid salmon
#

ok ok. will follow you

#

@sly hill

sly hill
#

Add the :rw like in the screenshot

vapid salmon
#

@sly hill that fixed the issue. But now running into this issue:

sly hill
#

hmhmmm

#

And you're sure there's not sudo getent group render ?

#

Let's put them manually in the machine learning container and get rid of the extends
Like so:

...
  immich-machine-learning:
    group_add:
      - "993"
    user: 1026:100
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}-openvino
    device_cgroup_rules:
      - 'c 189:* rmw'
    devices:
      - /dev/dri/renderD128:/dev/dri/renderD128
      - /dev/dri/card0:/dev/dri/card0
      - /dev/dri:/dev/dri
    volumes:
      - /dev/bus/usb:/dev/bus/usb
      - model-cache:/cache
      - ml-config:/.config
      - mplib:/.config/matplotlib
    env_file:
      - .env
    restart: always
    healthcheck:
      disable: false
...
volumes:
  model-cache:
  ml-config:
  mplib:
vapid salmon
#

trying it now. just an FYI, i upated the config.yml to this:
immich-machine-learning: container_name: immich_machine_learning user: 1026:100 # For hardware acceleration, add one of -[armnn, cuda, rocm, openvino, rknn] to the image tag. # Example tag: ${IMMICH_VERSION:-release}-cuda image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}-openvino group_add: - "993" # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration # file: hwaccel.ml.yml # service: openvino # set to one of [armnn, cuda, rocm, openvino, openvino-wsl, rknn] for accelerated inference - use the -wsl version for WSL2 where applicable device_cgroup_rules: - 'c 189:* rmw' devices: - /dev/dri/renderD128:/dev/dri/renderD128 - /dev/dri/card0:/dev/dri/card0 - /dev/dri:/dev/dri volumes: - /volume1/docker/immich/cache:/cache:rw - /volume1/docker/immich/cache:/.cache:rw - /volume1/docker/immich/cache:/.config:rw - /volume1/docker/immich/matplotlib:/matplotlib:rw env_file: - .env restart: always healthcheck: disable: false

#

still the same issue

sly hill
#

darn, well something is missing, but what

#

rights, users, groups... I don't know for sure

vapid salmon
#

I commented out # user: 1026:100 and now its not throwing any "no gpu found". But cpu is still at 98% @sly hill

#

its not constantly at 90s though. Its going up and down.

#

between 50-98

sly hill
#

Looks like it's trying the openvino acceleration for the CPU instead of CPU maybe?

#

To be clear

#

You don't NEED HWA for immich to work

#

and after initial ingest the CPU will calm down

vapid salmon
#

ohk

#

thanks for your help btw.

#

but what ever im seeing here is expected right?

sly hill
#

Yes, machine learning and video transcoding is very intensive

whole wigeon
#

openvino has to compile all the models at first, which can take some minutes to finish. it'll use a lot of cpu during this time

#

it should use less cpu once it's done compiling

vapid salmon
#

redis and ml look good

sly hill
#

No need to tag people for that

#

The postgres error is unrelated to the ML errro

#

And it seems to me the video is simply not compatible for transcodes or is corruct, that happens