question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

wandb mistakes integers and dictionaries as DataFrames?

See original GitHub issue

wandb --version && python --version && uname I’m running Wandb locally via wandb local It is running successfully on localhost:8080

  • Weights and Biases version: wandb, version 0.9.7
  • Python version: Python 3.7.9
  • Operating System: Windows 10

Description

Describe what you were trying to get done. Just simple config logging of hyperparameters.

I set wandb.config.verbosity = 3 and wandb.config.hyperparameters = {'NN': {'num_epochs': 5}} to record the verbosity and hyperparameters of a training model with the AutoGluon framework.

Tell us what happened, what went wrong, and what you expected to happen.

wandb.config.tags = [col for col in columns_to_keep]  # use the feature column names as tags 
wandb.config.metric_name = 'roc_auc'
wandb.config.trial_datetime = utils.get_current_time()

print(f'wandb.config.trial_datetime is :   {wandb.config.trial_datetime}\n')

wandb.config.output_directory = str(Path(config.AUTOGLUON_MODELS_DIR, wandb.config.trial_datetime))
wandb.config.eval_metric = wandb.config.metric_name
wandb.config.auto_stack = True
wandb.config.num_trials = 5
wandb.config.time_limits = config.MAX_RUNTIME_SECS  #1*60 #
wandb.config.num_bagging_folds = config.FOLDS # 5
wandb.config.stack_ensemble_levels = 3
wandb.config.visualizer = 'tensorboard'
wandb.config.verbosity = 3
wandb.config.hyperparameter_config_option = 'default'
wandb.config.hyperparameter_config_dict = get_hyperparameter_config(wandb.config.hyperparameter_config_option)

if train_with_neural_network == True:
    wandb.config.hyperparameters = {
                                        'NN': {'num_epochs':5}
                                        # 'GBM': {'num_boost_round':100}
                                    }

After setting the wandb config values, I simply print them:

print(wandb.config.hyperparameters) print(wandb.config.verbosity)

Expected behavior is that the simple integer value of 3 and the dictionary {'NN': {'num_epochs': 5}} would be interpreted correctly as an integer and dictionary, respectively, and not as a DataFrame.

Actual behavior: prints value, then throws an error. Curiously, I was logging a bunch of values in wandb.config and had no issue until this one.

Also curiously, it does indeed print the config value, but then immediately prints the AssertionError.

AssertionError: We don’t yet support DataFrames in History. Use wandb.Table(dataframe=my_dataframe)

What I Did

wandb.config.hyperparameters = {'NN': {'num_epochs': 5}}
wandb.config.verbosity = 3

print(wandb.config.hyperparameters)
{'NN': {'num_epochs': 5}}

Error in callback <function _init_jupyter.<locals>.cleanup at 0x00000158AAC33558> (for post_run_cell):
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
C:\ProgramData\Anaconda3\envs\arn\lib\site-packages\backcall\backcall.py in adapted(*args, **kwargs)
    102                 kwargs.pop(name)
    103 #            print(args, kwargs, unmatched_pos, cut_positional, unmatched_kw)
--> 104             return callback(*args, **kwargs)
    105 
    106         return adapted

C:\ProgramData\Anaconda3\envs\arn\lib\site-packages\wandb\__init__.py in cleanup()
    528         # shutdown async logger because _user_process_finished isn't called in jupyter
    529         shutdown_async_log_thread()
--> 530         run._stop_jupyter_agent()
    531     if hasattr(ipython.events, "_orig_post_run"):
    532         ipython.events.unregister("post_run_cell", ipython.events._orig_post_run)

C:\ProgramData\Anaconda3\envs\arn\lib\site-packages\wandb\wandb_run.py in _stop_jupyter_agent(self)
    211 
    212     def _stop_jupyter_agent(self):
--> 213         self._jupyter_agent.stop()
    214 
    215     def send_message(self, options):

C:\ProgramData\Anaconda3\envs\arn\lib\site-packages\wandb\jupyter.py in stop(self)
    140             self.save_history()
    141             self.rm.unmirror_stdout_stderr()
--> 142             wandb.run.close_files()
    143             self.rm.shutdown()
    144             self.paused = True

C:\ProgramData\Anaconda3\envs\arn\lib\site-packages\wandb\wandb_run.py in close_files(self)
    910             self._events = None
    911         if self._history is not None:
--> 912             self._history.close()
    913             self._history = None
    914 

C:\ProgramData\Anaconda3\envs\arn\lib\site-packages\wandb\history.py in close(self)
    260 
    261     def close(self):
--> 262         self._write()
    263         self._lock.acquire()
    264         try:

C:\ProgramData\Anaconda3\envs\arn\lib\site-packages\wandb\history.py in _write(self)
    244                 if self.stream_name != "default":
    245                     self.row["_stream"] = self.stream_name
--> 246                 self._transform()
    247                 self._file.write(util.json_dumps_safer_history(self.row))
    248                 self._file.write('\n')

C:\ProgramData\Anaconda3\envs\arn\lib\site-packages\wandb\history.py in _transform(self)
    225     def _transform(self):
    226         """Transforms special classes into the proper format before writing"""
--> 227         self.row = data_types.history_dict_to_json(self._run, self.row)
    228 
    229     def _write(self):

C:\ProgramData\Anaconda3\envs\arn\lib\site-packages\wandb\data_types.py in history_dict_to_json(run, payload, step)
   1707             payload[key] = history_dict_to_json(run, val, step=step)
   1708         else:
-> 1709             payload[key] = val_to_json(run, key, val, step=step)
   1710 
   1711     return payload

C:\ProgramData\Anaconda3\envs\arn\lib\site-packages\wandb\data_types.py in val_to_json(run, key, val, step)
   1735 
   1736     if util.is_pandas_data_frame(val):
-> 1737         assert step == 'summary', "We don't yet support DataFrames in History. Use `wandb.Table(dataframe=my_dataframe)`"
   1738         return data_frame_to_json(val, run, key, step)
   1739     elif util.is_matplotlib_typename(typename) or util.is_plotly_typename(typename):

AssertionError: We don't yet support DataFrames in History. Use `wandb.Table(dataframe=my_dataframe)`

Why does WandB misinterpret an integer as a DataFrame??

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
issue-label-bot[bot]commented, Sep 17, 2020

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.69. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

0reactions
sydhollcommented, Nov 18, 2021

In the past year we’ve majorly reworked the CLI and UI for Weights & Biases. We’re closing issues older than 6 months. Please comment to reopen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

wandb mistakes integers and dictionaries as DataFrames?
wandb --version && python --version && uname. I'm running Wandb locally via wandb local. It is running successfully on localhost:8080.
Read more >
Log Media & Objects - Documentation - Weights & Biases
To log an overlay, you'll need to provide a dictionary with the following keys and values to the masks keyword argument of wandb.Image...
Read more >
wandb.data_types.Table - Documentation - Weights & Biases
(pandas.DataFrame) DataFrame object used to create the table. When set, data and columns arguments are ignored.
Read more >
An Introduction to Datasets and DataLoader in PyTorch - Wandb
A tutorial covering how to write Datasets and DataLoader in PyTorch, complete with code and interactive visualizations. .
Read more >
Log Data with wandb.log - Documentation - Weights & Biases
Call wandb.log(dict) to log a dictionary of metrics, media, or custom objects to a step. Each time you log, we increment the step...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found