Closed nathanfletcher closed 2 years ago
Hey @nathanfletcher ! I'd like to take this on. Will be able to get started on it tomorrow morning (GMT +2).
Thanks @sabinevidal, this issue has been assigned to you
Hi @sabinevidal
Would you like some assistance on this task? I would like to collaborate with you on this.
Hi @Ashara-kosi That sounds amazing! βΊοΈ I've already started setting the tests up, but I'm about to log off for the night. I will publish what I've done first thing tomorrow morning so then you can jump into the new branch and we can collaborate! What time zone are you in? I'm GMT + 2 (South Africa).
Alright, that is cool! @sabinevidal I'm GMT +1(Nigeria)
Hey @Ashara-kosi I've just published my branch! https://github.com/sabinevidal/kindly/tree/api-unit-tests
You will need to run pip install pytest
in your env
, then in the main folder you can just run pytest
and it will work.
Ran across a problem, so hopefully you'll be able to help! When I run the tests as is they fail because they can't find the right model folder at this point in api.py
(around line 108)
def process(inputText):
...
model = AutoModelForSequenceClassification.from_pretrained("./model")
It's looking for the 'https://huggingface.co/models' url which isn't correct, it should be 'https://huggingface.co/cardiffnlp/twitter-roberta-base-offensive'. I managed to create a work around to at least get the tests working by replacing ./model
with the correct endpoint... but obviously it shouldn't be like this π
Any ideas?
Also any other tests you can think of? π€
Hi @sabinevidal
I am unable to access your branch in your repo. Please send in a draft pr so I can access it on the main kindly repository
Thanks.
Hello @sabinevidal
I have been able to resolve the error..apparently, the model was not referenced correctly.
The tests now pass!!!
Hey @Ashara-kosi That's great! π How did you change the reference?
@lacabra @nathanfletcher should we create unittests for the other endpoints at this point?
And what's best practice for the amount of examples to pass to the test? I've done manual for now testing one for offensive and one for not-offensive.
@sabinevidal: Yes, it would be great to have tests for all available endpoints.
I would say that a best practice is to have one test that catches the expected behavior, and other tests that catch the various possible errors.
@lacabra Ok, thought so - I'll finish creating the rest! Thanks!
There should be at least a unit test especially for the API endpoints -
/detect
Anyone can feel free to pick this up.