ML-Agents Video Streamer
Now you can Live Stream the Agent's learning behavior to Twitch/YouTube from Google Colab while training these Agents.
What’s In This Document
Installation
!pip install mlagents-video-streamer
And if you already have mlagents-video-streamer then upgrade it by this command.
!pip install --upgrade mlagents-video-streamer
Imports and Usage
from mlagents_video_streamer import SetupVirtualDisplay
from mlagents_video_streamer import VideoStreamer
-
Now Setup the Virtual Display:
SetupVirtualDisplay()
-
Define your live stream information:
# stream_info dictionary should be in this format only stream_info = { "URL": "rtmp://live.twitch.tv/app/", # example of Twitch URL "secret": "--- secret here ---" }
-
Initialize the
VideoStreamerclass withstream_info:videoStreamer = VideoStreamer(stream_info)
*If you don't pass
stream_infothen it will simply store the video locally in thevideosdirectory. -
Start the video streamer before starting with the training process:
videoStreamer.start()
-
Now capture the training process, using subprocess library:
import subprocess from random import randrange try: train = subprocess.run([ "mlagents-learn", "config.yaml", "--run-id=train-1", "--env=3DBall_example/3DBall.x86_64", "--base-port=" + str(randrange(9000, 9999)) ], cwd="/content/", stdout=subprocess.PIPE) print("Training process has been successfully ended.") except Exception as e: print("You killed the training process in between.") finally: videoStreamer.close()
*At the end don't forget to close the video streamer by using
close()method onvideoStreamerobject as shown in the above example.
License
Licensed under the MIT License.
Metadata
Release files for mlagents-video-streamer 2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mlagents-video-streamer-2.0.tar.gz | 5.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mlagents_video_streamer-2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.6 kB
Release files / mlagents-video-streamer-2.0.tar.gz
| Download URL | mlagents-video-streamer-2.0.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
78319a7b341be5b9f6a72fe11fbee53cb86d59ece72cc3aa1447c32ff863270b
|
|
BLAKE2b-256 checksum How to use checksums |
a869906a65579c6e075d72239f7207db82a561fa637d7752ac632e9f7f0497bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1
|
Release files / mlagents_video_streamer-2.0-py3-none-any.whl
| Download URL | mlagents_video_streamer-2.0-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f73937f037cd5cb06b6318c17bc3dcddaf4df8f94f870ec5f2c3a8b36982db5e
|
|
BLAKE2b-256 checksum How to use checksums |
aa2dac78fe648c1563f88726c030d45726d75a5e5cc5cf8dac1807698eeb5509
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1
|
Security for mlagents-video-streamer 2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.