Upload intrinsic README.
Browse files
README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
| 1 |
---
|
| 2 |
library_name: peft
|
| 3 |
-
base_model: granite-4.0-micro
|
| 4 |
tags:
|
| 5 |
- mellea
|
| 6 |
---
|
| 7 |
|
| 8 |
# stembolts Intrinsic Adapter
|
| 9 |
|
| 10 |
-
This intrinsic adapter
|
| 11 |
|
| 12 |
## Training Data
|
| 13 |
|
| 14 |
-
The training dataset consists of JSONL
|
| 15 |
|
| 16 |
### Examples
|
| 17 |
|
|
@@ -65,7 +65,7 @@ _INTRINSIC_MODEL_ID = "nfulton/stembolts"
|
|
| 65 |
_INTRINSIC_ADAPTER_NAME = "stembolts"
|
| 66 |
|
| 67 |
|
| 68 |
-
class
|
| 69 |
def __init__(self, base_model_name: str):
|
| 70 |
super().__init__(
|
| 71 |
model_id=_INTRINSIC_MODEL_ID,
|
|
@@ -74,29 +74,29 @@ class StemboltsAdapter(CustomGraniteCommonAdapter):
|
|
| 74 |
)
|
| 75 |
|
| 76 |
|
| 77 |
-
class
|
| 78 |
-
def __init__(self,
|
| 79 |
Intrinsic.__init__(self, intrinsic_name=_INTRINSIC_ADAPTER_NAME)
|
| 80 |
-
SimpleComponent.__init__(self,
|
| 81 |
|
| 82 |
def format_for_llm(self):
|
| 83 |
return SimpleComponent.format_for_llm(self)
|
| 84 |
|
| 85 |
-
async def async_stembolts(
|
| 86 |
# Backend.add_adapter should be idempotent, but we'll go ahead and check just in case.
|
| 87 |
if adapter.qualified_name not in backend.list_adapters():
|
| 88 |
-
backend.add_adapter(
|
| 89 |
-
action =
|
| 90 |
mot = await backend.generate_from_context(action, ctx)
|
| 91 |
return mot
|
| 92 |
|
| 93 |
|
| 94 |
-
def stembolts(
|
| 95 |
# Backend.add_adapter should be idempotent, but we'll go ahead and check just in case.
|
| 96 |
-
adapter =
|
| 97 |
if adapter.qualified_name not in backend.list_adapters():
|
| 98 |
backend.add_adapter(adapter)
|
| 99 |
-
action =
|
| 100 |
return mfuncs.act(action, ctx, backend)
|
| 101 |
|
| 102 |
if __name__ == "__main__":
|
|
@@ -104,6 +104,6 @@ if __name__ == "__main__":
|
|
| 104 |
from mellea.backends.model_ids import IBM_GRANITE_4_MICRO_3B
|
| 105 |
from mellea.stdlib.context import ChatContext
|
| 106 |
backend = LocalHFBackend(IBM_GRANITE_4_MICRO_3B)
|
| 107 |
-
result, ctx = stembolts(
|
| 108 |
print(result.value)
|
| 109 |
```
|
|
|
|
| 1 |
---
|
| 2 |
library_name: peft
|
| 3 |
+
base_model: ibm-granite/granite-4.0-micro
|
| 4 |
tags:
|
| 5 |
- mellea
|
| 6 |
---
|
| 7 |
|
| 8 |
# stembolts Intrinsic Adapter
|
| 9 |
|
| 10 |
+
This intrinsic adapter analyzes plain text descriptions of vehicle engine issues to identify potential defective parts and provides a diagnostic likelihood score.
|
| 11 |
|
| 12 |
## Training Data
|
| 13 |
|
| 14 |
+
The training dataset consists of JSONL formatted strings where each line contains an 'item' field with a description of the engine issue, and a 'label' field containing a JSON object specifying the suspected 'defective_part' and its corresponding 'diag_likelihood'.
|
| 15 |
|
| 16 |
### Examples
|
| 17 |
|
|
|
|
| 65 |
_INTRINSIC_ADAPTER_NAME = "stembolts"
|
| 66 |
|
| 67 |
|
| 68 |
+
class StemBoltsAdapter(CustomGraniteCommonAdapter):
|
| 69 |
def __init__(self, base_model_name: str):
|
| 70 |
super().__init__(
|
| 71 |
model_id=_INTRINSIC_MODEL_ID,
|
|
|
|
| 74 |
)
|
| 75 |
|
| 76 |
|
| 77 |
+
class StemBoltsIntrinsic(Intrinsic, SimpleComponent):
|
| 78 |
+
def __init__(self, defect_description: str):
|
| 79 |
Intrinsic.__init__(self, intrinsic_name=_INTRINSIC_ADAPTER_NAME)
|
| 80 |
+
SimpleComponent.__init__(self, defect_description=defect_description)
|
| 81 |
|
| 82 |
def format_for_llm(self):
|
| 83 |
return SimpleComponent.format_for_llm(self)
|
| 84 |
|
| 85 |
+
async def async_stembolts(defect_description: str, ctx: Context, backend: Backend | AdapterMixin):
|
| 86 |
# Backend.add_adapter should be idempotent, but we'll go ahead and check just in case.
|
| 87 |
if adapter.qualified_name not in backend.list_adapters():
|
| 88 |
+
backend.add_adapter(StemBoltsAdapter(backend.base_model_name))
|
| 89 |
+
action = StemBoltsIntrinsic("stembolts", defect_description)
|
| 90 |
mot = await backend.generate_from_context(action, ctx)
|
| 91 |
return mot
|
| 92 |
|
| 93 |
|
| 94 |
+
def stembolts(defect_description: str, ctx: Context, backend: Backend | AdapterMixin):
|
| 95 |
# Backend.add_adapter should be idempotent, but we'll go ahead and check just in case.
|
| 96 |
+
adapter = StemBoltsAdapter(backend.base_model_name)
|
| 97 |
if adapter.qualified_name not in backend.list_adapters():
|
| 98 |
backend.add_adapter(adapter)
|
| 99 |
+
action = StemBoltsIntrinsic(defect_description)
|
| 100 |
return mfuncs.act(action, ctx, backend)
|
| 101 |
|
| 102 |
if __name__ == "__main__":
|
|
|
|
| 104 |
from mellea.backends.model_ids import IBM_GRANITE_4_MICRO_3B
|
| 105 |
from mellea.stdlib.context import ChatContext
|
| 106 |
backend = LocalHFBackend(IBM_GRANITE_4_MICRO_3B)
|
| 107 |
+
result, ctx = stembolts(defect_description='Airflow to the intake seems restricted; it bogs under throttle.', ctx=ChatContext(), backend=backend)
|
| 108 |
print(result.value)
|
| 109 |
```
|