Muhammadreza commited on
Commit
b327dd3
1 Parent(s): a294df4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +76 -0
README.md CHANGED
@@ -1,3 +1,79 @@
1
  ---
2
  license: mit
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ tags:
4
+ - text-to-image
5
  ---
6
+
7
+ ![Sample](https://huggingface.co/mann-e/mann-e_4_rev-0-1/resolve/main/futuristic-city.jpg)
8
+
9
+ # Mann-E 4 Revision 0.1
10
+
11
+ __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.
12
+ This is revision 0.1 of the 4th version of the model.
13
+
14
+ ### What does _Mann-E_ mean?
15
+
16
+ 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.
17
+
18
+ ## How to use the model
19
+
20
+ ### Colab
21
+
22
+ Colab hasn't been updated with this version yet.
23
+
24
+ ### Code
25
+
26
+ 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.
27
+
28
+ First, you need to install required libraries:
29
+
30
+ ```
31
+ pip3 install diffusers transformers scipy ftfy accelerate
32
+ ```
33
+
34
+ _NOTE: installation of `accelerate` library makes the inference process amazingly faster. but it's totally optional_.
35
+
36
+ Then, you need to import required libraries:
37
+
38
+ ```python
39
+ from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler, DiffusionPipeline, DPMSolverMultistepScheduler
40
+ import torch
41
+ ```
42
+
43
+ and then, create a pipeline (this pipeline is made with Euler Scheduler):
44
+
45
+ ```python
46
+ model_id = "mann-e/mann-e_4_rev-0-1"
47
+
48
+ scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
49
+
50
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, torch_dtype=torch.float16)
51
+ pipe = pipe.to("cuda")
52
+ ```
53
+
54
+ and of course, since you may get NSFW filteration warnings even on simplest prompts, you may consider disabling it:
55
+
56
+ ```python
57
+ def dummy(images, **kwargs):
58
+ return images, False
59
+
60
+ pipe.safety_checker = dummy
61
+ ```
62
+
63
+ _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_.
64
+
65
+ And after that, you easily can start inference:
66
+
67
+ ```python
68
+ prompt = "Concept art of a hostile alien planet with unbreathable purple air and toxic clouds, sinister atmosphere, deep shadows, sharp details"
69
+ negative_prompt = "low quality, blurry"
70
+ width = 768
71
+ height = 512
72
+ ```
73
+
74
+ then:
75
+
76
+ ```python
77
+ image = pipe(prompt=prompt, negative_prompt=negative_prompt, num_inference_steps=100, width=width, height=height, guidance_scale=10).images[0]
78
+ image.save("My_image.png")
79
+ ```