Wang Yuanhong

Results 1 comments of Wang Yuanhong

参考:https://zhuanlan.zhihu.com/p/637233783?utm_id=0 第一次调用encoding_for_model()时,编码数据将通过HTTP从 [http://openaipublic.blob.core.windows.net](https://link.zhihu.com/?target=http%3A//openaipublic.blob.core.windows.net) Azure Blob存储桶(storage bucket)获取(代码:[https://github.com/openai/tiktoken/blob/0.4.0/tiktoken_ext/openai_public.py](https://link.zhihu.com/?target=https%3A//github.com/openai/tiktoken/blob/0.4.0/tiktoken_ext/openai_public.py))。这些数据会被缓存在临时目录中,但如果机器重新启动,该目录将被清除。你可通过设置 TIKTOKEN_CACHE_DIR环境变量来强制使用更持久的缓存目录。 参考tiktoken源码: ```python ... def read_file_cached(blobpath: str) -> bytes: user_specified_cache = True if "TIKTOKEN_CACHE_DIR" in os.environ: cache_dir = os.environ["TIKTOKEN_CACHE_DIR"] elif "DATA_GYM_CACHE_DIR" in os.environ: cache_dir...