alfraser commited on
Commit
3853f7c
·
1 Parent(s): 5ea3cc9

Added option to directly pass the HF hub token when wiping the trace file, so I can use it locally outside of streamlit. Defaulted to None avoid changing existing behaviour.

Browse files
Files changed (1) hide show
  1. src/architectures.py +3 -2
src/architectures.py CHANGED
@@ -203,11 +203,12 @@ class Architecture:
203
  trace_file = os.path.join(trace_dir, trace_file_name)
204
 
205
  @classmethod
206
- def wipe_trace(cls):
207
  if os.path.exists(cls.trace_dir):
208
  shutil.rmtree(cls.trace_dir)
209
  try:
210
- hf_write_token = hf_api_token(write=True)
 
211
  cls.save_repo = Repository(local_dir=cls.trace_dir, clone_from=cls.save_repo_url, token=hf_write_token)
212
  test_json = {'tests': []}
213
  with open(cls.trace_file, 'w') as f:
 
203
  trace_file = os.path.join(trace_dir, trace_file_name)
204
 
205
  @classmethod
206
+ def wipe_trace(cls, hf_write_token:str = None):
207
  if os.path.exists(cls.trace_dir):
208
  shutil.rmtree(cls.trace_dir)
209
  try:
210
+ if hf_write_token is None:
211
+ hf_write_token = hf_api_token(write=True)
212
  cls.save_repo = Repository(local_dir=cls.trace_dir, clone_from=cls.save_repo_url, token=hf_write_token)
213
  test_json = {'tests': []}
214
  with open(cls.trace_file, 'w') as f: