You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes to neural_machine_translation_with_keras_hub example.
This example was no longer running beause of:
- breaking change in `get_file`.
- use of `to_tensor` on a non-ragged tensor, which was replaced with the cross-backend `convert_to_tensor(ragged=False)`.
- decoding of string that was no longer needed.
Fixes#2176
Copy file name to clipboardExpand all lines: examples/nlp/md/neural_machine_translation_with_keras_hub.md
+49-65Lines changed: 49 additions & 65 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,9 +48,10 @@ Before we start implementing the pipeline, let's import all the libraries we nee
48
48
```python
49
49
!pip install -q --upgrade rouge-score
50
50
!pip install -q --upgrade keras-hub
51
-
!pip install -q --upgrade keras# Upgrade to Keras 3.
51
+
!pip install -q --upgrade keras
52
52
```
53
53
54
+
54
55
```python
55
56
import keras_hub
56
57
import pathlib
@@ -60,18 +61,8 @@ import keras
60
61
from keras import ops
61
62
62
63
import tensorflow.data as tf_data
63
-
from tensorflow_text.tools.wordpiece_vocab import (
64
-
bert_vocab_from_dataset as bert_vocab,
65
-
)
66
64
```
67
-
<divclass="k-default-codeblock">
68
-
```
69
-
[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
70
-
tensorflow 2.15.1 requires keras<2.16,>=2.15.0, but you have keras 3.3.3 which is incompatible.[31m
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
615
-
I0000 00:00:1714519073.816969 34774 device_compiler.h:186] Compiled cluster using XLA! This line is logged at most once for the lifetime of the process.
604
+
I0000 00:00:1761199596.202348 2777684 service.cc:152] XLA service 0x60000074e200 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
605
+
I0000 00:00:1761199596.202365 2777684 service.cc:160] StreamExecutor device (0): Host, Default Version
606
+
I0000 00:00:1761199596.309835 2777684 device_compiler.h:188] Compiled cluster using XLA! This line is logged at most once for the lifetime of the process.
616
607
617
608
** Example 0 **
618
-
i got the ticket free of charge.
619
-
me pregunto la comprome .
620
-
```
621
-
</div>
622
-
623
-
<divclass="k-default-codeblock">
624
-
```
609
+
i would like shoes like that.
610
+
me gusta la puerta .
611
+
625
612
** Example 1 **
626
-
i think maybe that's all you have to do.
627
-
creo que tom le dije que hacer eso .
613
+
don't speak with your mouth full.
614
+
no le pidió tu ayuda .
628
615
```
629
616
</div>
630
-
631
-
632
617
633
618
---
634
619
## Evaluating our model (quantitative analysis)
@@ -651,8 +636,7 @@ for test_pair in test_pairs[:30]:
0 commit comments