Skip to content

RuntimeError RunPod Pytorch 2.4.0 #1923

Closed

Description

@nvjob

`---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[1], line 3
1 ### Unsloth
----> 3 from unsloth import FastLanguageModel
4 import torch
5 max_seq_length = 2048 # Choose any! We auto support RoPE Scaling internally!

File /usr/local/lib/python3.11/dist-packages/unsloth/init.py:214
211 raise ImportError("Unsloth: Please install unsloth_zoo via pip install unsloth_zoo")
212 pass
--> 214 from .models import *
215 from .models import version
216 from .save import *

File /usr/local/lib/python3.11/dist-packages/unsloth/models/init.py:15
1 # Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
(...)
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
---> 15 from .llama import FastLlamaModel
16 from .loader import FastLanguageModel, FastVisionModel
17 from .mistral import FastMistralModel

File /usr/local/lib/python3.11/dist-packages/unsloth/models/llama.py:2683
2680 pass
2682 from .rl import PatchFastRL
-> 2683 PatchFastRL(FastLanguageModel = FastLlamaModel)

File /usr/local/lib/python3.11/dist-packages/unsloth/models/rl.py:691, in PatchFastRL(algorithm, FastLanguageModel)
689 def PatchFastRL(algorithm = None, FastLanguageModel = None):
690 if FastLanguageModel is not None: PatchRL(FastLanguageModel)
--> 691 patch_trl_rl_trainers()
692 if type(algorithm) is str and algorithm.islower():
693 PatchRLStatistics(algorithm)

File /usr/local/lib/python3.11/dist-packages/unsloth/models/rl.py:684, in patch_trl_rl_trainers()
682 all_trainers = [x for x in all_trainers if x.islower() and x.endswith("_trainer")]
683 for trainer in all_trainers:
--> 684 _patch_trl_rl_trainers(trainer)
685 return

File /usr/local/lib/python3.11/dist-packages/unsloth/models/rl.py:504, in _patch_trl_rl_trainers(trainer_file)
501 RLTrainer_source = re.sub(r"[\n]{3,}", "\n", RLTrainer_source)
503 # Create new function
--> 504 created_module = create_new_function(
505 f"Unsloth{RLTrainer_name}",
506 RLTrainer_source,
507 f"trl.trainer.{trainer_file}",
508 imports,
509 overwrite = False,
510 )
512 # Patch Trainer
513 exec(f"trl.{RLTrainer_name} = created_module.Unsloth{RLTrainer_name}", locals(), globals())

File /usr/local/lib/python3.11/dist-packages/unsloth_zoo/compiler.py:296, in create_new_function(name, new_source, model_location, functions, prepend, append, overwrite, add_torch_compile)
294 if overwrite or not os.path.isfile(file_location):
295 while not os.path.isfile(file_location):
--> 296 if trials == 1000: raise RuntimeError("Unsloth: Failed to create dynamic compiled modules!")
297 trials += 1
298 time.sleep(0.01)

RuntimeError: Unsloth: Failed to create dynamic compiled modules!`

Activity

  1. added a commit that references this issue on Mar 6, 2025
  2. danielhanchen commented on Mar 6, 2025

    @danielhanchen
    Member

    @nvjob Extreme apologies - I rechecked everything and pushed some fixes - so sorry on the issue!

    For local machines, please do:

    pip install --upgrade --force-reinstall --no-deps unsloth unsloth_zoo
    

    For Colab / Kaggle machines, please disconnect and restart the runtime!

    You should see Unsloth's version at least is 2025.3.8:
    Image

  3. added a commit that references this issue on May 14, 2026
  4. danielhanchen commented on Sep 9, 2026

    @danielhanchen
    Member

    Fixed! The compiled cache writer was rewritten to do a locked, fsynced write that reads its bytes back, and if the cache folder is unwritable it falls back to a temp directory instead of spinning 1000 times waiting for a file that never appears.

    Please update Unsloth: uv pip install --upgrade unsloth unsloth_zoo --force-reinstall --no-cache-dir (if it's not in the current release yet it'll be in the next one). Reopen if it still happens!

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