[CODE SOLUTIONS REMOVED FROM MODERATOR]
After running this code getting following error:
TypeError: init() got an unexpected keyword argument ‘instance_name’
Kindly help to resolve this issue if possible.
[CODE SOLUTIONS REMOVED FROM MODERATOR]
After running this code getting following error:
TypeError: init() got an unexpected keyword argument ‘instance_name’
Kindly help to resolve this issue if possible.
What this error is saying is that instance_name=‘import_user_schema’, is part of the function parameters in your solution! Try removing it.
TypeError Traceback (most recent call last)
in
4 from tfx.types import standard_artifacts
5 # Use an ImporterNode to put the curated schema to ML Metadata
----> 6 user_schema_importer = ImporterNode(
7 instance_name=‘import_user_schema’,
8 source_uri=UPDATED_SCHEMA_DIR,
/opt/conda/lib/python3.8/site-packages/tfx/utils/deprecation_utils.py in init(self, *args, **kwargs)
145 f’From {call_loc}: The name {deprecated_name} is deprecated. ’
146 f’Please use {name} instead.')
→ 147 super().init(*args, **kwargs)
148
149 return _NewDeprecatedClass
TypeError: init() got an unexpected keyword argument ‘instance_name’
There does not seem to be any syntax errors, however, it might be a depreciated version of TFX. Maybe the ImporterNode arguments have changed and it does not accept ‘instance_name’ anymore.
You could also try running it without the keyword, so
user_schema_importer = ImporterNode(‘import_user_schema’,
source_uri=UPDATED_SCHEMA_DIR,
…)
Hope this helped!
import sys, importlib
sys.path.append(‘src/’)
prepare_data.py
moduleimport prepare_data
if ‘prepare_data’ in sys.modules:
importlib.reload(prepare_data)
input_ids = prepare_data.convert_to_bert_input_ids(“this product is great!”, max_seq_length)
updated_correctly = False
if len(input_ids) != max_seq_length:
print(‘#######################################################################################################’)
print(‘Please check that the function 'convert_to_bert_input_ids' in the file src/prepare_data.py is complete.’)
print(‘#######################################################################################################’)
raise Exception(‘Please check that the function 'convert_to_bert_input_ids' in the file src/prepare_data.py is complete.’)
else:
print(‘##################’)
print(‘Updated correctly!’)
print(‘##################’)
updated_correctly = True
Shall needs to change anything in this code?