I want to extract and process the metadata from PNG images and the first line of .safetensors files for LLM’s and LoRA’s. I could spend ages farting around with sed or awk but formats of files are constantly changing. I’d like a faster way to see a summary of training and a few other details when they are available.
jq, and its Yaml sibling, yq.
I have a very handy command in my .vimrc for this -
command! JSON setlocal filetype=json | %!jq .
Anytime I’m in a json file that isn’t formatted it’s as simple as typing
:JSON
to have it all sorted.Specifically this version of yq - there are other versions bundled with distros that look and act very differently and lack the potency of this version.
Seriously, can’t get those 15 minutes back.
And there is htmlq too, if you ever need to scrape some stuff from a website :)
Naw, everybody knows that you have to use regex for that