louijiec commited on
Commit
17c04e9
·
verified ·
1 Parent(s): 8192cad

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +99 -3
README.md CHANGED
@@ -1,3 +1,99 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ license: apache-2.0
4
+ library_name: transformers
5
+ tags:
6
+ - text-generation
7
+ - mistral
8
+ - lora
9
+ - manga
10
+ - anime
11
+ - prompt-generation
12
+ - fine-tuned
13
+ base_model: mistralai/Mistral-7B-Instruct-v0.2
14
+ datasets:
15
+ - succinctly/midjourney-prompts
16
+ pipeline_tag: text-generation
17
+ ---
18
+
19
+ # 🎨 Monogatari Generation Model
20
+
21
+ This is a fine-tuned version of **`mistralai/Mistral-7B-Instruct-v0.2`** specialized for generating descriptive, high-quality prompts for **manga and anime-style image generation**.
22
+
23
+ The model was fine-tuned on a curated dataset of prompts to learn the structure, keywords, and artistic styles commonly used to create compelling manga art. The name "Monogatari" (物語) is Japanese for "story" or "tale," reflecting the model's purpose in helping users craft visual stories.
24
+
25
+ This model was trained using 4-bit quantization (QLoRA) with PEFT, making it efficient and accessible.
26
+
27
+ ## 🚀 Intended Use
28
+
29
+ The primary use case for this model is to act as a creative assistant for artists, hobbyists, and developers working with text-to-image models (like Stable Diffusion, Midjourney, etc.). It can take a basic idea and expand it into a rich, detailed prompt.
30
+
31
+ **You must format your input using the `### Prompt:` prefix** for the model to work as intended.
32
+
33
+ **Example Use Cases:**
34
+ * Expanding a simple character concept into a full scene description.
35
+ * Generating stylistic keywords (e.g., "by Junji Ito," "80s anime style," "ghibli inspired").
36
+ * Creating detailed prompts for specific manga panels or character sheets.
37
+
38
+ ## ⚠️ Limitations and Bias
39
+
40
+ * **Domain-Specific:** This model is highly specialized for manga/anime art prompts. It is not a general-purpose chatbot and will perform poorly on other tasks.
41
+ * **Inherited Bias:** The model was trained on the `succinctly/midjourney-prompts` dataset. It will reflect the biases and common tropes present in that data. This may include stylistic preferences, character archetypes, and other patterns from the source prompts.
42
+ * **Not a Perfect Artist:** The model generates *text prompts*, not images. The quality of the final image depends entirely on the text-to-image model you use the prompt with.
43
+
44
+ ## 💻 How to Use
45
+
46
+ You can run this model easily using the `transformers` library. Make sure to install the necessary dependencies first. The model is loaded in 4-bit to save memory.
47
+
48
+ ```bash
49
+ # Install required libraries
50
+ pip install -q transformers accelerate bitsandbytes torch```
51
+
52
+ ```python
53
+ import torch
54
+ from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
55
+
56
+ # The Hugging Face Hub model ID
57
+ model_id = "louijiec/monogatari-generation-model"
58
+
59
+ # Load the tokenizer
60
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
61
+
62
+ # Load the model with 4-bit quantization
63
+ model = AutoModelForCausalLM.from_pretrained(
64
+ model_id,
65
+ load_in_4bit=True,
66
+ torch_dtype=torch.float16,
67
+ device_map="auto"
68
+ )
69
+
70
+ # Create a text generation pipeline
71
+ generator = pipeline(
72
+ "text-generation",
73
+ model=model,
74
+ tokenizer=tokenizer
75
+ )
76
+
77
+ # --- Your creative idea goes here! ---
78
+ # Remember to use the '### Prompt:' format.
79
+ base_prompt = "### Prompt: a close-up portrait of a powerful female samurai with cherry blossoms"
80
+
81
+ # Generate the detailed prompt
82
+ result = generator(
83
+ base_prompt,
84
+ max_new_tokens=75, # Adjust as needed
85
+ num_return_sequences=1,
86
+ eos_token_id=tokenizer.eos_token_id,
87
+ do_sample=True, # Set to True for more creative, less deterministic outputs
88
+ temperature=0.7,
89
+ top_p=0.9,
90
+ )
91
+
92
+ print("--- Generated Prompt ---")
93
+ print(result['generated_text'])
94
+ print("------------------------")
95
+
96
+ # Example Output:
97
+ # --- Generated Prompt ---
98
+ # ### Prompt: a close-up portrait of a powerful female samurai with cherry blossoms, intricate armor details, sharp focus, cinematic lighting, dramatic pose, by Kentaro Miura and Makoto Shinkai, detailed face, emotional expression, rule of thirds, 8k, trending on artstation
99
+ # ------------------------