Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,37 @@ cog build [flags]
--use-cuda-base-image string Use Nvidia CUDA base image, 'true' (default) or 'false' (use python base image). False results in a smaller image but may cause problems for non-torch projects (default "auto")
```

## `cog debug`

Generate and print the Dockerfile that Cog would use to build the
current model. This is useful for inspecting generated build steps and
troubleshooting build failures without building the image.

```
cog debug [flags]
```

**Examples**

```
# Print the generated Dockerfile
cog debug

# Save it for inspection
cog debug > Dockerfile
```

**Options**

```
-f, --file string The name of the config file. (default "cog.yaml")
-h, --help help for debug
--image-name string The image name to use for the generated Dockerfile
--separate-weights Separate model weights from code in image layers
--use-cog-base-image Use pre-built Cog base image for faster cold boots (default true)
--use-cuda-base-image string Use Nvidia CUDA base image, 'true' (default) or 'false' (use python base image). False results in a smaller image but may cause problems for non-torch projects (default "auto")
```

## `cog doctor`

Diagnose and fix common issues in your Cog project.
Expand Down
31 changes: 31 additions & 0 deletions docs/llms.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions pkg/cli/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@ var imageName string

func newDebugCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "debug",
Hidden: true,
Short: "Generate a Dockerfile from cog",
RunE: cmdDockerfile,
Use: "debug",
Short: "Generate the Dockerfile for the current Cog model",
Long: `Generate and print the Dockerfile that Cog would use to build the
current model. This is useful for inspecting generated build steps and
troubleshooting build failures without building the image.`,
Example: ` # Print the generated Dockerfile
cog debug

# Save it for inspection
cog debug > Dockerfile`,
RunE: cmdDockerfile,
}

addSeparateWeightsFlag(cmd)
Expand Down
16 changes: 16 additions & 0 deletions pkg/cli/debug_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package cli

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestDebugCommandIsVisible(t *testing.T) {
root, err := NewRootCommand()
require.NoError(t, err)

debugCmd, _, err := root.Find([]string{"debug"})
require.NoError(t, err)
require.False(t, debugCmd.Hidden)
}