Skip to content
Merged
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
11 changes: 11 additions & 0 deletions tests/functional/finetune/data/finetune_test_cost_estimation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{"model_name": "gpt2", "model_id": "64e615671567f848804985e1", "dataset_name": "Test text generation dataset"},
{"model_name": "falcon 7b instruct", "model_id": "65519d57bf42e6037ab109d5", "dataset_name": "Test text generation dataset"},
{"model_name": "bloomz 7b", "model_id": "6551ab17bf42e6037ab109e0", "dataset_name": "Test text generation dataset"},
{"model_name": "MPT 7B", "model_id": "6551a72bbf42e6037ab109d9", "dataset_name": "Test text generation dataset"},
{"model_name": "falcon 7b", "model_id": "6551bff9bf42e6037ab109e1", "dataset_name": "Test text generation dataset"},
{"model_name": "mistral 7b", "model_id": "6551a9e7bf42e6037ab109de", "dataset_name": "Test text generation dataset"},
{"model_name": "MPT 7B Storywriter", "model_id": "6551a870bf42e6037ab109db", "dataset_name": "Test text generation dataset"},
{"model_name": "llama 2 7b", "model_id": "6543cb991f695e72028e9428", "dataset_name": "Test text generation dataset"},
{"model_name": "Llama 2 7B Chat", "model_id": "65519ee7bf42e6037ab109d8", "dataset_name": "Test text generation dataset"}
]
2 changes: 2 additions & 0 deletions tests/functional/finetune/data/finetune_test_end2end.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
[
{
"model_name": "gpt2",
"model_id": "64e615671567f848804985e1",
"dataset_name": "Test text generation dataset",
"inference_data": "Hello!",
"required_dev": true
},
{
"model_name": "aiR",
"model_id": "6499cc946eb5633de15d82a1",
"dataset_name": "Test search dataset",
"inference_data": "Hello!",
Expand Down
17 changes: 17 additions & 0 deletions tests/functional/finetune/finetune_functional_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

TIMEOUT = 20000.0
RUN_FILE = "tests/functional/finetune/data/finetune_test_end2end.json"
ESTIMATE_COST_FILE = "tests/functional/finetune/data/finetune_test_cost_estimation.json"
LIST_FILE = "tests/functional/finetune/data/finetune_test_list_data.json"
PROMPT_FILE = "tests/functional/finetune/data/finetune_test_prompt_validator.json"

Expand All @@ -44,6 +45,11 @@ def run_input_map(request):
return request.param


@pytest.fixture(scope="module", params=read_data(ESTIMATE_COST_FILE))
def estimate_cost_input_map(request):
return request.param


@pytest.fixture(scope="module", params=read_data(LIST_FILE))
def list_input_map(request):
return request.param
Expand Down Expand Up @@ -82,6 +88,17 @@ def test_end2end_text_generation(run_input_map):
finetune_model.delete()


def test_cost_estimation_text_generation(estimate_cost_input_map):
model = ModelFactory.get(estimate_cost_input_map["model_id"])
dataset_list = [DatasetFactory.list(query=estimate_cost_input_map["dataset_name"])["results"][0]]
finetune = FinetuneFactory.create(str(uuid.uuid4()), dataset_list, model)
assert type(finetune.cost) is FinetuneCost
cost_map = finetune.cost.to_dict()
assert "trainingCost" in cost_map
assert "hostingCost" in cost_map
assert "inferenceCost" in cost_map
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to assert the exact costs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, as this is an estimate, the cost can vary depending on the random sample extracted from the dataset.



def test_list_finetunable_models(list_input_map):
model_list = ModelFactory.list(
function=Function(list_input_map["function"]),
Expand Down