Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add f_net_classifier and f_net_classifier_test #670

Merged
merged 39 commits into from
Jan 25, 2023

Conversation

ADITYADAS1999
Copy link
Contributor

Add FNetClassifier #650

Here I add two script at f_net folder.

But we need to improve the f_net_classifier file, because if this model similar to BertClassifier, then the f_net_presets.py file is require that is not present at f_net folder.

@abheesht17 @mattdangerw

@mattdangerw mattdangerw self-requested a review January 18, 2023 02:58
@mattdangerw
Copy link
Member

@ADITYADAS1999 looks like there are some testing failures, could you take a look at those first? You'll probably want an environment in which you can reproduce the failure locally, as described in our contributing guide.

@ADITYADAS1999
Copy link
Contributor Author

@ADITYADAS1999 looks like there are some testing failures, could you take a look at those first? You'll probably want an environment in which you can reproduce the failure locally, as described in our contributing guide.

okk I test the file locally

@ADITYADAS1999
Copy link
Contributor Author

@ADITYADAS1999 looks like there are some testing failures, could you take a look at those first? You'll probably want an environment in which you can reproduce the failure locally, as described in our contributing guide.

okk I test the file locally

testone

when I use this commands for windows it show this errors in my pycharm editor

isort --sp "setup.cfg" --sl
black --line-length 80
flake8 --config "setup.cfg" --max-line-length=200

python version 3.7
OS : windows10

@abheesht17
Copy link
Collaborator

@ADITYADAS1999, pass the complete path from the root of the repository.

Instead of f_net_classifier.py, pass this: keras_nlp/models/f_net/f_net_classifier.py.

So, your commands will be:

isort --sp "setup.cfg" --sl keras_nlp/models/f_net/f_net_classifier.py
black --line-length 80 keras_nlp/models/f_net/f_net_classifier.py
flake8 --config "setup.cfg" --max-line-length=200 keras_nlp/models/f_net/f_net_classifier.py

isort --sp "setup.cfg" --sl keras_nlp/models/f_net/f_net_classifier_test.py
black --line-length 80 keras_nlp/models/f_net/f_net_classifier_test.py
flake8 --config "setup.cfg" --max-line-length=200 keras_nlp/models/f_net/f_net_classifier_test.py

Hope this solves the issue! :)

@ADITYADAS1999
Copy link
Contributor Author

ADITYADAS1999 commented Jan 19, 2023

@ADITYADAS1999, pass the complete path from the root of the repository.

Instead of f_net_classifier.py, pass this: keras_nlp/models/f_net/f_net_classifier.py.

So, your commands will be:

isort --sp "setup.cfg" --sl keras_nlp/models/f_net/f_net_classifier.py
black --line-length 80 keras_nlp/models/f_net/f_net_classifier.py
flake8 --config "setup.cfg" --max-line-length=200 keras_nlp/models/f_net/f_net_classifier.py

isort --sp "setup.cfg" --sl keras_nlp/models/f_net/f_net_classifier_test.py
black --line-length 80 keras_nlp/models/f_net/f_net_classifier_test.py
flake8 --config "setup.cfg" --max-line-length=200 keras_nlp/models/f_net/f_net_classifier_test.py

Hope this solves the issue! :)

thanks abheesht17, I will try this commands

@abheesht17
Copy link
Collaborator

@ADITYADAS1999 - it is recommended that if you are using Windows, use WSL. Makes life very easy! You can follow this guide: https://learn.microsoft.com/en-us/windows/wsl/install.

@ADITYADAS1999
Copy link
Contributor Author

ADITYADAS1999 commented Jan 19, 2023

@ADITYADAS1999 - it is recommended that if you are using Windows, use WSL. Makes life very easy! You can follow this guide: https://learn.microsoft.com/en-us/windows/wsl/install.

installed successfully
linux

can you conform that test commands for linux are correct or not

shell/format.sh
shell/lint.sh

core

@abheesht17
Copy link
Collaborator

@ADITYADAS1999, yep! The commands are correct. Do you have the correct black and flake version though? Please follow the pip install commands given here: https://github.com/keras-team/keras-nlp/blob/master/CONTRIBUTING.md#formatting-code.

@ADITYADAS1999
Copy link
Contributor Author

ADITYADAS1999 commented Jan 20, 2023

@ADITYADAS1999, yep! The commands are correct. Do you have the correct black and flake version though? Please follow the pip install commands given here: https://github.com/keras-team/keras-nlp/blob/master/CONTRIBUTING.md#formatting-code.

yes I install both

6666

@ADITYADAS1999
Copy link
Contributor Author

hey @mattdangerw can you review this one, If necessary changes are require , All tests are now passed.

Copy link
Member

@mattdangerw mattdangerw left a comment

Choose a reason for hiding this comment

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

Thank you! And nice work on this!

Overall it is looking good, only major comment is we need to add some more "presets" testing. Commented below. Thanks!


@keras.utils.register_keras_serializable(package="keras_nlp")
class FNetClassifier(Task):

Copy link
Member

Choose a reason for hiding this comment

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

no newline before docstring

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for FNET classification model."""
Copy link
Member

Choose a reason for hiding this comment

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

FNET -> FNet (even the paper authors do not style this all caps)

from keras_nlp.models.f_net.f_net_tokenizer import FNetTokenizer


class FNetClassifierTest(tf.test.TestCase, parameterized.TestCase):
Copy link
Member

Choose a reason for hiding this comment

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

You will also need to add some preset tests in f_net_presets_tests.py, you can take a look at #668, which is doing a similar thing for AlBERT.

@ADITYADAS1999
Copy link
Contributor Author

Thank you! And nice work on this!

Overall it is looking good, only major comment is we need to add some more "presets" testing. Commented below. Thanks!

Thats awesome, made the changes soon

@ADITYADAS1999
Copy link
Contributor Author

Thank you! And nice work on this!

Overall it is looking good, only major comment is we need to add some more "presets" testing. Commented below. Thanks!

hey @mattdangerw I made necessary changes

Copy link
Member

@mattdangerw mattdangerw left a comment

Choose a reason for hiding this comment

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

@ADITYADAS1999 LGTM.

There are a few test failures currently for the preset tests. Running these are a bit funky... you can specify --run_extra_large flag when running these test, but it will download a lot of data so will be slow (hence the flag)! It helps to only run these tests for a single application at a time.

E.g. you could catch the current error by running

pytest keras_nlp/models/f_net --run_extra_large

But anyway, the issues here our minor, I can just fix these up as I land. Thanks for the contribution!

@mattdangerw mattdangerw merged commit 73475c6 into keras-team:master Jan 25, 2023
@ADITYADAS1999
Copy link
Contributor Author

@ADITYADAS1999 LGTM.

There are a few test failures currently for the preset tests. Running these are a bit funky... you can specify --run_extra_large flag when running these test, but it will download a lot of data so will be slow (hence the flag)! It helps to only run these tests for a single application at a time.

E.g. you could catch the current error by running

pytest keras_nlp/models/f_net --run_extra_large

But anyway, the issues here our minor, I can just fix these up as I land. Thanks for the contribution!

So this command basically tests large files in locally , 👀 I use this for future contribution thanks.

Thanks 👍 @mattdangerw @abheesht17 for fixing and merging the PR 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants