huggingface / huggingface/optimum-nvidia

ValueError: mutable default <class 'tensorrt_llm.lora_manager.LoraBuildConfig'> for field lora_config is not allowed: use default_factory

Open
#119 5 comments 3 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1k
Forks
103
Avg merge
2m
Merged PRs (30d)
1

Description

I get the following error on importing pipeline. Any ideas? Thanks.

```
from optimum.nvidia.pipelines import pipeline

---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[10], line 1
----> 1 from optimum.nvidia.pipelines import pipeline

File ~/anaconda3/lib/python3.11/site-packages/optimum/nvidia/__init__.py:16
1 # coding=utf-8
2 # Copyright 2024 The HuggingFace Inc. team. All rights reserved.
3 # #
(...)
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
---> 16 from .config import TensorRTConfig
17 from .logging import DEFAULT_LOGGING_FMT, setup_logging
18 from .models import AutoModelForCausalLM

File ~/anaconda3/lib/python3.11/site-packages/optimum/nvidia/config.py:21
18 from typing import Optional, Union
20 import torch
---> 21 from tensorrt_llm import Mapping
22 from tensorrt_llm.models import PretrainedConfig as TensorRTPretrainedConfig
23 from tensorrt_llm.models.modeling_utils import (
24 QuantizationConfig as TensorRTQuantizationConfig,
25 )

File ~/anaconda3/lib/python3.11/site-packages/tensorrt_llm/__init__.py:35
33 import tensorrt_llm.models as models
34 import tensorrt_llm.quantization as quantization
---> 35 import tensorrt_llm.runtime as runtime
36 import tensorrt_llm.tools as tools
38 from ._common import _init, default_net, default_trtnet, precision

File ~/anaconda3/lib/python3.11/site-packages/tensorrt_llm/runtime/__init__.py:22
16 from .generation import (ChatGLMGenerationSession, GenerationSession,
17 LogitsProcessor, LogitsProcessorList,
18 MambaLMHeadModelGenerationSession, ModelConfig,
19 QWenForCausalLMGenerationSession, StoppingCriteria,
20 StoppingCriteriaList, to_word_list_format)
21 from .kv_cache_manager import GenerationSequence, KVCacheManager
---> 22 from .model_runner import ModelRunner
23 from .session import Session, TensorInfo
25 try:

File ~/anaconda3/lib/python3.11/site-packages/tensorrt_llm/runtime/model_runner.py:27
25 from .. import profiler
26 from .._utils import mpi_world_size
---> 27 from ..builder import Engine, get_engine_version
28 from ..logger import logger
29 from ..mapping import Mapping

File ~/anaconda3/lib/python3.11/site-packages/tensorrt_llm/builder.py:408
404 to_json_file(config, config_path)
405 logger.info(f'Config saved to {config_path}.')
--> 408 @dataclass
409 class BuildConfig:
410 max_input_len: int = 256
411 max_output_len: int = 256

File ~/anaconda3/lib/python3.11/dataclasses.py:1230, in dataclass(cls, init, repr, eq, order, unsafe_hash, frozen, match_args, kw_only, slots, weakref_slot)
1227 return wrap
1229 # We're called as @dataclass without parens.
-> 1230 return wrap(cls)

File ~/anaconda3/lib/python3.11/dataclasses.py:1220, in dataclass..wrap(cls)
1219 def wrap(cls):
-> 1220 return _process_class(cls, init, repr, eq, order, unsafe_hash,
1221 frozen, match_args, kw_only, slots,
1222 weakref_slot)

File ~/anaconda3/lib/python3.11/dataclasses.py:958, in _process_class(cls, init, repr, eq, order, unsafe_hash, frozen, match_args, kw_only, slots, weakref_slot)
955 kw_only = True
956 else:
957 # Otherwise it's a field of some type.
--> 958 cls_fields.append(_get_field(cls, name, type, kw_only))
960 for f in cls_fields:
961 fields[f.name] = f

File ~/anaconda3/lib/python3.11/dataclasses.py:815, in _get_field(cls, a_name, a_type, default_kw_only)
811 # For real fields, disallow mutable defaults. Use unhashable as a proxy
812 # indicator for mutability. Read the __hash__ attribute from the class,
813 # not the instance.
814 if f._field_type is _FIELD and f.default.__class__.__hash__ is None:
--> 815 raise ValueError(f'mutable default {type(f.default)} for field '
816 f'{f.name} is not allowed: use default_factory')
818 return f

ValueError: mutable default for field lora_config is not allowed: use default_factory
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.