yangheng95 / PyABSA

Sentiment Analysis, Text Classification, Text Augmentation, Text Adversarial defense, etc.;
https://pyabsa.readthedocs.io
MIT License
909 stars 153 forks source link

keep encounring PermissionError #75

Closed WeiLi9811 closed 2 years ago

WeiLi9811 commented 2 years ago

Hi! Thanks so much for sharing your code first, but i kept facing the same problem when operating your code. whenever i input: sent_classifier = Trainer(config=apc_config_english, dataset=dataset_path, # train set and test set will be automatically detected checkpoint_save_mode=1, # = None to avoid save model auto_device=True # automatic choose CUDA or CPU ) I always receive errors as follows: PermissionError Traceback (most recent call last)

in ----> 1 sent_classifier = Trainer(config=apc_config_english, 2 dataset=dataset_path, # train set and test set will be automatically detected 3 checkpoint_save_mode=1, # = None to avoid save model 4 auto_device=True # automatic choose CUDA or CPU 5 ) D:\Anaconda\lib\site-packages\pyabsa\functional\trainer\trainer.py in __init__(self, config, dataset, from_checkpoint, checkpoint_save_mode, auto_device) 86 self.config.dataset_item = list(custom_dataset) 87 self.config.dataset_name = custom_dataset.dataset_name ---> 88 self.dataset_file = detect_dataset(dataset, task=self.task) 89 self.config.dataset_file = self.dataset_file 90 self.config = init_config(self.config, auto_device) D:\Anaconda\lib\site-packages\pyabsa\functional\dataset\dataset_manager.py in detect_dataset(dataset_path, task) 71 print('{} dataset is integrated dataset from: {}'.format(d, 'https://github.com/yangheng95/ABSADatasets')) 72 download_datasets_from_github(os.getcwd()) ---> 73 search_path = find_dir(os.getcwd(), ['integrated_dataset'], exclude_key=['infer', 'test.'], disable_alert=True) 74 dataset_file['train'] += find_files(search_path, [d, 'train', task], exclude_key=['infer', 'test.', '.py']) 75 dataset_file['test'] += find_files(search_path, [d, 'test', task], exclude_key=['infer', 'train.', '.py']) D:\Anaconda\lib\site-packages\findfile\find.py in find_dir(search_path, key, exclude_key, use_regex, recursive, disable_alert) 181 :return the first target dir 182 ''' --> 183 res = find_dirs(search_path, key, exclude_key, use_regex, recursive) 184 185 if len(res) > 1 and not disable_alert: D:\Anaconda\lib\site-packages\findfile\find.py in find_dirs(search_path, key, exclude_key, use_regex, recursive) 167 for file in items: 168 if recursive: --> 169 res += find_dirs(os.path.join(search_path, file), key, exclude_key, use_regex, recursive) 170 171 return res D:\Anaconda\lib\site-packages\findfile\find.py in find_dirs(search_path, key, exclude_key, use_regex, recursive) 167 for file in items: 168 if recursive: --> 169 res += find_dirs(os.path.join(search_path, file), key, exclude_key, use_regex, recursive) 170 171 return res D:\Anaconda\lib\site-packages\findfile\find.py in find_dirs(search_path, key, exclude_key, use_regex, recursive) 167 for file in items: 168 if recursive: --> 169 res += find_dirs(os.path.join(search_path, file), key, exclude_key, use_regex, recursive) 170 171 return res D:\Anaconda\lib\site-packages\findfile\find.py in find_dirs(search_path, key, exclude_key, use_regex, recursive) 164 165 if os.path.isdir(search_path): --> 166 items = os.listdir(search_path) 167 for file in items: 168 if recursive: PermissionError: [WinError 5] 拒绝访问。: 'C:\\Users\\Li Wei\\AppData\\Local\\Application Data' I tried several solutions including changing permissions of python( and anaconda as well), none of them worked. Is there any other suggestions i could refer to? Thanks in advance.
yangheng95 commented 2 years ago

hello, please try run the code in another not protected path. e.g., Desktop directory

---Original--- From: "Wei, @.> Date: Sun, Sep 5, 2021 23:14 PM To: @.>; Cc: @.***>; Subject: [yangheng95/PyABSA] keep encounring PermissionError (#75)

Hi! Thanks so much for sharing your code first, but i kept facing the same problem when operating your code. whenever i input: sent_classifier = Trainer(config=apc_config_english, dataset=dataset_path, # train set and test set will be automatically detected checkpoint_save_mode=1, # = None to avoid save model auto_device=True # automatic choose CUDA or CPU ) I always receive errors as follows: PermissionError Traceback (most recent call last) in ----> 1 sent_classifier = Trainer(config=apc_config_english, 2 dataset=dataset_path, # train set and test set will be automatically detected 3 checkpoint_save_mode=1, # = None to avoid save model 4 auto_device=True # automatic choose CUDA or CPU 5 )

D:\Anaconda\lib\site-packages\pyabsa\functional\trainer\trainer.py in init(self, config, dataset, from_checkpoint, checkpoint_save_mode, auto_device) 86 self.config.dataset_item = list(custom_dataset) 87 self.config.dataset_name = custom_dataset.dataset_name ---> 88 self.dataset_file = detect_dataset(dataset, task=self.task) 89 self.config.dataset_file = self.dataset_file 90 self.config = init_config(self.config, auto_device)

D:\Anaconda\lib\site-packages\pyabsa\functional\dataset\dataset_manager.py in detect_dataset(dataset_path, task) 71 print('{} dataset is integrated dataset from: {}'.format(d, 'https://github.com/yangheng95/ABSADatasets')) 72 download_datasets_from_github(os.getcwd()) ---> 73 search_path = find_dir(os.getcwd(), ['integrated_dataset'], exclude_key=['infer', 'test.'], disable_alert=True) 74 dataset_file['train'] += find_files(search_path, [d, 'train', task], exclude_key=['infer', 'test.', '.py']) 75 dataset_file['test'] += find_files(search_path, [d, 'test', task], exclude_key=['infer', 'train.', '.py'])

D:\Anaconda\lib\site-packages\findfile\find.py in find_dir(search_path, key, exclude_key, use_regex, recursive, disable_alert) 181 :return the first target dir 182 ''' --> 183 res = find_dirs(search_path, key, exclude_key, use_regex, recursive) 184 185 if len(res) > 1 and not disable_alert:

D:\Anaconda\lib\site-packages\findfile\find.py in find_dirs(search_path, key, exclude_key, use_regex, recursive) 167 for file in items: 168 if recursive: --> 169 res += find_dirs(os.path.join(search_path, file), key, exclude_key, use_regex, recursive) 170 171 return res

D:\Anaconda\lib\site-packages\findfile\find.py in find_dirs(search_path, key, exclude_key, use_regex, recursive) 167 for file in items: 168 if recursive: --> 169 res += find_dirs(os.path.join(search_path, file), key, exclude_key, use_regex, recursive) 170 171 return res

D:\Anaconda\lib\site-packages\findfile\find.py in find_dirs(search_path, key, exclude_key, use_regex, recursive) 167 for file in items: 168 if recursive: --> 169 res += find_dirs(os.path.join(search_path, file), key, exclude_key, use_regex, recursive) 170 171 return res

D:\Anaconda\lib\site-packages\findfile\find.py in find_dirs(search_path, key, exclude_key, use_regex, recursive) 164 165 if os.path.isdir(search_path): --> 166 items = os.listdir(search_path) 167 for file in items: 168 if recursive:

PermissionError: [WinError 5] 拒绝访问。: 'C:\Users\Li Wei\AppData\Local\Application Data' I tried several solutions including changing permissions of python( and anaconda as well), none of them worked. Is there any other suggestions i could refer to? Thanks in advance.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

yangheng95 commented 2 years ago

You can try the test version pip install pyabsa==1.1.13a1 to solve the PermissionError