【开源实习】针对任务类型Image Feature Extraction,开发可在香橙派AIpro开发板运行的应用#118
Open
ycf7606 wants to merge 6 commits intomindspore-lab:masterfrom
Open
【开源实习】针对任务类型Image Feature Extraction,开发可在香橙派AIpro开发板运行的应用#118ycf7606 wants to merge 6 commits intomindspore-lab:masterfrom
ycf7606 wants to merge 6 commits intomindspore-lab:masterfrom
Conversation
Contributor
Contributor
|
最新要求是在CANN 8.1.RC1版本下验证,辛苦升级cann版本后完成验证,并且修改readme中的相应版本信息 |
Contributor
|
验收通过,可以合入 |
xing-yiren
reviewed
Dec 31, 2025
| "source": [ | ||
| "from mindspore import Tensor, Parameter\n", | ||
| "import mindspore as ms\n", | ||
| "from mindspore import dtype as mstype\n", |
Contributor
There was a problem hiding this comment.
这个是比较旧的写法了,现在指定数据类型比如说直接mindspore.float16就行
| "source": [ | ||
| "from mindspore import dtype as mstype\n", | ||
| "from mindspore import ops\n", | ||
| "def to_fp16_model(net):\n", |
Contributor
There was a problem hiding this comment.
这个可以推荐试下,在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", |
Contributor
There was a problem hiding this comment.
我有点好奇这个当时是遇到什么问题了,所以会有这个备选的方案,因为一般来说是不推荐用类似于ops.Argmax这样的ops.primitive接口的
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

No description provided.