Skip to content

🤗 Named Entity Extraction service capable of running on Hugging Face and MLflow managed environment

License

Notifications You must be signed in to change notification settings

QubitPi/lamassu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

title emoji colorFrom colorTo sdk sdk_version app_file pinned license
Lamassu
🤗
gray
red
gradio
5.1.0
app.py
false
apache-2.0

Hugging Face space badge Hugging Face sync status badge MLflow badge MLflow build status badge Apache License Badge

Lamassu is a Named Entity Extraction service that is capable of running on Hugging Face and MLflow managed environment. It is the service backing the Nexus Graph

Hugging Face

Lamassu is directly available on Hugging Face space. Please check it out.

MLflow

Python Version Badge

Getting Source Code

git clone [email protected]:QubitPi/lamassu.git

Running Locally

Create virtual environment and install dependencies:

cd lamassu/mlflow
python3 -m venv .venv
. .venv/bin/activate
pip3 install -r requirements.txt

Generate Model with

python3 HanLPner.py

A model directory called "HanLPner" appears under mlflow/models. Then build Docker image

mlflow models build-docker --name "entity-extraction"

and run container with

cp parser.py models/HanLPner/
export ML_MODEL_PATH=/absolute/path/to/models/HanLPner

docker run --rm \
  --memory=4000m \
  -p 8080:8080 \
  -v $ML_MODEL_PATH:/opt/ml/model \
  -e PYTHONPATH="/opt/ml/model:$PYTHONPATH" \
  -e GUNICORN_CMD_ARGS="--timeout 60 -k gevent" \
  "entity-extraction"

Tip

If docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory')) error is seen, refer to https://forums.docker.com/t/docker-errors-dockerexception-error-while-fetching-server-api-version-connection-aborted-filenotfounderror-2-no-such-file-or-directory-error-in-python/135637/5

The container runs Gunicorn server inside to serve incoming requests.

Example query:

curl -X POST -H "Content-Type:application/json" \
  --data '{"dataframe_split": {"columns":["text"], "data":[["我爱中国"], ["世界会变、科技会变,但「派昂」不会变,它不会向任何人低头,不会向任何困难低头,甚至不会向「时代」低头。「派昂」,永远引领对科技的热爱。只有那些不向梦想道路上的阻挠认输的人,才配得上与我们一起追逐梦想"]]}}' \
  http://127.0.0.1:8080/invocations

Note the JSON schema of the --data value

License

The use and distribution terms for lamassu are covered by the Apache License, Version 2.0.

About

🤗 Named Entity Extraction service capable of running on Hugging Face and MLflow managed environment

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published