Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
polinwong committed May 10, 2024
1 parent 17aafe1 commit 8ee0d4f
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 1 deletion.
29 changes: 29 additions & 0 deletions pip_safe_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#! /bin/bash
# 检查是否提供了至少一个参数
do_cmd(){
echo $@
$@
[[ $? -ne 0 ]] && echo "do_cmd failed" && exit 1
}
if [ "$#" -lt 1 ]; then
echo "Usage: $0 <requirements.txt>"
exit 1
fi

# 遍历所有提供的参数
for arg in "$@"; do
# 检查参数是否以.txt结尾
if [[ $arg == *.txt ]]; then
# 如果是,运行pip install -r

#prgs="$(cat $arg|grep -vE '^$|^#|#$'|sed 's/\([^=<>!&#126;^&#126;]*\)[=<>].*$/\1/g'| awk -F'==' '{print $1}')"
prgs="$(cat $arg|sed 's/\([^=<>!&#126;^&#126;]*\)[=<>].*$/\1/g'|grep -vE '^$|^#|#$')"
prgs="${prgs//$'\n'/ }"
prgs="${prgs//#/}"
echo "prgs=$prgs"
[[ -z "$prgs" ]] && echo "nothing to install for $arg" && continue
do_cmd pip install $prgs
else
echo "Warning: '$arg' does not end with .txt. Skipping..."
fi
done
1 change: 1 addition & 0 deletions requirements_extra.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
llama_index
2 changes: 2 additions & 0 deletions requirements_init.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
chardet
sentencepiece
3 changes: 3 additions & 0 deletions runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
. ~/jvenv311/bin/activate
python startup.py -a

2 changes: 1 addition & 1 deletion server/reranker/reranker.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from langchain_core.documents import Document
from langchain.callbacks.manager import Callbacks
from langchain.retrievers.document_compressors.base import BaseDocumentCompressor
from llama_index.bridge.pydantic import Field, PrivateAttr
from llama_index.legacy.bridge.pydantic import Field, PrivateAttr


class LangchainReranker(BaseDocumentCompressor):
Expand Down

0 comments on commit 8ee0d4f

Please sign in to comment.