From e8e3800613c6e44913e85e44f0a760cfd50ec382 Mon Sep 17 00:00:00 2001 From: liuzxtest02 <134442@163.com> Date: Tue, 7 Nov 2023 15:34:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20''?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _OpenI云脑使用教程.ipynb | 192 +++++++++++++++++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 _OpenI云脑使用教程.ipynb diff --git a/_OpenI云脑使用教程.ipynb b/_OpenI云脑使用教程.ipynb new file mode 100644 index 0000000..968e144 --- /dev/null +++ b/_OpenI云脑使用教程.ipynb @@ -0,0 +1,192 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "7d112f9b-84ba-420d-a52b-9eb7ba307068", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Looking in indexes: http://pip.modelarts.private.com:8888/repository/pypi/simple\n", + "Requirement already satisfied: openi-test==0.7.1 in /home/ma-user/anaconda3/envs/python-3.7.10/lib/python3.7/site-packages (0.7.1)\n", + "Requirement already satisfied: requests in /home/ma-user/modelarts-dev/modelarts-sdk (from openi-test==0.7.1) (2.28.2)\n", + "Requirement already satisfied: tqdm in /home/ma-user/modelarts-dev/modelarts-sdk (from openi-test==0.7.1) (4.64.0)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /home/ma-user/modelarts-dev/modelarts-sdk (from requests->openi-test==0.7.1) (3.3.2)\n", + "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/ma-user/anaconda3/envs/python-3.7.10/lib/python3.7/site-packages (from requests->openi-test==0.7.1) (1.26.12)\n", + "Requirement already satisfied: idna<4,>=2.5 in /home/ma-user/modelarts-dev/modelarts-sdk (from requests->openi-test==0.7.1) (3.4)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /home/ma-user/anaconda3/envs/python-3.7.10/lib/python3.7/site-packages (from requests->openi-test==0.7.1) (2022.6.15)\n", + "Note: you may need to restart the kernel to use updated packages.\n" + ] + } + ], + "source": [ + "pip install openi-test==0.7.1" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "02ad2e02-6533-4da0-98c3-c5f238d4d8f7", + "metadata": {}, + "outputs": [], + "source": [ + "#导入包\n", + "from openi.context import prepare, upload_openi" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "69880626-9320-46cd-ad29-8e5f7be09f32", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:root:Using MoXing-v2.1.0.5d9c87c8-5d9c87c8\n", + "INFO:root:Using OBS-Python-SDK-3.20.9.1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "🎉 Successfully Download s3:///urchincache/attachment/d/d/ddabdf57-a65a-496c-bef0-19d82b9043cd/MNISTData.zip to /home/ma-user/work/dataset/MNISTData.zip\n", + "🎉 Successfully Extracted /home/ma-user/work/dataset/MNISTData.zip\n", + "🎉 Successfully Deleted /home/ma-user/work/dataset/MNISTData.zip\n", + "🎉 Successfully Download s3:///urchincache/attachment/2/c/2c59be66-64ec-41ca-b311-f51a486eabf8/checkpoint_lenet-1_1875.zip to /home/ma-user/work/dataset/checkpoint_lenet-1_1875.zip\n", + "🎉 Successfully Extracted /home/ma-user/work/dataset/checkpoint_lenet-1_1875.zip\n", + "🎉 Successfully Deleted /home/ma-user/work/dataset/checkpoint_lenet-1_1875.zip\n", + "🎉 Successfully Download s3:///urchincache/aimodels/0/c/0cf4367b-5234-4967-a41f-f548d3f69fcf/ to /home/ma-user/work/pretrainmodel/MNIST_Example_model_zjdt\n", + "please set the output location to /home/ma-user/work/output\n" + ] + } + ], + "source": [ + "\n", + "#初始化导入数据集和预训练模型到容器内\n", + "openi_context = prepare()" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "c586f98f-bead-4dc9-a22f-173a672d456b", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/home/ma-user/work/dataset\n" + ] + } + ], + "source": [ + "#获取数据集路径,预训练模型路径,输出路径\n", + "dataset_path = openi_context.dataset_path\n", + "print(dataset_path)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "7d6617f0-7b86-4b1b-a201-ecdc58db53a5", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/home/ma-user/work/pretrainmodel\n" + ] + } + ], + "source": [ + "pretrain_model_path = openi_context.pretrain_model_path\n", + "print(pretrain_model_path)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "6bc51211-5555-452e-9d83-adcfee1c4f79", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/home/ma-user/work/output\n" + ] + } + ], + "source": [ + "output_path = openi_context.output_path\n", + "print(output_path)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "48b5da5d-a55f-4781-9056-b886d41779c7", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "upload /home/ma-user/work/output to openi\n" + ] + }, + { + "data": { + "text/plain": [ + "'/home/ma-user/work/output'" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#回传结果到openi,训练任务才能回传,调试任务回传后也是不支持下载\n", + "upload_openi()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "75e7ce04-594e-4e8f-8292-15241709eb5e", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "python-3.7.10", + "language": "python", + "name": "python-3.7.10" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}