Task #6 - Customize the image

本文介绍如何在Yocto平台中自定义图像,包括查找可用图像、使用命令进行搜索、添加新包以及配置本地文件以包含特定包。通过示例展示了如何将包如xinput-calibrator整合到自定义图像中,并介绍了如何使用HOB进行图像创建。此外,还提供了关于添加开发工具和使用不同标签进行图像定制的指南。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Task #6 - Customize the image

Don't forget to update your source code.

 

How to customize the image

 

Enter <yocto>/source and find any image available:

 

$ find -name *image*.bb

./meta-fsl-demos/recipes-fsl/images/fsl-image-gui-sdk.bb

./meta-fsl-demos/recipes-fsl/images/fsl-image-test.bb

./meta-fsl-demos/recipes-fsl/images/fsl-image-gui.bb

./meta-fsl-demos/recipes-qt/images/qt-in-use-image.bb

./meta-fsl-demos/recipes-qt/images/qte-in-use-image.bb

./meta-openembedded/meta-initramfs/recipes-bsp/images/initramfs-kexecboot-klibc-image.bb

./meta-openembedded/meta-initramfs/recipes-bsp/images/initramfs-kexecboot-image.bb

./meta-openembedded/meta-oe/recipes-support/imagemagick/imagemagick_6.7.5.bb

./meta-openembedded/meta-oe/recipes-multimedia/libsdl-image/libsdl-image_1.2.12.bb

./poky/meta-hob/recipes-core/images/hob-image.bb

./poky/meta-skeleton/recipes-multilib/images/core-image-multilib-example.bb

./poky/meta/recipes-devtools/mkelfimage/mkelfimage_svn.bb

./poky/meta/recipes-sato/images/core-image-sato-dev.bb

./poky/meta/recipes-sato/images/core-image-sato.bb

./poky/meta/recipes-sato/images/core-image-sato-sdk.bb

./poky/meta/recipes-qt/images/qt4e-demo-image.bb

./poky/meta/recipes-core/images/core-image-minimal.bb

./poky/meta/recipes-core/images/core-image-base.bb

./poky/meta/recipes-core/images/core-image-minimal-dev.bb

./poky/meta/recipes-core/images/core-image-minimal-initramfs.bb

./poky/meta/recipes-core/images/build-appliance-image.bb

./poky/meta/recipes-core/images/core-image-minimal-mtdutils.bb

./poky/meta/recipes-extended/images/core-image-lsb-sdk.bb

./poky/meta/recipes-extended/images/core-image-basic.bb

./poky/meta/recipes-extended/images/core-image-lsb-dev.bb

./poky/meta/recipes-extended/images/core-image-lsb.bb

./poky/meta/recipes-graphics/images/core-image-directfb.bb

./poky/meta/recipes-graphics/images/core-image-x11.bb

./poky/meta/recipes-graphics/images/core-image-clutter.bb

./poky/meta/recipes-graphics/xcb/xcb-util-image_0.3.9.bb

./poky/meta/recipes-bsp/u-boot/u-boot-mkimage_2012.04.01.bb

./poky/meta/recipes-bsp/u-boot/u-boot-mkimage_2011.06.bb

./poky/meta/recipes-bsp/u-boot/u-boot-mkimage_2011.03.bb

./poky/meta/recipes-rt/images/core-image-rt-sdk.bb

./poky/meta/recipes-rt/images/core-image-rt.bb


The above images (and packages with 'image' in file name) may be used as a base image, where new packages may be added, or example of new images.

 

bitbake -s  shows any *available* package locally. Grep for the name of desired package:

 

 

$ bitbake -s | grep calibrat

calibrateproto                      :0.0+gitAUTOINC+1da6fd1e2c7a49648245c98481fabea8b9690a8c-r2             

libxcalibrate                       :0.0+gitAUTOINC+209d83af61ed38a002c8096377deac292b3e396c-r0             

xinput-calibrator                   :0.7.5+gitAUTOINC+c01c5af807cb4b0157b882ab07a893df9a810111-r1

 

For example, the package name is xinput-calibrator, in order to include this package this would be the string needed.

 

The dependency tree is shown with

 

$ bitbake -g fsl-image-test

 

 

For the fsl-image-test. Or any other image

 

Include the package name on the image definition file.

 

$ cd meta-fsl-demos/

$ vim recipes-fsl/images/fsl-image-test.bb

 

Include the package name on IMAGE_INSTALL list:

IMAGE_INSTALL += " \

    packagegroup-fsl-gstreamer \

    packagegroup-fsl-tools-testapps \

    packagegroup-fsl-tools-benchmark \

xinput-calibrator \

"

 

In order to include the package on any image, configure conf/local.conf file the as the following:

 

 

MACHINE ??= 'imx6qsabresd'

DISTRO ?= 'poky'

PACKAGE_CLASSES ?= "package_rpm"

EXTRA_IMAGE_FEATURES = "debug-tweaks tools-sdk"

USER_CLASSES ?= "buildstats image-mklibs image-prelink"

PATCHRESOLVE = "noop"

CONF_VERSION = "1"

BB_NUMBER_THREADS = '8'

PARALLEL_MAKE = '-j 8'

ACCEPT_FSL_EULA = "1"

 

CORE_IMAGE_EXTRA_INSTALL += "xinput-calibrator"

 

And then

 

$ bitbake fsl-image-test

 

 

In order to add debug or native builder include on conf/local.conf:

EXTRA_IMAGE_FEATURES += "tools-sdk"

 

Every image created after that will include development tools. The same may be included in any bb image file.

 

 

From Poky description:

'tools-sdk" - Adds development tools such as gcc, make, pkgconfig and so forth.

"dev-pkg" - Adds -dev packages for all installed packages. This is useful if you want to develop against the libraries in the image.

"tools-debug" - Adds debugging tools such as gdb and strace.

 

If you don't like command line, or you prefer a window-like interface, you can take a look on HOB.

 

See hob documentation https://www.yoctoproject.org/documentation/hob-manual

See getting started video for hob Introducing Hob - YouTube

 

Go to Yocto Training - HOME

Go to Task #5 - Kernel


"# The config recipe. # https://rasa.com/docs/rasa/model-configuration/ recipe: default.v1 # The assistant project unique identifier # This default value must be replaced with a unique assistant name within your deployment assistant_id: placeholder_default # Configuration for Rasa NLU. # https://rasa.com/docs/rasa/nlu/components/ language: en pipeline: # # No configuration for the NLU pipeline was provided. The following default pipeline was used to train your model. # # If you&#39;d like to customize it, uncomment and adjust the pipeline. # # See https://rasa.com/docs/rasa/tuning-your-model for more information. # - name: WhitespaceTokenizer # - name: RegexFeaturizer # - name: LexicalSyntacticFeaturizer # - name: CountVectorsFeaturizer # - name: CountVectorsFeaturizer # analyzer: char_wb # min_ngram: 1 # max_ngram: 4 # - name: DIETClassifier # epochs: 100 # constrain_similarities: true # - name: EntitySynonymMapper # - name: ResponseSelector # epochs: 100 # constrain_similarities: true # - name: FallbackClassifier # threshold: 0.3 # ambiguity_threshold: 0.1 # Configuration for Rasa Core. # https://rasa.com/docs/rasa/core/policies/ policies: # # No configuration for policies was provided. The following default policies were used to train your model. # # If you&#39;d like to customize them, uncomment and adjust the policies. # # See https://rasa.com/docs/rasa/policies for more information. # - name: MemoizationPolicy # - name: RulePolicy # - name: UnexpecTEDIntentPolicy # max_history: 5 # epochs: 100 # - name: TEDPolicy # max_history: 5 # epochs: 100 # constrain_similarities: true "我的config文件是这样的,我需要把注释去掉才可以运行吗,你可以帮我吗
08-07
<think>我们正在处理用户关于Rasa配置文件注释的问题。用户想知道是否需要取消注释配置文件中的组件才能运行,并请求配置帮助。 根据Rasa文档,配置文件(通常是config.yml)中的注释行以#开头。在YAML语法中,注释行会被解析器忽略,因此不会影响配置。 关键点: 1. 要启用某个组件,必须取消其前面的注释(即删除行首的#),这样该组件才会被包含在pipeline中。 2. 如果组件被注释(以#开头),则Rasa会忽略该行,不会加载该组件。 示例说明: 假设配置文件如下: ```yaml pipeline: # - name: WhitespaceTokenizer - name: RegexFeaturizer - name: LexicalSyntacticFeaturizer # - name: CountVectorsFeaturizer # analyze: char_wb # min_ngram: 1 # max_ngram: 4 - name: DIETClassifier epochs: 100 hidden_units: 256 ``` 在这个例子中: - `RegexFeaturizer`, `LexicalSyntacticFeaturizer`, 和 `DIETClassifier` 是启用的(因为行首没有#)。 - `WhitespaceTokenizer` 和 `CountVectorsFeaturizer` 被注释掉了,因此不会在pipeline中使用。 因此,用户必须取消注释想要使用的组件。但是,注意不要同时启用不兼容的组件。 配置建议: 1. 根据任务需求选择组件。例如: - 如果处理中文,可能需要使用JiebaTokenizer而不是WhitespaceTokenizer[^2]。 - 意图分类和实体识别通常使用DIETClassifier或CRFEntityExtractor等。 2. 注意组件的顺序,因为Rasa按顺序执行pipeline。 3. 每个组件可能有自己的参数(如上面的DIETClassifier的epochs和hidden_units),这些参数也需要正确配置。 帮助用户配置的步骤: 1. 确定任务:是仅NLU(自然语言理解)还是包含对话管理(Core)?用户的问题似乎集中在NLU部分。 2. 选择语言:不同的语言需要不同的tokenizer等组件。 3. 选择pipeline:根据语言和任务选择合适的组件。 例如,一个典型的中文NLU pipeline可能如下: ```yaml pipeline: - name: JiebaTokenizer - name: RegexFeaturizer - name: LexicalSyntacticFeaturizer - name: CountVectorsFeaturizer analyzer: char_wb min_ngram: 1 max_ngram: 4 - name: DIETClassifier epochs: 100 hidden_units: 256 transformer_size: 128 number_of_transformer_layers: 2 dropout: 0.2 weight_sparsity: 0.7 batch_size: 64 ``` 注意:以上配置需要根据具体数据和硬件调整参数。 总结回答: - 需要取消注释组件来启用它们。 - 配置时要注意组件的兼容性和顺序。 - 提供配置示例,特别是针对中文的配置(因为引用[2]提到了中文处理)。 最后,生成相关问题。</think>### Rasa配置文件注释问题详解 在Rasa的配置文件(`config.yml`)中,**注释行(以#开头的行)不会自动生效,必须取消注释才能使对应组件运行**。以下是完整配置指南: --- ### 配置原则 1. **注释处理规则**: ```yaml # 注释行(不生效) - name: ComponentA # 被忽略 - name: ComponentB # 生效行(已取消注释) ``` - 只有移除行首的`#`才能使组件生效 - 行尾注释(如`param: value # 说明`)不影响配置 2. **典型配置结构**: ```yaml language: zh # 指定中文[^2] pipeline: # 必须取消注释以下组件: - name: JiebaTokenizer # 中文分词器 - name: RegexFeaturizer - name: LexicalSyntacticFeaturizer - name: CountVectorsFeaturizer analyzer: "char_wb" # 按字符分割 min_ngram: 1 max_ngram: 4 - name: DIETClassifier # 核心分类器 epochs: 100 hidden_units: 256 policies: - name: RulePolicy # 取消注释启用规则 - name: TEDPolicy # 取消注释启用对话管理 max_history: 5 ``` --- ### 配置步骤 1. **启用必要组件**: - 删除关键组件前的`#`,特别是: - Tokenizer(中文必用`JiebaTokenizer`[^2]) - 特征提取器(`CountVectorsFeaturizer`) - 分类器(`DIETClassifier`) 2. **参数配置技巧**: ```yaml - name: DIETClassifier # 取消注释并修改以下参数: batch_size: 64 # 根据内存调整(32/64/128) transformer_size: 256 # 值越大精度越高 number_of_transformer_layers: 4 dropout: 0.2 # 防过拟合 weight_sparsity: 0.7 # 模型压缩 # use_gpu: true # 有GPU时取消注释 ``` 3. **验证配置**: ```bash rasa data validate # 检查数据兼容性 rasa train --dry-run # 测试配置文件有效性 ``` --- ### 中文场景特殊配置 参考中文最佳实践[^2]: ```yaml pipeline: - name: JiebaTokenizer - name: LanguageModelFeaturizer model_name: "bert" model_weights: "bert-base-chinese" # 使用中文BERT - name: DIETClassifier epochs: 50 hidden_units: 512 # 添加正则化防止过拟合 constrain_similarities: true sparsity_loss_weight: 1e-4 ``` > ⚠️ 注意:旧版MITIE配置(引用[2])已过时,推荐使用DIET+BERT方案 --- ### 常见错误处理 1. **组件未生效**: - 症状:训练日志中缺少组件输出 - 解决:检查是否遗漏取消注释 2. **版本兼容问题**: ```bash # 检查兼容组合 rasa --version pip show tensorflow ``` 推荐:Rasa 3.x + TensorFlow 2.10+ 3. **迁移旧配置**: 使用工具升级旧版配置[^1]: ```bash rasa data migrate domain --format yaml ``` 通过正确取消注释和参数配置,可解决95%的初始化问题。训练时建议添加`--debug`参数捕获详细日志。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值