Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions python/infinilm/base_config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import argparse
import json
import os
import sys
import warnings


Expand Down Expand Up @@ -277,7 +275,7 @@ def get_device_str(self, device):
"nvidia": "cuda",
"qy": "cuda",
"cambricon": "mlu",
"ascend": "ascend",
"ascend": "npu",
"metax": "cuda",
"moore": "musa",
"iluvatar": "cuda",
Expand Down
14 changes: 7 additions & 7 deletions python/infinilm/llm/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def __init__(self, config: EngineConfig):

def _init_device(self):
"""Initialize infinicore device and dtype."""
supported_devices = ["cpu", "cuda", "mlu", "musa"]
supported_devices = ["cpu", "cuda", "mlu", "musa", "npu"]
device_str = self.config.device
if device_str not in supported_devices:
raise ValueError(
Expand Down Expand Up @@ -709,13 +709,13 @@ def add_request(
elif prompt is not None:
prompt_token_ids = self.engine.tokenize(prompt)
else:
assert messages is not None, (
"Either messages or prompt/prompt_token_ids must be provided"
)
assert (
messages is not None
), "Either messages or prompt/prompt_token_ids must be provided"

assert apply_chat_template, (
"apply_chat_template needs to be true for multi-role conversation"
)
assert (
apply_chat_template
), "apply_chat_template needs to be true for multi-role conversation"

prompt = self.engine.apply_chat_template(
messages, add_generation_prompt=add_generation_prompt
Expand Down
Loading