MCPcopy Create free account
hub / github.com/pytorch/examples / _yield_tokens

Function _yield_tokens

language_translation/src/data.py:9–15  ·  view source on GitHub ↗
(iterable_data, tokenizer, src)

Source from the content-addressed store, hash-verified

7
8# Turns an iterable into a generator
9def _yield_tokens(iterable_data, tokenizer, src):
10
11 # Iterable data stores the samples as (src, tgt) so this will help us select just one language or the other
12 index = 0 if src else 1
13
14 for data in iterable_data:
15 yield tokenizer(data[index])
16
17# Get data, tokenizer, text transform, vocab objs, etc. Everything we
18# need to start training the model

Callers 1

get_dataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected