ttnn-visualizer 0.56.0__py3-none-any.whl → 0.57.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ttnn_visualizer/models.py CHANGED
@@ -154,6 +154,26 @@ class StackTrace(SerializeableDataclass):
154
154
  stack_trace: str
155
155
 
156
156
 
157
+ @dataclasses.dataclass
158
+ class ErrorRecord(SerializeableDataclass):
159
+ operation_id: int
160
+ operation_name: str
161
+ error_type: str
162
+ error_message: str
163
+ stack_trace: str
164
+ timestamp: str
165
+
166
+ def to_nested_dict(self) -> dict:
167
+ """
168
+ Returns a dictionary representation without operation_id and operation_name.
169
+ Use this when the error is nested under an operation to avoid redundancy.
170
+ """
171
+ result = self.to_dict()
172
+ result.pop("operation_id", None)
173
+ result.pop("operation_name", None)
174
+ return result
175
+
176
+
157
177
  # Non Data Models
158
178
 
159
179
 
@@ -12,6 +12,7 @@ from ttnn_visualizer.models import (
12
12
  BufferPage,
13
13
  Device,
14
14
  DeviceOperation,
15
+ ErrorRecord,
15
16
  InputTensor,
16
17
  Instance,
17
18
  Operation,
@@ -156,6 +157,13 @@ class DatabaseQueries:
156
157
  operation_id, stack_trace = row
157
158
  yield StackTrace(operation_id, stack_trace=stack_trace)
158
159
 
160
+ def query_error_records(
161
+ self, filters: Optional[Dict[str, Any]] = None
162
+ ) -> Generator[ErrorRecord, None, None]:
163
+ rows = self._query_table("errors", filters)
164
+ for row in rows:
165
+ yield ErrorRecord(*row)
166
+
159
167
  def query_tensor_comparisons(
160
168
  self, local: bool = True, filters: Optional[Dict[str, Any]] = None
161
169
  ) -> Generator[TensorComparisonRecord, None, None]:
@@ -19,6 +19,7 @@ def serialize_operations(
19
19
  devices,
20
20
  producers_consumers,
21
21
  device_operations,
22
+ error_records=None,
22
23
  ):
23
24
  tensors_dict = {t.tensor_id: t for t in tensors}
24
25
  device_operations_dict = {
@@ -29,6 +30,11 @@ def serialize_operations(
29
30
 
30
31
  stack_traces_dict = {st.operation_id: st.stack_trace for st in stack_traces}
31
32
 
33
+ errors_dict = {}
34
+ if error_records:
35
+ for error in error_records:
36
+ errors_dict[error.operation_id] = error.to_nested_dict()
37
+
32
38
  arguments_dict = defaultdict(list)
33
39
  for argument in operation_arguments:
34
40
  arguments_dict[argument.operation_id].append(argument)
@@ -49,6 +55,8 @@ def serialize_operations(
49
55
  )
50
56
  id = operation_data.pop("operation_id", None)
51
57
 
58
+ error_data = errors_dict.get(operation.operation_id)
59
+
52
60
  results.append(
53
61
  {
54
62
  **operation_data,
@@ -58,6 +66,7 @@ def serialize_operations(
58
66
  "arguments": arguments,
59
67
  "inputs": inputs,
60
68
  "outputs": outputs,
69
+ "error": error_data,
61
70
  }
62
71
  )
63
72
  return results
@@ -144,6 +153,7 @@ def serialize_operation(
144
153
  devices,
145
154
  producers_consumers,
146
155
  device_operations,
156
+ error_record=None,
147
157
  ):
148
158
  tensors_dict = {t.tensor_id: t for t in tensors}
149
159
  comparisons = comparisons_by_tensor_id(
@@ -176,6 +186,9 @@ def serialize_operation(
176
186
  device_operations_data = do.captured_graph
177
187
  break
178
188
 
189
+ # Convert error record to nested dict if it exists (excludes operation_id and operation_name)
190
+ error_data = error_record.to_nested_dict() if error_record else None
191
+
179
192
  return {
180
193
  **operation_data,
181
194
  "id": id,
@@ -186,6 +199,7 @@ def serialize_operation(
186
199
  "arguments": arguments_data,
187
200
  "inputs": inputs_data or [],
188
201
  "outputs": outputs_data or [],
202
+ "error": error_data,
189
203
  }
190
204
 
191
205
 
@@ -1 +1 @@
1
- import{I as s}from"./index-CnPrfHYh.js";import{I as r}from"./index-Cnc1EkDo.js";import{p as n,I as c}from"./index-6Y2MAcdI.js";function p(t,a){const o=n(t);return a===c.STANDARD?s[o]:r[o]}export{s as IconSvgPaths16,r as IconSvgPaths20,p as getIconPaths};
1
+ import{I as s}from"./index-CnPrfHYh.js";import{I as r}from"./index-Cnc1EkDo.js";import{p as n,I as c}from"./index-Sc99nrOV.js";function p(t,a){const o=n(t);return a===c.STANDARD?s[o]:r[o]}export{s as IconSvgPaths16,r as IconSvgPaths20,p as getIconPaths};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/allPaths-ofNxJ79X.js","assets/index-CnPrfHYh.js","assets/index-Cnc1EkDo.js","assets/index-Sc99nrOV.js","assets/index-BO2e1Ec3.css"])))=>i.map(i=>d[i]);
2
+ import{_ as e}from"./index-Sc99nrOV.js";const s=async(t,a)=>{const{getIconPaths:o}=await e(async()=>{const{getIconPaths:r}=await import("./allPaths-ofNxJ79X.js");return{getIconPaths:r}},__vite__mapDeps([0,1,2,3,4]));return o(t,a)};export{s as allPathsLoader};