Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ascend] Enable support for 310p NPUs #3532

Closed
wants to merge 3 commits into from
Closed

Conversation

zer0py2c
Copy link

@zer0py2c zer0py2c commented Sep 22, 2024

Adapted models

  • ChatGLM3-6B
  • vicuna-7b-v1.3

⚠️Before loading ChatGLM3-6B, you need to modify the model code file!

  • modeling_chatglm.py
...
# @torch.jit.script
def apply_rotary_pos_emb(x: torch.Tensor, rope_cache: torch.Tensor) -> torch.Tensor:
    ...

Environment Preparation

ℹ️Recommend that build a Docker image for environment setup.

  • Docker: 20.10.2+

    • Ascend Docker Runtime Plugin: Download
  • NPU Driver and Firmware: Download Page

  • CANN: 8.0.RC2

  • Python: 3.8+

    • torch-npu==2.1.0.post6
    • transformers>=4.41.0

Inference with Command Line Interface

使用FastChat适配NPU
Single NPU
python3 -m fastchat.serve.cli --model-path /opt/models/vicuna-7b-v1.3/ --device npu
Multiple NPUs
ASCEND_RT_VISIBLE_DEVICES=0,1 python3 -m fastchat.serve.cli --model-path /opt/models/vicuna-7b-v1.3/ --num-gpus 2 --device npu --max-gpu-memory 12GiB

@zer0py2c zer0py2c closed this Sep 22, 2024
@zer0py2c zer0py2c closed this Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant