Skip to content

Commit c5ca97e

Browse files
committed
Add a story for "Recipes generation".
1 parent e982bc1 commit c5ca97e

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

assets/recipes_generation.ru.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,20 +1644,19 @@ _<small>➔ вывод:</small>_
16441644
> (1, None)
16451645
> ```
16461646
1647-
### Петля прогнозирования
1647+
### Цикл прогнозирования
16481648
1649-
To use our trained model for recipe generation we need to implement a so-called prediction loop. The following code block generates the text using the loop:
1649+
Чтобы использовать нашу обученную модель для генерации рецептов, нам необходимо реализовать так называемый цикл прогнозирования. Следующий блок кода генерирует текст с помощью цикла:
16501650
1651-
- It starts by choosing a start string, initializing the RNN state and setting the number of characters to generate.
1652-
- It gets the prediction distribution of the next character using the start string, and the RNN state.
1653-
- Then, it uses a categorical distribution to calculate the index of the predicted character. It uses this predicted character as the next input to the model.
1654-
- The RNN state returned by the model is fed back into the model so that it now has more context, instead of only one character. After predicting the next character, the modified RNN states are again fed back into the model, which is how it learns as it gets more context from the previously predicted characters.
1651+
- Начинаем с выбора входящей строки, инициализации состояния RNN и установки количества генерируемых символов.
1652+
- Получаем предсказания для каждого символа из словаря.
1653+
- С помощью семплинга выбираем следующий символ. Используем его в качестве следующей входящей в модель строки.
16551654
16561655
![Prediction loop](https://www.tensorflow.org/tutorials/text/images/text_generation_sampling.png)
16571656
1658-
> Image source: [Text generation with an RNN](https://www.tensorflow.org/tutorials/text/text_generation) notebook.
1657+
> Источник изображения [Text generation with an RNN](https://www.tensorflow.org/tutorials/text/text_generation) .
16591658
1660-
The `temperature` parameter here defines how fuzzy or how unexpected the generated recipe is going to be. Low temperatures results in more predictable text. Higher temperatures result in more surprising text. You need to experiment to find the best setting. We will do some experimentation with different temperatures below.
1659+
Параметр `temperature` здесь определяет, насколько нечетким или насколько неожиданным будет сгенерированный рецепт. Низкие значения `temperature` приводят к более предсказуемому тексту. Более высокие значения `temperature` приводят к более неожиданному тексту. Мы проведем некоторые эксперименты с различными значениями `temperature` ниже.
16611660
16621661
```python
16631662
def generate_text(model, start_string, num_generate = 1000, temperature=1.0):
@@ -1696,9 +1695,9 @@ def generate_text(model, start_string, num_generate = 1000, temperature=1.0):
16961695
return (padded_start_string + ''.join(text_generated))
16971696
```
16981697
1699-
### Figuring out proper temperature for prediction loop
1698+
### Экспериментируем с параметром `temperature`
17001699

1701-
Now, let's use `generate_text()` to actually generate some new recipes. The `generate_combinations()` function goes through all possible combinations of the first recipe letters and temperatures. It generates `56` different combinations to help us figure out how the model performs and what temperature is better to use.
1700+
Воспользуемся функцией `generate_text()` для генерации рецептов. Функция `generate_combinations()` генерирует `56` различных комбинаций входящего текста и параметра `temperature`. Это должно помочь нам определиться с подходящим значением для `temperature`.
17021701

17031702
```python
17041703
def generate_combinations(model):
@@ -1721,7 +1720,7 @@ def generate_combinations(model):
17211720

17221721
```
17231722

1724-
To avoid making this article too long only some of those `56` combinations will be printed below.
1723+
Чтобы не делать эту статью слишком длинной, ниже будут напечатаны только некоторые из этих `56` комбинаций.
17251724

17261725
```python
17271726
generate_combinations(model_simplified)
@@ -2057,9 +2056,9 @@ _<small>➔ вывод:</small>_
20572056
> ▪︎ Meanwhile, heat the olive oil in a large skillet over medium-high heat. Add the shallots and saute until tender, about 3 minutes. Add the garlic and cook for 1 minute. Add the sausage and cook until the shallots are tender, about 3 minutes. Add the sausage and cook until tender, about 2 minutes. Add the garlic and cook, stirring, until the garlic is lightly browned, about 1 minute. Add the sausage and cook until the s
20582057
> ```
20592058
2060-
## Interactive model demo
2059+
## Интерактивная демонстрация модели
20612060
2062-
You may use 🎨 [**Cooking recipes generator demo**](https://trekhleb.github.io/machine-learning-experiments/#/experiments/RecipeGenerationRNN) to play around with this model, input text, and temperature parameters to generate some random recipes right in your browser.
2061+
Вы можете воспользоватья 🎨 [**Cooking recipes generator demo**](https://trekhleb.github.io/machine-learning-experiments/#/experiments/RecipeGenerationRNN) to play around with this model, input text, and temperature parameters to generate some random recipes right in your browser.
20632062
20642063
![Recipe generator demo](https://raw.githubusercontent.com/trekhleb/machine-learning-experiments/master/assets/images/recipes_generation/00-demo.gif)
20652064

0 commit comments

Comments
 (0)