keras-team / keras-io

Keras documentation, hosted live at keras.io
Apache License 2.0
2.75k stars 2.03k forks source link

How to make individual predictions using the FNet example? #1833

Closed erickdp closed 4 months ago

erickdp commented 5 months ago

Issue Type

Support

Source

source

Keras Version

Keras 2.14

Custom Code

Yes

OS Platform and Distribution

Linux Ubuntu

Python version

No response

GPU model and memory

No response

Current Behavior?

Once I have used the script for the creation of an FNet network, I want to make predictions on individual entries, however, doing it this way generates an array with several values and there should only be 2. How to make individual predictions using the predict method?

reference: https://keras.io/examples/nlp/fnet_classification_with_keras_nlp/

Standalone code to reproduce the issue or tutorial link

When I use predict, I got a vector with shape (32, 3)

fnet_classifier.predict(({"input_ids": [tokenizer("Hi, I'm Erick")]}))

Relevant log output

No response

sachinprasadhs commented 5 months ago

Using the same example when I predicted I got the shape 16,1

fnet_classifier.predict(({"input_ids": [tokenizer("Hi, I'm Erick")]})).shape
16/16 ━━━━━━━━━━━━━━━━━━━━ 0s 4ms/step
(16, 1)
github-actions[bot] commented 5 months ago

This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.

github-actions[bot] commented 4 months ago

This issue was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further.

github-actions[bot] commented 4 months ago

Are you satisfied with the resolution of your issue? Yes No