Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: train_dataset does not implement __len__, max_steps has to be specified #1

Open
widyaputeriaulia10 opened this issue Oct 28, 2022 · 0 comments

Comments

@widyaputeriaulia10
Copy link

dear authors, i tried to re-implemented IndoBERT based on your code but when i train the model :

metric = load_metric("accuracy")

def compute_metrics(eval_pred):
logits, labels = eval_pred
predictions = np.argmax(logits, axis=-1)

return metric.compute(predictions=predictions, references=labels)

trainer = Trainer(
model=model,
args=training_args,
train_dataset=train_dataset,
eval_dataset=eval_dataset,
compute_metrics=compute_metrics,
)

train_history = trainer.train()
train_evaluate = trainer.evaluate()

i found the issue like this:

ValueError Traceback (most recent call last)
in
12 train_dataset=train_dataset,
13 eval_dataset=eval_dataset,
---> 14 compute_metrics=compute_metrics,
15 )
16

/setneg-dir/Uli/uli-env/lib/python3.6/site-packages/transformers/trainer.py in init(self, model, args, data_collator, train_dataset, eval_dataset, tokenizer, model_init, compute_metrics, callbacks, optimizers, preprocess_logits_for_metrics)
427
428 if train_dataset is not None and not has_length(train_dataset) and args.max_steps <= 0:
--> 429 raise ValueError("train_dataset does not implement len, max_steps has to be specified")
430
431 if (

ValueError: train_dataset does not implement len, max_steps has to be specified

may i ask you for your advices to solve the problem?

Thank You

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant