Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
Aamir ali Khan 07fdde70c1 | 9 months ago | |
---|---|---|
.. | ||
alembic | 11 months ago | |
oasst_backend | 10 months ago | |
test_data | 1 year ago | |
tests | 1 year ago | |
.env.example | 11 months ago | |
.gitignore | 1 year ago | |
README.md | 11 months ago | |
alembic.ini | 1 year ago | |
export.py | 1 year ago | |
import.py | 1 year ago | |
main.py | 11 months ago | |
requirements.txt | 9 months ago | |
requirements_worker.txt | 11 months ago | |
rerank.py | 1 year ago | |
sql_snippets.md | 1 year ago | |
update_message_attributes.py | 10 months ago |
In root directory, run
docker compose --profile backend-dev up --build --attach-dependencies
to start
a database. The default settings are already configured to connect to the
database at localhost:5432
. (See
FAQ
if you face any docker problems).
Note: when running on MacOS with an M1 chip you have to use:
DB_PLATFORM=linux/x86_64 docker compose ...
Python 3.10 is required. It is recommended to use pyenv
which will recognise
the .python-version
in the project root directory.
Next, to install all requirements, You can run
pip install -r backend/requirements.txt
pip install -e ./oasst-shared/.
pip install -e ./oasst-data/.
./scripts/backend-development/run-local.sh
to run the backend. This willhttp://localhost:8080
.Generate a new environment variable file .env
by coping the content of the
.env.example file.
Update the values of the environment variables in the .env
file by setting
the DATABASE_URI to you local database URI.
Update the rest of the environment variables according to your needs.
Have a look into the main README.md
file for more information on how to set up
the backend for development. Use the scripts within the
scripts/backend-development folder to run the BE API locally.
To create an Alembic database migration script after sql-models were modified
run alembic revision --autogenerate -m "..."
("..." is what you did) in the
/backend
directory. Then edit the newly created file. See
here for more
information.
Once you have successfully started the backend server, you can access the
default api docs at localhost:8080/docs
. If you need to update the exported
openapi.json in the docs/ folder you can run below command to wget
them from
the relevant local fastapi endpoint. This will enable anyone to just see API
docs via something like
Swagger.io
without having to actually set up and run a development backend.
# save openapi.json to docs/docs/api/
wget localhost:8080/api/v1/openapi.json -O docs/docs/api/backend-openapi.json
Note: The api docs should be automatically updated by the
test-api-contract.yaml
workflow. (TODO)
Celery workers are used for Huggingface API calls like toxicity and feature
extraction. Celery Beat along with worker is used for periodic tasks like user
streak update
To run APIs locally
export DEBUG_SKIP_TOXICITY_CALCULATION=False
andexport DEBUG_SKIP_EMBEDDING_COMPUTATION=False
inscripts/backend-development/run-local.sh
tail -f celery.log
and tail -f celery.beat.log
In CI
DEBUG_SKIP_TOXICITY_CALCULATION=False
andDEBUG_SKIP_EMBEDDING_COMPUTATION=False
in docker-compose.yamlWhen you have collected some data in the backend database, you can export it
using the export.py
script provided in this directory. This can be run from
the command line using an Python environment with the same requirements as the
backend itself. The script connects to the database in the same manner as the
backend and therefore uses the same environmental variables.
A simple usage of the script, to export all English trees which successfully
passed the review process, may look like:
python export.py --lang en --export-file output.jsonl
There are many options available to filter the data which can be found in the
help message of the script: python export.py --help
.
Why isn't my export working?
Common issues include (WIP):
--include-spam
flag.No Description
Jupyter Notebook Python TSX TypeScript SVG other
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》