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
+48-65Lines changed: 48 additions & 65 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,9 +48,9 @@ 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.
52
51
```
53
52
53
+
54
54
```python
55
55
import keras_hub
56
56
import pathlib
@@ -60,18 +60,8 @@ import keras
60
60
from keras import ops
61
61
62
62
import tensorflow.data as tf_data
63
-
from tensorflow_text.tools.wordpiece_vocab import (
64
-
bert_vocab_from_dataset as bert_vocab,
65
-
)
66
63
```
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.
603
+
I0000 00:00:1761330728.196220 3674624 service.cc:152] XLA service 0x600002a54000 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
604
+
I0000 00:00:1761330728.196232 3674624 service.cc:160] StreamExecutor device (0): Host, Default Version
605
+
I0000 00:00:1761330728.304584 3674624 device_compiler.h:188] Compiled cluster using XLA! This line is logged at most once for the lifetime of the process.
616
606
617
607
** 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
-
```
608
+
tom used to play the piano professionally.
609
+
tom se a la fiesta de la vida .
610
+
625
611
** Example 1 **
626
-
i think maybe that's all you have to do.
627
-
creo que tom le dije que hacer eso .
612
+
i had to leave boston.
613
+
tuve que ir a boston .
628
614
```
629
615
</div>
630
-
631
-
632
616
633
617
---
634
618
## Evaluating our model (quantitative analysis)
@@ -651,8 +635,7 @@ for test_pair in test_pairs[:30]:
0 commit comments