Skip to content

Commit 999b1b0

Browse files
authored
Remove unnecessary validation for local global attention (#12049)
Since `local_global_attention` is [already an int list](https://github.com/pytorch/executorch/blob/main/extension/llm/export/config/llm_config.py#L165), this validation doesn't make any sense to do.
1 parent b3c9bf7 commit 999b1b0

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

extension/llm/export/config/llm_config.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"""
1919

2020
import argparse
21-
import ast
2221
import re
2322
from dataclasses import dataclass, field
2423
from enum import Enum
@@ -166,7 +165,6 @@ class ModelConfig:
166165

167166
def __post_init__(self):
168167
self._validate_attention_sink()
169-
self._validate_local_global_attention()
170168

171169
if self.quantize_kv_cache and not self.use_kv_cache:
172170
raise ValueError(
@@ -186,18 +184,6 @@ def _validate_attention_sink(self):
186184
"The value of use_attention_sink must be structured like '<sink_size>,<window_size>,<batch_eviction_size>'"
187185
)
188186

189-
def _validate_local_global_attention(self):
190-
if self.local_global_attention:
191-
local_global_err = "The value of local_global_attention must be a list of integers, e.g., [0, 16, 0, 16]"
192-
try:
193-
parsed = ast.literal_eval(self.local_global_attention)
194-
if not (
195-
isinstance(parsed, list) and all(isinstance(i, int) for i in parsed)
196-
):
197-
raise ValueError(local_global_err)
198-
except Exception:
199-
raise ValueError(local_global_err)
200-
201187

202188
################################################################################
203189
################################ ExportConfig ##################################

0 commit comments

Comments
 (0)