Open-Assistant icon indicating copy to clipboard operation
Open-Assistant copied to clipboard

Create REST API client class to call the detoxify model

Open andreaskoepf opened this issue 2 years ago • 9 comments

This is follow up on https://github.com/LAION-AI/Open-Assistant/issues/38 and https://github.com/LAION-AI/Open-Assistant/tree/main/notebooks/detoxify-evaluation.

  1. Use the hugginface hosted inference API to host and expose the multilingual variant of the 'unitaryai/detoxify' models and make it available for calls from us.
  2. Clarify with the ml-team / admins on discord how we get hf-credits for inference-calls .
  3. Write an asynchronous REST client class that will be used by the backend to make calls against the detoxify endpoint at HF.

andreaskoepf avatar Jan 03 '23 06:01 andreaskoepf

Hey! Would like to contribute to this project! @SzymonOzog do you need any help on that?

nil-andreu avatar Jan 03 '23 18:01 nil-andreu

@Nil-Andreu Hi, help is always appreciated! If I create a function for accessing huggingface API from 1. will you be able to write the rest client that handles the requests from 3?

SzymonOzog avatar Jan 03 '23 19:01 SzymonOzog

@SzymonOzog Yes can try that! Will be my first contribution, so I will need to make the setup, ... I have already looked at the codebase, and I hope that when I get in touch with the code I could further contribute more in other issues.

nil-andreu avatar Jan 03 '23 22:01 nil-andreu

@Nil-Andreu Amazing! I've made a pr with the function for getting detoxify classification (https://github.com/LAION-AI/Open-Assistant/pull/362) You can start working on it as soon as it gets accepted

SzymonOzog avatar Jan 04 '23 08:01 SzymonOzog

reagarding 2.: They have a limited free access that runs on the cpu and is rate limited:

The free Inference API may be rate limited for heavy use cases. We try to balance the loads evenly between all our available resources, and favoring steady flows of requests. If your account suddenly sends 10k requests then you’re likely to receive 503 errors saying models are loading. In order to prevent that, you should instead try to start running queries smoothly from 0 to 10k over the course of a few minutes.

Also there is an option to pay for better accelerators image

SzymonOzog avatar Jan 04 '23 08:01 SzymonOzog

Perfect thanks!

nil-andreu avatar Jan 05 '23 09:01 nil-andreu

With 3., by the "rest client class" you mean a fastapi endpoint?

nil-andreu avatar Jan 05 '23 11:01 nil-andreu

I would say yes but I don't have much knowledge about our backend structure @andreaskoepf could you confirm?

SzymonOzog avatar Jan 05 '23 11:01 SzymonOzog

Okay! I have started the following PR: here, for the creation of the api with fastapi. Could be also assigned and be collaborator of the project? Thanks!

nil-andreu avatar Jan 05 '23 14:01 nil-andreu