auto-diffusers 1.3.4__py3-none-any.whl → 1.4.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- from .setup.Base_config import Basic_config
1
+ from .setup.base_config import Basic_config
2
2
  from .utils.run_download import download
3
3
  from .checker.get_checkpoint_type import checkpoint_type
4
- from .model_path.Perform_path_search import Search_cls
4
+ from .model_path.perform_path_search import Search_cls
5
5
 
6
6
  run_search = Search_cls()
@@ -0,0 +1 @@
1
+ from model_path.mix_class import Basic_config
@@ -0,0 +1,91 @@
1
+ #main
2
+
3
+ from typing import Any, Callable, Dict, List, Optional, Union
4
+ from dataclasses import dataclass
5
+
6
+ import diffusers
7
+ from diffusers import (
8
+ StableDiffusionPipeline,
9
+ AutoPipelineForText2Image,
10
+ AutoPipelineForImage2Image,
11
+ AutoPipelineForInpainting,
12
+ TextToVideoZeroPipeline,
13
+ FlaxStableDiffusionPipeline,
14
+ FlaxStableDiffusionImg2ImgPipeline,
15
+ FlaxStableDiffusionInpaintPipeline,
16
+ )
17
+
18
+ from model_path.perform_path_search import Search_cls
19
+ from model_path.mix_class import Basic_config
20
+
21
+
22
+ @dataclass
23
+ class AutoPipe_data:
24
+ pipe_dict = {
25
+ "torch":{
26
+ "base" : StableDiffusionPipeline,
27
+ "txt2img" : AutoPipelineForText2Image,
28
+ "img2img" : AutoPipelineForImage2Image,
29
+ "inpaint" : AutoPipelineForInpainting,
30
+ "txt2video" : TextToVideoZeroPipeline,
31
+ },
32
+ "flax" : {
33
+ "base" : FlaxStableDiffusionPipeline,
34
+ "txt2img" : FlaxStableDiffusionPipeline,
35
+ "img2img" : FlaxStableDiffusionImg2ImgPipeline,
36
+ "inpaint" : FlaxStableDiffusionInpaintPipeline,
37
+ "txt2video" : None,
38
+ }
39
+
40
+ }
41
+
42
+
43
+
44
+ class AutoPipeline(Search_cls,Basic_config):
45
+ def __init__(
46
+ self,
47
+ search_word: str,
48
+ pipe_type = "txt2img",
49
+ auto: Optional[bool] = True,
50
+ priority: Optional[str] = "hugface",
51
+ branch: Optional[str] = "main",
52
+ search_local_only: Optional[bool] = False,
53
+ **keywords
54
+ ):
55
+
56
+ super().__init__()
57
+ self.seach_word = search_word
58
+ self.pipe_type = pipe_type
59
+ self.auto = auto
60
+ self.priority = priority
61
+ self.branch = branch
62
+ self.search_local_only = search_local_only
63
+
64
+ self.device = self.device_type_check()
65
+
66
+
67
+
68
+ def pipeline_type(
69
+ self,
70
+ cls_or_name
71
+ ):
72
+ if isinstance(str, cls_or_name):
73
+ if hasattr(diffusers, cls_or_name):
74
+ return getattr(diffusers, cls_or_name)
75
+ else:
76
+ candidate = self.max_temper(cls_or_name,dir(diffusers))
77
+ error_txt = f"Maybe {candidate}?" if candidate else ""
78
+ raise ValueError(f"{cls_or_name} is not in diffusers.{error_txt}")
79
+
80
+ elif hasattr(diffusers, cls_or_name.__name__):
81
+ return cls_or_name
82
+
83
+ else:
84
+ candidate = self.max_temper(cls_or_name,dir(diffusers))
85
+ error_txt = f"Maybe {candidate}?" if candidate else ""
86
+ raise ValueError(f"{cls_or_name} is not in diffusers.{error_txt}")
87
+
88
+
89
+
90
+
91
+