L iIddlZddlZddlmZmZddlmZddlmZddl m Z dZ dZ d Z dd ed eeeejfd ed eedeeeefdeeeefdeedededeedeefdZdeddfdZy)N)OptionalUnion)version) cached_file)is_peft_availablezadapter_config.jsonzadapter_model.binzadapter_model.safetensorsmodel_id cache_dirforce_downloadresume_downloadproxiestokenrevisionlocal_files_only subfolder _commit_hashreturnc d} |ytjj|rCtj|} t| vr$tjj |t} | St |t||||||||| ddd} | S)a Simply checks if the model stored on the Hub or locally is an adapter model or not, return the path of the adapter config file if it is, None otherwise. Args: model_id (`str`): The identifier of the model to look for, can be either a local path or an id to the repository on the Hub. cache_dir (`str` or `os.PathLike`, *optional*): Path to a directory in which a downloaded pretrained model configuration should be cached if the standard cache should not be used. force_download (`bool`, *optional*, defaults to `False`): Whether or not to force to (re-)download the configuration files and override the cached versions if they exist. resume_download: Deprecated and ignored. All downloads are now resumed by default when possible. Will be removed in v5 of Transformers. proxies (`dict[str, str]`, *optional*): A dictionary of proxy servers to use by protocol or endpoint, e.g., `{'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}.` The proxies are used on each request. token (`str` or *bool*, *optional*): The token to use as HTTP bearer authorization for remote files. If `True`, will use the token generated when running `hf auth login` (stored in `~/.huggingface`). revision (`str`, *optional*, defaults to `"main"`): The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any identifier allowed by git. To test a pull request you made on the Hub, you can pass `revision="refs/pr/". local_files_only (`bool`, *optional*, defaults to `False`): If `True`, will only try to load the tokenizer configuration from local files. subfolder (`str`, *optional*, defaults to `""`): In case the relevant files are located inside a subfolder of the model repo on huggingface.co, you can specify the folder name here. NF) r r r r rrrrr _raise_exceptions_for_gated_repo%_raise_exceptions_for_missing_entries'_raise_exceptions_for_connection_errors)ospathisdirlistdirADAPTER_CONFIG_NAMEjoinr) r r r r r rrrrradapter_cached_filenamelist_remote_filess c/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/transformers/utils/peft_utils.pyfind_adapter_config_filer!sf# x JJx0 "3 3&(ggll8=P&Q #& #"##.  )+-%-22749# " #" min_versioncts tdtjtj jdtj|k\}|std|y)z Checks if the version of PEFT is compatible. Args: version (`str`): The version of PEFT to check against. z@PEFT is not installed. Please install it with `pip install peft`peftz_The version of PEFT you are using is not compatible, please use a version that is greater than N)r ValueErrorrparse importlibmetadata)r#is_peft_version_compatibles r check_peft_versionr+lsl  [\\!(y/A/A/I/I&/Q!RV]VcVcdoVp!p % M #   &r") NFNNNNFN)r(rtypingrr packagingrhubr import_utilsrrADAPTER_WEIGHTS_NAMEADAPTER_SAFE_WEIGHTS_NAMEstrPathLikebooldictr!r+r"r r8s "+,*7 48 &*(,(,"""&L#L#c2;;./0L#L#d^ L# d38n % L# E$)$ % L#smL#L#L#3-L#c]L#^ C D r"