Skip to content

Commit

Permalink
podcast script generation component (#15)
Browse files Browse the repository at this point in the history
* Add devcontainer and requirements

* Add pyproject.toml

* Add data_loaders and tests

* Add data_cleaners and tests

* Update demo

* Add `LOADERS` and `CLEANERS`

* Add markdown and docx

* Add API Reference

* Update tests

* Update install

* Add initial scripts

* More tests

* fix merge

* Add podcast writing to demo/app

* Add missing deps

* Add text_to_podcast module

* Expose model options and prompt tuning in the app

* pre-commit

* Strip system_prompt

* Rename to inference module. Add docstrings

* pre-commit

* Add CURATED_REPOS

* JSON prompt

* Update API docs

* Fix format

* Make text cutoff based on `model.n_ctx()`. Consider ~4 characters per token as a resonable default.

* Add inference tests

* Drop __init__ imports

* Fix outdated arg

* Drop redundant JSON output in prompt

* Update default stop
  • Loading branch information
daavoo authored and stefanfrench committed Dec 2, 2024
1 parent 1e2ec2e commit 5821440
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions tests/integration/test_model_load_and_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ def test_model_load_and_inference_text_to_text():
"HuggingFaceTB/smollm-135M-instruct-v0.2-Q8_0-GGUF/smollm-135m-instruct-add-basics-q8_0.gguf"
)
result = text_to_text(
"Answer to: What is the capital of France?",
"What is the capital of France?",
model=model,
system_prompt="",
)
assert isinstance(result, str)
assert json.loads(result)
assert json.loads(result)["Capital"] == "Paris"


def test_model_load_and_inference_text_to_text_no_json():
Expand All @@ -37,6 +37,19 @@ def test_model_load_and_inference_text_to_text_no_json():
assert result.startswith("The capital of France is Paris")


def test_model_load_and_inference_text_to_text_stream():
model = load_llama_cpp_model(
"HuggingFaceTB/smollm-135M-instruct-v0.2-Q8_0-GGUF/smollm-135m-instruct-add-basics-q8_0.gguf"
)
result = text_to_text_stream(
"What is the capital of France?",
model=model,
system_prompt="",
)
assert isinstance(result, Iterator)
assert json.loads("".join(result))["Capital"] == "Paris"


def test_model_load_and_inference_text_to_text_stream_no_json():
model = load_llama_cpp_model(
"HuggingFaceTB/smollm-135M-instruct-v0.2-Q8_0-GGUF/smollm-135m-instruct-add-basics-q8_0.gguf"
Expand Down

0 comments on commit 5821440

Please sign in to comment.