Skip to content

【开源实习】针对任务类型Image Feature Extraction,开发可在香橙派AIpro开发板运行的应用#118

Open
ycf7606 wants to merge 6 commits intomindspore-lab:masterfrom
ycf7606:project-1
Open

【开源实习】针对任务类型Image Feature Extraction,开发可在香橙派AIpro开发板运行的应用#118
ycf7606 wants to merge 6 commits intomindspore-lab:masterfrom
ycf7606:project-1

Conversation

@ycf7606
Copy link

@ycf7606 ycf7606 commented Nov 5, 2025

No description provided.

@cui0523
Copy link
Contributor

cui0523 commented Nov 11, 2025

image

需要在PYNATIVE模式下执行

@cui0523
Copy link
Contributor

cui0523 commented Nov 11, 2025

最新要求是在CANN 8.1.RC1版本下验证,辛苦升级cann版本后完成验证,并且修改readme中的相应版本信息

@cui0523
Copy link
Contributor

cui0523 commented Nov 18, 2025

验收通过,可以合入

"source": [
"from mindspore import Tensor, Parameter\n",
"import mindspore as ms\n",
"from mindspore import dtype as mstype\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是比较旧的写法了,现在指定数据类型比如说直接mindspore.float16就行

"source": [
"from mindspore import dtype as mstype\n",
"from mindspore import ops\n",
"def to_fp16_model(net):\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个可以推荐试下,在from_pretrained加载时,有一个ms_type的选项,设成mindspore.float16模型会转成fp16运算,不需要你手动写函数配了
大概是这个写法:

model = SegformerForSemanticSegmentation.from_pretrained(MODEL_NAME, ms_type=mindspore.float16)

"def logits_to_pred_np(logits):\n",
" try:\n",
" pred = ops.argmax(logits, 1)\n",
" except TypeError:\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我有点好奇这个当时是遇到什么问题了,所以会有这个备选的方案,因为一般来说是不推荐用类似于ops.Argmax这样的ops.primitive接口的

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.

3 participants