fix transformers_cli import relative path issue (#36989)

* fix transformers_cli relative import path issue

Signed-off-by: Yao, Matrix <matrix.yao@intel.com>

* fix style

Signed-off-by: Yao, Matrix <matrix.yao@intel.com>

---------

Signed-off-by: Yao, Matrix <matrix.yao@intel.com>
Co-authored-by: Joao Gante <joaofranciscocardosogante@gmail.com>
This commit is contained in:
Yao Matrix
2025-03-27 02:45:56 +08:00
committed by GitHub
parent 3a8ec8c467
commit 5b08db8844
2 changed files with 12 additions and 9 deletions

View File

@@ -94,6 +94,7 @@ class EnvironmentCommand(BaseTransformersCLICommand):
pt_version = torch.__version__ pt_version = torch.__version__
pt_cuda_available = torch.cuda.is_available() pt_cuda_available = torch.cuda.is_available()
pt_xpu_available = torch.xpu.is_available()
pt_npu_available = is_torch_npu_available() pt_npu_available = is_torch_npu_available()
pt_hpu_available = is_torch_hpu_available() pt_hpu_available = is_torch_hpu_available()
@@ -151,6 +152,9 @@ class EnvironmentCommand(BaseTransformersCLICommand):
if pt_cuda_available: if pt_cuda_available:
info["Using GPU in script?"] = "<fill in>" info["Using GPU in script?"] = "<fill in>"
info["GPU type"] = torch.cuda.get_device_name() info["GPU type"] = torch.cuda.get_device_name()
elif pt_xpu_available:
info["Using XPU in script?"] = "<fill in>"
info["XPU type"] = torch.xpu.get_device_name()
elif pt_hpu_available: elif pt_hpu_available:
info["Using HPU in script?"] = "<fill in>" info["Using HPU in script?"] = "<fill in>"
info["HPU type"] = torch.hpu.get_device_name() info["HPU type"] = torch.hpu.get_device_name()

View File

@@ -14,15 +14,14 @@
# limitations under the License. # limitations under the License.
from transformers import HfArgumentParser from transformers import HfArgumentParser
from transformers.commands.add_fast_image_processor import AddFastImageProcessorCommand
from .add_fast_image_processor import AddFastImageProcessorCommand from transformers.commands.add_new_model_like import AddNewModelLikeCommand
from .add_new_model_like import AddNewModelLikeCommand from transformers.commands.chat import ChatCommand
from .chat import ChatCommand from transformers.commands.convert import ConvertCommand
from .convert import ConvertCommand from transformers.commands.download import DownloadCommand
from .download import DownloadCommand from transformers.commands.env import EnvironmentCommand
from .env import EnvironmentCommand from transformers.commands.run import RunCommand
from .run import RunCommand from transformers.commands.serving import ServeCommand
from .serving import ServeCommand
def main(): def main():