lep photon
Manages photons locally and on the Lepton AI cloud.
Photon is at the core of Lepton AI's abstraction: it is a Python centric
abstraction of an AI model or application, and provides a simple interface
to specify dependencies, extra files, and environment variables. For more
details, see leptonai.photon.Photon
.
The photon command is used to create photons locally, push and fetch photons between local and remote, and run, list and delete photons either locally or remotely.
Usage
lep photon [OPTIONS] COMMAND [ARGS]...
Options
--help
: Show this message and exit.
Commands
create
: Creates a new photon in the local environment.fetch
: Fetch a photon from the workspace.list
: Lists all photons.metadata
: Returns the metadata json of the photon.push
: Push a photon to the workspace.remove
: Removes a photon.run
: Runs a photon.runlocal
: Run a photon locally.scaffold
: Creates a scaffolding main.py file for a new photon.
lep photon scaffold
Creates a scaffolding main.py file for a new photon. The file serves as a
starting point that you can modify to create your own implementations. After
implementing your photon, you can use lep photon create -n [name] -m main.py
to create a photon from the file.
Usage
lep photon scaffold [OPTIONS]
Options
-n
,--name TEXT
: Name of the scaffolding file--help
: Show this message and exit.
lep photon create
Creates a new photon in the local environment. For specifics on the model
spec, see leptonai.photon.Photon
. To push a photon to the workspace, use
lep photon push
.
Developer note: insert a link to the photon documentation here.
Usage
lep photon create [OPTIONS]
Options
-n
,--name TEXT
: Name of the photon [required]-m
,--model TEXT
: Model spec [required]-r
,--requirements TEXT
: Path to file that contains additional requirements, such as a requirements.txt file.--help
: Show this message and exit.
lep photon remove
Removes a photon. The behavior of this command depends on whether one has
logged in to the Lepton AI cloud via lep login
. If one has logged in, this
command will remove the photon from the workspace. Otherwise, or of
--local
is explicitly specified, it will remove the photon from the local
environment.
Usage
lep photon remove [OPTIONS]
Options
-n
,--name TEXT
: Name of the photon to delete. If--all
is specified, all versions of the photon with this name will be deleted. Otherwise, remove the latest version of the photon with this name.-l
,--local
: Remove local photons instead of remote.-i
,--id TEXT
: The specific version id of the photon to remove.-a
,--all
: Remove all versions of the photon.--help
: Show this message and exit.
lep photon list
Lists all photons. If one has logged in to the Lepton AI cloud via lep login
, this command will list all photons in the Lepton AI cloud.
Otherwise, or if --local
is explicitly specified, it will list all photons
in the local environment.
Usage
lep photon list [OPTIONS]
Options
-l
,--local
: If specified, list local photons--pattern TEXT
: Regular expression pattern to filter photon names--public-photon
: If specified, list photons from the public photon registry.--help
: Show this message and exit.
lep photon run
Runs a photon. If one has logged in to the Lepton AI cloud via lep login
,
the photon will be run on the cloud. Otherwise, or if --local
is
specified, the photon will be run locally.
Refer to the documentation for a more detailed description on the choices
among --name
, --model
, --file
and --id
.
Usage
lep photon run [OPTIONS]
Options
-n
,--name TEXT
: Name of the photon to run.-m
,--model TEXT
: Model spec of the photon. If model is specified, we will rebuild the photon before running.-i
,--id TEXT
: ID of the photon (only required for remote).-dn
,--deployment-name TEXT
: Optional name for the deployment. If not specified, we will attempt to use the name (if specified) or id as the base name, and find the first non-conflict name by appending a number.--rerun
: If specified, shutdown the deployment of the same deployment name and rerun it. Note that this may cause downtime of the photon if it is for production use, so use with caution. In a production environment, you should do photon create, push, andlep deployment update
instead.--help
: Show this message and exit.
lep photon runlocal
Run a photon locally.
Usage
lep photon runlocal [OPTIONS]
Options
-n
,--name TEXT
: Name of the photon to run.-m
,--model TEXT
: Model spec of the photon. If model is specified, we will rebuild the photon before running.-f
,--file TEXT
: Path to the specific.photon
file to run.-p
,--port INTEGER
: Port to run on.-e
,--env TEXT
: Environment variables to pass to the deployment, in the formatNAME=VALUE
.-s
,--secret TEXT
: Secrets to pass to the deployment, in the formatNAME=SECRET_NAME
. If secret name is also the environment variable name, you can omit it and simply passSECRET_NAME
.--help
: Show this message and exit.
lep photon push
Push a photon to the workspace.
Usage
lep photon push [OPTIONS]
Options
-n
,--name TEXT
: Name of the photon [required]--help
: Show this message and exit.
lep photon metadata
Returns the metadata json of the photon.
Usage
lep photon metadata [OPTIONS]
Options
-n
,--name TEXT
: Name of the photon [required]-i
,--id TEXT
: ID of the photon, if the photon is a remote one. If not specified, the latest photon will be used.-l
,--local
: If specified, obtain metadata for the local photon.--indent INTEGER
: Indentation of the json.--public-photon
: If specified, get the photon from the public photon registry. This is only supported for remote execution.--help
: Show this message and exit.
lep photon fetch
Fetch a photon from the workspace.
Usage
lep photon fetch [OPTIONS]
Options
-i
,--id TEXT
: ID of the photon [required]-f
,--file TEXT
: Path to the local .photon file--help
: Show this message and exit.