Skip to content

openai_harmony.HarmonyError: error downloading or loading vocab file: failed to download or load #46

Open

Description

@lianxintao

In an offline environment without a network, the following error will be reported:
File "/home/lianxintao/venv-gpt/lib/python3.12/site-packages/openai_harmony/init.py", line 689, in load_harmony_encoding
inner: _PyHarmonyEncoding = _load_harmony_encoding(name)
openai_harmony.HarmonyError: error downloading or loading vocab file: failed to download or load vocab file。

how can I slove this problem 。

Activity

  1. jameslai-dev commented on Aug 7, 2025

    @jameslai-dev

    I'm not entirely sure if I did it correctly or not.
    I found that a /tmp/tiktoken-rs-cache is created after running the load_harmony_encoding function.
    After I uploaded and mounted the directory into the container, I can launch the model purely offline.

  2. lianxintao commented on Aug 7, 2025

    @lianxintao
    Author

    yes, you are right,.#41

  3. Redias commented on Aug 8, 2025

    @Redias

    I'm not entirely sure if I did it correctly or not. I found that a /tmp/tiktoken-rs-cache is created after running the load_harmony_encoding function. After I uploaded and mounted the directory into the container, I can launch the model purely offline.

    I want to know which files you uploaded and mounted and where I can download them? I upload 2 files but error exists though. Thx!

    ls -l /tmp/tiktoken-rs-cache/
    total 5176
    -rw-rw-r-- 1 1002 1002 1681126 Aug  8 02:26 cl100k_base.tiktoken
    -rw-rw-r-- 1 1002 1002 3613922 Aug  8 02:25 o200k_base.tiktoken
    
  4. Gh0stWires commented on Aug 8, 2025

    @Gh0stWires

    I am also receiving this error but I am on an online environment. I have the library installed in a python virtual env thats running on a RPi connected to the network but I get this error

    python -c "from openai_harmony import load_harmony_encoding, HarmonyEncodingName as N; load_harmony_encoding(N.HARMONY_GPT_OSS)"
    Traceback (most recent call last):
    File "", line 1, in
    File "/home/gh0st/env/lib/python3.11/site-packages/openai_harmony/init.py", line 689, in load_harmony_encoding
    inner: _PyHarmonyEncoding = _load_harmony_encoding(name)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    openai_harmony.HarmonyError: error downloading or loading vocab file: failed to download or load vocab file

  5. Hexoplon commented on Aug 8, 2025

    @Hexoplon

    When running on a corporate network with TLS decryption this error also occurs. Seems that the rust implementation does not respect the system trust store.

  6. jameslai-dev commented on Aug 9, 2025

    @jameslai-dev

    I'm not entirely sure if I did it correctly or not. I found that a /tmp/tiktoken-rs-cache is created after running the load_harmony_encoding function. After I uploaded and mounted the directory into the container, I can launch the model purely offline.

    I want to know which files you uploaded and mounted and where I can download them? I upload 2 files but error exists though. Thx!

    ls -l /tmp/tiktoken-rs-cache/
    total 5176
    -rw-rw-r-- 1 1002 1002 1681126 Aug  8 02:26 cl100k_base.tiktoken
    -rw-rw-r-- 1 1002 1002 3613922 Aug  8 02:25 o200k_base.tiktoken
    

    Hi Red,

    I uploaded the /tmp/tiktoken-rs-cache directory entirely without modifying the file names. Please give it a try.
    Image

    I got this directory generated after executing the following command:

    python -c "import openai_harmony; openai_harmony.load_harmony_encoding(openai_harmony.HarmonyEncodingName.HARMONY_GPT_OSS)"
  7. gaby commented on Aug 10, 2025

    @gaby

    Why is this library downloading files during runtime? This causes a lot of issues in local/offline environments.

    @Redias @Gh0stWires @Hexoplon I was able to get it working by setting an ENV variable named TIKTOKEN_ENCODINGS_BASE pointing to the folder with the 2 encoding files.

    You do have to download both files before hand and put them in a directory on your host. The files are:

    Related vllm-project/vllm#22525

  8. Redias commented on Aug 10, 2025

    @Redias

    I download the vocab file in this method.

    TIKTOKEN_RS_CACHE_DIR=/vocab/download/path python -c 'from openai_harmony import load_harmony_encoding; load_harmony_encoding("HarmonyGptOss")'

    ref: https://huggingface.co/openai/gpt-oss-120b/discussions/39#6892d6cc421a56a8deb417a7

  9. StoKou commented on Dec 4, 2025

    @StoKou

    so is there a solution for all?

    root@ai-vtraining-gpu-prd-10-121-97-208:/data# ls -l /tmp/tiktoken-rs-cache/
    total 5176
    -rw-r--r-- 1 root root 1681126 Dec  4 07:10 cl100k_base.tiktoken
    -rw-r--r-- 1 root root 3613922 Dec  4 07:10 o200k_base.tiktoken
    root@ai-vtraining-gpu-prd-10-121-97-208:/data# python -c "import openai_harmony; openai_harmony.load_harmony_encoding(openai_harmony.HarmonyEncodingName.HARMONY_GPT_OSS)"
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/local/lib/python3.12/dist-packages/openai_harmony/__init__.py", line 689, in load_harmony_encoding
        inner: _PyHarmonyEncoding = _load_harmony_encoding(name)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    openai_harmony.HarmonyError: error downloading or loading vocab file: failed to download or load vocab file
    root@ai-vtraining-gpu-prd-10-121-97-208:/data# 
    
  10. Redias commented on Dec 5, 2025

    @Redias

    so is there a solution for all?

    root@ai-vtraining-gpu-prd-10-121-97-208:/data# ls -l /tmp/tiktoken-rs-cache/
    total 5176
    -rw-r--r-- 1 root root 1681126 Dec  4 07:10 cl100k_base.tiktoken
    -rw-r--r-- 1 root root 3613922 Dec  4 07:10 o200k_base.tiktoken
    root@ai-vtraining-gpu-prd-10-121-97-208:/data# python -c "import openai_harmony; openai_harmony.load_harmony_encoding(openai_harmony.HarmonyEncodingName.HARMONY_GPT_OSS)"
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/local/lib/python3.12/dist-packages/openai_harmony/__init__.py", line 689, in load_harmony_encoding
        inner: _PyHarmonyEncoding = _load_harmony_encoding(name)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    openai_harmony.HarmonyError: error downloading or loading vocab file: failed to download or load vocab file
    root@ai-vtraining-gpu-prd-10-121-97-208:/data# 
    

    just use TIKTOKEN_RS_CACHE_DIR=/vocab/download/path python -c 'from openai_harmony import load_harmony_encoding; load_harmony_encoding("HarmonyGptOss")'

    But there are some errors in your env and code. You can use an independent env to download the vocab file, and move it to where you want to use. Notify that move to /tmp/tiktoken-rs-cache/, and the vocab filename is a hash-result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions