Check if the cache directory exists and clear it if it does
if os.path.exists(cache_dir):
print("Cache directory found. Attempting to clear it...")
shutil.rmtree(cache_dir)
print("Cache directory cleared.")
else:
print("Cache directory does not exist.")
- Tried re installing tiktoken
Any ideas on how I could fix this error?
Thanks in advance!
This is the code I'm trying to run
tokenizer = tiktoken.get_encoding("gpt2")
and this is the error I get:From issue #51, here is the full log:
Here is what I tried: (Solutions from #63 )
Identify the cache directory
cache_dir = os.path.join(tempfile.gettempdir(), "data-gym-cache") print(f"Cache directory: {cache_dir}")
Check if the cache directory exists and clear it if it does
if os.path.exists(cache_dir): print("Cache directory found. Attempting to clear it...") shutil.rmtree(cache_dir) print("Cache directory cleared.") else: print("Cache directory does not exist.")