You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

OpenI云脑使用教程.ipynb 6.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 1,
  6. "id": "7d112f9b-84ba-420d-a52b-9eb7ba307068",
  7. "metadata": {},
  8. "outputs": [
  9. {
  10. "name": "stdout",
  11. "output_type": "stream",
  12. "text": [
  13. "Looking in indexes: http://pip.modelarts.private.com:8888/repository/pypi/simple\n",
  14. "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",
  15. "Requirement already satisfied: requests in /home/ma-user/modelarts-dev/modelarts-sdk (from openi-test==0.7.1) (2.28.2)\n",
  16. "Requirement already satisfied: tqdm in /home/ma-user/modelarts-dev/modelarts-sdk (from openi-test==0.7.1) (4.64.0)\n",
  17. "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",
  18. "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",
  19. "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",
  20. "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",
  21. "Note: you may need to restart the kernel to use updated packages.\n"
  22. ]
  23. }
  24. ],
  25. "source": [
  26. "pip install openi-test==0.7.1"
  27. ]
  28. },
  29. {
  30. "cell_type": "code",
  31. "execution_count": 2,
  32. "id": "02ad2e02-6533-4da0-98c3-c5f238d4d8f7",
  33. "metadata": {},
  34. "outputs": [],
  35. "source": [
  36. "#导入包\n",
  37. "from openi.context import prepare, upload_openi"
  38. ]
  39. },
  40. {
  41. "cell_type": "code",
  42. "execution_count": 3,
  43. "id": "69880626-9320-46cd-ad29-8e5f7be09f32",
  44. "metadata": {},
  45. "outputs": [
  46. {
  47. "name": "stderr",
  48. "output_type": "stream",
  49. "text": [
  50. "INFO:root:Using MoXing-v2.1.0.5d9c87c8-5d9c87c8\n",
  51. "INFO:root:Using OBS-Python-SDK-3.20.9.1\n"
  52. ]
  53. },
  54. {
  55. "name": "stdout",
  56. "output_type": "stream",
  57. "text": [
  58. "🎉 Successfully Download s3:///urchincache/attachment/d/d/ddabdf57-a65a-496c-bef0-19d82b9043cd/MNISTData.zip to /home/ma-user/work/dataset/MNISTData.zip\n",
  59. "🎉 Successfully Extracted /home/ma-user/work/dataset/MNISTData.zip\n",
  60. "🎉 Successfully Deleted /home/ma-user/work/dataset/MNISTData.zip\n",
  61. "🎉 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",
  62. "🎉 Successfully Extracted /home/ma-user/work/dataset/checkpoint_lenet-1_1875.zip\n",
  63. "🎉 Successfully Deleted /home/ma-user/work/dataset/checkpoint_lenet-1_1875.zip\n",
  64. "🎉 Successfully Download s3:///urchincache/aimodels/0/c/0cf4367b-5234-4967-a41f-f548d3f69fcf/ to /home/ma-user/work/pretrainmodel/MNIST_Example_model_zjdt\n",
  65. "please set the output location to /home/ma-user/work/output\n"
  66. ]
  67. }
  68. ],
  69. "source": [
  70. "\n",
  71. "#初始化导入数据集和预训练模型到容器内\n",
  72. "openi_context = prepare()"
  73. ]
  74. },
  75. {
  76. "cell_type": "code",
  77. "execution_count": 15,
  78. "id": "c586f98f-bead-4dc9-a22f-173a672d456b",
  79. "metadata": {},
  80. "outputs": [
  81. {
  82. "name": "stdout",
  83. "output_type": "stream",
  84. "text": [
  85. "/home/ma-user/work/dataset\n"
  86. ]
  87. },
  88. {
  89. "data": {
  90. "text/plain": [
  91. "['checkpoint_lenet-1_1875', 'MNISTData']"
  92. ]
  93. },
  94. "execution_count": 15,
  95. "metadata": {},
  96. "output_type": "execute_result"
  97. }
  98. ],
  99. "source": [
  100. "#获取数据集路径,预训练模型路径,输出路径\n",
  101. "dataset_path = openi_context.dataset_path\n",
  102. "print(dataset_path)\n",
  103. "\n",
  104. "import os\n",
  105. "os.listdir(dataset_path)"
  106. ]
  107. },
  108. {
  109. "cell_type": "code",
  110. "execution_count": 16,
  111. "id": "7d6617f0-7b86-4b1b-a201-ecdc58db53a5",
  112. "metadata": {},
  113. "outputs": [
  114. {
  115. "name": "stdout",
  116. "output_type": "stream",
  117. "text": [
  118. "/home/ma-user/work/pretrainmodel\n"
  119. ]
  120. },
  121. {
  122. "data": {
  123. "text/plain": [
  124. "['MNIST_Example_model_zjdt']"
  125. ]
  126. },
  127. "execution_count": 16,
  128. "metadata": {},
  129. "output_type": "execute_result"
  130. }
  131. ],
  132. "source": [
  133. "pretrain_model_path = openi_context.pretrain_model_path\n",
  134. "print(pretrain_model_path)\n",
  135. "os.listdir(pretrain_model_path)"
  136. ]
  137. },
  138. {
  139. "cell_type": "code",
  140. "execution_count": 17,
  141. "id": "6bc51211-5555-452e-9d83-adcfee1c4f79",
  142. "metadata": {},
  143. "outputs": [
  144. {
  145. "name": "stdout",
  146. "output_type": "stream",
  147. "text": [
  148. "/home/ma-user/work/output\n"
  149. ]
  150. },
  151. {
  152. "data": {
  153. "text/plain": [
  154. "[]"
  155. ]
  156. },
  157. "execution_count": 17,
  158. "metadata": {},
  159. "output_type": "execute_result"
  160. }
  161. ],
  162. "source": [
  163. "output_path = openi_context.output_path\n",
  164. "print(output_path)\n",
  165. "os.listdir(output_path)"
  166. ]
  167. },
  168. {
  169. "cell_type": "code",
  170. "execution_count": 9,
  171. "id": "48b5da5d-a55f-4781-9056-b886d41779c7",
  172. "metadata": {},
  173. "outputs": [
  174. {
  175. "name": "stdout",
  176. "output_type": "stream",
  177. "text": [
  178. "upload /home/ma-user/work/output to openi\n"
  179. ]
  180. },
  181. {
  182. "data": {
  183. "text/plain": [
  184. "'/home/ma-user/work/output'"
  185. ]
  186. },
  187. "execution_count": 9,
  188. "metadata": {},
  189. "output_type": "execute_result"
  190. }
  191. ],
  192. "source": [
  193. "#回传结果到openi,训练任务才能回传,调试任务回传后也是不支持下载\n",
  194. "upload_openi()"
  195. ]
  196. },
  197. {
  198. "cell_type": "code",
  199. "execution_count": null,
  200. "id": "75e7ce04-594e-4e8f-8292-15241709eb5e",
  201. "metadata": {},
  202. "outputs": [],
  203. "source": []
  204. }
  205. ],
  206. "metadata": {
  207. "kernelspec": {
  208. "display_name": "python-3.7.10",
  209. "language": "python",
  210. "name": "python-3.7.10"
  211. },
  212. "language_info": {
  213. "codemirror_mode": {
  214. "name": "ipython",
  215. "version": 3
  216. },
  217. "file_extension": ".py",
  218. "mimetype": "text/x-python",
  219. "name": "python",
  220. "nbconvert_exporter": "python",
  221. "pygments_lexer": "ipython3",
  222. "version": "3.7.10"
  223. }
  224. },
  225. "nbformat": 4,
  226. "nbformat_minor": 5
  227. }

No Description