Skip to main content

A test package for openi pypi

Project description

OpenI

PYPI package for 启智AI协作平台。

使用说明安装

  • 启智平台提供的Python工具包,使用户能在本地上传数据集。
  • 用户可以获取镜像内存放代码,数据集,模型,输出结果的路径
  • 可以使用公共函数实现数据集的拷贝,模型的上传等
  • 使用说明:
    • 使用前请在平台个人设置中获取token:点击跳转token获取界面
    • 当前版本为了解决用户上传数据集的需求,建议在本地使用。后续版本将适配代码仓配置、隐藏token及云脑任务。

安装

适配python3.6及以上版本

PYPI package for 启智 AI 协作平台。

安装

适配 python3.6 及以上版本

pip3 install -U openi_test
pip install openi-test==0.5.1 -i https://pypi.tuna.tsinghua.edu.cn/simple

本地上传数据集示例

dataset.upload_file(file, username, repository, token, cluster = "NPU")

平台数据集的上传与下载

  • 提供命令行与代码使用
  • 具体请参考 帮助文档-API参考
  • file str, 必填:文件路径(包含文件名,支持linux与mac路径,也支持windows文件路径如d:\xxx)
  • username str, 必填:上传数据集所属项目owner用户名,可以是用户或组织
  • repository str, 必填:数据集所属项目路径,此为仓库地址中的名字,更改过名称的项目需填写仓库地址中的路径
  • token str, 必填:用户启智上获取的令牌token,并对该数据集有权限
  • cluster str, 选填, 默认"NPU":可填入GPU或NPU,上传至不同的存储集群
from openi.dataset import upload_file
upload_file(
    file = "", # 必填,文件路径(包含文件名)
    username = "", # 必填,数据集所属项目用户名
    repository = "", # 必填,数据集所属项目名
    token = "", #必填,用户启智上获取的令牌token,并对该项目数据集有权限

    cluster = "", # 选填,可填入GPU或NPU,不填写后台默认为NPU
    app_url = "" #选填, 默认为平台地址,用户不用填写,开发测试用
    file = "", 
    username = "", 
    repository = "", 
    token = "", 
    cluster = ""
    )

界面

from openi.dataset import download_file

download_file(
    file="my_data.zip",
    repo_id="user1/repo1",
    cluster="gpu",
    save_path="local_path/",
)

""" output
Complete( my_data.zip)(gpu): 100%|██████████████████████████████████████████| 22.0MB/22.0MB [00:01<00:00, 15.9MB/s]
"""
>>> openi
usage: openi {login, whoami, dataset, ...} [<args>] [-h]

OpenI command line tool 启智AI协作平台命令行工具

commands:
  {login,logout,whoami,dataset,d,model,m}
    login               使用令牌登录启智并保存到本机
    logout              登出当前用户并删除本地令牌文件
    whoami              查询当前登录用户
    dataset (d)         {upload,download} 上传/下载启智AI协作平台的数据集
    model (m)           {upload,download} 上传/下载启智AI协作平台的模型
>>> openi login


             ██████╗   ██████╗  ███████╗  ███╗   ██╗  ██████╗
            ██╔═══██╗  ██╔══██╗ ██╔════╝  ████╗  ██║    ██╔═╝
            ██║   ██║  ██████╔╝ █████╗    ██╔██╗ ██║    ██║
            ██║   ██║  ██╔═══╝  ██╔══╝    ██║╚██╗██║    ██║
            ╚██████╔╝  ██║      ███████╗  ██║ ╚████║  ██████╗
             ╚═════╝   ╚═╝      ╚══════╝  ╚═╝  ╚═══╝  ╚═════╝


点击链接获取令牌并复制粘贴到下列输入栏 https://openi.pcl.ac.cn/user/settings/applications

[WARNING] 若本机已存在登录令牌,本次输入的令牌会将其覆盖
          粘贴前请先按 退格键⇦ 删除多余空格

  🔒 token:

云脑资源初始化与上传,获取路径示例:

#导入包
from openi.context import prepare, upload_openi

#初始化导入数据集和预训练模型到容器内
openi_context = prepare()

#获取数据集路径,预训练模型路径,输出路径
dataset_path = openi_context.dataset_path
pretrain_model_path = openi_context.pretrain_model_path
you_must_save_here = openi_context.output_path

#回传结果到openi
upload_openi()

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openi-test-0.8.9.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

openi_test-0.8.9-py3-none-any.whl (34.3 kB view details)

Uploaded Python 3

File details

Details for the file openi-test-0.8.9.tar.gz.

File metadata

  • Download URL: openi-test-0.8.9.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.5

File hashes

Hashes for openi-test-0.8.9.tar.gz
Algorithm Hash digest
SHA256 5e47a001fb927a0596637d2b95dcc02ef55af7131078ddca2dbdb9ff54577e7e
MD5 cde78821c50af835c2e20234f20f0604
BLAKE2b-256 2405412fb71eb0166955d0a43372edd0f2b1d991c78045f9cd6db867ecab2e4e

See more details on using hashes here.

File details

Details for the file openi_test-0.8.9-py3-none-any.whl.

File metadata

  • Download URL: openi_test-0.8.9-py3-none-any.whl
  • Upload date:
  • Size: 34.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.5

File hashes

Hashes for openi_test-0.8.9-py3-none-any.whl
Algorithm Hash digest
SHA256 e0bca3c99d249bd237df496b5a47877184ba5d8336e0bbe5cc1694ffbf7fb45e
MD5 caec67752603b8313d354e2f408feee3
BLAKE2b-256 35c2eeda9b5589062f65de6e4a9271c1359d4d80cfe726d79edd43a299d7ab57

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page