cannot import name 'LlamaDynamicNTKScalingRotaryEmbedding'
Training as proposed in the README or executing the 3rd cell of the eval_acc.ipynb gives the following error:
File ~/Thomas/KBLaM/src/kblam/models/llama3_model.py:43 38 from transformers.modeling_outputs import ( 39 BaseModelOutputWithPast, 40 CausalLMOutputWithPast, 41 ) 42 from transformers.models.llama.configuration_llama import LlamaConfig ---> 43 from transformers.models.llama.modeling_llama import ( 44 _CONFIG_FOR_DOC, 45 LLAMA_INPUTS_DOCSTRING, 46 LLAMA_START_DOCSTRING, 47 LlamaDynamicNTKScalingRotaryEmbedding, 48 LlamaLinearScalingRotaryEmbedding, 49 LlamaMLP, 50 LlamaPreTrainedModel, 51 LlamaRMSNorm, 52 LlamaRotaryEmbedding, 53 apply_rotary_pos_emb, 54 repeat_kv, 55 ) 56 from transformers.utils import ( 57 add_start_docstrings, 58 add_start_docstrings_to_model_forward, 59 logging, 60 replace_return_docstrings, 61 ) 63 from kblam.models.kblam_config import KBLaMConfig
ImportError: cannot import name 'LlamaDynamicNTKScalingRotaryEmbedding' from 'transformers.models.llama.modeling_llama' (/home/fokus/miniforge3/envs/kblam/lib/python3.13/site-packages/transformers/models/llama/modeling_llama.py)
The transformers lib doesn't define LlamaDynamicNTKScalingRotaryEmbedding. Hence, the "transformers==4.48.0" in pyproject seems to be wrong.
Ok downgrading to transformers=4.46.0 seems to solve the problem above. However, afterwards I get another error:
`---> 23 from kblam.utils.data_utils import aug_row, generate_multi_entity_qa 24 from kblam.utils.eval_utils import ( 25 instruction_prompts, 26 instruction_prompts_multi_entities, (...) 33 softmax, 34 ) 35 from kblam.utils.train_utils import get_kb_embd
ImportError: cannot import name 'aug_row' from 'kblam.utils.data_utils' (/home/fokus/Thomas/KBLaM/src/kblam/utils/data_utils.py)`
Seems that in data_util.py it is now called, if I try to execute the 3rd cell of eval_acc.ipynb:
def augment_row(row: dict[str, str]) -> list[dict[str, str]]: """Augment an entity with questions from pre-defined templates."""
same issue!!!
same issue
same issue
pip install transformers==4.46.0。 I have solved the above issue。
duplicate of https://github.com/microsoft/KBLaM/issues/32
Thanks, let me make a PR pinning to transformers 4.46.0. We'll consider longer-term solutions as well in the meantime