Autokers textinput text classifier does not work.
ferdasonmez opened this issue · 0 comments
ferdasonmez commented
Hi,
I am trying to use Autokeras to classify varied length of text (which are lines from a code file).
I am hoping to get a model design thisway, however I am getting the below error. On purpose I did not tokenize or pad the data so that I am hoping the autokeras can provide the model which does that for me in a proper way.
Regards,
Ferda
File "C:\Programfiles\Python311\Lib\site-packages\autokeras\auto_model.py", line 344, in
x_shapes = [a.shape for a in nest.flatten(x)]
^^^^^^^
AttributeError: 'str' object has no attribute 'shape'
input_node = ak.TextInput()
output_node = ak.TextBlock(block_type="ngram")(input_node)
output_node = ak.ClassificationHead()(output_node)
clf = ak.AutoModel(
inputs=input_node, outputs=output_node, overwrite=True, max_trials=1
)
clf.fit(X_train_text, y_train[:, 0], epochs=2, validation_data=(X_val_text, y_val))
# Export as a Keras Model.
model = clf.export_model()