Skip to content

Latest commit

 

History

History
126 lines (106 loc) · 4.33 KB

installation.md

File metadata and controls

126 lines (106 loc) · 4.33 KB

Installing MemoryScope

I. Install with docker [Recommended] [x86_64]

  1. Clone the repository and edit settings

    # clone project
    git clone https://github.com/modelscope/memoryscope
    cd memoryscope
    # edit configuration, e.g. add api keys
    vim memoryscope/core/config/demo_config.yaml
  2. Build Docker image

    sudo docker build --network=host -t memoryscope .

    If you are using arm-based computers, modify command above into: sudo docker build -f DockerfileArm --network=host -t memoryscope .

  3. Launch Docker container

    sudo docker run -it --rm --net=host memoryscope

Important

To inspect memory shift during the conversation, modify command in step 3 to sudo docker run -it --name=memoryscope_container --rm --net=host memoryscope;
Then start a new terminal window and execute sudo docker exec -it memoryscope_container python quick-start-demo.py --config_path=memoryscope/core/config/demo_config_zh.yaml;
In the second window, input /list_memory refresh_time=5 to inspect memory

II. Install with docker compose [Recommended] [x86_64]

  1. Clone the repository and edit settings

    # clone project
    git clone https://github.com/modelscope/memoryscope
    cd memoryscope
    # edit configuration, e.g. add api keys
    vim memoryscope/core/config/demo_config.yaml
  2. Edit docker-compose.yml to change environment variable.

    OPENAI_API_KEY: "sk-0000000000"
    
  3. Run docker-compose run memory_scope_main to build and launch the memory-scope cli interface. (For ARM architecture, you should edit docker-compose.yml, changing image: ghcr.io/modelscope/memoryscope:main to image: ghcr.io/modelscope/memoryscope_arm:main)

III. Install from PyPI

  1. Install from PyPI

    pip install memoryscope
  2. Run Elasticsearch service, refer to elasticsearch documents. The docker method is recommended:

    sudo docker run -p 9200:9200 \
    -e "discovery.type=single-node" \
    -e "xpack.security.enabled=false" \
    -e "xpack.license.self_generated.type=trial" \
    docker.elastic.co/elasticsearch/elasticsearch:8.13.2
    
  3. Test Chinese / Dashscope Configuration

    export DASHSCOPE_API_KEY="sk-0000000000"
    memoryscope --language="cn" \
            --memory_chat_class="cli_memory_chat" \
            --human_name="用户" \
            --assistant_name="AI" \
            --generation_backend="dashscope_generation" \
            --generation_model="qwen-max" \
            --embedding_backend="dashscope_embedding" \
            --embedding_model="text-embedding-v2" \
            --enable_ranker=True \
            --rank_backend="dashscope_rank" \
            --rank_model="gte-rerank"
  4. Test English / OpenAI Configuration

    export OPENAI_API_KEY="sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    memoryscope --language="en" \
            --memory_chat_class="cli_memory_chat" \
            --human_name="User" \
            --assistant_name="AI" \
            --generation_backend="openai_generation" \
            --generation_model="gpt-4o" \
            --embedding_backend="openai_embedding" \
            --embedding_model="text-embedding-3-small" \
            --enable_ranker=False

IV. Install from source

  1. Clone the repository and edit settings

    # clone project
    git clone https://github.com/modelscope/memoryscope
    cd memoryscope
    # edit configuration, e.g. add api keys
    vim memoryscope/core/config/demo_config.yaml
  2. Install

    pip install -e .
  3. Run Elasticsearch service, refer to elasticsearch documents. The docker method is recommended:

    sudo docker run -p 9200:9200 \
    -e "discovery.type=single-node" \
    -e "xpack.security.enabled=false" \
    -e "xpack.license.self_generated.type=trial" \
    docker.elastic.co/elasticsearch/elasticsearch:8.13.2
    
  4. Launch memoryscope, also refer to cli documents

    export OPENAI_API_KEY="sk-0000000000"
    python quick-start-demo.py --config_path=memoryscope/core/config/demo_config_zh.yaml