From f5004ec0025836095e838b1b860441cad6f3756b Mon Sep 17 00:00:00 2001 From: Craig Pfeifer Date: Sun, 15 Dec 2024 13:33:33 -0500 Subject: [PATCH] set devices to 0, default is 1 which fails when no GPU device available --- tests/test_readme.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/test_readme.py b/tests/test_readme.py index 65c21dcde2..8d7c68c81d 100644 --- a/tests/test_readme.py +++ b/tests/test_readme.py @@ -173,9 +173,9 @@ def test_continue_pretrain_model(tmp_path): @pytest.mark.dependency(depends=["test_download_model"]) def test_serve(): - CHECKPOINT_DIR = str("checkpoints" / REPO_ID) + CHECKPOINT_DIR = str("/Users/craig/code/litgpt/checkpoints" / REPO_ID) run_command = [ - "litgpt", "serve", str(CHECKPOINT_DIR) + "litgpt", "serve", "--devices","0", str(CHECKPOINT_DIR) ] process = None @@ -183,10 +183,17 @@ def test_serve(): def run_server(): nonlocal process try: + print (f"Running command {run_command}") process = subprocess.Popen(run_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) stdout, stderr = process.communicate(timeout=60) - except subprocess.TimeoutExpired: + print (f"stdout : {stdout}") + print(f"stderr : {stderr}") + except subprocess.TimeoutExpired as te: print('Server start-up timeout expired') + raise te + except Exception as e: + print (e) + raise e server_thread = threading.Thread(target=run_server) server_thread.start() @@ -197,6 +204,7 @@ def run_server(): try: response = requests.get("http://127.0.0.1:8000") print(response.status_code) + print (response.text) assert response.status_code == 200, "Server did not respond as expected." finally: if process: