jhc13 / taggui

Tag manager and captioner for image datasets
GNU General Public License v3.0
495 stars 26 forks source link

save captioning in history.jsonl file with settings and selected images #187

Open geroldmeisinger opened 1 month ago

geroldmeisinger commented 1 month ago

171

.jsonl expect a json object on every line. here is an (formatted) example. actual file is compact. the name of the file is !0_history.jsonl to always display on the beginning in most file managers:

{
    "date": "2024-06-09 18:19:46",
    "settings": {
        "model": "THUDM/cogvlm2-llama3-chat-19B-int4",
        "prompt": "describe this image",
        "caption_start": "",
        "caption_position": "Insert after last tag",
        "device": "GPU if available",
        "gpu_index": 0,
        "load_in_4_bit": true,
        "remove_tag_separators": false,
        "bad_words": "",
        "forced_words": "",
        "generation_parameters": {
            "min_new_tokens": 1,
            "max_new_tokens": 512,
            "num_beams": 1,
            "length_penalty": 1.0,
            "do_sample": false,
            "temperature": 1.0,
            "top_k": 50,
            "top_p": 1.0,
            "repetition_penalty": 1.0,
            "no_repeat_ngram_size": 3
        },
        "wd_tagger_settings": {
            "show_probabilities": true,
            "min_probability": 0.4,
            "max_tags": 30,
            "tags_to_exclude": ""
        }
    },
    "images": [
        "000000020.jpg",
        "000000020.webp"
    ]
}
geroldmeisinger commented 1 month ago

todo:

geroldmeisinger commented 4 weeks ago

new scheme:

{
    "date": "2024-06-10 09:52:04",
    "history_version": 0,
    "app": {
        "origin": "git@github.com:geroldmeisinger/taggui.git",
        "revision": "12a341e823c7bda229713e366491d3ce90fec1c2",
        "settings": {
            "model": "THUDM/cogvlm2-llama3-chat-19B-int4",
            "prompt": "describe this image",
            "caption_start": "",
            "caption_position": "Insert before first tag",
            "load_in_4_bit": true,
            "remove_tag_separators": true,
            "bad_words": "",
            "forced_words": "",
            "generation_parameters": {
                "min_new_tokens": 1,
                "max_new_tokens": 100,
                "num_beams": 1,
                "length_penalty": 1.0,
                "do_sample": false
            }
        }
    },
    "model": {
        "name": "THUDM/cogvlm2-llama3-chat-19B-int4",
        "type": ""
    },
    "images": [
        "000000020.webp"
    ]
}

model = model information according to model loader (transformers in this case) i want to add "commit hash", "endpoint" (=huggingface.co), "architecture" or "internal model name", quantization app = model information according to settings in application (taggui)

geroldmeisinger commented 4 weeks ago

@jhc13 : in history_list.py:45 HistoryListModel.append how do i get the models...

transformers defines sooo many classes I'm confused about which type is actually used and where, and if the info is available in the model, the config or the hub.

https://huggingface.co/docs/transformers/main/en/model_doc/auto#transformers.AutoConfig.from_pretrained https://huggingface.co/docs/transformers/main/en/model_doc/auto#transformers.AutoModelForCausalLM https://huggingface.co/docs/transformers/main/en/model_doc/auto#transformers.AutoModel https://huggingface.co/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel https://huggingface.co/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig

geroldmeisinger commented 4 weeks ago

History View: Screenshot from 2024-06-10 10-39-15