Muhammadreza commited on
Commit
a433b17
1 Parent(s): abf1685

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +67 -0
README.md CHANGED
@@ -7,3 +7,70 @@ tags:
7
 
8
  __Mann-E__ is a _text to image_ model which has been developed by [Muhammadreza Haghiri](https://haghiri75.com/en) in order to be part of the [Cognitive Web](https://opencognitives.com) movement and projects.
9
  This is revision 3 of the model and it's the first one to have a code name. The code name is _Prompt Muse_.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  __Mann-E__ is a _text to image_ model which has been developed by [Muhammadreza Haghiri](https://haghiri75.com/en) in order to be part of the [Cognitive Web](https://opencognitives.com) movement and projects.
9
  This is revision 3 of the model and it's the first one to have a code name. The code name is _Prompt Muse_.
10
+
11
+ ### What does _Mann-E_ mean?
12
+
13
+ It's a play with the name [Mani](https://en.wikipedia.org/wiki/Mani_(prophet)), who was a Persian religious leader at the early Sassanian era and also a painter and he's famous for both his religious and artistic works. His artistic side was more considered for naming the model of course.
14
+
15
+ ## How to use the model
16
+
17
+ ### Colab
18
+
19
+ You easily can click on [this link](https://colab.research.google.com/github/prp-e/mann-e/blob/main/Mann_E.ipynb) and use model's inference notebook.
20
+
21
+ ### Code
22
+
23
+ The following code is written for _CUDA_ supported devices. If you use UI's or inference tools on other devices, you may need to tweak them in order to get them to the work. Otherwise, it will be fine.
24
+
25
+ First, you need to install required libraries:
26
+
27
+ ```
28
+ pip3 install diffusers transformers scipy ftfy accelerate
29
+ ```
30
+
31
+ _NOTE: installation of `accelerate` library makes the inference process amazingly faster. but it's totally optional_.
32
+
33
+ Then, you need to import required libraries:
34
+
35
+ ```python
36
+ from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler, DiffusionPipeline, DPMSolverMultistepScheduler
37
+ import torch
38
+ ```
39
+
40
+ and then, create a pipeline (this pipeline is made with Euler Scheduler):
41
+
42
+ ```python
43
+ model_id = "mann-e/mann-e_rev-3"
44
+
45
+ scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
46
+
47
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, torch_dtype=torch.float16)
48
+ pipe = pipe.to("cuda")
49
+ ```
50
+
51
+ and of course, since you may get NSFW filteration warnings even on simplest prompts, you may consider disabling it:
52
+
53
+ ```python
54
+ def dummy(images, **kwargs):
55
+ return images, False
56
+
57
+ pipe.safety_checker = dummy
58
+ ```
59
+
60
+ _NOTE: Please consider consequences of disabling this filter as well. we do not want people to get any sort of damage or injury from the image generation results_.
61
+
62
+ And after that, you easily can start inference:
63
+
64
+ ```python
65
+ prompt = "Concept art of a hostile alien planet with unbreathable purple air and toxic clouds, sinister atmosphere, deep shadows, sharp details"
66
+ negative_prompt = "low quality, blurry"
67
+ width = 768
68
+ height = 512
69
+ ```
70
+
71
+ then:
72
+
73
+ ```python
74
+ image = pipe(prompt=prompt, negative_prompt=negative_prompt, num_inference_steps=100, width=width, height=height, guidance_scale=10).images[0]
75
+ image.save("My_image.png")
76
+ ```