먼저 window ai boost driver를 설치하고 적용해야한다.
Intel® NPU Driver - Windows*
This download installs Intel® NPU Driver - Windows* 32.0.100.3104 for Intel® Core™ Ultra processors.
www.intel.com
인텔 NPU 드라이버 설치/업데이트 단계
설명
- 인텔® NPU 드라이버를 설치하는 데 문제가 있습니다.
- NPU 드라이버를 설치하거나 업데이트하는 데 필요한 단계는 무엇입니까?
해결 방법
아래 단계에 따라 인텔 코어 울트라 프로세서(시리즈 1) 및 인텔® 코어® 울트라 프로세서(시리즈 2)용 인텔® NPU(인텔® AI Boost라고도 함) 드라이버를 설치하십시오.
- NPU 드라이버가 장치에 이미 설치되어 있는지 확인하십시오.
- Windows* 시작 버튼을 마우스 오른쪽 버튼으로 클릭하고 장치 관리자를 선택합니다.
- 신경망 프로세서 아래에 인텔® AI Boost 표시되는지 확인합니다.
- NPU 드라이버를 제거합니다.
- 장치 관리자 창에서 인텔® AI Boost 마우스 오른쪽 버튼으로 클릭하고 장치 제거를 선택합니다.
- 검사 이 장치의 드라이버를 제거하려는 유혹. 상자.
- '제거'를 클릭합니다.
- Device Manage(장치 관리)로 이동하고 Scan for Hardware Changes(하드웨어 변경 사항 검색)를 클릭합니다. 상단 메뉴에 있는 아이콘을 한 번 클릭하면 다른 장치가 표시됩니다.
- 새 드라이버를 다운로드합니다.
- 인텔 다운로드 센터 에서 최신 NPU 드라이버를 다운로드하십시오.
- 다운로드한 zip 드라이버 패키지의 압축을 풉니다. .zip 드라이버 파일의 압축을 풀려면, 파일을 마우스 오른쪽 단추로 클릭하고 모두 압축 풀기를 선택합니다.
- 새 NPU 드라이버를 설치합니다.
- 다른 장치에서 PCI 장치를 찾습니다. 마우스 오른쪽 버튼으로 클릭하고 드라이버 업데이트를 선택합니다.
.
- 새 창이 나타나면 내 컴퓨터에서 드라이버 찾아보기를 클릭하고 압축을 푼 드라이버가 저장된 위치로 이동합니다.
- 하위 폴더 포함이 선택되어 있는지 확인합니다.
- 드라이버가 올바르게 설치되면 Windows에서 드라이버를 성공적으로 업데이트 했으며 장치 관리 의 신경망 프로세서 아래에 인텔® AI Boost 드라이버가 표시되어야 한다는 다음 창이 표시되어야 합니다.
- 다른 장치에서 PCI 장치를 찾습니다. 마우스 오른쪽 버튼으로 클릭하고 드라이버 업데이트를 선택합니다.
intel npu acceleration library library instell
The Intel® NPU Acceleration Library is a Python library designed to boost the efficiency of your applications by leveraging the power of the Intel Neural Processing Unit (NPU) to perform high-speed computations on compatible hardware.
pip install intel-npu-acceleration-library
pip install transformers==4.42.4
버전 잘 맞춰서 받아야 돌아간다.
Intel NPU 가속을 활용하여 TinyLlama-1.1B-Chat 모델을 실행하는 대화형 챗봇
import datetime
import torch
import intel_npu_acceleration_library
from intel_npu_acceleration_library.compiler import CompilerConfig
from transformers import pipeline, TextStreamer, set_seed
# 모델 및 설정
MODEL_ID = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
def load_model():
"""모델 로드 및 NPU 최적화"""
print("Loading the model...")
pipe = pipeline(
"text-generation", model=MODEL_ID, torch_dtype=torch.bfloat16, device_map="auto"
)
print("Compiling the model for NPU...")
config = CompilerConfig(dtype=torch.int8)
try:
pipe.model = intel_npu_acceleration_library.compile(pipe.model, config)
except Exception as e:
print(f"NPU Compilation Failed: {e}")
exit(1)
return pipe
def chat():
"""NPU 기반 챗봇 실행"""
pipe = load_model()
streamer = TextStreamer(pipe.tokenizer, skip_special_tokens=True, skip_prompt=True)
set_seed(42)
messages = [{"role": "system", "content": "You are a friendly chatbot. You can ask me anything."}]
print("NPU Chatbot is ready! Type 'exit' to quit.")
while True:
query = input("User: ")
if query.lower() == "exit":
break
messages.append({"role": "user", "content": query})
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
start_time = datetime.datetime.now()
print("Assistant: ", end="", flush=True)
out = pipe(prompt, max_new_tokens=512, do_sample=True, temperature=0.7, top_k=50, top_p=0.95, streamer=streamer)
end_time = datetime.datetime.now()
print(f"\nResponse Time: {end_time - start_time}")
reply = out[0]["generated_text"].split("<|assistant|>")[-1].strip()
messages.append({"role": "assistant", "content": reply})
if __name__ == "__main__":
chat()
NPU 를 잘쓰고 있는 모습이다.
'A.I.(인공지능) & M.L.(머신러닝)' 카테고리의 다른 글
deepseek-r1 vs gemma3 성능 및 품질 비교 (0) | 2025.03.14 |
---|---|
[ComfyUI] ComfyUI 설치 및 간단 사용법 정리 (1) | 2025.02.05 |
[유치원과정] 트랜스포머 이론 - 인코더 | Multi-Head Attention (0) | 2025.01.05 |
Sana: Efficient High-Resolution Image Synthesis with Linear Diffusion Transformer (2) | 2024.12.02 |
런웨이 & 루마 AI API (1) | 2024.09.22 |