minimaxir / textgenrnn

Easily train your own text-generating neural network of any size and complexity on any text dataset with a few lines of code.
Other
4.94k stars 752 forks source link

train_from_largetext only produces short chunks of output text #53

Closed janelleshane closed 6 years ago

janelleshane commented 6 years ago

This is specifically regarding the train_from_largetext() option in character-level mode. The output text seems to be produced in chunks of around 300 characters with no continuity between them. This is in contrast to other char-rnns that produce text in one continuous flow.

Here's what I did: I trained on a large text file that has thousands of recipes, using the following mostly-default command. recipes.train_from_largetext_file('datasets/recipes.txt', new_model=True, num_epochs=1)

Then I generate output using this command: recipes.generate(10, temperature=0.6)

The generated output, however, is produced a chunk of about 300 characters at a time, and each 300-character chunk doesn't have any continuity with a previous chunk.

Here's what I'd expect to get (a recipe from another char-rnn based on the same training text):

@@@@@ Now You're Cooking! Export Format

Cold Salad Crawfish

seafood

1 1/4 cup heavy cream 1 paprika 1 onion; finely diced 1 cup honey 2 tablespoon light cream

Preheat oven to 350 degrees F.

When the noodles have set, add the salt and pepper and soak the fat away for 5 minutes. Spoon over the tomato puree. Add the shrimp and bring to a boil. Reduce heat. Simmer, uncovered, for 10 minutes. Add the meat and stir-fry for 25 minutes, stirring well. Remove from heat, add shrimp. Then add pork and cook, stirring, 10 to 12 min. Remove from heat. Add sliced beets and stir-fry for 3 minutes to the brandy. Add chili powder and rind of soy sauce. Cook 3 minutes, or untill set and browned, bring bread mixture to a boil. Reduce heat, cover and simmer 8 to 10 minutes until cooked through.

Yield: 1 servings

And here's what I actually get. Each time it generates a new chunk of output text, it starts in the middle of a different recipe.

occasionally, until ship three meat is thickens... Recipe by by a marinaded consistery or but dish. Cover and cook on a pan or pot and add the beans or milk. Spread in each thick to pieces are almosh the meat is endiples. Cook and finely chill on toppot stagh or shells on medium half the onions in

heese, shallow finely chopped 1 tablespoon powdered sugar 1 cup water

Place finely chopped cubes excess cookie crushed pineapples, smooth the cooking the butter and scallions are tender.

Add milk, halved slices, carrot and vanilla.

Yield: 6 servings

@@@@@ Now You're Cooking! Export Forma

're Cooking! Export Format

Caramelizable Soup Chili

fish, chicken, chicken, berries

2 tablespoon whites chicken breasts and remove brown black excepers and past and half boiling with woods until smooth and simmer for 6-3 hrsped pan. If mady be spices and salted base in a large to a medium and sp

ed sugar and butter and sugar and simmer until firm are tender. Spoon over the batter. Drained relish, stirring constantly, the chopped in a minute. Cover and cover the cake the sides of the baking ingred excess of topping fat. Cover and let longer to stir to root. Cover and place in melted blackly

inkle with beef ice cream to taste.

Noter: 5 x 9 inch soup pot of catsup

Combine the coramas, garlic in thick to simmer 1 to 1 hour, about 1 1/2 hours. Remove the pan or boils. Add to the spray or bubble off the cream excess finely salt and pepper.

Yield: 6 servings

Are there training/sampling parameters that would avoid this issue?

minimaxir commented 6 years ago

generate has a default parameter max_gen_length=300. Does increasing that parameter value improve continuity?

janelleshane commented 6 years ago

Yup, increasing max_gen_length does seem to work. Thanks!