diff --git a/.github/workflows/instructlab-knowledge-e2e.yml b/.github/workflows/instructlab-knowledge-e2e.yml index 1482db7..0223d47 100644 --- a/.github/workflows/instructlab-knowledge-e2e.yml +++ b/.github/workflows/instructlab-knowledge-e2e.yml @@ -8,11 +8,10 @@ on: pull_request: branches: - "main" - types: [opened, reopened] env: # dependencies that need to be installed using pip for testing to work - TESTING_PIP_DEPENDENCIES: "papermill nbformat" + TESTING_PIP_DEPENDENCIES: "papermill nbformat ipykernel" jobs: end_to_end: @@ -23,18 +22,19 @@ jobs: runs-on: ubuntu-latest env: # customize the workflow here - API_KEY: "" API_URL: "http://127.0.0.1:11434/v1" MODEL_ID: "Mixtral-8x7B" # must be open-AI compatible when using inference mock steps: - uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: '3.11' cache: pip - name: Install Testing Tools - run: pip install ${{ env.TESTING_PIP_DEPENDENCIES }} + run: | + pip install ${{ env.TESTING_PIP_DEPENDENCIES }} + ipython kernel install --name "python3" --user - name: Validate The Notebook working-directory: ./notebooks/instructlab-knowledge run: | @@ -44,15 +44,10 @@ jobs: working-directory: ./tests/inference-mock run: | pip install -r requirements.txt - python python -m flask run & + nohup python app.py & sleep 1 echo "Inference mock server started on port 11434" - name: Run End To End Tests working-directory: ./notebooks/instructlab-knowledge # NOTE: for this to work, cells with parameters need to be tagged as parameters in the target notebooks - run: papermill ${{ matrix.notebooks_to_test }} ${{ matrix.notebooks_to_test }}.tmp -p API_KEY $API_KEY -p API_URL $API_URL -p MODEL_ID $MODEL_ID - - name: Terminate Inference Mock Server - if: always() - run: | - pkill -f "python -m flask" - echo "Mock server terminated" + run: papermill ${{ matrix.notebooks_to_test }} ${{ matrix.notebooks_to_test }}.tmp -p API_URL $API_URL -p MODEL_ID $MODEL_ID diff --git a/notebooks/instructlab-knowledge/instructlab-knowledge.ipynb b/notebooks/instructlab-knowledge/instructlab-knowledge.ipynb index 2f496cc..7ebde02 100644 --- a/notebooks/instructlab-knowledge/instructlab-knowledge.ipynb +++ b/notebooks/instructlab-knowledge/instructlab-knowledge.ipynb @@ -367,14 +367,14 @@ }, "outputs": [], "source": [ - "API_KEY = \"\" # the API access key for your account ( empty if not required )\n", + "API_KEY = \"none\" # the API access key for your account ( cannot be empty )\n", "API_URL = \"http://127.0.0.1:11434/v1\" # the URL of your model's API\n", "MODEL_ID = \"granite3.3\" # the name of your model" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "b702267e-f550-4bc2-bce4-c0fcecbbd292", "metadata": {}, "outputs": [], @@ -426,15 +426,13 @@ "import random #TODO: replace random sampling with subset selection\n", "\n", "for doc, chunks in dataset.items(): # TODO: multiple file support\n", - " generate_options.generated_file = AUTHORING_OUTPUT_DIR / f\"qagen-{doc}.json\" \n", + " generate_options.generated_file = AUTHORING_OUTPUT_DIR / f\"qagen-{doc}.json\"\n", " gen = Generator(generate_options=generate_options)\n", - " \n", " print(f\"processing chunks that looks like:\\n{chunks[0].text}\")\n", " selected_chunks = random.sample(chunks, NUM_CHUNKS_TO_SELECT_FOR_AUTHORING)\n", " print(f\"Selected {len(selected_chunks)} contexts\")\n", "\n", " Path.unlink(generate_options.generated_file, missing_ok=True)\n", - " breakpoint()\n", " results = gen.generate_from_chunks(selected_chunks) # automatically saves to file\n", "\n", " print(f\"{doc}: {results.status}\")\n", diff --git a/tests/inference-mock/app.py b/tests/inference-mock/app.py index d6dfaec..ee568bb 100644 --- a/tests/inference-mock/app.py +++ b/tests/inference-mock/app.py @@ -58,7 +58,6 @@ def mock_generate(): response = jsonify(completion_response(completion, request.json['model'])) app.logger.debug(f"response: {response}") return response - if __name__ == '__main__': app.run(debug=True, port=port_number)