Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mistral-prompter #19

Merged
merged 29 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from 19 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
66 changes: 66 additions & 0 deletions sigllm/pipelines/prompter/mistral_prompter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"primitives": [
"mlstars.custom.timeseries_preprocessing.time_segments_aggregate",
"sklearn.impute.SimpleImputer",
"sigllm.primitives.transformation.Float2Scalar",
"sigllm.primitives.prompting.timeseries_preprocessing.rolling_window_sequences",
"sigllm.primitives.transformation.format_as_string",
"sigllm.primitives.prompting.huggingface.HF",
"sigllm.primitives.transformation.format_as_integer",
"sigllm.primitives.prompting.anomalies.val2idx",
"sigllm.primitives.prompting.anomalies.ano_within_windows",
"sigllm.primitives.prompting.anomalies.merge_anomaly_seq",
"sigllm.primitives.prompting.anomalies.idx2time",
"sigllm.primitives.prompting.anomalies.timestamp2interval"
],
"init_params": {
"mlstars.custom.timeseries_preprocessing.time_segments_aggregate#1": {
"time_column": "timestamp",
"interval": 21600,
"method": "mean"
},
"sigllm.primitives.transformation.Float2Scalar#1": {
"decimal": 2,
"rescale": true
},
"sigllm.primitives.prompting.timeseries_preprocessing.rolling_window_sequences#1": {
"window_size": 200,
"step_size": 40
},
"sigllm.primitives.transformation.format_as_string#1": {
"space": false
},
"sigllm.primitives.prompting.huggingface.HF#1": {
"name": "mistralai/Mistral-7B-Instruct-v0.2",
"samples": 10
},
"sigllm.primitives.prompting.anomalies.ano_within_windows#1": {
"alpha": 0.4
},
"sigllm.primitives.prompting.anomalies.merge_anomaly_seq#1": {
"beta": 0.5
}
},
"input_names": {
"sigllm.primitives.prompting.huggingface.HF#1": {
"X": "X_str"
},
"sigllm.primitives.transformation.format_as_integer#1":{
"X": "y_hat"
}
Linh-nk marked this conversation as resolved.
Show resolved Hide resolved
},
"output_names": {
"mlstars.custom.timeseries_preprocessing.time_segments_aggregate#1": {
"index": "timestamp"
},
"sigllm.primitives.transformation.format_as_string#1": {
"X": "X_str"
},
"sigllm.primitives.prompting.huggingface.HF#1": {
"y": "y_hat"
},
"sigllm.primitives.transformation.format_as_integer#1":{
"X": "y"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "sigllm.primitives.prompting.anomalies.ano_within_windows",
"contributors": [
"Sarah Alnegheimish <[email protected]>",
"Linh Nguyen <[email protected]>"
],
"description": "Get the final list of anomalous indices of each window",
"classifiers": {
"type": "postprocessor",
"subtype": "merger"
},
"modalities": [],
"primitive": "sigllm.primitives.prompting.anomalies.ano_within_windows",
"produce": {
"args": [
{
"name": "y",
"type": "ndarray"
}
],
"output": [
{
"name": "y",
"type": "ndarray"
}
]
},
"hyperparameters": {
"fixed": {
"alpha": {
"type": "float",
"default": 0.5
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "sigllm.primitives.prompting.anomalies.idx2time",
"contributors": [
"Sarah Alnegheimish <[email protected]>",
"Linh Nguyen <[email protected]>"
],
"description": "Convert list of indices into list of timestamp",
"classifiers": {
"type": "postprocessor",
"subtype": "converter"
},
"modalities": [],
"primitive": "sigllm.primitives.prompting.anomalies.idx2time",
"produce": {
"args": [
{
"name": "timestamp",
"type": "ndarray"
},
{
"name": "y",
"type": "ndarray"
}
],
"output": [
{
"name": "y",
"type": "ndarray"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "sigllm.primitives.prompting.anomalies.merge_anomaly_seq",
"contributors": [
"Sarah Alnegheimish <[email protected]>",
"Linh Nguyen <[email protected]>"
],
"description": "Get the final list of anomalous indices of a sequence when merging all rolling windows",
"classifiers": {
"type": "postprocessor",
"subtype": "merger"
},
"modalities": [],
"primitive": "sigllm.primitives.prompting.anomalies.merge_anomaly_seq",
"produce": {
"args": [
{
"name": "y",
"type": "ndarray"
},
{
"name": "first_index",
"type": "ndarray"
},
{
"name": "window_size",
"type": "int"
},
{
"name": "step_size",
"type": "int"
}
],
"output": [
{
"name": "y",
"type": "ndarray"
}
]
},
"hyperparameters": {
"fixed": {
"beta": {
"type": "float",
"default": 0.5
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "sigllm.primitives.prompting.anomalies.timestamp2interval",
"contributors": [
"Sarah Alnegheimish <[email protected]>",
"Linh Nguyen <[email protected]>"
],
"description": "Convert list of timestamps to list of intervals by padding to both sides and merge overlapping",
"classifiers": {
"type": "postprocessor",
"subtype": "converter"
},
"modalities": [],
"primitive": "sigllm.primitives.prompting.anomalies.timestamp2interval",
"produce": {
"args": [
{
"name": "y",
"type": "ndarray"
},
{
"name": "timestamp",
"type": "ndarray"
}
],
"output": [
{
"name": "df",
"type": "Dataframe"
Linh-nk marked this conversation as resolved.
Show resolved Hide resolved
}
]
},
"hyperparameters": {
"fixed": {
"padding_size": {
"type": "int",
"default": 50
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "sigllm.primitives.prompting.anomalies.val2idx",
"contributors": [
"Sarah Alnegheimish <[email protected]>",
"Linh Nguyen <[email protected]>"
],
"description": "Convert detected anomalous values into indices",
"classifiers": {
"type": "postprocessor",
"subtype": "converter"
},
"modalities": [],
"primitive": "sigllm.primitives.prompting.anomalies.val2idx",
"produce": {
"args": [
{
"name": "y",
"type": "ndarray"
},
{
"name": "X",
"type": "ndarray"
}
],
"output": [
{
"name": "y",
"type": "ndarray"
}
]
}
}
73 changes: 73 additions & 0 deletions sigllm/primitives/jsons/sigllm.primitives.prompting.gpt.GPT.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"name": "sigllm.primitives.prompting.gpt.GPT",
"contributors": [
"Linh Nguyen <[email protected]>"
],
"description": "Prompt openai GPT model to detect time series anomalies.",
"classifiers": {
"type": "estimator",
"subtype": "detector"
},
"modalities": [],
"primitive": "sigllm.primitives.prompting.huggingface.HF",
"produce": {
"method": "detect",
"args": [
{
"name": "X",
"type": "ndarray"
}
],
"output": [
{
"name": "y",
"type": "ndarray"
},
{
"name": "logprob",
"type": "ndarray",
"default": null
}
]
},
"hyperparameters": {
"fixed": {
"name": {
"type": "str",
"default": "gpt-3.5-turbo"
},
"sep": {
"type": "str",
"default": ","
},
"anomalous_percent": {
"type": "float",
"default": "0.5"
},
"temp": {
"type": "float",
"default": 1
},
"top_p": {
"type": "float",
"default": 1
},
"logprobs": {
"type": "bool",
"default": false
},
"top_logprobs": {
"type": "int",
"default": null
},
"samples": {
"type": "int",
"default": 1
},
"seed": {
"type": "int",
"default": null
}
}
}
}
Loading
Loading