has no attribute 'register_for_auto_class'
#2
by HangingTree - opened
from example provided in the readme.md
python src/modules/llm.py
Loading model...
Traceback (most recent call last):
File "/home/uwu/Documents/programming/src/modules/llm.py", line 8, in <module>
model = AutoModelForCausalLM.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/uwu/Documents/programming/.venv/lib/python3.12/site-packages/transformers/models/auto/auto_factory.py", line 340, in from_pretrained
config, kwargs = AutoConfig.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/uwu/Documents/programming/.venv/lib/python3.12/site-packages/transformers/models/auto/configuration_auto.py", line 425, in from_pretrained
config_class.register_for_auto_class()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'Qwen3LoopConfig' has no attribute 'register_for_auto_class'
the code (the example provided in the readme of the project):
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "coolpoodle/Qwen3-0.6B-Looped"
print("Loading model...")
# trust_remote_code=True is essential for the custom architecture
model = AutoModelForCausalLM.from_pretrained(
model_id,
trust_remote_code=True,
torch_dtype=torch.float16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
# Prompt
prompt = "The future of artificial intelligence is"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
# Generate
# use_cache=False is RECOMMENDED for Loop Attention to fully activate its mixing logic during generation
print("Generating...")
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=100,
do_sample=True,
temperature=0.7,
use_cache=False
)
print("-" * 20)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
print("-" * 20)