Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

Generators file for low-memory users - Code Provided #39

Closed
thethiny opened this issue Mar 23, 2019 · 1 comment
Closed

Generators file for low-memory users - Code Provided #39

thethiny opened this issue Mar 23, 2019 · 1 comment
Assignees
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@thethiny
Copy link
Contributor

Hi,
I would suggest these 2 generators for usage with people with small memory, or for GPUs with low memory.

def _generator(sentence_pairs, batch_size, seq_len):
    while True:
        inp, outp = gen_batch_inputs(sentence_pairs, token_dict, token_list, seq_len=seq_len)
        for i in range (0, len(sentence_pairs), batch_size):
            yield [inp[x][i:i+batch_size] for x in range(len(inp))], [outp[x][i:i+batch_size] for x in range (len(outp))]
            
def _generator_v(sentence_pairs, batch_size, seq_len):
    while True:
        for i in range(0, len(sentence_pairs), batch_size):
            yield gen_batch_inputs(sentence_pairs[i:i+batch_size], token_dict, token_list, seq_len=seq_len)
@thethiny thethiny added the enhancement New feature or request label Mar 23, 2019
@stale
Copy link

stale bot commented Mar 28, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Mar 28, 2019
@stale stale bot closed this as completed Mar 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants