Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

geroldmeisinger
Copy link
Contributor

@geroldmeisinger geroldmeisinger commented Jun 9, 2024

#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
Copy link
Contributor Author

geroldmeisinger commented Jun 9, 2024

todo:

  • on click of history entry restore settings
  • add model revision to infos
  • add history to "Views" and make it show again when closed

@geroldmeisinger
Copy link
Contributor Author

geroldmeisinger commented Jun 10, 2024

new scheme:

{
    "date": "2024-06-10 09:52:04",
    "history_version": 0,
    "app": {
        "origin": "[email protected]: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
Copy link
Contributor Author

geroldmeisinger commented Jun 10, 2024

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

  • git commit hash of download
  • pretrained_model_name_or_path or model_name_or_path
  • internal type/architecture as string
  • repo url endpoint used in downloader (huggingface.co or any other url set)

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
Copy link
Contributor Author

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

@geroldmeisinger geroldmeisinger marked this pull request as draft July 4, 2024 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant