Skip to content

Commit

Permalink
Merge branch 'main' into releasev1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
liuwenran authored Sep 21, 2023
2 parents 907a99a + 5bfcda6 commit 6f7673e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
10 changes: 5 additions & 5 deletions projects/prompt_to_prompt/models/seq_aligner.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ def mis_match_char(self, x, y):

def get_matrix(size_x, size_y, gap):
matrix = []
for i in range(len(size_x) + 1):
for i in range(size_x + 1):
sub_matrix = []
for j in range(len(size_y) + 1):
for j in range(size_y + 1):
sub_matrix.append(0)
matrix.append(sub_matrix)
for j in range(1, len(size_y) + 1):
for j in range(1, size_y + 1):
matrix[0][j] = j * gap
for i in range(1, len(size_x) + 1):
for i in range(1, size_x + 1):
matrix[i][0] = i * gap
return matrix
return np.array(matrix)


# def get_matrix(size_x, size_y, gap):
Expand Down
8 changes: 5 additions & 3 deletions projects/prompt_to_prompt/visualize.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,11 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 1. VAE reconstruction as the a standard result\n"
"#### 1. VAE reconstruction as the standard result\n"
]
},
{
Expand All @@ -123,11 +124,12 @@
"source": [
"from models import ptp_utils\n",
"import torch\n",
"import mmcv\n",
"\n",
"image_path = 'projects/prompt_to_prompt/assets/gnochi_mirror.jpeg'\n",
"image = mmcv.imread('https://github.com/open-mmlab/mmagic/assets/12782558/c851dcf8-bcfa-424f-9eeb-d01a48ea7127', channel_order='rgb')\n",
"prompt = \"a cat sitting next to a mirror\"\n",
"# using vae to reconstruct the image\n",
"image_tensor = ptp_utils.load_512(image_path).to('cuda')\n",
"image_tensor = ptp_utils.load_512(image).to('cuda')\n",
"vae = StableDiffuser.vae\n",
"with torch.no_grad():\n",
" vae_rec = vae(image_tensor, return_dict=False)[0]\n",
Expand Down

0 comments on commit 6f7673e

Please sign in to comment.