이런 오류가 뜨는데 뭐려나요...ㅠㅠ

GPU는 AMD Radeon RX 6600 입니다ㅠㅠ

속도 빠르게 답변 받고 싶어서 비벼보려고 하는데 잘 모르겠어유


RuntimeError: value cannot be converted to type uint8_t without overflow


import torch
import torch_directml
from transformers import AutoModelForCausalLM, AutoTokenizer

# 1) DirectML 디바이스 객체 생성
dml_device = torch_directml.device()

model_id = "google/gemma-3-1b-it"

# 2) 모델과 토크나이저 불러오기 (precision은 예시에 따라 float16 사용)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16, # 필요에 따라 bf16 등으로 수정 가능
use_auth_token="내토큰" # ★ 본인 토큰으로 교체
)
tokenizer = AutoTokenizer.from_pretrained(
model_id,
use_auth_token="내토큰" # ★ 본인 토큰으로 교체
)

# 3) 캐시 사용 설정 (캐시를 켜기)
model.config.cache_implementation = "hybrid"
model.config.use_cache = True

# 4) 모델을 DirectML 디바이스로 이동
model.to(dml_device)

# 5) 추론할 프롬프트 정의
prompt = "Hugging Face에 대해 간단히 설명해줘."

# 6) 토크나이저로 텐서 변환 후 디바이스 이동
inputs = tokenizer(prompt, return_tensors="pt").to(dml_device)

# 7) 추론 (generate() 호출 시 use_cache를 따로 명시하지 않음)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=50
# use_cache 파라미터를 넘기지 않아 model.config.use_cache = True 적용
)

# 8) 결과 디코딩
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_text)