Merge branch quick-start into master

This commit is contained in:
fuqingxu.fqx 2024-08-19 14:14:42 +08:00
commit e6a0872185
5 changed files with 54 additions and 11 deletions

View file

@ -1,20 +1,53 @@
# 构建 sudo docker build --network=host -t memoryscope .
# 运行 sudo docker run -it --rm --net=host memoryscope
# __ __ ____
# | \/ | ___ _ __ ___ ___ _ __ _ _/ ___| ___ ___ _ __ ___
# | |\/| |/ _ \ '_ ` _ \ / _ \| '__| | | \___ \ / __/ _ \| '_ \ / _ \
# | | | | __/ | | | | | (_) | | | |_| |___) | (_| (_) | |_) | __/
# |_| |_|\___|_| |_| |_|\___/|_| \__, |____/ \___\___/| .__/ \___|
# |___/ |_|
# Instruction
# To construct docker image:
# sudo docker build --network=host -t memoryscope .
# To run docker image:
# sudo docker run -it --rm --net=host memoryscope
FROM python:3.11
# 非必要步骤更换pip源 (以下三行,可以删除)
# (Not necessary) Change pip source
RUN echo '[global]' > /etc/pip.conf && \
echo 'index-url = https://mirrors.aliyun.com/pypi/simple/' >> /etc/pip.conf && \
echo 'trusted-host = mirrors.aliyun.com' >> /etc/pip.conf
# 安装大部分依赖利用Docker缓存加速以后的构建 (以下两行,可以删除)
# (Not necessary) Install the majority of deps, using docker build cache to accelerate future building
COPY requirements.txt ./
RUN pip3 install -r requirements.txt
# 进入工作路径(必要)
# Install Elastic Search
RUN useradd -m elastic_search_user
USER elastic_search_user
WORKDIR /home/elastic_search_user/elastic_search
# COPY elasticsearch-8.15.0-linux-x86_64.tar.gz ./elasticsearch-8.15.0-linux-x86_64.tar.gz
RUN wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.15.0-linux-x86_64.tar.gz
RUN tar -xzf elasticsearch-8.15.0-linux-x86_64.tar.gz
WORKDIR /home/elastic_search_user/elastic_search/elasticsearch-8.15.0
ENV DISCOVERY_TYPE=single-node \
XPACK_SECURITY_ENABLED=false \
XPACK_LICENSE_SELF_GENERATED_TYPE=trial
# Change user back to root and fix ownership
USER root
RUN chown -R elastic_search_user:elastic_search_user /home/elastic_search_user/
WORKDIR /memory_scope_project
# Enter working dir
WORKDIR /memory_scope_project
COPY . .
RUN pip install -r requirements.txt
# 启动(必要)
CMD ["python3", "memory_scope/cli.py", "config/demo_config_cn.yaml"]
# Launch!
# CMD ["bash"]
CMD ["bash", "examples/docker/entry_point.sh"]

View file

@ -0,0 +1,2 @@
sh examples/docker/run_elastic_search.sh
python quick_start_demo.py --config_path=memoryscope/core/config/demo_config.yaml

View file

@ -0,0 +1 @@
su - elastic_search_user -c "/home/elastic_search_user/elastic_search/elasticsearch-8.15.0/bin/elasticsearch -d"

View file

@ -157,14 +157,14 @@ worker:
model:
generation_model:
class: core.models.llama_index_generation_model
module_name: openai_generation
model_name: gpt-4o
module_name: dashscope_generation
model_name: qwen-max
max_tokens: 2000
temperature: 0.01
embedding_model:
class: core.models.llama_index_embedding_model
module_name: openai_embedding
model_name: text-embedding-3-small
module_name: dashscope_embedding
model_name: text-embedding-v2
rank_model:
class: core.models.llama_index_rank_model
module_name: dashscope_rank

7
quick_start_demo.py Normal file
View file

@ -0,0 +1,7 @@
import os
if os.environ.get('DASHSCOPE_API_KEY', None) is None:
os.environ['DASHSCOPE_API_KEY'] = input('Missing api key from dashscope ( https:// ???? ), please input key and press Enter:')
from memoryscope import cli
cli()