Skip to content

Cannot import name 'UnencryptedCookieSessionFactoryConfig' from 'pyramid.session' (unknown location) when run “run_unlearn.py --target_model_name_or_path ../../models/Yi-6B --per_device_train_batch_size 1 --do_unlearn --output_dir ./output --overwrite_output_dir --num_train_epochs 1 --logging_steps 1 --learning_rate 2e-5 --warmup_ratio 0.03 --overwrite_cache --save_total_limit 1 --fsdp "full_shard auto_wrap" --fsdp_transformer_layer_cls_to_wrap 'LlamaDecoderLayer' --bf16 True --tf32 True --weight_decay 0. --lr_scheduler_type "cosine" --domain github --gradient_accumulation_steps 85 --unlearn_method gradient_ascent “ #8

@IMoonKeyBoy

Description

@IMoonKeyBoy

Could the author help me to solve this?

Traceback (most recent call last):
File "/miniconda3/envs/unlearning_llm/lib/python3.12/site-packages/transformers/utils/import_utils.py", line 1764, in _get_module
return importlib.import_module("." + module_name, self.name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "
/miniconda3/envs/unlearning_llm/lib/python3.12/importlib/init.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 995, in exec_module
File "", line 488, in _call_with_frames_removed
File "/miniconda3/envs/unlearning_llm/lib/python3.12/site-packages/transformers/trainer.py", line 189, in
from apex import amp
File "
/miniconda3/envs/unlearning_llm/lib/python3.12/site-packages/apex/init.py", line 13, in
from pyramid.session import UnencryptedCookieSessionFactoryConfig
ImportError: cannot import name 'UnencryptedCookieSessionFactoryConfig' from 'pyramid.session' (unknown location)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "//Machine Unlearning of Pre-trained Large Language Models/llm_unlearn/run_unlearn.py", line 42, in
from transformers import (
File "", line 1412, in _handle_fromlist
File "/miniconda3/envs/unlearning_llm/lib/python3.12/site-packages/transformers/utils/import_utils.py", line 1754, in getattr
module = self._get_module(self._class_to_module[name])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "
/miniconda3/envs/unlearning_llm/lib/python3.12/site-packages/transformers/utils/import_utils.py", line 1766, in _get_module
raise RuntimeError(
RuntimeError: Failed to import transformers.trainer because of the following error (look up to see its traceback):
cannot import name 'UnencryptedCookieSessionFactoryConfig' from 'pyramid.session' (unknown location)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions