You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Failed to create dynamic compiled modules and RecursionError: maximum recursion depth [FIXED] #1925
I have the same issue. The problem is with the march updates. Versions until Feb work fine. I tried it with various machines A6000 A100 H100 and also using a requrements file taken from a notebook that doesnt produce the error nothing fixed it.
On runpod, the same problem, I tried everything I could, everything worked before, I thought I was doing something wrong, it turns out that something broke in the repository. #1923
unsloth==2025.2.14 unsloth_zoo==2025.2.7
Unfortunately, this version also has an error, but a different. No label_names provided for model class PeftModelForCausalLM. Since PeftModel hides base models input arguments, if label_names is not given, label_names can't be set automatically within Trainer. Note that empty label_names list will be used instead. #1788
unsloth==2025.3.6 unsloth_zoo==2025.3.4
In runpod, this version doesn't work either.
I upgraded unsloth and unsloth to the latest versions. The code I wrote runs normally. However, I used llama_factory and then accelerated it with unlsoth, but I still got the same error. Failed to create dynamic compiled. I modified the code of unsloth_zoo according to the issue in llama_factory and it can run normally. But I don't know if this is a bug of unsloth or llama_factory。
the issue of llama_factory: hiyouga/LlamaFactory#7177 hiyouga/LlamaFactory#7170 (comment)
So after the last couple of updates I dont get this errror. However I want to share something that I noticed. The same exactly enviroment will run for me with jupyter but not directly (dircetly it will give the error). I had this issue with many gpus, including vast and runpod. Since the error is resolved, I am really really curious what caused it first place. My belief is that some kind of overwriting was forbidden in some cases, but jupyter isolated enough to allow this.
This should be fixed now - sorry on the delay - please update with uv pip install --upgrade unsloth unsloth_zoo --force-reinstall --no-cache-dir - if it's not fixed yet, it'll be in the next pip / PyPI release - if it's still not working after that, please open another issue - appreciate it again!
Activity
chishti055nsu commentedon Mar 6, 2025
Having same problem
How to solv this ?
spydaz commentedon Mar 6, 2025
Same !! I tried loads of things even loading the nightly source code !
i think perhaps a cuda issue ? it kept also saying it needed to be imported first ???
dustinwloring1988 commentedon Mar 6, 2025
this seems to have happened after the last update use an older version might help
spydaz commentedon Mar 6, 2025
this is a live error on all notebooks !
artnoage commentedon Mar 6, 2025
I have the same issue. The problem is with the march updates. Versions until Feb work fine. I tried it with various machines A6000 A100 H100 and also using a requrements file taken from a notebook that doesnt produce the error nothing fixed it.
kozzy97 commentedon Mar 6, 2025
+1
gweesin commentedon Mar 6, 2025
pip install unsloth==2025.2.14 unsloth_zoo==2025.2.7also works for me.harshalmore31 commentedon Mar 6, 2025
Having same problem
nvjob commentedon Mar 6, 2025
On runpod, the same problem, I tried everything I could, everything worked before, I thought I was doing something wrong, it turns out that something broke in the repository. #1923
Dillion commentedon Mar 6, 2025
!pip install unsloth==2025.3.6 unsloth_zoo==2025.3.4works on colab, thats yesterday's releasenvjob commentedon Mar 6, 2025
Thank you very much!
eshita-3104 commentedon Mar 6, 2025
This worked for me too, thanks!:)
LudWittg commentedon Mar 6, 2025
This worked fine for me on Colab.
However,
didn't on Colab (oddly, but I haven’t looked into it—and I don’t plan to).
nvjob commentedon Mar 6, 2025
unsloth==2025.2.14 unsloth_zoo==2025.2.7
Unfortunately, this version also has an error, but a different.
No label_names provided for model class
PeftModelForCausalLM. SincePeftModelhides base models input arguments, if label_names is not given, label_names can't be set automatically withinTrainer. Note that empty label_names list will be used instead.#1788
unsloth==2025.3.6 unsloth_zoo==2025.3.4
In runpod, this version doesn't work either.
14 remaining items
danielhanchen commentedon Mar 6, 2025
Sorry on the issue guys again!
Strong-Gavin commentedon Mar 7, 2025
I upgraded unsloth and unsloth to the latest versions. The code I wrote runs normally. However, I used llama_factory and then accelerated it with unlsoth, but I still got the same error. Failed to create dynamic compiled. I modified the code of unsloth_zoo according to the issue in llama_factory and it can run normally. But I don't know if this is a bug of unsloth or llama_factory。
the issue of llama_factory:
hiyouga/LlamaFactory#7177
hiyouga/LlamaFactory#7170 (comment)
vreamer commentedon Mar 7, 2025
I'm still facing the issue after running this
pip install --upgrade --force-reinstall --no-deps unsloth unsloth_zoomicDKpara commentedon Mar 7, 2025
Thanks Daniel 💯 /
micDKpara commentedon Mar 7, 2025
I do this and it worked in Colab:::
Do this only in Colab notebooks! Otherwise use pip install unsloth
CurtiusSimplus commentedon Mar 7, 2025
This from above: !pip install --no-deps bitsandbytes accelerate xformers==0.0.29 peft trl triton
!pip install --upgrade unsloth_zoo==2025.3.7
!pip install sentencepiece protobuf datasets huggingface_hub hf_transfer
!pip install --upgrade unsloth==2025.3.8
Works perfectly AFAIK.
Running a Nemo Finetune right now ...
Thanks again folks. You do good work.
CurtiusSimplus commentedon Mar 7, 2025
Bro ... You have NOTHING to have sorrow over ... You are Johnny on the Spot about these things.
Thank You.
shimmyshimmer commentedon Mar 11, 2025
Great to hear and glad it worked!
artnoage commentedon Mar 13, 2025
So after the last couple of updates I dont get this errror. However I want to share something that I noticed. The same exactly enviroment will run for me with jupyter but not directly (dircetly it will give the error). I had this issue with many gpus, including vast and runpod. Since the error is resolved, I am really really curious what caused it first place. My belief is that some kind of overwriting was forbidden in some cases, but jupyter isolated enough to allow this.
edwardlee4948 commentedon Mar 19, 2025
Error still persists in version 2025.3.12 of unsloth-zoo.
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:493: SyntaxWarning: invalid escape sequence '\s'
left = re.match("[\s\n]{4,}", leftover).span()[1]
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:921: SyntaxWarning: invalid escape sequence '*'
.replace("", "*").replace("^", "^")
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:921: SyntaxWarning: invalid escape sequence '^'
.replace("", "*").replace("^", "^")
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:922: SyntaxWarning: invalid escape sequence '-'
.replace("-", "-").replace("", "_")
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:922: SyntaxWarning: invalid escape sequence '_'
.replace("-", "-").replace("", "_")
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:923: SyntaxWarning: invalid escape sequence ':'
.replace(":", ":").replace("+", "+")
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:923: SyntaxWarning: invalid escape sequence '+'
.replace(":", ":").replace("+", "+")
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:924: SyntaxWarning: invalid escape sequence '.'
.replace(".", ".").replace(",", ",")
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:924: SyntaxWarning: invalid escape sequence ','
.replace(".", ".").replace(",", ",")
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:925: SyntaxWarning: invalid escape sequence '('
.replace("(", "(").replace(")", ")")
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:925: SyntaxWarning: invalid escape sequence ')'
.replace("(", "(").replace(")", ")")
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:926: SyntaxWarning: invalid escape sequence '['
.replace("[", "[").replace("]", "]")
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:926: SyntaxWarning: invalid escape sequence ']'
.replace("[", "[").replace("]", "]")
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:1015: SyntaxWarning: invalid escape sequence '_'
if "loss_function" in cross_entropy_find and "loss_function" not in forward:
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:1017: SyntaxWarning: invalid escape sequence '_'
elif "loss_function" not in cross_entropy_find and "loss_function" in forward:
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:1053: SyntaxWarning: invalid escape sequence '.'
if "logits = outputs.logits" in cross_entropy_find:
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:1160: SyntaxWarning: invalid escape sequence ':'
r"for ([^\s]{1,}) in " + modulelist_item + ":[\n]" +
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:1364: SyntaxWarning: invalid escape sequence '('
regex_find = f"{call_class}(([^)]{{1,}}))"
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:1364: SyntaxWarning: invalid escape sequence ')'
regex_find = f"{call_class}(([^)]{{1,}}))"
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:1370: SyntaxWarning: invalid escape sequence '('
regex_find = "def forward(([^)]{1,}))"
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:1471: SyntaxWarning: invalid escape sequence ')'
inherited_modules = re.findall(r"class ([^\s]{1,})(" + inherited_class + ")", full_source)
/.venv/lib/python3.12/site-packages/unsloth_zoo/compiler.py:1514: SyntaxWarning: invalid escape sequence '('
called = re.findall(r"[\s]{1,}" + re.escape(function) + "(.+?)", full_source, flags = re.DOTALL)
/.venv/lib/python3.12/site-packages/unsloth_zoo/peft_utils.py:222: SyntaxWarning: invalid escape sequence '.'
name = re.sub(".([\d]{1,}).", r"[\1].", name)
Big bug fixes
danielhanchen commentedon Jun 18, 2026
This should be fixed now - sorry on the delay - please update with
uv pip install --upgrade unsloth unsloth_zoo --force-reinstall --no-cache-dir- if it's not fixed yet, it'll be in the next pip / PyPI release - if it's still not working after that, please open another issue - appreciate it again!