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

Not able to run the tutorial notebook #187

Open
jun-xuan-li-26 opened this issue Nov 6, 2024 · 1 comment
Open

Not able to run the tutorial notebook #187

jun-xuan-li-26 opened this issue Nov 6, 2024 · 1 comment

Comments

@jun-xuan-li-26
Copy link

jun-xuan-li-26 commented Nov 6, 2024

Hi, @wgifford

I copied this notebook and tried to run the same on my machine.

Got this error when trying to generate the evaluation zeroshot_trainer.evaluate(test_dataset), can you guide here:

IsADirectoryError                         Traceback (most recent call last)
Cell In[20], line 1
----> 1 zeroshot_trainer.evaluate(test_dataset)

File /anaconda/envs/spark/lib/python3.10/site-packages/transformers/trainer.py:3975, in Trainer.evaluate(self, eval_dataset, ignore_keys, metric_key_prefix)
   3972 start_time = time.time()
   3974 eval_loop = self.prediction_loop if self.args.use_legacy_prediction_loop else self.evaluation_loop
-> 3975 output = eval_loop(
   3976     eval_dataloader,
   3977     description="Evaluation",
   3978     # No point gathering the predictions if there are no metrics, otherwise we defer to
   3979     # self.args.prediction_loss_only
   3980     prediction_loss_only=True if self.compute_metrics is None else None,
   3981     ignore_keys=ignore_keys,
   3982     metric_key_prefix=metric_key_prefix,
   3983 )
   3985 total_batch_size = self.args.eval_batch_size * self.args.world_size
   3986 if f"{metric_key_prefix}_jit_compilation_time" in output.metrics:

File /anaconda/envs/spark/lib/python3.10/site-packages/transformers/trainer.py:4202, in Trainer.evaluation_loop(self, dataloader, description, prediction_loss_only, ignore_keys, metric_key_prefix)
   4199     if not self.args.batch_eval_metrics or description == "Prediction":
   4200         all_labels.add(labels)
-> 4202 self.control = self.callback_handler.on_prediction_step(args, self.state, self.control)
   4204 if self.args.batch_eval_metrics:
   4205     if self.compute_metrics is not None and logits is not None and labels is not None:

File /anaconda/envs/spark/lib/python3.10/site-packages/transformers/trainer_callback.py:514, in CallbackHandler.on_prediction_step(self, args, state, control)
    513 def on_prediction_step(self, args: TrainingArguments, state: TrainerState, control: TrainerControl):
--> 514     return self.call_event("on_prediction_step", args, state, control)

File /anaconda/envs/spark/lib/python3.10/site-packages/transformers/trainer_callback.py:518, in CallbackHandler.call_event(self, event, args, state, control, **kwargs)
    516 def call_event(self, event, args, state, control, **kwargs):
    517     for callback in self.callbacks:
--> 518         result = getattr(callback, event)(
    519             args,
    520             state,
    521             control,
    522             model=self.model,
    523             processing_class=self.processing_class,
    524             optimizer=self.optimizer,
    525             lr_scheduler=self.lr_scheduler,
    526             train_dataloader=self.train_dataloader,
    527             eval_dataloader=self.eval_dataloader,
    528             **kwargs,
    529         )
    530         # A Callback can skip the return of `control` if it doesn't change it.
    531         if result is not None:

File /anaconda/envs/spark/lib/python3.10/site-packages/transformers/utils/notebook.py:322, in NotebookProgressCallback.on_prediction_step(self, args, state, control, eval_dataloader, **kwargs)
    320     else:
    321         self.prediction_bar = NotebookProgressBar(len(eval_dataloader))
--> 322     self.prediction_bar.update(1)
    323 else:
    324     self.prediction_bar.update(self.prediction_bar.value + 1)

File /anaconda/envs/spark/lib/python3.10/site-packages/transformers/utils/notebook.py:143, in NotebookProgressBar.update(self, value, force_update, comment)
    141     self.first_calls = self.warmup
    142     self.wait_for = 1
--> 143     self.update_bar(value)
    144 elif value <= self.last_value and not force_update:
    145     return

File /anaconda/envs/spark/lib/python3.10/site-packages/transformers/utils/notebook.py:188, in NotebookProgressBar.update_bar(self, value, comment)
    185         self.label += f", {1/self.average_time_per_item:.2f} it/s"
    187 self.label += "]" if self.comment is None or len(self.comment) == 0 else f", {self.comment}]"
--> 188 self.display()

File /anaconda/envs/spark/lib/python3.10/site-packages/transformers/utils/notebook.py:197, in NotebookProgressBar.display(self)
    195     return
    196 if self.output is None:
--> 197     self.output = disp.display(disp.HTML(self.html_code), display_id=True)
    198 else:
    199     self.output.update(disp.HTML(self.html_code))

File /anaconda/envs/spark/lib/python3.10/site-packages/IPython/core/display.py:432, in HTML.__init__(self, data, url, filename, metadata)
    430 if warn():
    431     warnings.warn("Consider using IPython.display.IFrame instead")
--> 432 super(HTML, self).__init__(data=data, url=url, filename=filename, metadata=metadata)

File /anaconda/envs/spark/lib/python3.10/site-packages/IPython/core/display.py:327, in DisplayObject.__init__(self, data, url, filename, metadata)
    324 elif self.metadata is None:
    325     self.metadata = {}
--> 327 self.reload()
    328 self._check_data()

File /anaconda/envs/spark/lib/python3.10/site-packages/IPython/core/display.py:353, in DisplayObject.reload(self)
    351 if self.filename is not None:
    352     encoding = None if "b" in self._read_flags else "utf-8"
--> 353     with open(self.filename, self._read_flags, encoding=encoding) as f:
    354         self.data = f.read()
    355 elif self.url is not None:
    356     # Deferred import

IsADirectoryError: [Errno 21] Is a directory: "\n    <div>\n      \n      <progress value='1' max='179' style='width:300px; height:20px; vertical-align: middle;'></progress>\n      [  1/179 : < :]\n    </div>\n    "
@wgifford
Copy link
Collaborator

I tried this morning in python 3.10 and python 3.11 using the latest version of the notebook (https://github.com/ibm-granite/granite-tsfm/blob/main/notebooks/tutorial/ttm_tutorial.ipynb) locally on my MacBook. I could not reproduce the above error.

Could you try again, in a new python environment?

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

2 participants