Skip to content

Commit 6bdc202

Browse files
committed
minor changes
1 parent a8a4431 commit 6bdc202

File tree

4 files changed

+44
-5
lines changed

4 files changed

+44
-5
lines changed

README.md

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,10 @@ Some [examples](examples/) were trained on the [MNIST](https://pjreddie.com/proj
138138
5. *[Generative Adversarial Network](examples/gan.py)*
139139
6. *[Recurrent Digits Classifier](examples/recurrent_digits_classifier.py)*
140140
7. *[Recurrent Sequences Classifier](examples/recurrent_sequences_classifier.py)*
141-
8. *[Variational Autoencoder](examples/vae.py)*
142-
9. *[Vector Quantized Variational Autoencoder](examples/vqvae.py)*
143-
10. *[Word2Vec](examples/word2vec.py)*
141+
8. *[Seq2Seq Transformer](examples/seq2seq.py)*
142+
9. *[Variational Autoencoder](examples/vae.py)*
143+
10. *[Vector Quantized Variational Autoencoder](examples/vqvae.py)*
144+
11. *[Word2Vec](examples/word2vec.py)*
144145

145146

146147

@@ -330,6 +331,44 @@ Code:
330331
*[Model Example](examples/recurrent_digits_classifier.py)*
331332
</details>
332333

334+
<details>
335+
<summary>Seq2Seq Transformer</summary>
336+
337+
#### Examples of translated sentences of validation set:
338+
339+
>Example №1
340+
*Input sentence: These four people are standing outdoors, with 3 dogs.
341+
Decoded sentence: Vier Personen stehen im Freien mit drei Hunden.
342+
Target sentence: Diese vier Personen stehen mit 3 Hunden im Freien.*
343+
344+
>Example №2
345+
*Input sentence: A man in a martial arts uniform in midair.
346+
Decoded sentence: Ein Mann in Uniform befindet sich in der Luft.
347+
Target sentence: Ein Mann in einem Karateanzug in der Luft.*
348+
349+
>Example №3
350+
*Input sentence: A long-haired, male musician is playing on a piano.
351+
Decoded sentence: Ein langhaariger Mann spielt Klavier auf einem Klavier.
352+
Target sentence: Ein Musiker mit langen Haaren spielt Keyboard.*
353+
354+
>Example №4
355+
*Input sentence: A child is laying on a beige rug laughing.
356+
Decoded sentence: Ein Kind liegt auf einem beigen Teppich.
357+
Target sentence: Ein Kind liegt auf einem beigefarbenen Teppich und lacht.*
358+
359+
>Example №5
360+
*Input sentence: A dark-haired bearded man in glasses and a Hawaiian shirt is sitting on the grass.
361+
Decoded sentence: Ein bärtiger Mann mit Brille und einem dunkelhaarigen Mann sitzt im Gras.
362+
Target sentence: Ein dunkelhaariger Mann mit Bart, Brille und Hawaiihemd sitzt auf dem Gras.*
363+
</details>
364+
365+
#### Attention plots of the first sentence:
366+
367+
<p align="center">
368+
<img src="generated images/attention plots.png" width=100% height=100%>
369+
</p>
370+
371+
333372
<details>
334373
<summary>Variational Autoencoder (VAE)</summary>
335374

@@ -802,5 +841,5 @@ Native implementation Example | Neural network Example
802841

803842
### TODO:
804843
- [x] Add Seq2Seq Transformer example
805-
- [ ] Add GPT Transformer example
844+
- [ ] Add GPT example
806845
- [ ] Add lr schedulers
File renamed without changes.

neunet/nn/losses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def forward(self, y_pred: Tensor, y_true: Tensor) -> Tensor:
107107

108108
# TODO: if neg value in y_true != ignore_index, raise error, fix, negative ids in weight
109109

110-
ignore_mask = (y_true.data != self.ignore_index).astype(y_pred.dtype)
110+
ignore_mask = y_true.data != self.ignore_index
111111

112112
idx = np.indices(y_true.data.shape, sparse=True)
113113
criterion = (idx[0], y_true.data, *idx[1:])
File renamed without changes.

0 commit comments

Comments
 (0)