Skip to content

Commit

Permalink
Correct typo of "preiod" mistake to "period" in 6 files (keras-team#1536
Browse files Browse the repository at this point in the history
)

*Correct typo mistake in 6 files, which the word should be "period" and not "preiod".
  • Loading branch information
newer027 authored Oct 10, 2023
1 parent d92b7aa commit 0915932
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions examples/generative/dreambooth.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,9 @@ def train_step(self, inputs):

def get_timestep_embedding(self, timestep, dim=320, max_period=10000):
half = dim // 2
log_max_preiod = tf.math.log(tf.cast(max_period, tf.float32))
log_max_period = tf.math.log(tf.cast(max_period, tf.float32))
freqs = tf.math.exp(
-log_max_preiod * tf.range(0, half, dtype=tf.float32) / half
-log_max_period * tf.range(0, half, dtype=tf.float32) / half
)
args = tf.convert_to_tensor([timestep], dtype=tf.float32) * freqs
embedding = tf.concat([tf.math.cos(args), tf.math.sin(args)], 0)
Expand Down
4 changes: 2 additions & 2 deletions examples/generative/finetune_stable_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,9 @@ def train_step(self, inputs):

def get_timestep_embedding(self, timestep, dim=320, max_period=10000):
half = dim // 2
log_max_preiod = tf.math.log(tf.cast(max_period, tf.float32))
log_max_period = tf.math.log(tf.cast(max_period, tf.float32))
freqs = tf.math.exp(
-log_max_preiod * tf.range(0, half, dtype=tf.float32) / half
-log_max_period * tf.range(0, half, dtype=tf.float32) / half
)
args = tf.convert_to_tensor([timestep], dtype=tf.float32) * freqs
embedding = tf.concat([tf.math.cos(args), tf.math.sin(args)], 0)
Expand Down
4 changes: 2 additions & 2 deletions examples/generative/ipynb/dreambooth.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -676,9 +676,9 @@
"\n",
" def get_timestep_embedding(self, timestep, dim=320, max_period=10000):\n",
" half = dim // 2\n",
" log_max_preiod = tf.math.log(tf.cast(max_period, tf.float32))\n",
" log_max_period = tf.math.log(tf.cast(max_period, tf.float32))\n",
" freqs = tf.math.exp(\n",
" -log_max_preiod * tf.range(0, half, dtype=tf.float32) / half\n",
" -log_max_period * tf.range(0, half, dtype=tf.float32) / half\n",
" )\n",
" args = tf.convert_to_tensor([timestep], dtype=tf.float32) * freqs\n",
" embedding = tf.concat([tf.math.cos(args), tf.math.sin(args)], 0)\n",
Expand Down
4 changes: 2 additions & 2 deletions examples/generative/ipynb/finetune_stable_diffusion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,9 @@
"\n",
" def get_timestep_embedding(self, timestep, dim=320, max_period=10000):\n",
" half = dim // 2\n",
" log_max_preiod = tf.math.log(tf.cast(max_period, tf.float32))\n",
" log_max_period = tf.math.log(tf.cast(max_period, tf.float32))\n",
" freqs = tf.math.exp(\n",
" -log_max_preiod * tf.range(0, half, dtype=tf.float32) / half\n",
" -log_max_period * tf.range(0, half, dtype=tf.float32) / half\n",
" )\n",
" args = tf.convert_to_tensor([timestep], dtype=tf.float32) * freqs\n",
" embedding = tf.concat([tf.math.cos(args), tf.math.sin(args)], 0)\n",
Expand Down
4 changes: 2 additions & 2 deletions examples/generative/md/dreambooth.md
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,9 @@ class DreamBoothTrainer(tf.keras.Model):

def get_timestep_embedding(self, timestep, dim=320, max_period=10000):
half = dim // 2
log_max_preiod = tf.math.log(tf.cast(max_period, tf.float32))
log_max_period = tf.math.log(tf.cast(max_period, tf.float32))
freqs = tf.math.exp(
-log_max_preiod * tf.range(0, half, dtype=tf.float32) / half
-log_max_period * tf.range(0, half, dtype=tf.float32) / half
)
args = tf.convert_to_tensor([timestep], dtype=tf.float32) * freqs
embedding = tf.concat([tf.math.cos(args), tf.math.sin(args)], 0)
Expand Down
4 changes: 2 additions & 2 deletions examples/generative/md/finetune_stable_diffusion.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,9 @@ class Trainer(tf.keras.Model):

def get_timestep_embedding(self, timestep, dim=320, max_period=10000):
half = dim // 2
log_max_preiod = tf.math.log(tf.cast(max_period, tf.float32))
log_max_period = tf.math.log(tf.cast(max_period, tf.float32))
freqs = tf.math.exp(
-log_max_preiod * tf.range(0, half, dtype=tf.float32) / half
-log_max_period * tf.range(0, half, dtype=tf.float32) / half
)
args = tf.convert_to_tensor([timestep], dtype=tf.float32) * freqs
embedding = tf.concat([tf.math.cos(args), tf.math.sin(args)], 0)
Expand Down

0 comments on commit 0915932

Please sign in to comment.