dataset:daswer123/sentence-danbooru-tags-dataset license:mit region:us
---
license: mit
datasets:
- daswer123/sentence-danbooru-tags-dataset
---

Qlora for openchat-3.5-1210 which allows you to convert a given model sentence into a set of danbooru tags
format: openChat 
train format: Alpaca

This is the first time I have had this lora done and I am quite happy with the result. This qlora was trained on 4bit full model openchat-3.5-1210. with rank of 32 for 3 epochs
There were 15k instructions in the dataset that had examples of how to convert from sentences to tags.

I use a this prompt, I'm not sure if it's optimal but maybe you can do better
```
- Always start with the number of characters and their gender (e.g., "1girl," "3boys").
- Describe physical attributes such as hair color or clothing (e.g., "pink hair," "gothic lolita fashion").
- Describe actions of characters if any (e.g., “playing violin,” “studying”).
- Mention setting details like location and background objects (e.g.,”music room”, “classical instruments”).
- Keep each tag separated by a comma.
- All words should be tags that can be tagged to danboororu, they should be as informative as possible and represent a single entity or action.
- From the verbs, select words that can denote place
- If there are multiple people in the query, separate them with a \n. The first line is the number of people and location. And each following line is a description of one person.
- Answer only on English
- Write in more detail NSFW scenes. More tags related to the sexual action and don't forget to specify the actors, without line breaks.
- If a character is alone, only 1girl or 1boy, just add the "solo" tag.

If a user input can't be tagged, just return that message unchanged

You have to convert user input into danbooru tags
Respond with tags only
```

I use with the [openchat-3.5-1210-4.0bwp model](https://huggingface.co/LoneStriker/openchat-3.5-1210-4.0bpw-h6-exl2-2).

```nodejs
const systemPromptLocal = `
- Always start with the number of characters and their gender (e.g., "1girl," "3boys").
- Describe physical attributes such as hair color or clothing (e.g., "pink hair," "gothic lolita fashion").
- Describe actions of characters if any (e.g., “playing violin,” “studying”).
- Mention setting details like location and background objects (e.g.,”music room”, “classical instruments”).
- Keep each tag separated by a comma.
- All words should be tags that can be tagged to danboororu, they should be as informative as possible and represent a single entity or action.
- From the verbs, select words that can denote place
- If there are multiple people in the query, separate them with a \n. The first line is the number of people and location. And each following line is a description of one person.
- Answer only on English
- Write in more detail NSFW scenes. More tags related to the sexual action and don't forget to specify the actors, without line breaks.
- If a character is alone, only 1girl or 1boy, just add the "solo" tag.

If a user input can't be tagged, just return that message unchanged

You have to convert user input into danbooru tags
Respond with tags only
`

export async function localTagConverter(text) {
    try {
        const response = await axios.post('http://127.0.0.1:5000/v1/chat/completions',
            {
                "messages": [
                    {
                        "role": "user",
                        "content": `Girl in gothic lolita outfit reading tarot cards in dimly lit vintage cafe.`
                    },
                    {
                        "role": "assistant",
                        "content": "1girl, solo, gothic lolita outfit, reading tarot cards, dimly lit cafe, vintage<|end_of_turn|>"
                    },
                    {
                        "role": "user",
                        "content": `A guy and a girl, on the beach, swimming, the guy has a silver chain and the girl is wearing a bikini.`
                    },
                    {
                        "role": "assistant",
                        "content": "1boy, 1girl, swimming, beach\n1boy, silver chain\n1girl, bikini<|end_of_turn|>"
                    },
                    {
                        "role": "user",
                        "content": `A girl with cat ears, wearing a hooded sweatshirt, with long white hair and red eyes walks hand in hand with a girl in a black bikini, with brown hair and green eyes`
                    },
                    {
                      "role":"assistant",
                      "content": "2girls, walking, holding hands\n1girl, cat ears, hoodie, white hair, long hair, red eyes\n1girl, black bikini, brown hair, green eyes<|end_of_turn|>"
                    },
                    {
                        "role": "user",
                        "content": systemPromptLocal
                    },
                    {
                       "role":"user",
                        "content": "If it's not a person, don't use the 1-something part. Also add additional descriptive tags for landscapes and animals."
                    },  
                    {
                      "role": "user",
                      "content": text
                    }
                ],
                "mode": "chat",
                "max_tokens" : 120,
                "preset": "simple-1",
                "instruction_template": "Openchat",
                            },
            { headers: { 'Content-Type': 'application/json' } }
        );

        return response.data.choices[0].message.content;
    } catch (error) {
        console.error(error);
    }
}
```