modernBERT Duplicate Template Name
Author: kpdowney
Pull request: no
Labels: name: bug

### System Info

transformers 4.50.3
torch 2.6.0
python 3.11
MacOS 15.3.2

Trying to run a simple test in a notebook I get the following error:
RuntimeError: Failed to import transformers.models.modernbert.modeling_modernbert because of the following error (look up to see its traceback):
duplicate template name

I have completely uninstalled transformers and re-installed the latest version. I even tried to compile from git on the 4.51.0dev version to see if that resolved the issue. I also updated and reinstalled torch. Note that I tested this on both the base modernbert model and this simple code:
from transformers import pipeline
classifier = pipeline("zero-shot-classification",model="tasksource/ModernBERT-base-nli")

The exact same result each time. Any assistance would be appreciated.

Here is the full trace:

config.json:   0%|          | 0.00/5.54k [00:00<?, ?B/s]
[0;31m---------------------------------------------------------------------------[0m
[0;31mAssertionError[0m                            Traceback (most recent call last)
File [0;32m~/Documents/Companies/Sentinel/Codebase/Python/2023_Code/venv/lib/python3.11/site-packages/transformers/utils/import_utils.py:1976[0m, in [0;36m_LazyModule._get_module[0;34m(self, module_name)[0m
[1;32m   1975[0m [38;5;28;01mtry[39;00m:
[0;32m-> 1976[0m     [38;5;28;01mreturn[39;00m [43mimportlib[49m[38;5;241;43m.[39;49m[43mimport_module[49m[43m([49m[38;5;124;43m"[39;49m[38;5;124;43m.[39;49m[38;5;124;43m"[39;49m[43m [49m[38;5;241;43m+[39;49m[43m [49m[43mmodule_name[49m[43m,[49m[43m [49m[38;5;28;43mself[39;49m[38;5;241;43m.[39;49m[38;5;18;43m__name__[39;49m[43m)[49m
[1;32m   1977[0m [38;5;28;01mexcept[39;00m [38;5;167;01mException[39;00m [38;5;28;01mas[39;00m e:

File [0;32m/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py:126[0m, in [0;36mimport_module[0;34m(name, package)[0m
[1;32m    125[0m         level [38;5;241m+[39m[38;5;241m=[39m [38;5;241m1[39m
[0;32m--> 126[0m [38;5;28;01mreturn[39;00m [43m_bootstrap[49m[38;5;241;43m.[39;49m[43m_gcd_import[49m[43m([49m[43mname[49m[43m[[49m[43mlevel[49m[43m:[49m[43m][49m[43m,[49m[43m [49m[43mpackage[49m[43m,[49m[43m [49m[43mlevel[49m[43m)[49m

File [0;32m<frozen importlib._bootstrap>:1206[0m, in [0;36m_gcd_import[0;34m(name, package, level)[0m

File [0;32m<frozen importlib._bootstrap>:1178[0m, in [0;36m_find_and_load[0;34m(name, import_)[0m

File [0;32m<frozen importlib._bootstrap>:1149[0m, in [0;36m_find_and_load_unlocked[0;34m(name, import_)[0m

File [0;32m<frozen importlib._bootstrap>:690[0m, in [0;36m_load_unlocked[0;34m(spec)[0m

File [0;32m<frozen importlib._bootstrap_external>:940[0m, in [0;36mexec_module[0;34m(self, module)[0m

File [0;32m<frozen importlib._bootstrap>:241[0m, in [0;36m_call_with_frames_removed[0;34m(f, *args, **kwds)[0m

File [0;32m~/Documents/Companies/Sentinel/Codebase/Python/2023_Code/venv/lib/python3.11/site-packages/transformers/models/modernbert/modeling_modernbert.py:200[0m
[1;32m    197[0m         [38;5;28;01mreturn[39;00m [38;5;124mf[39m[38;5;124m"[39m[38;5;124mdim=[39m[38;5;132;01m{[39;00m[38;5;28mself[39m[38;5;241m.[39mdim[38;5;132;01m}[39;00m[38;5;124m, base=[39m[38;5;132;01m{[39;00m[38;5;28mself[39m[38;5;241m.[39mbase[38;5;132;01m}[39;00m[38;5;124m, scale_base=[39m[38;5;132;01m{[39;00m[38;5;28mself[39m[38;5;241m.[39mscale_base[38;5;132;01m}[39;00m[38;5;124m"[39m
[0;32m--> 200[0m [38;5;28;43;01mclass[39;49;00m[43m [49m[38;5;21;43;01mModernBertEmbeddings[39;49;00m[43m([49m[43mnn[49m[38;5;241;43m.[39;49m[43mModule[49m[43m)[49m[43m:[49m
[1;32m    201[0m [38;5;250;43m    [39;49m[38;5;124;43;03m"""[39;49;00m
[1;32m    202[0m [38;5;124;43;03m    Same as BertEmbeddings with a tiny tweak for positional embeddings indexing.[39;49;00m
[1;32m    203[0m [38;5;124;43;03m    """[39;49;00m

File [0;32m~/Documents/Companies/Sentinel/Codebase/Python/2023_Code/venv/lib/python3.11/site-packages/transformers/models/modernbert/modeling_modernbert.py:212[0m, in [0;36mModernBertEmbeddings[0;34m()[0m
[1;32m    210[0m     [38;5;28mself[39m[38;5;241m.[39mdrop [38;5;241m=[39m nn[38;5;241m.[39mDropout(config[38;5;241m.[39membedding_dropout)
[0;32m--> 212[0m [43m[49m[38;5;129;43m@torch[39;49m[38;5;241;43m.[39;49m[43mcompile[49m[43m([49m[43mdynamic[49m[38;5;241;43m=[39;49m[38;5;28;43;01mTrue[39;49;00m[43m)[49m
[1;32m    213[0m [43m[49m[38;5;28;43;01mdef[39;49;00m[43m [49m[38;5;21;43mcompiled_embeddings[39;49m[43m([49m[38;5;28;43mself[39;49m[43m,[49m[43m [49m[43minput_ids[49m[43m:[49m[43m [49m[43mtorch[49m[38;5;241;43m.[39;49m[43mLongTensor[49m[43m)[49m[43m [49m[38;5;241;43m-[39;49m[38;5;241;43m>[39;49m[43m [49m[43mtorch[49m[38;5;241;43m.[39;49m[43mTensor[49m[43m:[49m
[1;32m    214[0m [43m    [49m[38;5;28;43;01mreturn[39;49;00m[43m [49m[38;5;28;43mself[39;49m[38;5;241;43m.[39;49m[43mdrop[49m[43m([49m[38;5;28;43mself[39;49m[38;5;241;43m.[39;49m[43mnorm[49m[43m([49m[38;5;28;43mself[39;49m[38;5;241;43m.[39;49m[43mtok_embeddings[49m[43m([49m[43minput_ids[49m[43m)[49m[43m)[49m[43m)[49m

File [0;32m~/Documents/Companies/Sentinel/Codebase/Python/2023_Code/venv/lib/python3.11/site-packages/torch/__init__.py:2536[0m, in [0;36mcompile.<locals>.fn[0;34m(model)[0m
[1;32m   2535[0m     [38;5;28;01mraise[39;00m [38;5;167;01mRuntimeError[39;00m([38;5;124m"[39m[38;5;124mModel can[39m[38;5;124m'[39m[38;5;124mt be None[39m[38;5;124m"[39m)
[0;32m-> 2536[0m [38;5;28;01mreturn[39;00m [38;5;28;43mcompile[39;49m[43m([49m
[1;32m   2537[0m [43m    [49m[43mmodel[49m[43m,[49m
[1;32m   2538[0m [43m    [49m[43mfullgraph[49m[38;5;241;43m=[39;49m[43mfullgraph[49m[43m,[49m
[1;32m   2539[0m [43m    [49m[43mdynamic[49m[38;5;241;43m=[39;49m[43mdynamic[49m[43m,[49m
[1;32m   2540[0m [43m    [49m[43mbackend[49m[38;5;241;43m=[39;49m[43mbackend[49m[43m,[49m
[1;32m   2541[0m [43m    [49m[43mmode[49m[38;5;241;43m=[39;49m[43mmode[49m[43m,[49m
[1;32m   2542[0m [43m    [49m[43moptions[49m[38;5;241;43m=[39;49m[43moptions[49m[43m,[49m
[1;32m   2543[0m [43m    [49m[43mdisable[49m[38;5;241;43m=[39;49m[43mdisable[49m[43m,[49m
[1;32m   2544[0m [43m[49m[43m)[49m

File [0;32m~/Documents/Companies/Sentinel/Codebase/Python/2023_Code/venv/lib/python3.11/site-packages/torch/__init__.py:2565[0m, in [0;36mcompile[0;34m(model, fullgraph, dynamic, backend, mode, options, disable)[0m
[1;32m   2563[0m     backend [38;5;241m=[39m _TorchCompileWrapper(backend, mode, options, dynamic)
[0;32m-> 2565[0m [38;5;28;01mreturn[39;00m [43mtorch[49m[38;5;241;43m.[39;49m[43m_dynamo[49m[38;5;241;43m.[39;49m[43moptimize[49m[43m([49m
[1;32m   2566[0m [43m    [49m[43mbackend[49m[38;5;241;43m=[39;49m[43mbackend[49m[43m,[49m
[1;32m   2567[0m [43m    [49m[43mnopython[49m[38;5;241;43m=[39;49m[43mfullgraph[49m[43m,[49m
[1;32m   2568[0m [43m    [49m[43mdynamic[49m[38;5;241;43m=[39;49m[43mdynamic[49m[43m,[49m
[1;32m   2569[0m [43m    [49m[43mdisable[49m[38;5;241;43m=[39;49m[43mdisable[49m[43m,[49m
[1;32m   2570[0m [43m[49m[43m)[49m(model)

File [0;32m~/Documents/Companies/Sentinel/Codebase/Python/2023_Code/venv/lib/python3.11/site-packages/torch/_dynamo/eval_frame.py:842[0m, in [0;36moptimize[0;34m(*args, **kwargs)[0m
[1;32m    840[0m     [38;5;28;01mreturn[39;00m optimize([38;5;241m*[39margs, [38;5;241m*[39m[38;5;241m*[39mkwargs)
[0;32m--> 842[0m [38;5;28;01mreturn[39;00m [43m_optimize[49m[43m([49m[43mrebuild_ctx[49m[43m,[49m[43m [49m[38;5;241;43m*[39;49m[43margs[49m[43m,[49m[43m [49m[38;5;241;43m*[39;49m[38;5;241;43m*[39;49m[43mkwargs[49m[43m)[49m

File [0;32m~/Documents/Companies/Sentinel/Codebase/Python/2023_Code/venv/lib/python3.11/site-packages/torch/_dynamo/eval_frame.py:917[0m, in [0;36m_optimize[0;34m(rebuild_ctx, backend, nopython, guard_export_fn, guard_fail_fn, disable, dynamic)[0m
[1;32m    908[0m [38;5;66;03m# The backend function is stashed in the callable returned by[39;00m
[1;32m    909[0m [38;5;66;03m# _optimize_catch_errors in the field _torchdynamo_orig_callable. This can[39;00m
[1;32m    910[0m [38;5;66;03m# be used by eval_frame.c to insert a guard on the backend.[39;00m
[1;32m    911[0m [38;5;28;01mreturn[39;00m _optimize_catch_errors(
[1;32m    912[0m     convert_frame[38;5;241m.[39mconvert_frame(backend, hooks[38;5;241m=[39mhooks),
[1;32m    913[0m     hooks,
[1;32m    914[0m     backend_ctx_ctor,
[1;32m    915[0m     dynamic[38;5;241m=[39mdynamic,
[1;32m    916[0m     compiler_config[38;5;241m=[39m(
[0;32m--> 917[0m         [43mbackend[49m[38;5;241;43m.[39;49m[43mget_compiler_config[49m[43m([49m[43m)[49m
[1;32m    918[0m         [38;5;28;01mif[39;00m [38;5;28mhasattr[39m(backend, [38;5;124m"[39m[38;5;124mget_compiler_config[39m[38;5;124m"[39m)
[1;32m    919[0m         [38;5;28;01melse[39;00m [38;5;28;01mNone[39;00m
[1;32m    920[0m     ),
[1;32m    921[0m     rebuild_ctx[38;5;241m=[39mrebuild_ctx,
[1;32m    922[0m )

File [0;32m~/Documents/Companies/Sentinel/Codebase/Python/2023_Code/venv/lib/python3.11/site-packages/torch/__init__.py:2343[0m, in [0;36m_TorchCompileInductorWrapper.get_compiler_config[0;34m(self)[0m
[1;32m   2342[0m [38;5;28;01mdef[39;00m [38;5;21mget_compiler_config[39m([38;5;28mself[39m):
[0;32m-> 2343[0m     [38;5;28;01mfrom[39;00m [38;5;21;01mtorch[39;00m[38;5;21;01m.[39;00m[38;5;21;01m_inductor[39;00m[38;5;21;01m.[39;00m[38;5;21;01mcompile_fx[39;00m [38;5;28;01mimport[39;00m get_patched_config_dict
[1;32m   2345[0m     [38;5;28;01mreturn[39;00m get_patched_config_dict(config_patches[38;5;241m=[39m[38;5;28mself[39m[38;5;241m.[39mconfig)

File [0;32m~/Documents/Companies/Sentinel/Codebase/Python/2023_Code/venv/lib/python3.11/site-packages/torch/_inductor/compile_fx.py:97[0m
[1;32m     96[0m [38;5;28;01mfrom[39;00m [38;5;21;01m.[39;00m[38;5;21;01mdecomposition[39;00m [38;5;28;01mimport[39;00m select_decomp_table
[0;32m---> 97[0m [38;5;28;01mfrom[39;00m [38;5;21;01m.[39;00m[38;5;21;01mfx_passes[39;00m[38;5;21;01m.[39;00m[38;5;21;01mjoint_graph[39;00m [38;5;28;01mimport[39;00m joint_graph_passes
[1;32m     98[0m [38;5;28;01mfrom[39;00m [38;5;21;01m.[39;00m[38;5;21;01mfx_passes[39;00m[38;5;21;01m.[39;00m[38;5;21;01mpost_grad[39;00m [38;5;28;01mimport[39;00m post_grad_passes, view_to_reshape

File [0;32m~/Documents/Companies/Sentinel/Codebase/Python/2023_Code/venv/lib/python3.11/site-packages/torch/_inductor/fx_passes/joint_graph.py:22[0m
[1;32m     21[0m [38;5;28;01mfrom[39;00m [38;5;21;01m.[39;00m[38;5;21;01m.[39;00m [38;5;28;01mimport[39;00m config
[0;32m---> 22[0m [38;5;28;01mfrom[39;00m [38;5;21;01m.[39;00m[38;5;21;01m.[39;00m[38;5;21;01mpattern_matcher[39;00m [38;5;28;01mimport[39;00m (
[1;32m     23[0m     CallFunction,
[1;32m     24[0m     init_once_fakemode,
[1;32m     25[0m     KeywordArg,
[1;32m     26[0m     Match,
[1;32m     27[0m     MULTIPLE,
[1;32m     28[0m     PatternMatcherPass,
[1;32m     29[0m     register_graph_pattern,
[1;32m     30[0m     stable_topological_sort,
[1;32m     31[0m )
[1;32m     32[0m [38;5;28;01mfrom[39;00m [38;5;21;01m.[39;00m[38;5;21;01mreplace_random[39;00m [38;5;28;01mimport[39;00m replace_random_passes

File [0;32m~/Documents/Companies/Sentinel/Codebase/Python/2023_Code/venv/lib/python3.11/site-packages/torch/_inductor/pattern_matcher.py:95[0m
[1;32m     94[0m [38;5;28;01mfrom[39;00m [38;5;21;01m.[39;00m[38;5;21;01mdecomposition[39;00m [38;5;28;01mimport[39;00m select_decomp_table
[0;32m---> 95[0m [38;5;28;01mfrom[39;00m [38;5;21;01m.[39;00m[38;5;21;01mlowering[39;00m [38;5;28;01mimport[39;00m fallback_node_due_to_unsupported_type
[1;32m     98[0m log [38;5;241m=[39m logging[38;5;241m.[39mgetLogger([38;5;18m__name__[39m)

File [0;32m~/Documents/Companies/Sentinel/Codebase/Python/2023_Code/venv/lib/python3.11/site-packages/torch/_inductor/lowering.py:6518[0m
[1;32m   6515[0m [38;5;28;01mfrom[39;00m [38;5;21;01m.[39;00m [38;5;28;01mimport[39;00m kernel
[0;32m-> 6518[0m [43mimport_submodule[49m[43m([49m[43mkernel[49m[43m)[49m
[1;32m   6520[0m [38;5;28;01mfrom[39;00m [38;5;21;01m.[39;00m [38;5;28;01mimport[39;00m quantized_lowerings

File [0;32m~/Documents/Companies/Sentinel/Codebase/Python/2023_Code/venv/lib/python3.11/site-packages/torch/_dynamo/utils.py:2691[0m, in [0;36mimport_submodule[0;34m(mod)[0m
[1;32m   2690[0m [38;5;28;01mif[39;00m filename[38;5;241m.[39mendswith([38;5;124m"[39m[38;5;124m.py[39m[38;5;124m"[39m) [38;5;129;01mand[39;00m filename[[38;5;241m0[39m] [38;5;241m!=[39m [38;5;124m"[39m[38;5;124m_[39m[38;5;124m"[39m:
[0;32m-> 2691[0m     [43mimportlib[49m[38;5;241;43m.[39;49m[43mimport_module[49m[43m([49m[38;5;124;43mf[39;49m[38;5;124;43m"[39;49m[38;5;132;43;01m{[39;49;00m[43mmod[49m[38;5;241;43m.[39;49m[38;5;18;43m__name__[39;49m[38;5;132;43;01m}[39;49;00m[38;5;124;43m.[39;49m[38;5;132;43;01m{[39;49;00m[43mfilename[49m[43m[[49m[43m:[49m[38;5;241;43m-[39;49m[38;5;241;43m3[39;49m[43m][49m[38;5;132;43;01m}[39;49;00m[38;5;124;43m"[39;49m[43m)[49m

File [0;32m/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py:126[0m, in [0;36mimport_module[0;34m(name, package)[0m
[1;32m    125[0m         level [38;5;241m+[39m[38;5;241m=[39m [38;5;241m1[39m
[0;32m--> 126[0m [38;5;28;01mreturn[39;00m [43m_bootstrap[49m[38;5;241;43m.[39;49m[43m_gcd_import[49m[43m([49m[43mname[49m[43m[[49m[43mlevel[49m[43m:[49m[43m][49m[43m,[49m[43m [49m[43mpackage[49m[43m,[49m[43m [49m[43mlevel[49m[43m)[49m

File [0;32m~/Documents/Companies/Sentinel/Codebase/Python/2023_Code/venv/lib/python3.11/site-packages/torch/_inductor/kernel/bmm.py:52[0m
[1;32m     49[0m     [38;5;28;01mreturn[39;00m mm_configs(m, n, k)
[0;32m---> 52[0m bmm_template [38;5;241m=[39m [43mTritonTemplate[49m[43m([49m
[1;32m     53[0m [43m    [49m[43mname[49m[38;5;241;43m=[39;49m[38;5;124;43m"[39;49m[38;5;124;43mbmm[39;49m[38;5;124;43m"[39;49m[43m,[49m
[1;32m     54[0m [43m    [49m[43mgrid[49m[38;5;241;43m=[39;49m[43mbmm_grid[49m[43m,[49m
[1;32m     55[0m [43m    [49m[43msource[49m[38;5;241;43m=[39;49m[38;5;124;43mr[39;49m[38;5;124;43m"""[39;49m
[1;32m     56[0m [38;5;124;43m{{[39;49m[38;5;124;43mdef_kernel([39;49m[38;5;124;43m"[39;49m[38;5;124;43mA[39;49m[38;5;124;43m"[39;49m[38;5;124;43m, [39;49m[38;5;124;43m"[39;49m[38;5;124;43mB[39;49m[38;5;124;43m"[39;49m[38;5;124;43m)}}[39;49m
[1;32m     57[0m [38;5;124;43m    M = [39;49m[38;5;124;43m{{[39;49m[38;5;124;43msize([39;49m[38;5;124;43m"[39;49m[38;5;124;43mA[39;49m[38;5;124;43m"[39;49m[38;5;124;43m, -2)}}[39;49m
[1;32m     58[0m [38;5;124;43m    N = [39;49m[38;5;124;43m{{[39;49m[38;5;124;43msize([39;49m[38;5;124;43m"[39;49m[38;5;124;43mB[39;49m[38;5;124;43m"[39;49m[38;5;124;43m, -1)}}[39;49m
[1;32m     59[0m [38;5;124;43m    K = [39;49m[38;5;124;43m{{[39;49m[38;5;124;43msize([39;49m[38;5;124;43m"[39;49m[38;5;124;43mA[39;49m[38;5;124;43m"[39;49m[38;5;124;43m, -1)}}[39;49m
[1;32m     60[0m 
[1;32m     61[0m [38;5;124;43m    stride_aq = [39;49m[38;5;124;43m{{[39;49m[38;5;124;43mstride([39;49m[38;5;124;43m"[39;49m[38;5;124;43mA[39;49m[38;5;124;43m"[39;49m[38;5;124;43m, 0)}}[39;49m
[1;32m     62[0m [38;5;124;43m    stride_am = [39;49m[38;5;124;43m{{[39;49m[38;5;124;43mstride([39;49m[38;5;124;43m"[39;49m[38;5;124;43mA[39;49m[38;5;124;43m"[39;49m[38;5;124;43m, 1)}}[39;49m
[1;32m     63[0m [38;5;124;43m    stride_ak = [39;49m[38;5;124;43m{{[39;49m[38;5;124;43mstride([39;49m[38;5;124;43m"[39;49m[38;5;124;43mA[39;49m[38;5;124;43m"[39;49m[38;5;124;43m, 2)}}[39;49m
[1;32m     64[0m 
[1;32m     65[0m [38;5;124;43m    stride_bq = [39;49m[38;5;124;43m{{[39;49m[38;5;124;43mstride([39;49m[38;5;124;43m"[39;49m[38;5;124;43mB[39;49m[38;5;124;43m"[39;49m[38;5;124;43m, 0)}}[39;49m
[1;32m     66[0m [38;5;124;43m    stride_bk = [39;49m[38;5;124;43m{{[39;49m[38;5;124;43mstride([39;49m[38;5;124;43m"[39;49m[38;5;124;43mB[39;49m[38;5;124;43m"[39;49m[38;5;124;43m, 1)}}[39;49m
[1;32m     67[0m [38;5;124;43m    stride_bn = [39;49m[38;5;124;43m{{[39;49m[38;5;124;43mstride([39;49m[38;5;124;43m"[39;49m[38;5;124;43mB[39;49m[38;5;124;43m"[39;49m[38;5;124;43m, 2)}}[39;49m
[1;32m     68[0m 
[1;32m     69[0m [38;5;124;43m    # based on triton.ops.matmul[39;49m
[1;32m     70[0m [38;5;124;43m    pid = tl.program_id(0)[39;49m
[1;32m     71[0m [38;5;124;43m    grid_m = (M + BLOCK_M - 1) // BLOCK_M[39;49m
[1;32m     72[0m [38;5;124;43m    grid_n = (N + BLOCK_N - 1) // BLOCK_N[39;49m
[1;32m     73[0m 
[1;32m     74[0m [38;5;124;43m    # re-order program ID for better L2 performance[39;49m
[1;32m     75[0m [38;5;124;43m    width = GROUP_M * grid_n[39;49m
[1;32m     76[0m [38;5;124;43m    group_id = pid // width[39;49m
[1;32m     77[0m [38;5;124;43m    group_size = min(grid_m - group_id * GROUP_M, GROUP_M)[39;49m
[1;32m     78[0m [38;5;124;43m    pid_m = group_id * GROUP_M + (pid [39;49m[38;5;132;43;01m% g[39;49;00m[38;5;124;43mroup_size)[39;49m
[1;32m     79[0m [38;5;124;43m    pid_n = (pid [39;49m[38;5;124;43m%[39;49m[38;5;124;43m width) // (group_size)[39;49m
[1;32m     80[0m 
[1;32m     81[0m [38;5;124;43m    rm = pid_m * BLOCK_M + tl.arange(0, BLOCK_M)[39;49m
[1;32m     82[0m [38;5;124;43m    rn = pid_n * BLOCK_N + tl.arange(0, BLOCK_N)[39;49m
[1;32m     83[0m [38;5;124;43m    if (stride_am == 1 and stride_ak == M) or (stride_am == K and stride_ak == 1):[39;49m
[1;32m     84[0m [38;5;124;43m        ram = tl.max_contiguous(tl.multiple_of(rm [39;49m[38;5;124;43m%[39;49m[38;5;124;43m M, BLOCK_M), BLOCK_M)[39;49m
[1;32m     85[0m [38;5;124;43m    else:[39;49m
[1;32m     86[0m [38;5;124;43m        ram = rm [39;49m[38;5;124;43m%[39;49m[38;5;124;43m M[39;49m
[1;32m     87[0m [38;5;124;43m    if (stride_bk == 1 and stride_bn == K) or (stride_bk == N and stride_bn == 1):[39;49m
[1;32m     88[0m [38;5;124;43m        rbn = tl.max_contiguous(tl.multiple_of(rn [39;49m[38;5;124;43m%[39;49m[38;5;124;43m N, BLOCK_N), BLOCK_N)[39;49m
[1;32m     89[0m [38;5;124;43m    else:[39;49m
[1;32m     90[0m [38;5;124;43m        rbn = rn [39;49m[38;5;124;43m%[39;49m[38;5;124;43m N[39;49m
[1;32m     91[0m 
[1;32m     92[0m [38;5;124;43m    rk = tl.arange(0, BLOCK_K)[39;49m
[1;32m     93[0m 
[1;32m     94[0m [38;5;124;43m    idx_q = tl.program_id(1)  # batch dimension for BMM[39;49m
[1;32m     95[0m [38;5;124;43m    A = A + (ram[:, None] * stride_am + rk[None, :] * stride_ak + idx_q*stride_aq)[39;49m
[1;32m     96[0m [38;5;124;43m    B = B + (rk[:, None] * stride_bk + rbn[None, :] * stride_bn + idx_q*stride_bq)[39;49m
[1;32m     97[0m 
[1;32m     98[0m [38;5;124;43m    acc = tl.zeros((BLOCK_M, BLOCK_N), dtype=ACC_TYPE)[39;49m
[1;32m     99[0m [38;5;124;43m    for k in range(K, 0, -BLOCK_K):[39;49m
[1;32m    100[0m [38;5;124;43m        if EVEN_K:[39;49m
[1;32m    101[0m [38;5;124;43m            a = tl.load(A)[39;49m
[1;32m    102[0m [38;5;124;43m            b = tl.load(B)[39;49m
[1;32m    103[0m [38;5;124;43m        else:[39;49m
[1;32m    104[0m [38;5;124;43m            a = tl.load(A, mask=rk[None, :] < k, other=0.)[39;49m
[1;32m    105[0m [38;5;124;43m            b = tl.load(B, mask=rk[:, None] < k, other=0.)[39;49m
[1;32m    106[0m [38;5;124;43m        acc += tl.dot(a, b, allow_tf32=ALLOW_TF32)[39;49m
[1;32m    107[0m [38;5;124;43m        A += BLOCK_K * stride_ak[39;49m
[1;32m    108[0m [38;5;124;43m        B += BLOCK_K * stride_bk[39;49m
[1;32m    109[0m 
[1;32m    110[0m [38;5;124;43m    # rematerialize rm and rn to save registers[39;49m
[1;32m    111[0m [38;5;124;43m    rm = pid_m * BLOCK_M + tl.arange(0, BLOCK_M)[39;49m
[1;32m    112[0m [38;5;124;43m    rn = pid_n * BLOCK_N + tl.arange(0, BLOCK_N)[39;49m
[1;32m    113[0m [38;5;124;43m    idx_q = tl.program_id(1)  # batch dimension for BMM[39;49m
[1;32m    114[0m [38;5;124;43m    idx_m = rm[:, None][39;49m
[1;32m    115[0m [38;5;124;43m    idx_n = rn[None, :][39;49m
[1;32m    116[0m [38;5;124;43m    mask = (idx_m < M) & (idx_n < N)[39;49m
[1;32m    117[0m 
[1;32m    118[0m [38;5;124;43m    # inductor generates a suffix[39;49m
[1;32m    119[0m [38;5;124;43m    [39;49m[38;5;124;43m{{[39;49m[38;5;124;43mstore_output(([39;49m[38;5;124;43m"[39;49m[38;5;124;43midx_q[39;49m[38;5;124;43m"[39;49m[38;5;124;43m, [39;49m[38;5;124;43m"[39;49m[38;5;124;43midx_m[39;49m[38;5;124;43m"[39;49m[38;5;124;43m, [39;49m[38;5;124;43m"[39;49m[38;5;124;43midx_n[39;49m[38;5;124;43m"[39;49m[38;5;124;43m), [39;49m[38;5;124;43m"[39;49m[38;5;124;43macc[39;49m[38;5;124;43m"[39;49m[38;5;124;43m, [39;49m[38;5;124;43m"[39;49m[38;5;124;43mmask[39;49m[38;5;124;43m"[39;49m[38;5;124;43m)}}[39;49m
[1;32m    120[0m [38;5;124;43m"""[39;49m[43m,[49m
[1;32m    121[0m [43m)[49m
[1;32m    123[0m aten_bmm [38;5;241m=[39m ExternKernelChoice(torch[38;5;241m.[39mbmm, [38;5;124m"[39m[38;5;124mat::bmm_out[39m[38;5;124m"[39m)

File [0;32m~/Documents/Companies/Sentinel/Codebase/Python/2023_Code/venv/lib/python3.11/site-packages/torch/_inductor/select_algorithm.py:767[0m, in [0;36mTritonTemplate.__init__[0;34m(self, name, grid, source, debug)[0m
[1;32m    766[0m [38;5;28mself[39m[38;5;241m.[39mtemplate [38;5;241m=[39m [38;5;28mself[39m[38;5;241m.[39m_template_from_string(source)
[0;32m--> 767[0m [38;5;28;01massert[39;00m name [38;5;129;01mnot[39;00m [38;5;129;01min[39;00m [38;5;28mself[39m[38;5;241m.[39mall_templates, [38;5;124m"[39m[38;5;124mduplicate template name[39m[38;5;124m"[39m
[1;32m    768[0m [38;5;28mself[39m[38;5;241m.[39mall_templates[name] [38;5;241m=[39m [38;5;28mself[39m

[0;31mAssertionError[0m: duplicate template name

The above exception was the direct cause of the following exception:

[0;31mRuntimeError[0m                              Traceback (most recent call last)
Cell [0;32mIn [2], line 4[0m
[1;32m      2[0m [38;5;28;01mimport[39;00m [38;5;21;01mtorch[39;00m
[1;32m      3[0m [38;5;28;01mfrom[39;00m [38;5;21;01mtransformers[39;00m [38;5;28;01mimport[39;00m pipeline
[0;32m----> 4[0m classifier [38;5;241m=[39m [43mpipeline[49m[43m([49m[38;5;124;43m"[39;49m[38;5;124;43mzero-shot-classification[39;49m[38;5;124;43m"[39;49m[43m,[49m[43mmodel[49m[38;5;241;43m=[39;49m[38;5;124;43m"[39;49m[38;5;124;43mtasksource/ModernBERT-base-nli[39;49m[38;5;124;43m"[39;49m[43m)[49m

File [0;32m~/Documents/Companies/Sentinel/Codebase/Python/2023_Code/venv/lib/python3.11/site-packages/transformers/pipelines/__init__.py:942[0m, in [0;36mpipeline[0;34m(task, model, config, tokenizer, feature_extractor, image_processor, processor, framework, revision, use_fast, token, device, device_map, torch_dtype, trust_remote_code, model_kwargs, pipeline_class, **kwargs)[0m
[1;32m    940[0m [38;5;28;01mif[39;00m [38;5;28misinstance[39m(model, [38;5;28mstr[39m) [38;5;129;01mor[39;00m framework [38;5;129;01mis[39;00m [38;5;28;01mNone[39;00m:
[1;32m    941[0m     model_classes [38;5;241m=[39m {[38;5;124m"[39m[38;5;124mtf[39m[38;5;124m"[39m: targeted_task[[38;5;124m"[39m[38;5;124mtf[39m[38;5;124m"[39m], [38;5;124m"[39m[38;5;124mpt[39m[38;5;124m"[39m: targeted_task[[38;5;124m"[39m[38;5;124mpt[39m[38;5;124m"[39m]}
[0;32m--> 942[0m     framework, model [38;5;241m=[39m [43minfer_framework_load_model[49m[43m([49m
[1;32m    943[0m [43m        [49m[43madapter_path[49m[43m [49m[38;5;28;43;01mif[39;49;00m[43m [49m[43madapter_path[49m[43m [49m[38;5;129;43;01mis[39;49;00m[43m [49m[38;5;129;43;01mnot[39;49;00m[43m [49m[38;5;28;43;01mNone[39;49;00m[43m [49m[38;5;28;43;01melse[39;49;00m[43m [49m[43mmodel[49m[43m,[49m
[1;32m    944[0m [43m        [49m[43mmodel_classes[49m[38;5;241;43m=[39;49m[43mmodel_classes[49m[43m,[49m
[1;32m    945[0m [43m        [49m[43mconfig[49m[38;5;241;43m=[39;49m[43mconfig[49m[43m,[49m
[1;32m    946[0m [43m        [49m[43mframework[49m[38;5;241;43m=[39;49m[43mframework[49m[43m,[49m
[1;32m    947[0m [43m        [49m[43mtask[49m[38;5;241;43m=[39;49m[43mtask[49m[43m,[49m
[1;32m    948[0m [43m        [49m[38;5;241;43m*[39;49m[38;5;241;43m*[39;49m[43mhub_kwargs[49m[43m,[49m
[1;32m    949[0m [43m        [49m[38;5;241;43m*[39;49m[38;5;241;43m*[39;49m[43mmodel_kwargs[49m[43m,[49m
[1;32m    950[0m [43m    [49m[43m)[49m
[1;32m    952[0m model_config [38;5;241m=[39m model[38;5;241m.[39mconfig
[1;32m    953[0m hub_kwargs[[38;5;124m"[39m[38;5;124m_commit_hash[39m[38;5;124m"[39m] [38;5;241m=[39m model[38;5;241m.[39mconfig[38;5;241m.[39m_commit_hash

File [0;32m~/Documents/Companies/Sentinel/Codebase/Python/2023_Code/venv/lib/python3.11/site-packages/transformers/pipelines/base.py:262[0m, in [0;36minfer_framework_load_model[0;34m(model, config, model_classes, task, framework, **model_kwargs)[0m
[1;32m    260[0m transformers_module [38;5;241m=[39m importlib[38;5;241m.[39mimport_module([38;5;124m"[39m[38;5;124mtransformers[39m[38;5;124m"[39m)
[1;32m    261[0m [38;5;28;01mif[39;00m look_pt:
[0;32m--> 262[0m     _class [38;5;241m=[39m [38;5;28;43mgetattr[39;49m[43m([49m[43mtransformers_module[49m[43m,[49m[43m [49m[43marchitecture[49m[43m,[49m[43m [49m[38;5;28;43;01mNone[39;49;00m[43m)[49m
[1;32m    263[0m     [38;5;28;01mif[39;00m _class [38;5;129;01mis[39;00m [38;5;129;01mnot[39;00m [38;5;28;01mNone[39;00m:
[1;32m    264[0m         classes[38;5;241m.[39mappend(_class)

File [0;32m~/Documents/Companies/Sentinel/Codebase/Python/2023_Code/venv/lib/python3.11/site-packages/transformers/utils/import_utils.py:1965[0m, in [0;36m_LazyModule.__getattr__[0;34m(self, name)[0m
[1;32m   1963[0m [38;5;28;01melif[39;00m name [38;5;129;01min[39;00m [38;5;28mself[39m[38;5;241m.[39m_class_to_module[38;5;241m.[39mkeys():
[1;32m   1964[0m     module [38;5;241m=[39m [38;5;28mself[39m[38;5;241m.[39m_get_module([38;5;28mself[39m[38;5;241m.[39m_class_to_module[name])
[0;32m-> 1965[0m     value [38;5;241m=[39m [38;5;28mgetattr[39m(module, name)
[1;32m   1966[0m [38;5;28;01melif[39;00m name [38;5;129;01min[39;00m [38;5;28mself[39m[38;5;241m.[39m_modules:
[1;32m   1967[0m     value [38;5;241m=[39m [38;5;28mself[39m[38;5;241m.[39m_get_module(name)

File [0;32m~/Documents/Companies/Sentinel/Codebase/Python/2023_Code/venv/lib/python3.11/site-packages/transformers/utils/import_utils.py:1964[0m, in [0;36m_LazyModule.__getattr__[0;34m(self, name)[0m
[1;32m   1962[0m     value [38;5;241m=[39m Placeholder
[1;32m   1963[0m [38;5;28;01melif[39;00m name [38;5;129;01min[39;00m [38;5;28mself[39m[38;5;241m.[39m_class_to_module[38;5;241m.[39mkeys():
[0;32m-> 1964[0m     module [38;5;241m=[39m [38;5;28;43mself[39;49m[38;5;241;43m.[39;49m[43m_get_module[49m[43m([49m[38;5;28;43mself[39;49m[38;5;241;43m.[39;49m[43m_class_to_module[49m[43m[[49m[43mname[49m[43m][49m[43m)[49m
[1;32m   1965[0m     value [38;5;241m=[39m [38;5;28mgetattr[39m(module, name)
[1;32m   1966[0m [38;5;28;01melif[39;00m name [38;5;129;01min[39;00m [38;5;28mself[39m[38;5;241m.[39m_modules:

File [0;32m~/Documents/Companies/Sentinel/Codebase/Python/2023_Code/venv/lib/python3.11/site-packages/transformers/utils/import_utils.py:1978[0m, in [0;36m_LazyModule._get_module[0;34m(self, module_name)[0m
[1;32m   1976[0m     [38;5;28;01mreturn[39;00m importlib[38;5;241m.[39mimport_module([38;5;124m"[39m[38;5;124m.[39m[38;5;124m"[39m [38;5;241m+[39m module_name, [38;5;28mself[39m[38;5;241m.[39m[38;5;18m__name__[39m)
[1;32m   1977[0m [38;5;28;01mexcept[39;00m [38;5;167;01mException[39;00m [38;5;28;01mas[39;00m e:
[0;32m-> 1978[0m     [38;5;28;01mraise[39;00m [38;5;167;01mRuntimeError[39;00m(
[1;32m   1979[0m         [38;5;124mf[39m[38;5;124m"[39m[38;5;124mFailed to import [39m[38;5;132;01m{[39;00m[38;5;28mself[39m[38;5;241m.[39m[38;5;18m__name__[39m[38;5;132;01m}[39;00m[38;5;124m.[39m[38;5;132;01m{[39;00mmodule_name[38;5;132;01m}[39;00m[38;5;124m because of the following error (look up to see its[39m[38;5;124m"[39m
[1;32m   1980[0m         [38;5;124mf[39m[38;5;124m"[39m[38;5;124m traceback):[39m[38;5;130;01m\n[39;00m[38;5;132;01m{[39;00me[38;5;132;01m}[39;00m[38;5;124m"[39m
[1;32m   1981[0m     ) [38;5;28;01mfrom[39;00m [38;5;21;01me[39;00m

[0;31mRuntimeError[0m: Failed to import transformers.models.modernbert.modeling_modernbert because of the following error (look up to see its traceback):
duplicate template name

### Who can help?

_No response_

### Information

- [x] The official example scripts
- [ ] My own modified scripts

### Tasks

- [x] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

To reproduce this I simply did:
from transformers import pipeline
classifier = pipeline("zero-shot-classification",model="tasksource/ModernBERT-base-nli")

### Expected behavior

The model would download from source.

Comments:
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.

Wasn't able to reproduce on the latest version of Transformers, so closing for now! Try `pip install --upgrade transformers` to see if that resolves things.