Comments (7)
I am also interested to do what @stefan-it described.
Maybe @lmthang or @clarkkev you could also help us here?
from seqio.
Sorry for the late response; you don't necessarily need to process your text data source into TFRecrords; instead you can create a SeqIO Task with a TextLineDataSource [1]. Also, you can set your custom vocab in the output_features
dict while registering your SeqIO Task.
Hope this helps; happy to answer any follow up questions!
[1] https://github.com/google/seqio/blob/main/seqio/dataset_providers.py#L549
from seqio.
Maybe @adarob could help here 😅
from seqio.
That being said, it's important to note that having only a few file shards can result in overfitting if your job restarts frequently. I'd recommend using SaveCheckpointConfig.save_dataset = True
if this is the case.
from seqio.
Hi @gauravmishra and @adarob,
thanks for your hints! I've just written the following task, but I think something is wrong with the preprocessor (mapping):
import functools
import seqio
TaskRegistry = seqio.TaskRegistry
from t5.data import preprocessors
SPM_VOCAB = "/home/stefan/Repositories/seqio/t5-base-german-wikipedia/spiece.model"
DEFAULT_OUTPUT_FEATURES = {
"inputs": seqio.Feature(
vocabulary=seqio.SentencePieceVocabulary(SPM_VOCAB), add_eos=True,
required=False),
"targets": seqio.Feature(
vocabulary=seqio.SentencePieceVocabulary(SPM_VOCAB), add_eos=True)
}
TaskRegistry.add(
"secret_corpus",
source=seqio.TextLineDataSource({"train": "/home/stefan/Repositories/seqio/train.txt",
"validation": "/home/stefan/Repositories/seqio/validation.txt"}),
preprocessors=[
functools.partial(
preprocessors.rekey, key_map={
"inputs": None,
"targets": None
}),
seqio.preprocessors.tokenize,
seqio.CacheDatasetPlaceholder(),
preprocessors.span_corruption,
seqio.preprocessors.append_eos_after_trim,
],
output_features=DEFAULT_OUTPUT_FEATURES,
metric_fns=[])
The train
and validation
file is a normal text file with one sentence per line.
But after using:
dataset = seqio.get_mixture_or_task("secret_corpus").get_dataset(
sequence_length={"inputs": 512, "targets": 512},
split="validation",
shuffle=True,
num_epochs=1,
#shard_info=seqio.ShardInfo(index=0, num_shards=10),
use_cached=False,
seed=42
)
no examples are returned:
for _, ex in zip(range(5), dataset.as_numpy_iterator()):
print(ex)
Would be awesome if you have another hint 🤗
from seqio.
Hi Stefan, I think the issue is with your rekey preprocessor. The key_map maps new_keys to old_keys, and in your case, both inputs and targets are being mapped to None, so there's no data left after this step. You should either point inputs and targets to an existing key from your data source, or remove the re-key preprocessor. Let me know how it goes!
from seqio.
I ended up using TensorFlow datasets (https://www.tensorflow.org/datasets/add_dataset) and writing a custom recipe for it is very easy. I uploaded it to my GCP bucket and was able to train models with T5 library, so I'm happy now and closing this issue 🤗
from seqio.
Related Issues (20)
- Please include installation instructions HOT 2
- import seqio
- how to decide ideal mixture rates ? HOT 1
- FunctionDataSource does not allow function with 3 positional arguments thus shuffling does not work HOT 2
- unable to train mt5 from t5x using mixtures ValueError: Dataset is missing an expected feature during input_validation validation: 'inputs' HOT 3
- Tokenizer is not behaving as expected on special tokens (doesn't recognize `pad` and `eos` tokens) HOT 1
- Using a registered task to add another HOT 1
- seqio 0.0.13 cannot be installed on Apple Silicon due to transitive tensorflow dependency of clu HOT 2
- How to apply the huggingface tokenizer in seqio.vocabulary
- Different preprocessors for each dataset split HOT 2
- import seqio: AttributeError: module 'typing' has no attribute 'get_origin' HOT 1
- Concatenating Tasks? HOT 2
- caching tasks goes out of memory due to apache beam HOT 2
- How to choose minimum sequence length while avoiding truncation
- TfdsDataProvider gives error with non-None tfds_data_dir HOT 2
- Dataset performance
- seqio.get_mixture_or_task('bool_q_template_0_no_opt_five_shot') failed
- unimax sampling ?
- ValueError: mutable default <class 'seqio.vocabularies.PassThroughVocabulary'> for field vocabulary is not allowed: use default_factory HOT 3
- Unimax sampler implementation?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from seqio.