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

Upstream/1 add unit tests and regression test #171

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
aa05578
Create Python package & bump to Python 3.8
Sep 14, 2022
03ab20e
Address pr comments
Sep 14, 2022
ad1d4c0
Address pr comments
Sep 14, 2022
47b9779
Merge pull request #2 from EducationalTestingService/create_python_pa…
damien2012eng Sep 14, 2022
4a2ec3d
add unit tests for tokenization file
Sep 7, 2022
87a4997
Address pr comments
Sep 14, 2022
67d2256
add unit tests for token_indexer
Sep 14, 2022
6e57109
Address pr comments
Sep 15, 2022
f311813
Address pr comments
Sep 15, 2022
5c0cf10
Merge pull request #1 from EducationalTestingService/features/add_uni…
damien2012eng Sep 16, 2022
b00e946
Add unit tests for pretrained BERT embedder
Frost45 Sep 9, 2022
05407f3
Add unit tests for pretrained RoBERTa embedder
Frost45 Sep 14, 2022
b649aeb
Add unit tests for seq2labels model
Frost45 Sep 20, 2022
6801c42
Update tokenization tests to use AllenNLP test modules
Frost45 Sep 23, 2022
2964b05
Address PR comments
Frost45 Sep 26, 2022
a3c74c2
Add CI plan
Frost45 Sep 26, 2022
dbc39e2
Addressed PR comments
Frost45 Sep 27, 2022
ca950c3
Unit test for GecModel Prediction.
Sep 27, 2022
e3ea139
Removing duplicate import.
Sep 27, 2022
8291809
Adding readme file so that fixtures dir exists for downloading gector
ksteimel Sep 27, 2022
40619fe
Merge pull request #5 from EducationalTestingService/feature/add_inte…
ksteimel Sep 28, 2022
c535c53
Add how to run unit tests on README
Sep 29, 2022
86a7aff
Add regression data for raw and predictions
Sep 29, 2022
469d162
Merge pull request #7 from EducationalTestingService/features/add_reg…
damien2012eng Oct 3, 2022
bf4e209
Add regression test file
Frost45 Oct 6, 2022
2b4513e
Update CI plan to run regression tests
Frost45 Oct 6, 2022
68d900e
Addressed PR comments
Frost45 Oct 10, 2022
1b60b1b
Addressed PR comments
Frost45 Oct 12, 2022
f1db9a9
Addressed PR comments
Frost45 Oct 12, 2022
323d61a
Add environment.yml
damien2012eng Oct 17, 2022
21d496c
versioning starting with 1.0.0
damien2012eng Oct 17, 2022
5da5955
Address PR comments
damien2012eng Oct 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python test

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
- name: Unit Testing
run: |
pytest -v tests
- name: Regression Testing
run: |
python regression_tests/test_gector_roberta.py
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ This repository provides code for training and testing state-of-the-art models f
It is mainly based on `AllenNLP` and `transformers`.
## Installation
The following command installs all necessary packages:
```.bash
pip install -r requirements.txt
```bash
conda create --name <Environment_name> python=3.8
conda activate <Environment_name>
pip install -e .
```
The project was tested using Python 3.7.
The project was tested using Python 3.8.

## Unit tests
After activating the conda environment, simply run the code below:
`pytest -v tests`

## Datasets
All the public GEC datasets used in the paper can be downloaded from [here](https://www.cl.cam.ac.uk/research/nl/bea2019st/#data).<br>
Expand Down
Empty file added data/__init__.py
Empty file.
13 changes: 13 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: gector
dependencies:
- python=3.8
- pytorch=1.10.0
- python-Levenshtein
- transformers
- scikit-learn
- sentencepiece
- overrides=4.1.2
- numpy
- pip:
- allennlp==0.9.0

Empty file added gector/__init__.py
Empty file.
10 changes: 10 additions & 0 deletions regression_tests/original/FCE_10.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Dear Sir or Madam ,
I am writing in order to express my disappointment about your musical show " Over the Rainbow " .
I saws the show 's advertisement hanging up of a wall in London where I was spending my holiday with some friends . I convinced them to go there with me because I had heard good references about your Company and , above all , about the main star , Danny Brook .
The problems started in the box office , where we asked for the discounts you announced in the advertisement , and the man who was selling the tickets said that they did n't exist .
Moreover , the show was delayed forty - five minutes and the worst of all was that Danny Brook had been replaced by another actor .
On the other hand , the theatre restaurant was closed because unknown reasons .
You promised a perfect evening but it became a big disastrous !
I would like some kind of explanation and receive my money back .
If you do n't agree , I will act consequently .
I look forward to hearing from you .
127 changes: 127 additions & 0 deletions regression_tests/original/FCE_127.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
Yours faithfully ,
Unfortunately , Pat was n't very good at keeping secrets .
Last Wednesday Carole received a letter .
The stamp was from a foreign country and the address was written in Capital Letters .
She did n't recognize the writing .
She began to read " Dear Carolin ..
There was only a person who used to call her by this name .
It brought a lot of memories back to her .
It was long time ago , when she was fourteen and Paul sixteen .
He was her first love and also the first who kissed her .
Paul had to move to Mexico because of his father 's work .
When they were saying goodbye Paul " I will be the last person who will kiss you " . " It sounds nice but I do n't believe it " she replied .
" You only have to wait " he said .
But she did n't wait .
She got married and had two children .
At this moment Carole was living with her husband but they did n't love each other any more .
Their love had finished .
In his letter Paul said that he had become a rich man and he would come back to meet her again .
Her friend Pat had explained the whole story at her husband .
What she would do ?
10 June 2000
Dear Manager ,
I would like to complain about your theatre and the musical show that I saw last week .
I went to London for a holiday last week and read the advertisement about ' Over the rainbow ' in the hotel which I stayed .
I saw Danny Brook and Tina Truelove were written on the advertisement paper and was very excited .
However , Danny Brook did not appear on the stage until the end of musical showing time .
I was really disappointed about it .
Secondly , starting time was 19:30 but it started 20:15 so I was waited for 45 minutes .
It was so long time to wait in the theatre .
Thirdly , it mentioned about discounts .
Despite of the fact that I am a student , I could not get any discounts .
I also visited your restaurant after the show but already closed because the show finished late .
Because of the reason above , I , indeed , spent awful last night in London .
I would like you to refund , otherwise , I will take an action .
I look forward to receiving reply to my enquiry .
Sincerely
Fashion of the future
People will wear this kind of clothes 100 years later from now .
If weather is hot then we do n't have to wear under wear because very thin and light clothes will support our bodies .
There will be two functions for summer clothes that we do n't need to wear clothes like layer and layer .
For example , T - shirts for women are included bra : easy to take it out when you wash it , is very simple and comfortable .
What about short pants ?
You do n't have to wear knickers .
We can just put some thin pads in there .
We ca n't feel it and easy to remove and just can wash it .
Simplest is the best in summer !
When it 's very cold winter , we just wear light clothes what we want , in our style .
Because special warm and healthy material will be developed and use them inside thin clothes so we do n't need to put heavy clothes on our bodies .
We can show our body line in winter as well .
Most important thing is that we do n't have to kill the animals only for people 's cruel aims .
Functions ' clothes are the way to love animals !
DECEMBER 12TH
PRINCIPAL MR .
ROBERTSON
DEAR SIR ,
I WANT TO THAK YOU FOR PREPARING SUCH A GOOD PROGRAMME FOR US AND ESPECIALLY FOR TAKING US TO THE RIVER TRIP TO GREENWICH .
I WOULD LIKE TO KNOW IF THERE IS ANY CHANCE OF CHANGING THE PROGRAMME BECAUSE WE HAVE FOUND A VERY INTERESTING ACTIVITY TO DO ON TUESDAY 14 MARCH . IT CONSISTS ON VISITING THE LONDON FASHION AND LEISURE SHOW IN THE CENTRAL EXHIBITION HALL .
I THINK IT 'S A GREAT OPPORTUNITY TO MAKE GREATER USE OF OUR KNOWLEDGE OF ENGLISH LANGUAGE .
ON THE OTHER HAND , WE COULD LEARN THE DIFFERENT WAYS TO GET TO THE CENTRAL EXHIBITION HALL .
I SUGGEST THAT WE SHOULD GO TO THE NATIONAL ART GALLERY IN THE MORNING AND INSTEAD OF HAVING THE AFTERNOON FREE WE COULD GO TO THE FASHION AND LEISURE SHOW .
I WILL BE WRITING ANXIOUSLY FOR YOUR RESPONSE .
YOURS FAITHFULLY
( FAMOUS PEOPLE , SUCH AS POLITICIANS AND FILM STARS , DESERVE TO HAVE A PRIVATE LIFE WITHOUT JOURNALISTS FOLLOWING THEM ALL THE TIME )
FAMOUS PEOPLE SUCH AS SINGERS , FILM STARS , ETC ARE ALWAYS THE CENTRE OF ATTENTION .
AS SOME OF THEM ARE CONSIDERED IDOLS , THEIR FANS WANT TO KNOW HOW THEY ACT IN THEIR PRIVATE LIVES , WITH THEIR FAMILY OR FRIENDS .
AS A RESPONSE TO THIS DEMAND OF INFORMATION , JOURNALISTS FOLLOW FAMOUS PEOPLE DAY AND NIGHT IN MANY DIFFERENT WAYS , FOR EXAMPLE , CHASING THEIR CARS , TAKING PHOTOGRAPHS OR BREAKING INTO THEIR HOUSES WHILE THEY ARE ON HOLIDAYS .
THIS SITUATION AFFECTS FAMOUS PERSONAL LIVES BECAUSE THEY ARE NOT ALLOWED TO HAVE PRIVACY
THE MOST IMPORTANT THING IS THAT , ALTHOUGH THEY ARE FAMOUS , THEY ARE JUST NORMAL PEOPLE THAT DESERVE TO HAVE A PRIVATE LIFE WITHOUT JOURNALISTS AND FANS FOLLOWING THEM ALL THE TIME , AND ON THE OTHER HAND PEOPLE HAVE TO LEARN TO RESPECT THE FAMOUS RIGHT TO KEEP THEIR PERSONAL LIVES IN SECRET .
IN MY OPINION FAMOUS PEOPLE ARE BEING OBLIGED TO PAY A PRICE FOR BEING FAMOUS THAT IN SOME CASS , COSTS MORE THAN THEY DESERVE TO PAY .
To Mr. Robertson
I am writing to tell you something about the three - day trip to London .
I have seen your programme for the trip and I think it is going to be a great trip .
Thank you very much for organising this trip and putting all your spare time and effort into it .
Personally , I enjoy looking and learning about new inventions and all the science .
That is why I think the trip to the science museum is a good idea .
However , my class and I have seen an advertisement about a fashion and leisure show . We are attracted to this show and would like to go .
Unfortunately , it is on 14th March , which is the day we will be visiting the science museum .
This show is on the 14th March .
It is in the Central Exhibition Hall and will start and ten o'clock and finish at five o'clock in the evening .
Apparently , this show is free to all students , which means if we went , the cost of the trip will be cut down .
I think it is a great opportunity because it is based on fashion .
We like to keep up with the rage but I think it will help those who want to become a fashion designer later on .
I have a suggestion on how the programme could be changed .
The shopping time could be after the show and the free time exchanged for the science museum .
If we go to the show , we can do without the free time .
Please give this your careful consideration ..
Yours sincerely ,
In a country like the UK , we are all bound to have houses .
We either own it , or we simply borrow it from other people . We take our homes for granted .
Think about the people in the poor countries !
They struggle to survive .
However , as we approach the future , our homes will start to change .
Have you ever thought about how the changes will affect our lives ?
I doubt it .
There will be lots of differences in our homes of the future from our homes now , but there may also be a lot of similarities .
For one , the future homes might not be built out of bricks at all !
It may be built out of a stronger substance or a more attractive one , such as glass .
Non - breakable glass .
Also , due to global warming , sea levels might rise and risk of flooding will also rise .
Therefore , houses will be built on high supports .
All domestic appliances such as showers , kettles , lights , TV and curtains may be voice activated .
Incredibly high security will prevent robbery .
The future homes will also have many similarities , such as having a separate bathroom , and not having one in a bedroom , or having two floors or having garages .
It has been a pleasure sharing my thoughts with you .
What do you think will happen in the future ?
Dear Mrs. Jane Clark ,
Recently I was at the annual international arts festival , that you organized .
I 'm writing this letter to thank you for giving a possibility to know more about modern art .
I think , it is a wonderful idea to organize such festivals each year , because it is very interesting to learn some news about life in other countries .
Unfortunately , only six countries were represented this year at the festival , but I hope that soon there would be much more of them .
I extremely liked all concerts , shows , exhibitions , but why there were n't any photograph exhibitions ?
I think , you should make some next year .
Then , I want to mark , that concert halls were too small , that is why they were overcrowded during some concerts .
Then , I want to say , that plays and films were exellent , but it was n't enough of them for me .
May be you should make more next year ?
And at the end , my opinion is that one weekend ticket for all events is a great idea , because you do n't have to stay in queues to buy a ticket for a show , you want to go to .
Yours sincerely ,
Dear Lucia ,
I was very pleased to receive your letter .
You asked , if there are some school rules in my country .
As you know , I 'm studying at the private Academy , so the rules in my institute are different from the rules in state institutes . I 'll give you an example .
In our Acadamy we are not allowed to smoke .
The fine for smoking on the Academy is territory is 100 dollars .
So nobody smokes there .
I do n't smoke , so I do n't care about this rule .
But some of my friends really would like to change it .
You also wanted to know about what I 'm allowed or not allowed to do at home .
Loading