Skip to content

Conversation

@itrushkin
Copy link
Contributor

@itrushkin itrushkin commented Jan 12, 2023

Issue

NumPy library has int attribute deprecated since release 1.20.0 and no longer exists in the latest version.

Steps to reproduce

Follow steps in openfl-tutorials/interactive_api/PyTorch_TinyImageNet/README.md.

Error

ERROR    Collaborator env_one was failed with error code: 1, error_description: Traceback (most recent call last):             director_server.py:268
                      File "/home/itrushkin/repos/openfl/openfl/component/envoy/envoy.py", line 112, in run                                                     
                        self._run_collaborator()                                                                                                                
                      File "/home/itrushkin/repos/openfl/openfl/component/envoy/envoy.py", line 193, in _run_collaborator                                       
                        col.run()                                                                                                                               
                      File "/home/itrushkin/repos/openfl/openfl/component/collaborator/collaborator.py", line 145, in run                                       
                        self.do_task(task, round_number)                                                                                                        
                      File "/home/itrushkin/repos/openfl/openfl/component/collaborator/collaborator.py", line 255, in do_task                                   
                        global_output_tensor_dict, local_output_tensor_dict = func(                                                                             
                      File "/home/itrushkin/repos/openfl/openfl/federated/task/task_runner.py", line 109, in collaborator_adapted_task                          
                        self.rebuild_model(input_tensor_dict, validation=validation_flag, device=device)                                                        
                      File "/home/itrushkin/repos/openfl/openfl/federated/task/task_runner.py", line 230, in rebuild_model                                      
                        self.set_tensor_dict(input_tensor_dict, with_opt_vars=True, device=device)                                                              
                      File "/home/itrushkin/repos/openfl/openfl/federated/task/task_runner.py", line 382, in set_tensor_dict                                    
                        return self.framework_adapter.set_tensor_dict(*args, **kwargs)                                                                          
                      File "/home/itrushkin/repos/openfl/openfl/plugins/frameworks_adapters/pytorch_adapter.py", line 55, in                                    
                    set_tensor_dict                                                                                                                             
                        _set_optimizer_state(optimizer, device, tensor_dict)                                                                                    
                      File "/home/itrushkin/repos/openfl/openfl/plugins/frameworks_adapters/pytorch_adapter.py", line 70, in                                    
                    _set_optimizer_state                                                                                                                        
                        temp_state_dict = expand_derived_opt_state_dict(                                                                                        
                      File "/home/itrushkin/repos/openfl/openfl/plugins/frameworks_adapters/pytorch_adapter.py", line 218, in                                   
                    expand_derived_opt_state_dict                                                                                                               
                        derived_opt_state_dict.pop('__opt_group_lengths').astype(np.int)                                                                        
                      File "/home/itrushkin/.virtualenvs/openfl3.8/lib/python3.8/site-packages/numpy/__init__.py", line 284, in                                 
                    __getattr__                                                                                                                                 
                        raise AttributeError("module {!r} has no attribute "                                                                                    
                    AttributeError: module 'numpy' has no attribute 'int'

Fix

Replace all np.int casts with np.int32.

@itrushkin itrushkin marked this pull request as ready for review January 12, 2023 15:51
@itrushkin itrushkin added the bug Something isn't working label Jan 12, 2023
Copy link
Contributor

@igor-davidyuk igor-davidyuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@psfoley psfoley merged commit 335b975 into develop Jan 12, 2023
Signed-off-by: Ilya Trushkin <ilya.trushkin@intel.com>
Signed-off-by: Ilya Trushkin <ilya.trushkin@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants