Skip to content

Commit 74a0f0c

Browse files
authored
New guide: "Transfer learning and fine-tuning"
New guide: "Transfer learning and fine-tuning"
2 parents f4d21cb + e1b22a5 commit 74a0f0c

File tree

7 files changed

+608
-27
lines changed

7 files changed

+608
-27
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
- `layer_cudnn_gru()` and `layer_cudnn_lstm()` are deprecated. `layer_gru()` and `layer_lstm()` will
2525
automatically use CuDNN if it is available.
2626

27+
- New vignette: "Transfer learning and fine-tuning".
28+
2729
- New function `%<-active%`, a ergonomic wrapper around `makeActiveBinding()`
2830
for constructing Python `@property` decorated methods in `%py_class%`.
2931

R/layers-preprocessing.R

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,11 +1433,8 @@ function(object, run_eagerly = NULL, steps_per_execution = NULL, ...) {
14331433
}
14341434

14351435

1436-
# TODO: isn't there a hashing trick already? text_hashing_trick
14371436

14381437
# TODO: add an 'experimental' tag in the R docs where appropriate
1439-
# TODO: print a start up message suggesting people update tensorflow/keras if they're running an old version,
1440-
# or, at least telling them the current TF version and the range of compatible R-keras versions.
14411438

14421439
require_tf_version <- function(ver, msg = "this function.") {
14431440
if (tf_version() < ver)
@@ -1453,25 +1450,6 @@ require_tf_version <- function(ver, msg = "this function.") {
14531450
# gives the python interpreter a chance to recycle the address for the identical
14541451
# string that's already in it's string pool, which then passes the `is`
14551452
# comparison.
1456-
#
1457-
# TODO: file another PR
1458-
#
1459-
# ag --python --case-sensitive '^(?!\s*#).* if .+ is( not)? (?!None).*$'
1460-
# find . -type f -name '*.py' -exec grep ' is ' {} \;
1461-
#
1462-
# Hello!
1463-
# While working on the [R interface to keras](github.com/rstudio/keras/), I recently encountered this issue:
1464-
# https://github.com/keras-team/keras/blob/db3fa5d40ed19cdf89fc295e8d0e317fb64480d4/keras/layers/preprocessing/text_vectorization.py#L524
1465-
# The referenced snippet fails for valid strings `"int"` because `is not` compares memory addresses. Instead an equality comparison `!=` might be more appropriate.
1466-
# ([relevant stackoverflow thread](https://stackoverflow.com/a/1504742/5128728))
1467-
#
1468-
# There was a prior pull request merged around TF 2.2 for a similar issue:
1469-
# https://github.com/tensorflow/tensorflow/pull/34420
1470-
#
1471-
# I haven't looked through the rest of the codebase to see if `is` is used to
1472-
# compare strings anywhere else. A crude regex search on the keras repo yields 157 hits:
1473-
# `ag --python --case-sensitive '^(?!\s*#).* if .+ is( not)? .*(?<!None)[:]$' | wc -l`
1474-
# Most of these are probably fine, but it would take some work to go through and reason about each one.
14751453
fix_string <- local({
14761454
py_reparse <- NULL # R CMD check: no visible binding
14771455
delayedAssign("py_reparse",

R/optimizers.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,7 @@ optimizer_adam <- function(learning_rate = 0.001, beta_1 = 0.9, beta_2 = 0.999,
180180
do.call(keras$optimizers$Adam, args)
181181
}
182182

183-
# TODO: name arg? decay position moved?
184-
# TODO: lr -> learning_rate
183+
# TODO: decay position moved
185184
# tf.keras.optimizers.Adam(
186185
# learning_rate=0.001,
187186
# beta_1=0.9,

R/utils.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,5 +449,3 @@ capture_args <- function(cl, modifiers = NULL, ignore = NULL,
449449
args
450450
}
451451

452-
# TODO
453-
plot_model <- function(...) {}

tests/testthat/test-model-persistence.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ test_succeeds("model with custom loss and metrics can be saved and loaded", {
2929
loss_categorical_crossentropy(y_pred, y_true)
3030
}
3131

32-
#TODO: /home/tomasz/.virtualenvs/tf-2.5-cpu/lib/python3.8/site-packages/tensorflow/python/keras/optimizer_v2/optimizer_v2.py:374: UserWarning: The `lr` argument is deprecated, use `learning_rate` instead.
3332
model %>% compile(
3433
loss = custom_loss,
3534
optimizer = optimizer_nadam(),

tools/find-missing-layers.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,4 @@ df %>%
178178
filter(missing_in_r != "") %>%
179179
identity()
180180

181+
# TODO: backend, applications

0 commit comments

Comments
 (0)