Darktable AI Rating & Tagging - Lua-Script

I tried to use it with the latest (master) version of darktable and it looks quite promising to me but I faced an issue: as lm-studio and darktable both are using my GPU the call of darktable-cli for some images leads to overexposed / black / false-color jpegs.

Shutting down lm-studio and calling the same darktable-cli command from the command line is resulting in a correctly converted image while calling it while lm-studio is running the issue is present, too. I suppose that opencl does not have enough memory when lm-studio is running and so some modules / calculations are failing. I tried already with adding “–core clplatform_nvidiacuda=FALSE” or “–core opencl=FALSE” to force calculation without using the GPU but to no avail.

Does anybody have a hint how to solve this issue?

1 Like

Do you use the lua-script or the python ai xmp rating & tagging?

The lua-script do not use darktable-cli?

For testing purposes I am using the python ai xmp rating & tagging script currently. Do you think the lua script would behave different? Principally one should run into the same issue, as lm-studio and darktable are using the GPU memory in parallel, don’t they?

Edit: I tried to install the lua script, but I am getting an error when I try to activate:

     9,2406 LUA ERROR: dtutils.lua: prequire: 223: Error loading AI/AI Rating Tagging 
     9,2407 LUA ERROR: dtutils.lua: prequire: 224: Error returned is /home/ds/.config/darktable/lua/AI/AI Rating Tagging.lua:105: module 'json' not found:
	no field package.preload['json']
	no file '/usr/local/share/lua/5.4/json.lua'
	no file '/usr/local/share/lua/5.4/json/init.lua'
	no file '/usr/local/lib/lua/5.4/json.lua'
	no file '/usr/local/lib/lua/5.4/json/init.lua'
	no file '/usr/share/lua/5.4/json.lua'
	no file '/usr/share/lua/5.4/json/init.lua'
	no file './json.lua'
	no file './json/init.lua'
	no file '/opt/darktable/share/darktable/lua/json.lua'
	no file '/home/ds/.config/darktable/lua/json.lua'
	no file '/usr/local/lib/lua/5.4/json.so'
	no file '/usr/lib/x86_64-linux-gnu/lua/5.4/json.so'
	no file '/usr/lib/lua/5.4/json.so'
	no file '/usr/local/lib/lua/5.4/loadall.so'
	no file './json.so' 
     9,2408 LUA ERROR: script_manager.lua: activate: 541: error loading AI/AI Rating Tagging 
     9,2408 LUA ERROR: script_manager.lua: activate: 542: error message: /home/ds/.config/darktable/lua/AI/AI Rating Tagging.lua:105: module 'json' not found:
	no field package.preload['json']
	no file '/usr/local/share/lua/5.4/json.lua'
	no file '/usr/local/share/lua/5.4/json/init.lua'
	no file '/usr/local/lib/lua/5.4/json.lua'
	no file '/usr/local/lib/lua/5.4/json/init.lua'
	no file '/usr/share/lua/5.4/json.lua'
	no file '/usr/share/lua/5.4/json/init.lua'
	no file './json.lua'
	no file './json/init.lua'
	no file '/opt/darktable/share/darktable/lua/json.lua'
	no file '/home/ds/.config/darktable/lua/json.lua'
	no file '/usr/local/lib/lua/5.4/json.so'
	no file '/usr/lib/x86_64-linux-gnu/lua/5.4/json.so'
	no file '/usr/lib/lua/5.4/json.so'
	no file '/usr/local/lib/lua/5.4/loadall.so'
	no file './json.so'
1 Like

Ai-RatingX.py (18.9 KB)
This is a updated version for you. First it creates all jpegs in the ai_rated_jpeg folder (if not existing) and then starts with ai rating.
The ai_rating_utils.py has noc changes.

Thank you very much. I’ll try as soon as I am back at my PC.

1 Like

Your updated script works quite well … as long as I do not start lm-studio while the images are converted. But it’s not a big issue, as one can work in two phases though.

1 Like