radames commited on
Commit
95b0167
·
1 Parent(s): d8457bc

fix noise map

Browse files
server/pipelines/pix2pixTurbo.py CHANGED
@@ -49,16 +49,20 @@ class Pipeline:
49
  height: int = Field(
50
  512, min=2, max=15, title="Height", disabled=True, hide=True, id="height"
51
  )
52
- strength: float = Field(
 
 
 
53
  1.0,
54
  min=0.01,
55
- max=10.0,
56
  step=0.001,
57
- title="Strength",
58
  field="range",
59
  hide=True,
60
- id="strength",
61
  )
 
62
  deterministic: bool = Field(
63
  True,
64
  hide=True,
@@ -107,12 +111,17 @@ class Pipeline:
107
  params.canny_high_threshold,
108
  output_type="pil,tensor",
109
  )
 
 
 
 
110
  canny_tensor = torch.cat((canny_tensor, canny_tensor, canny_tensor), dim=1)
111
  output_image = self.model(
112
  canny_tensor,
113
  params.prompt,
114
  params.deterministic,
115
- params.strength,
 
116
  )
117
  output_pil = transforms.ToPILImage()(output_image[0].cpu() * 0.5 + 0.5)
118
 
 
49
  height: int = Field(
50
  512, min=2, max=15, title="Height", disabled=True, hide=True, id="height"
51
  )
52
+ seed: int = Field(
53
+ 2159232, min=0, title="Seed", field="seed", hide=True, id="seed"
54
+ )
55
+ noise_r: float = Field(
56
  1.0,
57
  min=0.01,
58
+ max=3.0,
59
  step=0.001,
60
+ title="Noise R",
61
  field="range",
62
  hide=True,
63
+ id="noise_r",
64
  )
65
+
66
  deterministic: bool = Field(
67
  True,
68
  hide=True,
 
111
  params.canny_high_threshold,
112
  output_type="pil,tensor",
113
  )
114
+ torch.manual_seed(params.seed)
115
+ noise = torch.randn(
116
+ (1, 4, params.width // 8, params.height // 8), device=self.device
117
+ )
118
  canny_tensor = torch.cat((canny_tensor, canny_tensor, canny_tensor), dim=1)
119
  output_image = self.model(
120
  canny_tensor,
121
  params.prompt,
122
  params.deterministic,
123
+ params.noise_r,
124
+ noise,
125
  )
126
  output_pil = transforms.ToPILImage()(output_image[0].cpu() * 0.5 + 0.5)
127
 
server/requirements.txt CHANGED
@@ -2,7 +2,7 @@ diffusers==0.25.1
2
  transformers==4.36.2
3
  --extra-index-url https://download.pytorch.org/whl/cu121;
4
  torch==2.2.0
5
- fastapi==0.108.0
6
  uvicorn[standard]==0.25.0
7
  Pillow==10.2.0
8
  accelerate==0.25.0
@@ -15,4 +15,6 @@ safetensors
15
  stable_fast @ https://github.com/chengzeyi/stable-fast/releases/download/v1.0.4/stable_fast-1.0.4+torch220cu121-cp310-cp310-manylinux2014_x86_64.whl ; sys_platform != 'darwin' or platform_machine != 'arm64'
16
  oneflow @ https://github.com/siliconflow/oneflow_releases/releases/download/community_cu121/oneflow-0.9.1.dev20240316+cu121-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl ; sys_platform != 'darwin' or platform_machine != 'arm64'
17
  onediff @ git+https://github.com/siliconflow/onediff.git@main#egg=onediff ; sys_platform != 'darwin' or platform_machine != 'arm64'
18
- setuptools
 
 
 
2
  transformers==4.36.2
3
  --extra-index-url https://download.pytorch.org/whl/cu121;
4
  torch==2.2.0
5
+ fastapi==0.110.0
6
  uvicorn[standard]==0.25.0
7
  Pillow==10.2.0
8
  accelerate==0.25.0
 
15
  stable_fast @ https://github.com/chengzeyi/stable-fast/releases/download/v1.0.4/stable_fast-1.0.4+torch220cu121-cp310-cp310-manylinux2014_x86_64.whl ; sys_platform != 'darwin' or platform_machine != 'arm64'
16
  oneflow @ https://github.com/siliconflow/oneflow_releases/releases/download/community_cu121/oneflow-0.9.1.dev20240316+cu121-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl ; sys_platform != 'darwin' or platform_machine != 'arm64'
17
  onediff @ git+https://github.com/siliconflow/onediff.git@main#egg=onediff ; sys_platform != 'darwin' or platform_machine != 'arm64'
18
+ setuptools
19
+ mpmath==1.3.0
20
+ numpy==1.*