Questa la devo provare:
https://hackaday.com/2023/12/29/using-local-ai-on-the-command-line-to-rename-images-and-more/
UPDATE: E infatti poi l’ho provata. Ho dovuto fare un po di aggiustamenti per utilizzare il tutto con windows e ho provato a modificare i prompt in italiano.
Le modifiche si limitano ai controlli sulla presenza dei llama-file e sui prompt.
Controllo presenza file:
if ! LLAVA=$(command -v ./llava-v1.5-7b-q4.llamafile.exe); then printf '%s\n' "llava-v1.5-7b-q4-main.llamafile: fatal error: update this script with the path of your llava llamafile" >&2 printf '%s\n' "please download https://huggingface.co/jartine/mistral-7b.llamafile/blob/main/mistral-7b-instruct-v0.1-Q4_K_M.llamafile, rename to llava-v1.5-7b-q4.llamafile.exe, and put it in the same directory of this script" >&2 abort fi if ! MISTRAL=$(command -v ./mistral-7b-instruct-v0.2.Q3_K_L.llamafile.exe); then printf '%s\n' "mistral-7b-instruct-v0.1-Q4_K_M-main.llamafile: fatal error: update this script with the path of your mistral llamafile" >&2 printf '%s\n' "please download https://huggingface.co/jartine/Mistral-7B-Instruct-v0.2-llamafile/blob/main/mistral-7b-instruct-v0.2.Q3_K_L.llamafile, rename to mistral-7b-instruct-v0.2.Q3_K_L.llamafile.exe, and put it in the same directory of this script" >&2 abort fi
Prompt italiani:
isgood() { "$MISTRAL" \ --temp 0 \ --grammar 'root ::= "si" | "no"' \ -p "[INST]Questo nome file '${1##*/}' è una descrizione comprensibile e corretta in lingua italiana?[/INST]" \ --silent-prompt 2>/dev/null } pickname() { "$LLAVA" \ --image "$1" --temp 0.3 \ --grammar 'root ::= [a-z]+ (" " [a-z]+)+' -n 15 \ -p '### User: Questa immagine contiene ... ### Assistant:' \ --silent-prompt 2>/dev/null }
Inoltre per mistral ho dovuto scegliere una versione di dimensione non superiore ai 4giga, per limitazioni proprie di windows.
Il comportamento in inglese è buono, mentre l’output in italiano non e’ molto utile e spesso capita qualche parola di spagnolo qua e la.