lightning-sdk


Namelightning-sdk JSON
Version 0.1.7 PyPI version JSON
download
home_pageNone
SummarySDK to develop using Lightning AI Studios
upload_time2024-04-29 16:22:14
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2024 Grid.ai Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords deep learning machine learning pytorch ai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Lightning SDK

Software Development Kit (SDK) for Lightning AI

## Installation

The package can be installed using `pip install lightning-sdk`

## Usage

To use the SDK, you need to export the environment variables `LIGHTNING_USER_ID` and `LIGHTNING_API_KEY` with the values found in your account settings -> Keys -> Programmatic Login.

If you want to use it from within a Studio, these variables are already available for you.

## Example

```python
from lightning_sdk import Machine, Studio

# or s =  Studio("my-studio", "my-teamspace", org="my-org", create_ok=True)
# or (inside a Studio) s = Studio()  # will infer name, teamspace and owner of the current studio automatically.
#    can also just pass some arguments: s = Studio("my-new-studio", create_ok=True)
s = Studio("my-studio", "my-teamspace", user="my-username", create_ok=True)

print("starting Studio...")
s.start()

# prints Machine.CPU-4
print(s.machine)

# or start directly on this machine with s.start(Machine.A10G)
print("switching Studio machine...")
s.switch_machine(Machine.A10G)

# prints Machine.A10G
print(s.machine)

# prints Status.Running
print(s.status)

print(s.run("nvidia-smi"))

# install plugins for jobs and multi-machine training
s.install_plugin("jobs")
s.install_plugin("multi-machine-training")

# run the resulting plugins to start 1 job and 1 multi-machine training
s.installed_plugins["jobs"].run("python my_dummy_file", name="my_first_job", cloud_compute=Machine.A10G)
s.installed_plugins["multi-machine-training"].run("python my_dummy_file", name="my_first_mmt", cloud_compute=Machine.T4, num_instances=42)

print("Stopping Studio")
s.stop()

# duplicates Studio, this will also duplicate the environment and all files in the Studio
duplicate = s.duplicate()

# delete original Studio, duplicated Studio is it's own entity and not related to original anymore
s.delete()

# stop and delete duplicated Studio
duplicate.stop()
duplicate.delete()
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "lightning-sdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "deep learning, machine learning, pytorch, AI",
    "author": null,
    "author_email": "Lightning-AI <justus@lightning.ai>",
    "download_url": null,
    "platform": null,
    "description": "# Lightning SDK\n\nSoftware Development Kit (SDK) for Lightning AI\n\n## Installation\n\nThe package can be installed using `pip install lightning-sdk`\n\n## Usage\n\nTo use the SDK, you need to export the environment variables `LIGHTNING_USER_ID` and `LIGHTNING_API_KEY` with the values found in your account settings -> Keys -> Programmatic Login.\n\nIf you want to use it from within a Studio, these variables are already available for you.\n\n## Example\n\n```python\nfrom lightning_sdk import Machine, Studio\n\n# or s =  Studio(\"my-studio\", \"my-teamspace\", org=\"my-org\", create_ok=True)\n# or (inside a Studio) s = Studio()  # will infer name, teamspace and owner of the current studio automatically.\n#    can also just pass some arguments: s = Studio(\"my-new-studio\", create_ok=True)\ns = Studio(\"my-studio\", \"my-teamspace\", user=\"my-username\", create_ok=True)\n\nprint(\"starting Studio...\")\ns.start()\n\n# prints Machine.CPU-4\nprint(s.machine)\n\n# or start directly on this machine with s.start(Machine.A10G)\nprint(\"switching Studio machine...\")\ns.switch_machine(Machine.A10G)\n\n# prints Machine.A10G\nprint(s.machine)\n\n# prints Status.Running\nprint(s.status)\n\nprint(s.run(\"nvidia-smi\"))\n\n# install plugins for jobs and multi-machine training\ns.install_plugin(\"jobs\")\ns.install_plugin(\"multi-machine-training\")\n\n# run the resulting plugins to start 1 job and 1 multi-machine training\ns.installed_plugins[\"jobs\"].run(\"python my_dummy_file\", name=\"my_first_job\", cloud_compute=Machine.A10G)\ns.installed_plugins[\"multi-machine-training\"].run(\"python my_dummy_file\", name=\"my_first_mmt\", cloud_compute=Machine.T4, num_instances=42)\n\nprint(\"Stopping Studio\")\ns.stop()\n\n# duplicates Studio, this will also duplicate the environment and all files in the Studio\nduplicate = s.duplicate()\n\n# delete original Studio, duplicated Studio is it's own entity and not related to original anymore\ns.delete()\n\n# stop and delete duplicated Studio\nduplicate.stop()\nduplicate.delete()\n```\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Grid.ai  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "SDK to develop using Lightning AI Studios",
    "version": "0.1.7",
    "project_urls": null,
    "split_keywords": [
        "deep learning",
        " machine learning",
        " pytorch",
        " ai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f3480f519fb3fc1f58fb0f8d74d21852f003734c475292d6131672d86aade5d2",
                "md5": "f3026513e31bc829afdf8b8aafa52ed8",
                "sha256": "5c6cfb636b93e6db5ca81cb5b0cca5ad7f582412740d8df8f77c9d7a02452f1a"
            },
            "downloads": -1,
            "filename": "lightning_sdk-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f3026513e31bc829afdf8b8aafa52ed8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 1151800,
            "upload_time": "2024-04-29T16:22:14",
            "upload_time_iso_8601": "2024-04-29T16:22:14.948709Z",
            "url": "https://files.pythonhosted.org/packages/f3/48/0f519fb3fc1f58fb0f8d74d21852f003734c475292d6131672d86aade5d2/lightning_sdk-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-29 16:22:14",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "lightning-sdk"
}
        
Elapsed time: 0.24699s