[Neuron] Adding support for adding/ overriding neuron configuration a… (#8062)
Co-authored-by: Harsha Bikki <harbikh@amazon.com>
This commit is contained in:
co-authored by
Harsha Bikki
parent
77d9e514a2
commit
008cf886c9
@@ -2,8 +2,8 @@ import argparse
|
||||
import dataclasses
|
||||
import json
|
||||
from dataclasses import dataclass
|
||||
from typing import (TYPE_CHECKING, Dict, List, Mapping, Optional, Tuple, Type,
|
||||
Union)
|
||||
from typing import (TYPE_CHECKING, Any, Dict, List, Mapping, Optional, Tuple,
|
||||
Type, Union)
|
||||
|
||||
import torch
|
||||
|
||||
@@ -149,6 +149,7 @@ class EngineArgs:
|
||||
otlp_traces_endpoint: Optional[str] = None
|
||||
collect_detailed_traces: Optional[str] = None
|
||||
disable_async_output_proc: bool = False
|
||||
override_neuron_config: Optional[Dict[str, Any]] = None
|
||||
|
||||
def __post_init__(self):
|
||||
if self.tokenizer is None:
|
||||
@@ -742,6 +743,16 @@ class EngineArgs:
|
||||
default=EngineArgs.disable_async_output_proc,
|
||||
help="Disable async output processing. This may result in "
|
||||
"lower performance.")
|
||||
parser.add_argument(
|
||||
'--override-neuron-config',
|
||||
type=lambda configs: {
|
||||
str(key): value
|
||||
for key, value in
|
||||
(config.split(':') for config in configs.split(','))
|
||||
},
|
||||
default=None,
|
||||
help="override or set neuron device configuration.")
|
||||
|
||||
return parser
|
||||
|
||||
@classmethod
|
||||
@@ -802,7 +813,7 @@ class EngineArgs:
|
||||
served_model_name=self.served_model_name,
|
||||
limit_mm_per_prompt=self.limit_mm_per_prompt,
|
||||
use_async_output_proc=not self.disable_async_output_proc,
|
||||
)
|
||||
override_neuron_config=self.override_neuron_config)
|
||||
cache_config = CacheConfig(
|
||||
block_size=self.block_size if self.device != "neuron" else
|
||||
self.max_model_len, # neuron needs block_size = max_model_len
|
||||
|
||||
Reference in New Issue
Block a user