oliverlevn commited on
Commit
f24cd00
·
verified ·
1 Parent(s): 2c2b38d

remote trust code

Browse files
Files changed (1) hide show
  1. processing_time_rcd.py +14 -2
processing_time_rcd.py CHANGED
@@ -196,6 +196,17 @@ class TimeRCDProcessor(ProcessorMixin):
196
  import os
197
  from huggingface_hub import hf_hub_download
198
 
 
 
 
 
 
 
 
 
 
 
 
199
  # Try to load from local path first
200
  config_file = os.path.join(pretrained_model_name_or_path, "preprocessor_config.json")
201
 
@@ -209,7 +220,7 @@ class TimeRCDProcessor(ProcessorMixin):
209
  config_file = hf_hub_download(
210
  repo_id=pretrained_model_name_or_path,
211
  filename="preprocessor_config.json",
212
- **kwargs
213
  )
214
  with open(config_file, "r") as f:
215
  config = json.load(f)
@@ -219,8 +230,9 @@ class TimeRCDProcessor(ProcessorMixin):
219
  f"Error: {e}"
220
  )
221
 
222
- # Remove processor_type from config
223
  config.pop("processor_type", None)
 
224
 
225
  return cls(**config)
226
 
 
196
  import os
197
  from huggingface_hub import hf_hub_download
198
 
199
+ # Filter kwargs to only include those accepted by hf_hub_download
200
+ # Remove transformers-specific kwargs like 'trust_remote_code'
201
+ hf_hub_kwargs = {
202
+ k: v for k, v in kwargs.items()
203
+ if k in [
204
+ 'cache_dir', 'force_download', 'proxies', 'resume_download',
205
+ 'token', 'revision', 'local_files_only', 'library_name',
206
+ 'library_version', 'user_agent', 'subfolder'
207
+ ]
208
+ }
209
+
210
  # Try to load from local path first
211
  config_file = os.path.join(pretrained_model_name_or_path, "preprocessor_config.json")
212
 
 
220
  config_file = hf_hub_download(
221
  repo_id=pretrained_model_name_or_path,
222
  filename="preprocessor_config.json",
223
+ **hf_hub_kwargs
224
  )
225
  with open(config_file, "r") as f:
226
  config = json.load(f)
 
230
  f"Error: {e}"
231
  )
232
 
233
+ # Remove processor_type and auto_map from config
234
  config.pop("processor_type", None)
235
+ config.pop("auto_map", None)
236
 
237
  return cls(**config)
238