HUB
Sign inSign up
mindformers logo

ascendai/mindformers

By ascendai

•Updated 1 day ago

Image
0

561

ascendai/mindformers repository overview

⁠MindSpore

⁠Quick Reference

⁠MindSpore Transformers

The MindSpore Transformers suite aims to build a comprehensive development toolkit covering the entire lifecycle of large-scale models, including pre-training, fine-tuning, evaluation, inference, and deployment. It provides industry-leading large Transformer-based language models, multimodal understanding models, and omni-modal models, enabling users to easily achieve end-to-end development of large-scale models.

⁠Supported Tags and Dockerfile Usage

⁠Tag Specification

Tags follow this format:

<MindSpore Transformers Version>-cann-<CANN Version>-mindspore<MindSpore Version>-<Hardware Info (Chip)>-<Operating System>-<Python Version>
FieldValuesDescription
MindSpore Transformers Version2.0.0Corresponds to the version identifier in MindSpore Transformers official release tags
CANN Version9.1.0CANN version built into the image
MindSpore Version2.10.0MindSpore version built into the image
Hardware Info (Chip)910b / a3NPU chip model identifier
Operating Systemubuntu22.04 / openeuler24.03Operating system distribution and version used in the base image
Python Versionpy3.12Major Python version built into the image

Tips: System architecture is automatically detected via Docker Manifest, no need to specify in the tag.

⁠Available Tags
  • 2.0.0-cann9.1.0-mindspore2.10.0-910b-ubuntu22.04-py3.12
  • 2.0.0-cann9.1.0-mindspore2.10.0-910b-openeuler24.03-py3.12
  • 2.0.0-cann9.1.0-mindspore2.10.0-a3-ubuntu22.04-py3.12
  • 2.0.0-cann9.1.0-mindspore2.10.0-a3-openeuler24.03-py3.12
⁠Image Repository Address

MindSpore Transformers images are hosted on the Huawei Cloud SWR image repository:

swr.cn-south-1.myhuaweicloud.com/ascendhub/mindformers

Full Image Example:

swr.cn-south-1.myhuaweicloud.com/ascendhub/mindformers:2.0.0-cann9.1.0-mindspore2.10.0-910b-ubuntu22.04-py3.12
⁠构建参数

See dockerfile: dockerfile⁠

ParameterDescriptionRequiredSourceValues
CANN_VERSIONCANN toolkit versionYesCANN image tag9.1.0
CHIP_ARCHNPU chip architecture identifierYesTag specification910b / a3
OS_SYSTEMBase image operating system and versionYesTag specificationubuntu22.04 / openeuler24.03
PY_VERSIONPython version built into the base imageYesTag specificationpy3.12
MINDSPORE_VERSIONMindSpore version numberYesMindSpore repository releases2.10.0
MINDFORMERS_VERSIONMindSpore Transformers version numberYesMindSpore Transformers repository releases2.0.0
PIP_INDEX_URLpip installation source URL (default: Huawei Cloud mirror)NoPyPI mirror sourcehttps://mirrors.huaweicloud.com/repository/pypi/simple⁠

⁠Quick Start

⁠Building MindSpore Image
# Enable Docker Content Trust so that image signatures are verified when building, pulling and
# pushing images, preventing tampered or man-in-the-middle replaced images
export DOCKER_CONTENT_TRUST=1

docker build \
--build-arg CANN_VERSION=9.1.0 \
--build-arg CHIP_ARCH=910b \
--build-arg OS_SYSTEM=ubuntu22.04 \
--build-arg PY_VERSION=py3.12 \
--build-arg MINDSPORE_VERSION=2.10.0 \
--build-arg MINDFORMERS_VERSION=2.0.0 \
--build-arg PIP_INDEX_URL=https://mirrors.huaweicloud.com/repository/pypi/simple \
-t mindformers:2.0.0-cann9.1.0-mindspore2.10.0-910b-ubuntu22.04-py3.12 \
-f Dockerfile .

Tips: DOCKER_CONTENT_TRUST=1 relies on the registry publishing signature (Notary) data. If the registry does not publish it, the legacy builder (DOCKER_BUILDKIT=0) fails with no trust data, while BuildKit simply ignores the variable. In both cases, pin the base image by digest instead (FROM quay.io/ascend/cann@sha256:...), which keeps the base image verifiable.

⁠运行 MindSpore Transformers 容器
docker run \
    --privileged \
    --name mindformers_container \
    --device /dev/davinci1 \
    --device /dev/davinci_manager \
    --device /dev/devmm_svm \
    --device /dev/hisi_hdc \
    -v /usr/local/dcmi:/usr/local/dcmi \
    -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
    -v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \
    -v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \
    -v /etc/ascend_install.info:/etc/ascend_install.info \
    -it mindspore:tag bash
⁠Checking Container Health

The image ships a HEALTHCHECK instruction that runs python3 -c "import mindformers" every 5 minutes. The result can be queried with:

docker inspect --format '{{.State.Health.Status}}' mindformers_container

A single probe takes under 10 seconds and peaks at about 800MB of memory. Append --no-healthcheck to docker run to turn the periodic probe off.

⁠Security Risks

When running MindSpore Transformers in Docker containers, pay attention to the following security risks:

  • Running as the root user:
    Containers run as the root user by default, which may introduce security risks. It is recommended to create and use a non-privileged user in production environments.

  • Running with --privileged mode:
    To ensure NPU functionality works properly, the container may require the --privileged option. This mode grants the container elevated access to host devices and system resources, increasing potential security risks. It is recommended to use it only in trusted environments and reduce risks through device whitelisting, resource limits, and network isolation.

  • Missing CPU and memory resource limits:
    Without resource limits, containers may consume excessive system resources and impact host performance. It is recommended to use the --cpus and --memory options to limit resource usage.

  • Unverified image provenance:
    Using images that are neither signed nor pinned by digest leaves room for tampering or man-in-the-middle replacement. It is recommended to export DOCKER_CONTENT_TRUST=1 before building, pulling or pushing images; when the registry publishes no signature data, pin the image version by digest (@sha256:...) instead.

⁠Supported Hardware

Chip SeriesProduct ExamplesArchitecture
910BAtlas 800T A2, Atlas 900 A2 PoDAuto-detected (ARM64/x86_64)
A3Atlas 800T A3Auto-detected (ARM64/x86_64)

Tips: Use the docker manifest inspect command to view the system architectures supported by an image.

⁠Image Usage Responsibility Statement

The released software images are community editions and are not intended for commercial use. They are provided solely as references for production practices. The responsibility statement is displayed in the image startup information and on the image hosting platform.

⁠License

View the license information⁠ for MindSpore and license information⁠included in these images.

As with all container images, pre-installed software packages (Python, system libraries, etc.) may be subject to their respective licenses.

Tag summary

Content type

Image

Digest

sha256:252e231ba…

Size

5.2 GB

Last updated

1 day ago

docker pull ascendai/mindformers:1.9.0-a3-openeuler24.03-py3.11