Create Photon from github
You can also create a photon from a Github repository. This is useful when you want to create a photon from a repository without cloning it to your local machine.
Step 1: Generate a token
Go to Github Personal Access Tokens Page, click Generate new token. Make the following changes based on your requirements:
-
Resource Owner: Change it to the owner of the repo from which you will be creating the photon.
-
Repository access: For security purposes, only select the repo you'd like to be used.
-
Permissions:
- Contents: Give read-only permission.
Then click Generate token.
Step 2: Set up the environment variable for CLI to pull the repo
In the terminal, type in the following commands:
export GITHUB_USER={YOUR_GITHUB_USERNAME}
export GITHUB_TOKEN={THE_TOKEN_GENERATED_FROM_STEP_1}
Step 3: Create photon via lepton cli
lep photon create -n {PHOTON_NAME} -m py:{GIT_REPO_URL}:{PATH_TO_SCRIPT}:{CLASS_NAME}
Key | Description | Example |
---|---|---|
PHOTON_NAME | The name of the photon | my-fs-counter |
GIT_REPO_URL | The URL for the repo | github.com/leptonai/examples.git |
PATH_TO_SCRIPT | The file extends the runner class | getting-started/counter/counter.py |
CLASS_NAME | The class extends the runner class inside the script | Counter |