mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-27 18:50:41 +00:00
# What does this PR do? This PR adds support for NVIDIA's NeMo Customizer API to the Llama Stack post-training module. The integration enables users to fine-tune models using NVIDIA's cloud-based customization service through a consistent Llama Stack interface. [//]: # (If resolving an issue, uncomment and update the line below) [//]: # (Closes #[issue-number]) ## Test Plan [Describe the tests you ran to verify your changes with result summaries. *Provide clear instructions so the plan can be easily re-executed.*] Yet to be done Things pending under this PR: - [x] Integration of fine-tuned model(new checkpoint) for inference with nvidia llm distribution - [x] distribution integration of API - [x] Add test cases for customizer(In Progress) - [x] Documentation ``` LLAMA_STACK_BASE_URL=http://localhost:5002 pytest -v tests/client-sdk/post_training/test_supervised_fine_tuning.py ============================================================================================================================================================================ test session starts ============================================================================================================================================================================= platform linux -- Python 3.10.0, pytest-8.3.4, pluggy-1.5.0 -- /home/ubuntu/llama-stack/.venv/bin/python cachedir: .pytest_cache metadata: {'Python': '3.10.0', 'Platform': 'Linux-6.8.0-1021-gcp-x86_64-with-glibc2.35', 'Packages': {'pytest': '8.3.4', 'pluggy': '1.5.0'}, 'Plugins': {'nbval': '0.11.0', 'metadata': '3.1.1', 'anyio': '4.8.0', 'html': '4.1.1', 'asyncio': '0.25.3'}} rootdir: /home/ubuntu/llama-stack configfile: pyproject.toml plugins: nbval-0.11.0, metadata-3.1.1, anyio-4.8.0, html-4.1.1, asyncio-0.25.3 asyncio: mode=strict, asyncio_default_fixture_loop_scope=None collected 2 items tests/client-sdk/post_training/test_supervised_fine_tuning.py::test_post_training_provider_registration[txt=8B] PASSED [ 50%] tests/client-sdk/post_training/test_supervised_fine_tuning.py::test_list_training_jobs[txt=8B] PASSED [100%] ======================================================================================================================================================================== 2 passed, 1 warning in 0.10s ======================================================================================================================================================================== ``` cc: @mattf @dglogo @sumitb --------- Co-authored-by: Ubuntu <ubuntu@llama-stack-customizer-dev-inst-2tx95fyisatvlic4we8hidx5tfj.us-central1-a.c.brevdevprod.internal>
60 lines
2.2 KiB
Python
60 lines
2.2 KiB
Python
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
# All rights reserved.
|
|
#
|
|
# This source code is licensed under the terms described in the LICENSE file in
|
|
# the root directory of this source tree.
|
|
|
|
import pytest
|
|
|
|
POST_TRAINING_PROVIDER_TYPES = ["remote::nvidia"]
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.fixture(scope="session")
|
|
def post_training_provider_available(llama_stack_client):
|
|
providers = llama_stack_client.providers.list()
|
|
post_training_providers = [p for p in providers if p.provider_type in POST_TRAINING_PROVIDER_TYPES]
|
|
return len(post_training_providers) > 0
|
|
|
|
|
|
@pytest.mark.integration
|
|
def test_post_training_provider_registration(llama_stack_client, post_training_provider_available):
|
|
"""Check if post_training is in the api list.
|
|
This is a sanity check to ensure the provider is registered."""
|
|
if not post_training_provider_available:
|
|
pytest.skip("post training provider not available")
|
|
|
|
providers = llama_stack_client.providers.list()
|
|
post_training_providers = [p for p in providers if p.provider_type in POST_TRAINING_PROVIDER_TYPES]
|
|
assert len(post_training_providers) > 0
|
|
|
|
|
|
@pytest.mark.integration
|
|
def test_get_training_jobs(llama_stack_client, post_training_provider_available):
|
|
"""Test listing all training jobs."""
|
|
if not post_training_provider_available:
|
|
pytest.skip("post training provider not available")
|
|
|
|
jobs = llama_stack_client.post_training.get_training_jobs()
|
|
assert isinstance(jobs, dict)
|
|
assert "data" in jobs
|
|
assert isinstance(jobs["data"], list)
|
|
|
|
|
|
@pytest.mark.integration
|
|
def test_get_training_job_status(llama_stack_client, post_training_provider_available):
|
|
"""Test getting status of a specific training job."""
|
|
if not post_training_provider_available:
|
|
pytest.skip("post training provider not available")
|
|
|
|
jobs = llama_stack_client.post_training.get_training_jobs()
|
|
if not jobs["data"]:
|
|
pytest.skip("No training jobs available to check status")
|
|
|
|
job_uuid = jobs["data"][0]["job_uuid"]
|
|
job_status = llama_stack_client.post_training.get_training_job_status(job_uuid=job_uuid)
|
|
|
|
assert job_status is not None
|
|
assert "job_uuid" in job_status
|
|
assert "status" in job_status
|
|
assert job_status["job_uuid"] == job_uuid
|