IBM / federated-learning-lib

A library for federated learning (a distributed machine learning process) in an enterprise environment.
Other
499 stars 135 forks source link

'No module named 'ibmfl.util.data_handlers.iot_data_handler' #80

Open seyirex opened 3 years ago

seyirex commented 3 years ago

Hello, i have been trying to load a custom IOT dataset into the IBMFL lib but got this error "No module named ibmfl.util.data_handlers.iot_data_handler" i want to use decision tree as a model but having difficulty bring everything to work, i dont really understand the data handler works, i thing making a tutoral how the data handler works on a custom dataset, this would help new people to understand this lib better. welldone guys am cherring for you guys.

`2021-09-06 13:00:21,501 | 1.0.5 | INFO | ibmfl.util.config | Getting Aggregator details from arguments. 2021-09-06 13:00:21,505 | 1.0.5 | ERROR | ibmfl.util.config | No module named 'ibmfl.util.data_handlers.iot_data_handler' Traceback (most recent call last): File "C:\Users\XXXXX\Anaconda3\envs\ibmfl2\lib\site-packages\ibmfl\util\config.py", line 459, in get_class_by_name cls_ref = get_attr_from_path(path, name_class) File "C:\Users\XXXXX\Anaconda3\envs\ibmfl2\lib\site-packages\ibmfl\util\config.py", line 491, in get_attr_from_path module = importlib.import_module(path) File "C:\Users\XXXXX\Anaconda3\envs\ibmfl2\lib\importlib__init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 953, in _find_and_load_unlocked ModuleNotFoundError: No module named 'ibmfl.util.data_handlers.iot_data_handler' 2021-09-06 13:00:21,508 | 1.0.5 | ERROR | ibmfl.util.config | Error occurred while loading class iotDataHandlerfrom path ibmfl.util.data_handlers.iot_data_handler Traceback (most recent call last): File "C:\Users\XXXXX\Anaconda3\envs\ibmfl2\lib\site-packages\ibmfl\util\config.py", line 459, in get_class_by_name cls_ref = get_attr_from_path(path, name_class) File "C:\Users\XXXXX\Anaconda3\envs\ibmfl2\lib\site-packages\ibmfl\util\config.py", line 491, in get_attr_from_path module = importlib.import_module(path) File "C:\Users\XXXXX\Anaconda3\envs\ibmfl2\lib\importlib\init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 953, in _find_and_load_unlocked ModuleNotFoundError: No module named 'ibmfl.util.data_handlers.iot_data_handler'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\XXXXX\Anaconda3\envs\ibmfl2\lib\site-packages\ibmfl\util\config.py", line 239, in get_data_from_config config['path'], config['name']) File "C:\Users\XXXXXX\Anaconda3\envs\ibmfl2\lib\site-packages\ibmfl\util\config.py", line 463, in get_class_by_name 'Error occurred while loading class '+name_class+'from path ' + path) ibmfl.exceptions.InvalidConfigurationException: Error occurred while loading class iotDataHandlerfrom path ibmfl.util.data_handlers.iot_data_handler

ModuleNotFoundError Traceback (most recent call last) ~\Anaconda3\envs\ibmfl2\lib\site-packages\ibmfl\util\config.py in get_class_by_name(path, name_class) 458 --> 459 cls_ref = get_attr_from_path(path, name_class) 460 except Exception as ex:

~\Anaconda3\envs\ibmfl2\lib\site-packages\ibmfl\util\config.py in get_attr_from_path(path, attr) 490 else: --> 491 module = importlib.import_module(path) 492

~\Anaconda3\envs\ibmfl2\lib\importlib__init__.py in import_module(name, package) 125 level += 1 --> 126 return _bootstrap._gcd_import(name[level:], package, level) 127

~\Anaconda3\envs\ibmfl2\lib\importlib_bootstrap.py in _gcd_import(name, package, level)

~\Anaconda3\envs\ibmfl2\lib\importlib_bootstrap.py in _find_andload(name, import)

~\Anaconda3\envs\ibmfl2\lib\importlib_bootstrap.py in _find_and_loadunlocked(name, import)

ModuleNotFoundError: No module named 'ibmfl.util.data_handlers.iot_data_handler'

During handling of the above exception, another exception occurred:

InvalidConfigurationException Traceback (most recent call last) ~\Anaconda3\envs\ibmfl2\lib\site-packages\ibmfl\util\config.py in get_data_from_config(config) 238 data_config['cls_ref'] = get_class_by_name( --> 239 config['path'], config['name']) 240 data_config['info'] = config['info']

~\Anaconda3\envs\ibmfl2\lib\site-packages\ibmfl\util\config.py in get_class_by_name(path, name_class) 462 raise InvalidConfigurationException( --> 463 'Error occurred while loading class '+name_class+'from path ' + path) 464 return cls_ref

InvalidConfigurationException: Error occurred while loading class iotDataHandlerfrom path ibmfl.util.data_handlers.iot_data_handler

During handling of the above exception, another exception occurred:

InvalidConfigurationException Traceback (most recent call last)

in 1 from ibmfl.aggregator.aggregator import Aggregator ----> 2 aggregator = Aggregator(config_dict=agg_config) 3 4 aggregator.start() ~\Anaconda3\envs\ibmfl2\lib\site-packages\ibmfl\aggregator\aggregator.py in __init__(self, **kwargs) 44 configure_logging_from_file() 45 ---> 46 cls_config = get_aggregator_config(**kwargs) 47 48 self.data_handler = None ~\Anaconda3\envs\ibmfl2\lib\site-packages\ibmfl\util\config.py in get_aggregator_config(**kwargs) 82 return get_config_from_file(config_file=config_file) 83 else: ---> 84 return get_config_from_args(**kwargs) 85 86 ~\Anaconda3\envs\ibmfl2\lib\site-packages\ibmfl\util\config.py in get_config_from_args(config_dict, **kwargs) 156 cls_config = {} 157 if config_dict: --> 158 cls_config = get_cls_by_config(config_dict) 159 else: 160 cls_config = get_cls_by_config(kwargs) ~\Anaconda3\envs\ibmfl2\lib\site-packages\ibmfl\util\config.py in get_cls_by_config(config_dict) 177 # TODO: since all the configuration blocks carry same signature this 178 # should be done in iterative way for all keys in the dictionary --> 179 cls_config['data'] = get_data_from_config(config_dict.get('data')) 180 cls_config['metrics_recorder'] = get_mrec_from_config(config_dict.get('metrics_recorder')) 181 cls_config['model'] = get_model_from_config(config_dict.get('model')) ~\Anaconda3\envs\ibmfl2\lib\site-packages\ibmfl\util\config.py in get_data_from_config(config) 242 logger.exception(ex) 243 raise InvalidConfigurationException( --> 244 'Error occurred while loading data config.') 245 246 else: InvalidConfigurationException: Error occurred while loading data config. `
Yi-Zoey commented 3 years ago

Hi @seyirex , thanks for trying out IBM FL! In case you haven't checked out our tutorials on data handler, I put some related links as follows:

  1. Data handler tutorial
  2. Video tutorial

From the above log info, it seems like IBM FL can't find this iot_data_handler. Make sure you provide the right path to the file where you define this custom data handler class.