Skip to content

Commit

Permalink
fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
evinpinar committed Feb 7, 2023
1 parent 72fa567 commit febc11a
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 278 deletions.
166 changes: 0 additions & 166 deletions environment.yml

This file was deleted.

30 changes: 30 additions & 0 deletions environment/environment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: ldm
channels:
- pytorch
- defaults
dependencies:
- python=3.8.5
- pip=20.3
- cudatoolkit=11.3
- pytorch=1.11.0
- torchvision=0.12.0
- numpy=1.19.2
- pip:
- albumentations==0.4.3
- diffusers
- opencv-python==4.1.2.30
- pudb==2019.2
- invisible-watermark
- imageio==2.9.0
- imageio-ffmpeg==0.4.2
- pytorch-lightning==1.4.2
- omegaconf==2.1.1
- test-tube>=0.7.5
- streamlit>=0.73.1
- einops==0.3.0
- torch-fidelity==0.3.0
- torchmetrics==0.6.0
- kornia==0.6
- -e git+https://github.com/CompVis/taming-transformers.git@master#egg=taming-transformers
- -e git+https://github.com/openai/CLIP.git@main#egg=clip
- -r requirements.txt
10 changes: 10 additions & 0 deletions environment/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ftfy
opencv-python
ipywidgets
matplotlib
pyrallis
torch==1.12.0
diffusers==0.12.1
transformers==4.26.0
jupyter
accelerate
108 changes: 0 additions & 108 deletions generate_sqexcite.py

This file was deleted.

5 changes: 2 additions & 3 deletions pipeline_attend_and_excite.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from diffusers.pipelines.stable_diffusion import StableDiffusionPipelineOutput
from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionSafetyChecker

#from pipeline_sd import StableDiffusionPipeline
from diffusers.pipelines.stable_diffusion import StableDiffusionPipeline

from utils.gaussian_smoothing import GaussianSmoothing
Expand Down Expand Up @@ -208,7 +207,7 @@ def _compute_max_attention_per_index(attention_maps: torch.Tensor,
for i in indices_to_alter:
image = attention_for_text[:, :, i]
if smooth_attentions:
smoothing = GaussianSmoothing(channels=1, kernel_size=kernel_size, sigma=sigma, dim=2).half().cuda()
smoothing = GaussianSmoothing(channels=1, kernel_size=kernel_size, sigma=sigma, dim=2).cuda()
input = F.pad(image.unsqueeze(0).unsqueeze(0), (1, 1, 1, 1), mode='reflect')
image = smoothing(input).squeeze(0).squeeze(0)
max_indices_list.append(image.max())
Expand Down Expand Up @@ -581,4 +580,4 @@ def __call__(
if not return_dict:
return (image, has_nsfw_concept)

return StableDiffusionPipelineOutput(images=image, nsfw_content_detected=has_nsfw_concept)
return StableDiffusionPipelineOutput(images=image, nsfw_content_detected=has_nsfw_concept)
2 changes: 1 addition & 1 deletion utils/gaussian_smoothing.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def forward(self, input):
Returns:
filtered (torch.Tensor): Filtered output.
"""
return self.conv(input, weight=self.weight, groups=self.groups)
return self.conv(input, weight=self.weight.to(input.dtype), groups=self.groups)


class AverageSmoothing(nn.Module):
Expand Down

0 comments on commit febc11a

Please sign in to comment.