Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 22 additions & 17 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
## Description

<!--
Please include a summary of the changes below;
Fill in the issue number that this PR addresses (if applicable);
Fill in the related MemOS-Docs repository issue or PR link (if applicable);
Mention the person who will review this PR (if you know who it is);
Replace (summary), (issue), (docs-issue-or-pr-link), and (reviewer) with the appropriate information.
Please include a summary of the change, the problem it solves, the implementation approach, and relevant context. List any dependencies required for this change.

请在下方填写更改的摘要;
填写此 PR 解决的问题编号(如果适用);
填写相关的 MemOS-Docs 仓库 issue 或 PR 链接(如果适用);
提及将审查此 PR 的人(如果您知道是谁);
替换 (summary)、(issue)、(docs-issue-or-pr-link) 和 (reviewer) 为适当的信息。
-->
Related Issue (Required): Fixes @issue_number

Summary: (summary)
## Type of change

Fix: #(issue)
Please delete options that are not relevant.

Docs Issue/PR: (docs-issue-or-pr-link)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Refactor (does not change functionality, e.g. code style improvements, linting)
- [ ] Documentation update

Reviewer: @(reviewer)
## How Has This Been Tested?

## Checklist:
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

- [ ] Unit Test
- [ ] Test Script Or Test Steps (please provide)
- [ ] Pipeline Automated API Test (please provide)

## Checklist

- [ ] I have performed a self-review of my own code | 我已自行检查了自己的代码
- [ ] I have commented my code in hard-to-understand areas | 我已在难以理解的地方对代码进行了注释
- [ ] I have added tests that prove my fix is effective or that my feature works | 我已添加测试以证明我的修复有效或功能正常
- [ ] I have created related documentation issue/PR in [MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) (if applicable) | 我已在 [MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) 中创建了相关的文档 issue/PR(如果适用)
- [ ] I have linked the issue to this PR (if applicable) | 我已将 issue 链接到此 PR(如果适用)
- [ ] I have mentioned the person who will review this PR | 我已提及将审查此 PR 的人

## Reviewer Checklist
- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] Made sure Checks passed
- [ ] Tests have been provided
3 changes: 2 additions & 1 deletion docker/requirements-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ nvidia-cusparselt-cu12==0.6.3
nvidia-nccl-cu12==2.26.2
nvidia-nvjitlink-cu12==12.6.85
nvidia-nvtx-cu12==12.6.77
ollama==0.4.9
ollama==0.5.0
onnxruntime==1.22.1
openai==1.97.0
openapi-pydantic==0.5.1
Expand Down Expand Up @@ -184,3 +184,4 @@ py-key-value-aio==0.2.8
py-key-value-shared==0.2.8
PyJWT==2.10.1
pytest==9.0.2
alibabacloud-oss-v2==1.2.2
3 changes: 2 additions & 1 deletion docker/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ mdurl==0.1.2
more-itertools==10.8.0
neo4j==5.28.1
numpy==2.3.4
ollama==0.4.9
ollama==0.5.0
openai==1.109.1
openapi-pydantic==0.5.1
orjson==3.11.4
Expand Down Expand Up @@ -123,3 +123,4 @@ uvicorn==0.38.0
uvloop==0.22.1; sys_platform != 'win32'
watchfiles==1.1.1
websockets==15.0.1
alibabacloud-oss-v2==1.2.2
104 changes: 104 additions & 0 deletions examples/extras/nli_e2e_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import sys
import threading
import time

import requests
import uvicorn

from memos.extras.nli_model.client import NLIClient
from memos.extras.nli_model.server.serve import app


# Config
PORT = 32534


def run_server():
print(f"Starting server on port {PORT}...")
# Using a separate thread for the server
uvicorn.run(app, host="127.0.0.1", port=PORT, log_level="info")


def main():
print("Initializing E2E Test...")

# Start server thread
server_thread = threading.Thread(target=run_server, daemon=True)
server_thread.start()

# Wait for server to be up
print("Waiting for server to initialize (this may take time if downloading model)...")
client = NLIClient(base_url=f"http://127.0.0.1:{PORT}")

# Poll until server is ready
start_time = time.time()
ready = False

# Wait up to 5 minutes for model download and initialization
timeout = 300

while time.time() - start_time < timeout:
try:
# Check if docs endpoint is accessible
resp = requests.get(f"http://127.0.0.1:{PORT}/docs", timeout=1)
if resp.status_code == 200:
ready = True
break
except requests.ConnectionError:
pass
except Exception:
# Ignore other errors during startup
pass

time.sleep(2)
print(".", end="", flush=True)

print("\n")
if not ready:
print("Server failed to start in time.")
sys.exit(1)

print("Server is up! Sending request...")

# Test Data
source = "I like apples"
targets = ["I like apples", "I hate apples", "Paris is a city"]

try:
results = client.compare_one_to_many(source, targets)
print("-" * 30)
print(f"Source: {source}")
print("Targets & Results:")
for t, r in zip(targets, results, strict=False):
print(f" - '{t}': {r.value}")
print("-" * 30)

# Basic Validation
passed = True
if results[0].value != "Duplicate":
print(f"FAILURE: Expected Duplicate for '{targets[0]}', got {results[0].value}")
passed = False

if results[1].value != "Contradiction":
print(f"FAILURE: Expected Contradiction for '{targets[1]}', got {results[1].value}")
passed = False

if results[2].value != "Unrelated":
print(f"FAILURE: Expected Unrelated for '{targets[2]}', got {results[2].value}")
passed = False

if passed:
print("\nSUCCESS: Logic verification passed!")
else:
print("\nFAILURE: Unexpected results!")

except Exception as e:
print(f"Error during request: {e}")
sys.exit(1)


if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print("\nTest interrupted.")
Loading