dc6079821b
CI Github Actions / Run Tests (push) Waiting to run
Automatic PR Merger / mergepal (push) Waiting to run
Semgrep / Semgrep Workflow Security Scan (push) Waiting to run
Docs Tests / Check for file changes (push) Has been cancelled
Docs Tests / Test Documentation (push) Has been cancelled
Docs Tests / Documentation Linting Checks (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-performance) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-policies) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-cli) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-core-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-full-model-training) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-nlu-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-nlu-predictors) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-other-unit-tests) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-performance) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.8, test-policies) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-cli) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-core-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-full-model-training) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-nlu-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-nlu-predictors) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-other-unit-tests) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-performance) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.9, test-policies) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-cli) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-core-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-full-model-training) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-nlu-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-nlu-predictors) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-other-unit-tests) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-performance) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.10, test-policies) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-cli) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-core-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-full-model-training) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-nlu-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-nlu-predictors) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-other-unit-tests) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-performance) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.8, test-policies) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-cli) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-core-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-full-model-training) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-nlu-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-nlu-predictors) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-other-unit-tests) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-performance) (push) Has been cancelled
Continuous Integration / Run Tests (windows-2022, 3.9, test-policies) (push) Has been cancelled
Continuous Integration / Run Flaky Tests (ubuntu-24.04, 3.10) (push) Has been cancelled
Continuous Integration / Run Flaky Tests (ubuntu-24.04, 3.8) (push) Has been cancelled
Continuous Integration / Run Flaky Tests (ubuntu-24.04, 3.9) (push) Has been cancelled
Continuous Integration / Run Flaky Tests (windows-2022, 3.10) (push) Has been cancelled
Continuous Integration / Run Flaky Tests (windows-2022, 3.8) (push) Has been cancelled
Continuous Integration / Run Flaky Tests (windows-2022, 3.9) (push) Has been cancelled
Continuous Integration / Check for file changes (push) Has been cancelled
Continuous Integration / Wait for docs tests (push) Has been cancelled
Continuous Integration / Code Quality (push) Has been cancelled
Continuous Integration / Check for changelog (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-cli) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-core-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-full-model-training) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-nlu-featurizers) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-nlu-predictors) (push) Has been cancelled
Continuous Integration / Run Tests (ubuntu-24.04, 3.10, test-other-unit-tests) (push) Has been cancelled
Continuous Integration / Upload coverage reports to codeclimate (push) Has been cancelled
Continuous Integration / Run Non-Sequential Integration Tests (push) Has been cancelled
Continuous Integration / Run Broker Integration Tests (push) Has been cancelled
Continuous Integration / Run Sequential Integration Tests (push) Has been cancelled
Continuous Integration / Build Docker base images and setup environment (push) Has been cancelled
Continuous Integration / Build Docker (default) (push) Has been cancelled
Continuous Integration / Build Docker (full) (push) Has been cancelled
Continuous Integration / Build Docker (mitie-en) (push) Has been cancelled
Continuous Integration / Build Docker (spacy-de) (push) Has been cancelled
Continuous Integration / Build Docker (spacy-en) (push) Has been cancelled
Continuous Integration / Build Docker (spacy-it) (push) Has been cancelled
Continuous Integration / Deploy to PyPI (push) Has been cancelled
Continuous Integration / Notify Slack & Publish Release Notes (push) Has been cancelled
Publish Documentation / Evaluate release tag (push) Has been cancelled
Publish Documentation / Prebuild Docs (push) Has been cancelled
Publish Documentation / Preview Docs (push) Has been cancelled
Publish Documentation / Check for file changes (push) Has been cancelled
Publish Documentation / Publish Docs (push) Has been cancelled
182 lines
7.6 KiB
Python
182 lines
7.6 KiB
Python
import pytest
|
|
import scipy.sparse
|
|
import numpy as np
|
|
|
|
from rasa.utils.tensorflow.model_data import (
|
|
RasaModelData,
|
|
FeatureArray,
|
|
ragged_array_to_ndarray,
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
async def model_data() -> RasaModelData:
|
|
return RasaModelData(
|
|
label_key="label",
|
|
label_sub_key="ids",
|
|
data={
|
|
"text": {
|
|
"sentence": [
|
|
FeatureArray(
|
|
ragged_array_to_ndarray(
|
|
[
|
|
np.random.rand(5, 14),
|
|
np.random.rand(2, 14),
|
|
np.random.rand(3, 14),
|
|
np.random.rand(1, 14),
|
|
np.random.rand(3, 14),
|
|
]
|
|
),
|
|
number_of_dimensions=3,
|
|
),
|
|
FeatureArray(
|
|
ragged_array_to_ndarray(
|
|
[
|
|
scipy.sparse.csr_matrix(
|
|
np.random.randint(5, size=(5, 10))
|
|
),
|
|
scipy.sparse.csr_matrix(
|
|
np.random.randint(5, size=(2, 10))
|
|
),
|
|
scipy.sparse.csr_matrix(
|
|
np.random.randint(5, size=(3, 10))
|
|
),
|
|
scipy.sparse.csr_matrix(
|
|
np.random.randint(5, size=(1, 10))
|
|
),
|
|
scipy.sparse.csr_matrix(
|
|
np.random.randint(5, size=(3, 10))
|
|
),
|
|
]
|
|
),
|
|
number_of_dimensions=3,
|
|
),
|
|
]
|
|
},
|
|
"action_text": {
|
|
"sequence": [
|
|
FeatureArray(
|
|
ragged_array_to_ndarray(
|
|
[
|
|
[
|
|
scipy.sparse.csr_matrix(
|
|
np.random.randint(5, size=(5, 10))
|
|
),
|
|
scipy.sparse.csr_matrix(
|
|
np.random.randint(5, size=(2, 10))
|
|
),
|
|
scipy.sparse.csr_matrix(
|
|
np.random.randint(5, size=(3, 10))
|
|
),
|
|
scipy.sparse.csr_matrix(
|
|
np.random.randint(5, size=(1, 10))
|
|
),
|
|
scipy.sparse.csr_matrix(
|
|
np.random.randint(5, size=(3, 10))
|
|
),
|
|
],
|
|
[
|
|
scipy.sparse.csr_matrix(
|
|
np.random.randint(5, size=(5, 10))
|
|
),
|
|
scipy.sparse.csr_matrix(
|
|
np.random.randint(5, size=(2, 10))
|
|
),
|
|
],
|
|
[
|
|
scipy.sparse.csr_matrix(
|
|
np.random.randint(5, size=(5, 10))
|
|
),
|
|
scipy.sparse.csr_matrix(
|
|
np.random.randint(5, size=(1, 10))
|
|
),
|
|
scipy.sparse.csr_matrix(
|
|
np.random.randint(5, size=(3, 10))
|
|
),
|
|
],
|
|
[
|
|
scipy.sparse.csr_matrix(
|
|
np.random.randint(5, size=(3, 10))
|
|
)
|
|
],
|
|
[
|
|
scipy.sparse.csr_matrix(
|
|
np.random.randint(5, size=(3, 10))
|
|
),
|
|
scipy.sparse.csr_matrix(
|
|
np.random.randint(5, size=(1, 10))
|
|
),
|
|
scipy.sparse.csr_matrix(
|
|
np.random.randint(5, size=(7, 10))
|
|
),
|
|
],
|
|
]
|
|
),
|
|
number_of_dimensions=4,
|
|
),
|
|
FeatureArray(
|
|
ragged_array_to_ndarray(
|
|
[
|
|
[
|
|
np.random.rand(5, 14),
|
|
np.random.rand(2, 14),
|
|
np.random.rand(3, 14),
|
|
np.random.rand(1, 14),
|
|
np.random.rand(3, 14),
|
|
],
|
|
[np.random.rand(5, 14), np.random.rand(2, 14)],
|
|
[
|
|
np.random.rand(5, 14),
|
|
np.random.rand(1, 14),
|
|
np.random.rand(3, 14),
|
|
],
|
|
[np.random.rand(3, 14)],
|
|
[
|
|
np.random.rand(3, 14),
|
|
np.random.rand(1, 14),
|
|
np.random.rand(7, 14),
|
|
],
|
|
]
|
|
),
|
|
number_of_dimensions=4,
|
|
),
|
|
]
|
|
},
|
|
"dialogue": {
|
|
"sentence": [
|
|
FeatureArray(
|
|
ragged_array_to_ndarray(
|
|
[
|
|
np.random.randint(2, size=(5, 10)),
|
|
np.random.randint(2, size=(2, 10)),
|
|
np.random.randint(2, size=(3, 10)),
|
|
np.random.randint(2, size=(1, 10)),
|
|
np.random.randint(2, size=(3, 10)),
|
|
]
|
|
),
|
|
number_of_dimensions=3,
|
|
)
|
|
]
|
|
},
|
|
"label": {
|
|
"ids": [FeatureArray(np.array([0, 1, 0, 1, 1]), number_of_dimensions=1)]
|
|
},
|
|
"entities": {
|
|
"tag_ids": [
|
|
FeatureArray(
|
|
ragged_array_to_ndarray(
|
|
[
|
|
np.array([[0], [1], [1], [0], [2]]),
|
|
np.array([[2], [0]]),
|
|
np.array([[0], [1], [1]]),
|
|
np.array([[0], [1]]),
|
|
np.array([[0], [0], [0]]),
|
|
]
|
|
),
|
|
number_of_dimensions=3,
|
|
)
|
|
]
|
|
},
|
|
},
|
|
)
|