diff --git a/.ai/system-prompt.md b/.ai/system-prompt.md index 95c266dae5..783309814b 100644 --- a/.ai/system-prompt.md +++ b/.ai/system-prompt.md @@ -21,7 +21,7 @@ As a W&B docs team member, you: ## Essential Guidelines ### Always: -- Follow the [W&B docs style guide](.ai/style-guide.md) +- Follow the [W&B docs style guide](./style-guide.md) - Use context managers for `wandb.init()` in code examples - Reference only public APIs documented in the [API reference](https://docs.wandb.ai/ref/python/) - Test code examples when possible to ensure they work diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml deleted file mode 100644 index 07d829aad1..0000000000 --- a/.github/workflows/build_docs.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Hugo build test - -on: - pull_request: - merge_group: - workflow_call: - -defaults: - run: - shell: bash - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5 - - name: Setup environment - run: | - wget "https://github.com/gohugoio/hugo/releases/download/v$(grep 'HUGO_VERSION' wrangler.toml | awk -F '\"' {'print $2'})/hugo_extended_$(grep 'HUGO_VERSION' wrangler.toml | awk -F '\"' {'print $2'})_linux-amd64.deb" -O hugo.deb - sudo apt install ./hugo.deb - npm install - go mod download - hugo mod get -u - - name: Run Hugo build - run: hugo diff --git a/.github/workflows/generate-reference-docs.yml b/.github/workflows/generate-reference-docs.yml new file mode 100644 index 0000000000..98fcb0c8ee --- /dev/null +++ b/.github/workflows/generate-reference-docs.yml @@ -0,0 +1,136 @@ +name: Generate Weave Reference Documentation + +on: + workflow_dispatch: + inputs: + weave_version: + description: 'Weave version (e.g., "latest", "0.51.34", "v0.51.34", commit SHA, or branch name)' + required: false + default: 'latest' + type: string + +jobs: + generate-docs: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Cache Python dependencies + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('scripts/reference-generation/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Install requests for Service API generation + run: | + pip install requests + + - name: Set version variable + id: version + run: | + VERSION="${{ github.event.inputs.weave_version }}" + echo "version=${VERSION}" >> $GITHUB_OUTPUT + echo "Using Weave version: ${VERSION}" + + # Generate timestamp + TIMESTAMP=$(date -u +"%Y-%m-%d %H:%M:%S UTC") + echo "timestamp=${TIMESTAMP}" >> $GITHUB_OUTPUT + echo "Generated at: ${TIMESTAMP}" + + - name: Generate Service API Documentation + run: | + echo "Generating Service API documentation..." + python scripts/reference-generation/generate_service_api_spec.py + + - name: Generate Python SDK Documentation + run: | + echo "Generating Python SDK documentation..." + VERSION="${{ steps.version.outputs.version }}" + echo "Using Weave version: ${VERSION}" + + # Create isolated environment for Python SDK generation + python -m venv venv_python + source venv_python/bin/activate + pip install requests lazydocs + python scripts/reference-generation/generate_python_sdk_docs.py "${VERSION:-latest}" + deactivate + rm -rf venv_python + + - name: Generate TypeScript SDK Documentation + run: | + echo "Generating TypeScript SDK documentation..." + VERSION="${{ steps.version.outputs.version }}" + echo "Using Weave version: ${VERSION}" + + # Create isolated environment for TypeScript SDK generation + python -m venv venv_typescript + source venv_typescript/bin/activate + python scripts/reference-generation/generate_typescript_sdk_docs.py "${VERSION:-latest}" + deactivate + rm -rf venv_typescript + + - name: Fix file casing + run: | + echo "Fixing file casing for SDK documentation..." + python scripts/reference-generation/fix_casing.py + + - name: Fix broken links + run: | + echo "Fixing broken links in documentation..." + python scripts/reference-generation/fix_broken_links.py + + - name: Create Pull Request + id: create-pr + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "chore: Update reference documentation (Weave ${{ steps.version.outputs.version }})" + title: "Update Weave reference documentation (Weave ${{ steps.version.outputs.version }})" + draft: true + body: | + This PR updates the reference documentation for Weave. + + **Version**: ${{ steps.version.outputs.version }} + **Generated on**: ${{ steps.version.outputs.timestamp }} + + ### Changes + - Updated Service API documentation from OpenAPI spec + - Regenerated Python SDK documentation using lazydocs + - Regenerated TypeScript SDK documentation using typedoc + - Fixed internal cross-reference links + + ### Notes + - Documentation generation runs in isolated environments + - All dependencies are development-only and not included in the repository + - Please review the changes before merging + branch: update-reference-docs-${{ github.run_number }} + delete-branch: true + labels: | + documentation + automated + weave + + - name: Display PR Link + if: steps.create-pr.outputs.pull-request-number + run: | + PR_URL="https://github.com/${{ github.repository }}/pull/${{ steps.create-pr.outputs.pull-request-number }}" + echo "📝 Draft PR created successfully!" + echo "🔗 Review the changes at: $PR_URL" + echo "" + echo "::notice title=Pull Request Created::A draft PR has been created for review: $PR_URL" diff --git a/.github/workflows/mintlify-deployment-preview.yml b/.github/workflows/mintlify-deployment-preview.yml new file mode 100644 index 0000000000..bb16376fa0 --- /dev/null +++ b/.github/workflows/mintlify-deployment-preview.yml @@ -0,0 +1,483 @@ +name: Mintlify Deployment Preview Links + +on: + deployment_status: + +permissions: + contents: read + pull-requests: write + issues: write + deployments: read + +jobs: + update-preview-links: + # Only run when Mintlify deployment succeeds + if: | + github.event.deployment_status.state == 'success' && + github.event.deployment.environment == 'staging' && + contains(github.event.deployment_status.creator.login, 'mintlify') + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v5 + with: + ref: ${{ github.event.deployment.ref }} + + - name: Get PR number from deployment ref + id: get-pr + uses: actions/github-script@v8 + with: + script: | + // The deployment ref is the branch name + const branch = context.payload.deployment.ref; + const deploymentSha = context.payload.deployment.sha; + + // Find PRs for this branch + const prs = await github.rest.pulls.list({ + owner: context.repo.owner, + repo: context.repo.repo, + head: `${context.repo.owner}:${branch}`, + state: 'open' + }); + + if (prs.data.length > 0) { + const pr = prs.data[0]; + + // Check if this deployment is for the latest commit in the PR + const prHeadSha = pr.head.sha; + if (deploymentSha !== prHeadSha) { + core.warning(`Deployment SHA (${deploymentSha}) doesn't match PR head SHA (${prHeadSha})`); + core.warning(`This appears to be a deployment for an older commit. Skipping update.`); + core.setOutput('skip_update', 'true'); + return null; + } + + core.setOutput('pr_number', pr.number); + core.setOutput('base_ref', pr.base.ref); + core.setOutput('base_sha', pr.base.sha); + core.setOutput('skip_update', 'false'); + core.info(`Found PR #${pr.number} for branch ${branch}`); + core.info(`Base branch: ${pr.base.ref} (${pr.base.sha})`); + core.info(`Deployment SHA matches PR head: ${deploymentSha}`); + return pr.number; + } else { + core.warning(`No open PR found for branch ${branch}`); + core.setOutput('skip_update', 'true'); + return null; + } + + - name: Get all PR changed files + if: steps.get-pr.outputs.pr_number && steps.get-pr.outputs.skip_update != 'true' + id: changed + uses: actions/github-script@v8 + with: + script: | + const prNumber = parseInt('${{ steps.get-pr.outputs.pr_number }}'); + + // Get all files changed in the PR + const files = await github.paginate(github.rest.pulls.listFiles, { + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber, + per_page: 100 + }); + + // Filter for relevant file types + const relevantFiles = files.filter(file => { + const filename = file.filename; + return filename.endsWith('.mdx') || + filename.endsWith('.md') || + filename === 'docs.json' || + filename === 'mint.json' || + filename.startsWith('snippets/') || + filename.startsWith('images/') || + filename.startsWith('icons/') || + filename.startsWith('logo/') || + filename.startsWith('static/') || + filename === 'style.css'; + }); + + // Group files by status - include previous_filename for renamed files + const added = relevantFiles.filter(f => f.status === 'added').map(f => f.filename); + const modified = relevantFiles.filter(f => f.status === 'modified').map(f => f.filename); + const removed = relevantFiles.filter(f => f.status === 'removed').map(f => f.filename); + const renamed = relevantFiles.filter(f => f.status === 'renamed').map(f => ({ + old: f.previous_filename, + new: f.filename + })); + + // Store all categorized files for the comment builder + core.setOutput('added_files', JSON.stringify(added)); + core.setOutput('modified_files', JSON.stringify(modified)); + core.setOutput('removed_files', JSON.stringify(removed)); + core.setOutput('renamed_files', JSON.stringify(renamed)); + core.setOutput('any_changed', relevantFiles.length > 0 ? 'true' : 'false'); + + core.info(`Found ${relevantFiles.length} changed files in PR #${prNumber}`); + core.info(`Added: ${added.length}, Modified: ${modified.length}, Renamed: ${renamed.length}, Removed: ${removed.length}`); + + - name: Update PR comment with preview links + if: steps.get-pr.outputs.pr_number && steps.get-pr.outputs.skip_update != 'true' && steps.changed.outputs.any_changed == 'true' + uses: actions/github-script@v8 + env: + PR_NUMBER: ${{ steps.get-pr.outputs.pr_number }} + PREVIEW_URL: ${{ github.event.deployment_status.environment_url }} + ADDED_FILES: ${{ steps.changed.outputs.added_files }} + MODIFIED_FILES: ${{ steps.changed.outputs.modified_files }} + REMOVED_FILES: ${{ steps.changed.outputs.removed_files }} + RENAMED_FILES: ${{ steps.changed.outputs.renamed_files }} + with: + script: | + const fs = require('fs'); + const path = require('path'); + + const prNumber = parseInt(process.env.PR_NUMBER); + const previewUrl = process.env.PREVIEW_URL; + + // Parse the categorized files + const added = JSON.parse(process.env.ADDED_FILES || '[]'); + const modified = JSON.parse(process.env.MODIFIED_FILES || '[]'); + const removed = JSON.parse(process.env.REMOVED_FILES || '[]'); + const renamed = JSON.parse(process.env.RENAMED_FILES || '[]'); + + if (!previewUrl) { + core.warning('No preview URL found in deployment status'); + return; + } + + const totalFiles = added.length + modified.length + removed.length + renamed.length; + core.info(`Mintlify Preview URL: ${previewUrl}`); + core.info(`Total changed files: ${totalFiles}`); + core.info(`Added: ${added.length}, Modified: ${modified.length}, Renamed: ${renamed.length}, Removed: ${removed.length}`); + + // Helper function to detect if a file is an image + function isImageFile(filepath) { + const imageExtensions = ['.png', '.jpg', '.jpeg', '.gif', '.svg', '.webp', '.ico', '.bmp']; + const ext = path.extname(filepath).toLowerCase(); + if (imageExtensions.includes(ext)) return true; + + // Also check if it's in an image-related directory + return filepath.startsWith('images/') || + filepath.startsWith('icons/') || + filepath.startsWith('logo/') || + filepath.startsWith('static/'); + } + + // Function to get title from file path + function titleFromPath(p) { + let base = path.basename(p, path.extname(p)); + + // Handle special icon naming pattern + if (base.includes('Name=') || base.includes('Mode=')) { + const nameMatch = base.match(/Name=([^,\s]+)/); + const modeMatch = base.match(/Mode=([^,\s]+)/); + + if (nameMatch || modeMatch) { + const parts = []; + if (nameMatch) parts.push(nameMatch[1]); + if (modeMatch) parts.push(modeMatch[1]); + base = parts.join(' '); + } + } + + if (base === 'index') { + const dir = path.dirname(p); + const parent = path.basename(dir); + return parent.replace(/[-_]+/g, ' ').replace(/\b\w/g, c => c.toUpperCase()); + } + return base.replace(/[-_]+/g, ' ').replace(/\b\w/g, c => c.toUpperCase()); + } + + // Function to get URL from file path + function urlFromPath(p) { + // Remove file extension + let urlPath = p.replace(/\.(mdx?|md)$/, ''); + + // Remove 'index' from the end if present + if (urlPath.endsWith('/index')) { + urlPath = urlPath.slice(0, -6); + } + + return `${previewUrl}/${urlPath}`; + } + + // Helper function to create file table rows + function createFileTable(files, maxShow = 10, showPreview = true, isImage = false) { + let table = showPreview ? + `| File | Preview |\n|------|----------|\n` : + `| File |\n|------|\n`; + + const toShow = files.slice(0, maxShow); + toShow.forEach(file => { + if (showPreview) { + if (file.endsWith('.mdx') || file.endsWith('.md')) { + const title = titleFromPath(file); + const url = urlFromPath(file); + table += `| \`${file}\` | [${title}](${url}) |\n`; + } else if (isImage) { + // Images can also be previewed directly + const title = titleFromPath(file); + const url = `${previewUrl}/${file}`; + table += `| \`${file}\` | [View ${title}](${url}) |\n`; + } else { + table += `| \`${file}\` | - |\n`; + } + } else { + table += `| \`${file}\` |\n`; + } + }); + + if (files.length > maxShow) { + table += showPreview ? + `| *... and ${files.length - maxShow} more files* | |\n` : + `| *... and ${files.length - maxShow} more files* |\n`; + } + + return table; + } + + // Build comment body + let body = `\n`; + body += `## 📚 Mintlify Preview Links\n\n`; + body += `🔗 **[View Full Preview](${previewUrl})**\n\n`; + + const maxPerSubcategory = 10; + let hasChanges = false; + + // Renamed/Moved files + if (renamed.length > 0) { + hasChanges = true; + body += `### 🔄 Renamed/Moved (${renamed.length} total)\n\n`; + + const pagesRenamed = renamed.filter(r => r.new.endsWith('.mdx') || r.new.endsWith('.md')); + const imagesRenamed = renamed.filter(r => !pagesRenamed.some(p => p.new === r.new) && isImageFile(r.new)); + const otherRenamed = renamed.filter(r => !pagesRenamed.some(p => p.new === r.new) && !imagesRenamed.some(i => i.new === r.new)); + + // Pages (with preview links) + if (pagesRenamed.length > 0) { + body += `#### 📄 Pages (${pagesRenamed.length})\n\n`; + body += `| Old Path → New Path | Preview |\n|---------------------|----------|\n`; + const toShow = pagesRenamed.slice(0, maxPerSubcategory); + toShow.forEach(({old: oldPath, new: newPath}) => { + const title = titleFromPath(newPath); + const url = urlFromPath(newPath); + body += `| \`${oldPath}\`
→ \`${newPath}\` | [${title}](${url}) |\n`; + }); + if (pagesRenamed.length > maxPerSubcategory) { + body += `| *... and ${pagesRenamed.length - maxPerSubcategory} more pages* | |\n`; + } + body += `\n`; + } + + // Images (with preview links) + if (imagesRenamed.length > 0) { + if (imagesRenamed.length > 5) { + body += `
\n🖼️ Images (${imagesRenamed.length})\n\n`; + } else { + body += `#### 🖼️ Images (${imagesRenamed.length})\n\n`; + } + body += `| Old Path → New Path | Preview |\n|---------------------|----------|\n`; + const toShow = imagesRenamed.slice(0, maxPerSubcategory); + toShow.forEach(({old: oldPath, new: newPath}) => { + const title = titleFromPath(newPath); + const url = `${previewUrl}/${newPath}`; + body += `| \`${oldPath}\`
→ \`${newPath}\` | [View ${title}](${url}) |\n`; + }); + if (imagesRenamed.length > maxPerSubcategory) { + body += `| *... and ${imagesRenamed.length - maxPerSubcategory} more images* | |\n`; + } + if (imagesRenamed.length > 5) { + body += `\n
\n`; + } + body += `\n`; + } + + // Other files (no preview) + if (otherRenamed.length > 0) { + body += `
\n⚙️ Other (${otherRenamed.length})\n\n`; + body += `| Old Path → New Path |\n|---------------------|\n`; + const toShow = otherRenamed.slice(0, maxPerSubcategory); + toShow.forEach(({old: oldPath, new: newPath}) => { + body += `| \`${oldPath}\`
→ \`${newPath}\` |\n`; + }); + if (otherRenamed.length > maxPerSubcategory) { + body += `| *... and ${otherRenamed.length - maxPerSubcategory} more files* |\n`; + } + body += `\n
\n\n`; + } + } + + // Added files + if (added.length > 0) { + hasChanges = true; + body += `### ✨ Added (${added.length} total)\n\n`; + + const pagesAdded = added.filter(f => f.endsWith('.mdx') || f.endsWith('.md')); + const imagesAdded = added.filter(f => !pagesAdded.includes(f) && isImageFile(f)); + const otherAdded = added.filter(f => !pagesAdded.includes(f) && !imagesAdded.includes(f)); + + // Pages (with preview links) + if (pagesAdded.length > 0) { + body += `#### 📄 Pages (${pagesAdded.length})\n\n`; + body += createFileTable(pagesAdded, maxPerSubcategory, true, false); + body += `\n`; + } + + // Images (with preview links) + if (imagesAdded.length > 0) { + if (imagesAdded.length > 5) { + body += `
\n🖼️ Images (${imagesAdded.length})\n\n`; + } else { + body += `#### 🖼️ Images (${imagesAdded.length})\n\n`; + } + body += createFileTable(imagesAdded, maxPerSubcategory, true, true); + if (imagesAdded.length > 5) { + body += `
\n`; + } + body += `\n`; + } + + // Other files (no preview) + if (otherAdded.length > 0) { + body += `
\n⚙️ Other (${otherAdded.length})\n\n`; + body += createFileTable(otherAdded, maxPerSubcategory, false); + body += `\n
\n\n`; + } + } + + // Changed files (Modified) + if (modified.length > 0) { + hasChanges = true; + body += `### 📝 Changed (${modified.length} total)\n\n`; + + const pagesModified = modified.filter(f => f.endsWith('.mdx') || f.endsWith('.md')); + const imagesModified = modified.filter(f => !pagesModified.includes(f) && isImageFile(f)); + const otherModified = modified.filter(f => !pagesModified.includes(f) && !imagesModified.includes(f)); + + // Pages (with preview links) + if (pagesModified.length > 0) { + body += `#### 📄 Pages (${pagesModified.length})\n\n`; + body += createFileTable(pagesModified, maxPerSubcategory, true, false); + body += `\n`; + } + + // Images (with preview links) + if (imagesModified.length > 0) { + if (imagesModified.length > 5) { + body += `
\n🖼️ Images (${imagesModified.length})\n\n`; + } else { + body += `#### 🖼️ Images (${imagesModified.length})\n\n`; + } + body += createFileTable(imagesModified, maxPerSubcategory, true, true); + if (imagesModified.length > 5) { + body += `
\n`; + } + body += `\n`; + } + + // Other files (no preview) + if (otherModified.length > 0) { + body += `
\n⚙️ Other (${otherModified.length})\n\n`; + body += createFileTable(otherModified, maxPerSubcategory, false); + body += `\n
\n\n`; + } + } + + // Deleted files (no preview links) + if (removed.length > 0) { + hasChanges = true; + body += `### 🗑️ Deleted (${removed.length} total)\n\n`; + + const pagesRemoved = removed.filter(f => f.endsWith('.mdx') || f.endsWith('.md')); + const imagesRemoved = removed.filter(f => !pagesRemoved.includes(f) && isImageFile(f)); + const otherRemoved = removed.filter(f => !pagesRemoved.includes(f) && !imagesRemoved.includes(f)); + + body += `
\nView deleted files\n\n`; + + // Pages (no preview) + if (pagesRemoved.length > 0) { + body += `**📄 Pages (${pagesRemoved.length})**\n\n`; + body += `| File |\n|------|\n`; + const toShow = pagesRemoved.slice(0, maxPerSubcategory); + toShow.forEach(file => { + body += `| \`${file}\` |\n`; + }); + if (pagesRemoved.length > maxPerSubcategory) { + body += `| *... and ${pagesRemoved.length - maxPerSubcategory} more pages* |\n`; + } + body += `\n`; + } + + // Images (no preview) + if (imagesRemoved.length > 0) { + body += `**🖼️ Images (${imagesRemoved.length})**\n\n`; + body += `| File |\n|------|\n`; + const toShow = imagesRemoved.slice(0, maxPerSubcategory); + toShow.forEach(file => { + body += `| \`${file}\` |\n`; + }); + if (imagesRemoved.length > maxPerSubcategory) { + body += `| *... and ${imagesRemoved.length - maxPerSubcategory} more images* |\n`; + } + body += `\n`; + } + + // Other files (no preview) + if (otherRemoved.length > 0) { + body += `**⚙️ Other (${otherRemoved.length})**\n\n`; + body += `| File |\n|------|\n`; + const toShow = otherRemoved.slice(0, maxPerSubcategory); + toShow.forEach(file => { + body += `| \`${file}\` |\n`; + }); + if (otherRemoved.length > maxPerSubcategory) { + body += `| *... and ${otherRemoved.length - maxPerSubcategory} more files* |\n`; + } + body += `\n`; + } + + body += `
\n\n`; + } + + if (!hasChanges) { + body += `*No documentation changes detected in this PR.*\n\n`; + } + + // Add deployment info and timestamp + const deploymentSha = context.payload.deployment.sha.substring(0, 7); + const timestamp = new Date().toISOString().replace('T', ' ').split('.')[0] + ' UTC'; + + body += `\n---\n`; + body += `🤖 *Generated automatically when Mintlify deployment succeeds*\n`; + body += `📍 *Deployment: \`${deploymentSha}\` at ${timestamp}*`; + + // Find existing comment + const comments = await github.paginate(github.rest.issues.listComments, { + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + per_page: 100, + }); + + let existingComment = comments.find(c => + c.body && c.body.includes('') + ); + + // Create or update comment + if (existingComment) { + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: existingComment.id, + body + }); + core.info(`Updated existing comment #${existingComment.id}`); + } else { + const newComment = await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + body + }); + core.info(`Created new comment #${newComment.data.id}`); + } diff --git a/.github/workflows/pr-preview-links-on-comment.yml b/.github/workflows/pr-preview-links-on-comment.yml deleted file mode 100644 index 1d2dc5e973..0000000000 --- a/.github/workflows/pr-preview-links-on-comment.yml +++ /dev/null @@ -1,545 +0,0 @@ -name: PR Preview Links - Update on Cloudflare Comment - -on: - issue_comment: - types: [created, edited] - -permissions: - contents: read - pull-requests: write - issues: write - -jobs: - update-preview-links: - # Only run on PR comments from Cloudflare bot - if: | - github.event.issue.pull_request && - contains(github.event.comment.user.login, 'cloudflare') && - contains(github.event.comment.body, 'Branch Preview URL') - - runs-on: ubuntu-latest - - steps: - - name: Get PR details - id: pr - uses: actions/github-script@v8 - with: - script: | - const pr = await github.rest.pulls.get({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.issue.number - }); - core.setOutput('head_sha', pr.data.head.sha); - core.setOutput('base_sha', pr.data.base.sha); - - - name: Checkout - uses: actions/checkout@v5 - with: - fetch-depth: 0 - ref: ${{ steps.pr.outputs.head_sha }} - - - name: Setup Node.js - uses: actions/setup-node@v6 - with: - node-version-file: .node-version - - - name: Get Hugo version and setup - run: | - set -euo pipefail - ver=$(grep 'HUGO_VERSION' wrangler.toml | awk -F '"' '{print $2}') - wget "https://github.com/gohugoio/hugo/releases/download/v${ver}/hugo_extended_${ver}_linux-amd64.deb" -O hugo.deb - sudo apt-get update - sudo apt-get install -y ./hugo.deb - - - name: Setup Go - uses: actions/setup-go@v6 - with: - go-version-file: go.mod - check-latest: true - - - name: Setup deps for build - run: | - set -euo pipefail - npm install - go mod download - hugo mod get -u - - - name: Get changed files - id: changed - uses: tj-actions/changed-files@v47 - with: - base_sha: ${{ steps.pr.outputs.base_sha }} - sha: ${{ steps.pr.outputs.head_sha }} - files: | - content/** - static/** - assets/** - layouts/** - i18n/** - configs/** - include_all_old_new_renamed_files: true - - - name: Build Hugo (generate pageurls) - if: steps.changed.outputs.any_changed == 'true' - run: | - hugo --minify - test -f public/pageurls.json && echo "Found pageurls.json" || (echo "Missing pageurls.json" && ls -la public || true) - - - - name: Extract Branch Preview URL - id: extract-url - uses: actions/github-script@v8 - with: - script: | - function sanitizeUrl(u) { - if (!u) return ''; - u = u.trim().replace(/^['"<]+/, '').replace(/[>'"]+$/, ''); - u = u.split(/[\s<>'"\]\)]/)[0]; - try { u = decodeURI(u); } catch (e) {} - return u.replace(/\/$/, ''); - } - - function extractBranchPreviewUrl(body) { - const patterns = [ - // Table format with anchor tag (what Cloudflare actually uses) - /Branch\s+Preview\s+URL:<\/strong><\/td>[\s\S]*?]+href=['"]([^'"<>]+pages\.dev[^'"<>]*)['"]/i, - // Try anchor tag format on same line - /Branch\s+Preview\s+URL:\s*]+href=['"]([^'"<>]+pages\.dev[^'"<>]*)['"]/i, - // Try plain URL format - /Branch\s+Preview\s+URL:\s*]+pages\.dev[^\s<>]*)/i - ]; - - for (const pattern of patterns) { - const m = (body || '').match(pattern); - if (m && m[1]) { - const url = m[1]; - if (!url.startsWith('http')) { - return sanitizeUrl('https://' + url); - } - return sanitizeUrl(url); - } - } - return ''; - } - - const branchUrl = extractBranchPreviewUrl(context.payload.comment.body); - core.info(`Extracted Branch Preview URL: ${branchUrl}`); - core.setOutput('branch_url', branchUrl); - - - name: Update PR comment with preview links - if: steps.changed.outputs.any_changed == 'true' && steps.extract-url.outputs.branch_url - uses: actions/github-script@v8 - env: - ADDED: ${{ steps.changed.outputs.added_files }} - MODIFIED: ${{ steps.changed.outputs.modified_files }} - DELETED: ${{ steps.changed.outputs.deleted_files }} - RENAMED: ${{ steps.changed.outputs.renamed_files }} - RENAMED_PAIRS: ${{ steps.changed.outputs.all_old_new_renamed_files }} - PREVIEW_BASE: ${{ steps.extract-url.outputs.branch_url }} - with: - script: | - const fs = require('fs'); - const path = require('path'); - - function splitList(s) { - if (!s) return []; - return s - .split(/\r?\n|,|\s+/) - .map(x => x.trim()) - .filter(Boolean); - } - - const added = splitList(process.env.ADDED); - const modified = splitList(process.env.MODIFIED); - const deleted = splitList(process.env.DELETED); - const renamed = splitList(process.env.RENAMED); - const renamedPairs = splitList(process.env.RENAMED_PAIRS); - - // Process renamed files - tj-actions outputs them as "old_path new_path" pairs - const renamedFiles = []; - const renamedMapping = new Map(); // old path -> new path - for (let i = 0; i < renamedPairs.length; i += 2) { - if (i + 1 < renamedPairs.length) { - const oldPath = renamedPairs[i]; - const newPath = renamedPairs[i + 1]; - renamedMapping.set(oldPath, newPath); - renamedFiles.push({ old: oldPath, new: newPath }); - } - } - - // Filter out renamed files from added and deleted arrays to avoid duplication - const addedFiltered = added.filter(f => !Array.from(renamedMapping.values()).includes(f)); - const deletedFiltered = deleted.filter(f => !Array.from(renamedMapping.keys()).includes(f)); - - const allChanged = [...addedFiltered, ...modified, ...deletedFiltered, ...renamed]; - const anyEligible = allChanged.some(p => /^(content|static|assets)\//.test(p)); - - // Handle case where there are no content changes - if (!anyEligible) { - core.info('No relevant content changes. Updating comment to reflect this.'); - - const previewBase = (process.env.PREVIEW_BASE || '').replace(/\/$/, ''); - const header = '\n\n**PR Preview: Changed content**'; - const body = header + '\n\nNo documentation content changes in this PR.'; - - // Find and update our existing comment - const comments = await github.paginate(github.rest.issues.listComments, { - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - per_page: 100, - }); - - const existing = comments.find(c => //.test(c.body || '')); - if (existing) { - await github.rest.issues.updateComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: existing.id, - body, - }); - core.info('Updated existing preview links comment to show no content changes'); - } - - return; - } - - let pageMap = []; - // Build candidate pageurls.json paths by scanning public/ - const candidatePaths = new Set(); - try { - if (fs.existsSync('public/pageurls.json')) candidatePaths.add('public/pageurls.json'); - } catch (e) { - core.warning(`Root pageurls existence check failed: ${e.message}`); - } - try { - if (fs.existsSync('public')) { - const entries = fs.readdirSync('public', { withFileTypes: true }); - for (const ent of entries) { - if (ent.isDirectory()) { - candidatePaths.add(path.posix.join('public', ent.name, 'pageurls.json')); - candidatePaths.add(path.posix.join('public', ent.name, 'index.pageurls.json')); - } - } - } - } catch (e) { - core.warning(`Could not scan public/ for languages: ${e.message}`); - } - - core.info(`Attempting to load page maps from: ${Array.from(candidatePaths).join(', ') || '(none)'}`); - for (const pageurlsPath of candidatePaths) { - try { - if (!fs.existsSync(pageurlsPath)) continue; - const raw = fs.readFileSync(pageurlsPath, 'utf8'); - const langPages = JSON.parse(raw); - pageMap = pageMap.concat(langPages); - core.info(`Loaded ${langPages.length} pages from ${pageurlsPath}`); - - } catch (e) { - core.warning(`Could not read ${pageurlsPath}. ${e.message}`); - } - } - - // Build lookup: support keys with and without language prefix - const byPath = new Map(); - for (const p of pageMap) { - const lang = p.lang || 'en'; // Default to 'en' if no lang specified - const rel = (p.path || '').replace(/^\/+/, '').replace(/\\/g, '/'); - const withLang = lang && !rel.startsWith(lang + '/') ? `${lang}/${rel}` : rel; - const withoutLang = lang && rel.startsWith(lang + '/') ? rel.slice(lang.length + 1) : rel; - const keys = new Set([ - rel, - withLang, - withoutLang, - path.posix.join('content', withLang), - path.posix.join('content', withoutLang), - path.posix.join('content', rel), - // Add explicit handling for language in path - path.posix.join('content', lang, rel), - path.posix.join('content', lang, withoutLang), - // Add .md extension variations for content files - rel.endsWith('.md') ? rel : rel + '.md', - withLang.endsWith('.md') ? withLang : withLang + '.md', - withoutLang.endsWith('.md') ? withoutLang : withoutLang + '.md', - path.posix.join('content', lang, rel.endsWith('.md') ? rel : rel + '.md'), - path.posix.join('content', lang, withoutLang.endsWith('.md') ? withoutLang : withoutLang + '.md'), - path.posix.join('content', withLang.endsWith('.md') ? withLang : withLang + '.md'), - path.posix.join('content', withoutLang.endsWith('.md') ? withoutLang : withoutLang + '.md'), - // Special handling for index files - path.posix.join('content', lang, '_index.md'), - path.posix.join('content', lang, 'index.md'), - ].filter(Boolean).map(k => k.replace(/\\/g, '/'))); - - // Debug log for new pages - if (p.path && p.path.includes('dspy')) { - core.info(`Debug: Page ${p.path} (lang: ${lang}) has keys: ${Array.from(keys).join(', ')}`); - } - - for (const k of keys) byPath.set(k, p); - } - - - const previewBase = (process.env.PREVIEW_BASE || '').replace(/\/$/, ''); - core.info(`Using Branch Preview URL: ${previewBase}`); - - function mapEntry(filePath) { - const norm = filePath.replace(/\\/g, '/'); - - // Try multiple variations to find the item - let item = byPath.get(norm); - if (!item) item = byPath.get(norm.replace(/^content\//, '')); - if (!item) item = byPath.get(norm.replace(/\.md$/, '')); - if (!item) item = byPath.get(norm.replace(/^content\//, '').replace(/\.md$/, '')); - - // Debug log for unmatched files - if (!item) { - core.info(`Debug: Could not find mapping for ${norm}`); - // For new files, construct the URL based on the file path - if (norm.startsWith('content/') && norm.endsWith('.md')) { - // Extract language and path - const pathParts = norm.replace(/^content\//, '').replace(/\.md$/, '').split('/'); - let lang = 'en'; - let urlPath = pathParts.join('/'); - - // Check if first part is a language code - if (['en', 'ja', 'ko'].includes(pathParts[0])) { - lang = pathParts[0]; - urlPath = pathParts.slice(1).join('/'); - } - - // Handle _index.md files - if (urlPath.endsWith('/_index') || urlPath === '_index') { - urlPath = urlPath.replace(/\/_index$/, '').replace(/^_index$/, ''); - } - - // Construct the URL - const rel = lang === 'en' ? `/${urlPath}/` : `/${lang}/${urlPath}/`; - const href = previewBase ? (previewBase.replace(/\/$/, '') + rel) : ''; - - core.info(`Debug: Constructed URL for new file ${norm}: ${href}`); - return { title: titleFromPath(norm), rel, href, path: norm }; - } - } - - if (!item) return { title: titleFromPath(norm), rel: '', href: '', path: norm }; - const rel = item.relPermalink || ''; - const href = previewBase ? (previewBase.replace(/\/$/, '') + rel) : ''; - const title = item.title || titleFromPath(norm); - return { title, rel, href, path: norm }; - } - - function titleFromPath(p) { - const stem = p.replace(/^content\//, '').replace(/\.(md|markdown)$/, ''); - const parts = stem.split('/'); - const last = parts[parts.length - 1]; - const base = last === 'index' ? (parts[parts.length - 2] || 'index') : last; - return base.replace(/[\-_]+/g, ' ').replace(/\b\w/g, c => c.toUpperCase()); - } - - // Function to check if a file is an include - function isIncludeFile(filePath) { - return /^content\/[^\/]+\/_includes\//.test(filePath); - } - - // Function to find pages that use a specific include - function findPagesUsingInclude(includePath) { - const includeFileName = includePath.split('/').pop(); - const pagesUsingInclude = []; - - // Search through all pages in pageMap - for (const page of pageMap) { - if (page.path && page.path.endsWith('.md')) { - try { - // Construct the correct file path - // page.path might already include content/ prefix, so handle both cases - let contentPath = page.path; - if (!contentPath.startsWith('content/')) { - contentPath = path.join('content', page.lang || 'en', page.path); - } - if (fs.existsSync(contentPath)) { - const content = fs.readFileSync(contentPath, 'utf8'); - - // Check for usage of the include file with various path formats - // The include might be referenced as: - // - /_includes/filename.md - // - /content/en/_includes/filename.md - // - /content//_includes/filename.md - const escapedFileName = includeFileName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); - - // Pattern to match any path ending with /_includes/filename - const includePattern = `[^"']*\\/_includes\\/${escapedFileName}`; - - // Check for both readfile syntaxes with flexible path matching - const pattern1 = new RegExp(`\\{\\{%\\s*readfile\\s+(?:file=)?["'](${includePattern})["']\\s*%\\}\\}`, 'i'); - const pattern2 = new RegExp(`\\{\\{<\\s*readfile\\s+file=["'](${includePattern})["']\\s*>\\}\\}`, 'i'); - - if (pattern1.test(content) || pattern2.test(content)) { - pagesUsingInclude.push(page); - } - } - } catch (e) { - // Skip if file can't be read - } - } - } - - return pagesUsingInclude; - } - - function buildRows(files, isDeleted = false) { - const rows = []; - - for (const fp of files) { - if (fp.startsWith('content/')) { - // Check if this is an include file - if (isIncludeFile(fp)) { - // Use just the filename for includes - const filename = fp.split('/').pop(); - - // Find pages that use this include - const dependentPages = findPagesUsingInclude(fp); - - // Build the title cell with filename and dependent pages - let titleCell = `\`${filename}\``; - if (dependentPages.length > 0) { - // Add dependent pages as a nested list - const pageLinks = dependentPages.map(page => { - const href = previewBase ? (previewBase + page.relPermalink) : ''; - const linkText = page.title || titleFromPath(page.path); - return href ? `[${linkText}](${href})` : linkText; - }); - - const dependentList = pageLinks.map(link => `
↳ ${link}`).join(''); - titleCell += `:${dependentList}`; - } - - rows.push(`| ${titleCell} | \`${fp}\` |`); - } else { - // Regular content file - const e = mapEntry(fp); - // Don't create links for deleted files - const titleCell = (e.href && !isDeleted) ? `[${e.title}](${e.href})` : e.title; - const pathCell = '`' + e.path + '`'; - rows.push(`| ${titleCell} | ${pathCell} |`); - } - } else { - // Static/assets: create direct preview links if base is known - // Only link common web assets; skip JSON, map files, etc. - const isLinkableAsset = /\.(png|jpe?g|gif|webp|svg|css|js|ico|txt|pdf|mp4|webm)$/i.test(fp); - const rel = fp.replace(/^static\//, '/').replace(/^assets\//, '/assets/'); - const href = (previewBase && isLinkableAsset && !isDeleted) ? (previewBase + rel) : ''; - const title = titleFromPath(fp); - const titleCell = href ? `[${title}](${href})` : title; - const pathCell = '`' + fp + '`'; - rows.push(`| ${titleCell} | ${pathCell} |`); - } - } - - return rows; - } - - function buildRenamedRows(renamedFiles) { - const rows = []; - - for (const rename of renamedFiles) { - const oldPath = rename.old; - const newPath = rename.new; - - if (newPath.startsWith('content/')) { - // Map the new path to get the preview link - const e = mapEntry(newPath); - const titleCell = e.href ? `[${e.title}](${e.href})` : e.title; - const pathCell = `\`${oldPath}\` → \`${newPath}\``; - rows.push(`| ${titleCell} | ${pathCell} |`); - } else { - // Static/assets: create direct preview links if base is known - const isLinkableAsset = /\.(png|jpe?g|gif|webp|svg|css|js|ico|txt|pdf|mp4|webm)$/i.test(newPath); - const rel = newPath.replace(/^static\//, '/').replace(/^assets\//, '/assets/'); - const href = (previewBase && isLinkableAsset) ? (previewBase + rel) : ''; - const title = titleFromPath(newPath); - const titleCell = href ? `[${title}](${href})` : title; - const pathCell = `\`${oldPath}\` → \`${newPath}\``; - rows.push(`| ${titleCell} | ${pathCell} |`); - } - } - - return rows; - } - - const addedRows = buildRows(addedFiltered); - const modifiedRows = buildRows(modified); - const deletedRows = buildRows(deletedFiltered, true); // Pass true for deleted files - const renamedRows = buildRenamedRows(renamedFiles); - - const header = '\n\n**PR Preview: Changed content**\n\nBase preview: ' + previewBase; - - function section(title, rows) { - if (rows.length === 0) return ''; - return `\n\n### ${title}\n\n| Title | Path |\n| --- | --- |\n${rows.join('\n')}`; - } - - const body = [ - header, - section('Renamed/Moved', renamedRows), - section('Added', addedRows), - section('Modified', modifiedRows), - section('Deleted', deletedRows), - ].join(''); - - // Find and update our existing comment - const comments = await github.paginate(github.rest.issues.listComments, { - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - per_page: 100, - }); - - const existing = comments.find(c => //.test(c.body || '')); - if (existing) { - await github.rest.issues.updateComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: existing.id, - body, - }); - core.info('Updated existing preview links comment'); - - // Add link to PR description if we have preview links - if (added.length + modified.length > 0) { - try { - const pr = await github.rest.pulls.get({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.issue.number, - }); - - const currentBody = pr.data.body || ''; - const commentUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/pull/${context.issue.number}#issuecomment-${existing.id}`; - const linkMarker = ''; - const linkText = `\n\n${linkMarker}\n\n📄 **[View preview links for changed content](${commentUrl})**`; - - // Only add if not already present - if (!currentBody.includes(linkMarker)) { - await github.rest.pulls.update({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.issue.number, - body: currentBody + linkText, - }); - core.info('Added preview link to PR description'); - } - } catch (e) { - core.warning(`Could not update PR description: ${e.message}`); - } - } - } else { - // This shouldn't happen since main workflow creates comment first - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - body, - }); - core.info('Created new preview links comment'); - } diff --git a/.github/workflows/pr-preview-links.yml b/.github/workflows/pr-preview-links.yml deleted file mode 100644 index 920f5312fe..0000000000 --- a/.github/workflows/pr-preview-links.yml +++ /dev/null @@ -1,717 +0,0 @@ -name: PR Preview Links - -on: - pull_request: - types: [opened, synchronize, reopened] - -permissions: - contents: read - pull-requests: write - issues: write - -jobs: - preview-links: - runs-on: ubuntu-latest - env: - CF_PAGES_SUFFIX: docodile.pages.dev - steps: - - name: Checkout - uses: actions/checkout@v5 - with: - fetch-depth: 0 - ref: ${{ github.event.pull_request.head.sha }} - - - name: Setup Node.js - uses: actions/setup-node@v6 - with: - node-version-file: .node-version - - - name: Get Hugo version and setup - run: | - set -euo pipefail - ver=$(grep 'HUGO_VERSION' wrangler.toml | awk -F '"' '{print $2}') - wget "https://github.com/gohugoio/hugo/releases/download/v${ver}/hugo_extended_${ver}_linux-amd64.deb" -O hugo.deb - sudo apt-get update - sudo apt-get install -y ./hugo.deb - - - name: Setup Go - uses: actions/setup-go@v6 - with: - go-version-file: go.mod - check-latest: true - - - name: Setup deps for build - run: | - set -euo pipefail - npm install - go mod download - hugo mod get -u - - - name: Get changed files - id: changed - uses: tj-actions/changed-files@v47 - with: - files: | - content/** - static/** - assets/** - layouts/** - i18n/** - configs/** - include_all_old_new_renamed_files: true - - - name: Build Hugo (generate pageurls) - if: steps.changed.outputs.any_changed == 'true' - run: | - # Debug: Check what ref we're building - echo "Current branch: $(git branch --show-current)" - echo "HEAD commit: $(git rev-parse HEAD)" - echo "PR head SHA: ${{ github.event.pull_request.head.sha }}" - - hugo --minify - test -f public/pageurls.json && echo "Found pageurls.json" || (echo "Missing pageurls.json" && ls -la public || true) - - # Debug: Check a specific file's title in the generated JSON - if [ -f public/pageurls.json ]; then - echo "Checking for public-api entries in pageurls.json:" - jq '.[] | select(.path | contains("public-api"))' public/pageurls.json || true - fi - - - name: Create or find preview comment - if: steps.changed.outputs.any_changed == 'true' - id: find-comment - uses: actions/github-script@v8 - with: - script: | - // First, check if our comment already exists - const comments = await github.paginate(github.rest.issues.listComments, { - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - per_page: 100, - }); - - const existingComment = comments.find(c => //.test(c.body || '')); - if (existingComment) { - core.info(`Found existing preview comment: ${existingComment.id}`); - core.setOutput('comment_id', existingComment.id); - core.setOutput('comment_exists', 'true'); - } else { - // Create placeholder comment immediately - const placeholderBody = `\n\n**PR Preview: Changed content**\n\n⏳ *Generating preview links...*\n\nThis comment will be automatically updated when file changes are detected and Cloudflare Pages finishes deploying.`; - - const newComment = await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - body: placeholderBody, - }); - - core.info(`Created placeholder preview comment: ${newComment.data.id}`); - core.setOutput('comment_id', newComment.data.id); - core.setOutput('comment_exists', 'false'); - } - - - name: Find Cloudflare Branch Preview URL - if: steps.changed.outputs.any_changed == 'true' - id: find-preview - uses: actions/github-script@v8 - with: - script: | - function htmlDecode(s) { - return (s || '') - .replace(/&/g, '&') - .replace(/</g, '<') - .replace(/>/g, '>') - .replace(/"/g, '"') - .replace(/'/g, "'"); - } - function sanitizeUrl(u) { - if (!u) return ''; - u = htmlDecode(u.trim()); - u = u.replace(/^['"<]+/, '').replace(/[>'"]+$/, ''); - u = u.split(/[\s<>'"\]\)]/)[0]; - try { u = decodeURI(u); } catch (e) {} - return u.replace(/\/$/, ''); - } - function extractBranchPreviewUrl(body) { - // Look for "Branch Preview URL:" followed by a URL - // In Cloudflare's table format, it's split across table cells - const patterns = [ - // Table format with anchor tag (what Cloudflare actually uses) - // Matches across multiple lines in a table cell - /Branch\s+Preview\s+URL:<\/strong><\/td>[\s\S]*?]+href=['"]([^'"<>]+pages\.dev[^'"<>]*)['"]/i, - // Try anchor tag format on same line - /Branch\s+Preview\s+URL:\s*]+href=['"]([^'"<>]+pages\.dev[^'"<>]*)['"]/i, - // Try markdown link format - /Branch\s+Preview\s+URL:\s*\[.*?\]\(([^)]+pages\.dev[^)]*)\)/i, - // Try plain URL format (with or without angle brackets) - /Branch\s+Preview\s+URL:\s*]+pages\.dev[^\s<>]*)/i - ]; - - for (const pattern of patterns) { - const m = (body || '').match(pattern); - if (m && m[1]) { - const url = m[1]; - // Make sure we have the full URL including https:// - if (!url.startsWith('http')) { - return sanitizeUrl('https://' + url); - } - return sanitizeUrl(url); - } - } - return ''; - } - async function fromOurExistingComment() { - const comments = await github.paginate(github.rest.issues.listComments, { - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - per_page: 100, - }); - const ours = comments.find(c => //i.test(c.body || '')); - if (!ours) return ''; - const body = ours.body || ''; - const hidden = body.match(//i); - if (hidden && hidden[1]) return sanitizeUrl(hidden[1]); - return ''; - } - async function waitForCloudflareBranchUrl(maxWaitMs = 120000) { // Max 2 minutes - const startTime = Date.now(); - let delayMs = 5000; // Start with 5 seconds - let attempt = 0; - - while (Date.now() - startTime < maxWaitMs) { - attempt++; - const comments = await github.paginate(github.rest.issues.listComments, { - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - per_page: 100, - }); - - for (const c of comments) { - // Check if this is a Cloudflare comment - if (c.user && c.user.login && c.user.login.includes('cloudflare') && c.body && c.body.includes('pages.dev')) { - core.info(`Found Cloudflare comment from ${c.user.login}`); - const url = extractBranchPreviewUrl(c.body || ''); - if (url) { - core.info(`Successfully extracted Branch Preview URL: ${url}`); - return url; - } else if (c.body.includes('Branch Preview URL')) { - core.info('Branch Preview URL field found but URL not yet populated'); - } - } - } - - const elapsed = Math.round((Date.now() - startTime) / 1000); - const remaining = Math.round((maxWaitMs - (Date.now() - startTime)) / 1000); - - if (Date.now() - startTime + delayMs < maxWaitMs) { - core.info(`Attempt ${attempt}: Branch Preview URL not found yet (${elapsed}s elapsed, ${remaining}s remaining)`); - await new Promise(r => setTimeout(r, delayMs)); - // Exponential backoff: increase delay but cap at 20 seconds - delayMs = Math.min(delayMs * 1.5, 20000); - } - } - - core.warning('Branch Preview URL not found within 2 minutes. Links will be added when Cloudflare comment triggers update workflow.'); - return ''; - } - let base = await waitForCloudflareBranchUrl(); - if (!base) base = await fromOurExistingComment(); - core.info(`Branch Preview URL found: ${base || '(not yet)'}`); - core.setOutput('base', base); - - - name: Update PR comment with preview links - if: steps.changed.outputs.any_changed == 'true' - uses: actions/github-script@v8 - env: - ADDED: ${{ steps.changed.outputs.added_files }} - MODIFIED: ${{ steps.changed.outputs.modified_files }} - DELETED: ${{ steps.changed.outputs.deleted_files }} - RENAMED: ${{ steps.changed.outputs.renamed_files }} - RENAMED_PAIRS: ${{ steps.changed.outputs.all_old_new_renamed_files }} - PREVIEW_BASE: ${{ steps.find-preview.outputs.base }} - COMMENT_ID: ${{ steps.find-comment.outputs.comment_id }} - with: - script: | - const fs = require('fs'); - const path = require('path'); - - function splitList(s) { - if (!s) return []; - // Support newline, comma, or space separated outputs - return s - .split(/\r?\n|,|\s+/) - .map(x => x.trim()) - .filter(Boolean); - } - - const added = splitList(process.env.ADDED); - const modified = splitList(process.env.MODIFIED); - const deleted = splitList(process.env.DELETED); - const renamed = splitList(process.env.RENAMED); - const renamedPairs = splitList(process.env.RENAMED_PAIRS); - - // Process renamed files - tj-actions outputs them as "old_path new_path" pairs - const renamedFiles = []; - const renamedMapping = new Map(); // old path -> new path - for (let i = 0; i < renamedPairs.length; i += 2) { - if (i + 1 < renamedPairs.length) { - const oldPath = renamedPairs[i]; - const newPath = renamedPairs[i + 1]; - renamedMapping.set(oldPath, newPath); - renamedFiles.push({ old: oldPath, new: newPath }); - } - } - - // Filter out renamed files from added and deleted arrays to avoid duplication - const addedFiltered = added.filter(f => !Array.from(renamedMapping.values()).includes(f)); - const deletedFiltered = deleted.filter(f => !Array.from(renamedMapping.keys()).includes(f)); - - const allChanged = [...addedFiltered, ...modified, ...deletedFiltered, ...renamed]; - const anyEligible = allChanged.some(p => /^(content|static|assets)\//.test(p)); - if (!anyEligible) { - core.info('No relevant content changes. Updating comment to reflect this.'); - - // Update the comment to show no content changes - const commentId = process.env.COMMENT_ID; - if (!commentId) { - core.error('No comment ID found'); - return; - } - - const previewBase = (process.env.PREVIEW_BASE || '').replace(/\/$/, ''); - const header = '\n\n**PR Preview: Changed content**'; - const body = header + '\n\nNo documentation content changes in this PR.'; - - await github.rest.issues.updateComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: parseInt(commentId), - body, - }); - - core.info('Updated preview comment to show no content changes'); - return; - } - - let pageMap = []; - - // Load pageurls.json for all languages - const languages = ['', 'ja', 'ko']; // '' for English (root) - for (const lang of languages) { - const pageurlsPath = lang ? `public/${lang}/pageurls.json` : 'public/pageurls.json'; - try { - const raw = fs.readFileSync(pageurlsPath, 'utf8'); - const langPages = JSON.parse(raw); - pageMap = pageMap.concat(langPages); - core.info(`Loaded ${langPages.length} pages from ${pageurlsPath}`); - } catch (e) { - core.warning(`Could not read ${pageurlsPath}. ${e.message}`); - } - } - - // Build lookup: support keys with and without language prefix - const byPath = new Map(); - for (const p of pageMap) { - const lang = p.lang || 'en'; // Default to 'en' if no lang specified - const rel = (p.path || '').replace(/^\/+/, '').replace(/\\/g, '/'); - const withLang = lang && !rel.startsWith(lang + '/') ? `${lang}/${rel}` : rel; - const withoutLang = lang && rel.startsWith(lang + '/') ? rel.slice(lang.length + 1) : rel; - - // Create all possible key variations - const keys = new Set([ - rel, - withLang, - withoutLang, - path.posix.join('content', withLang), - path.posix.join('content', withoutLang), - path.posix.join('content', rel), - // Add explicit handling for language in path - path.posix.join('content', lang, rel), - path.posix.join('content', lang, withoutLang), - // Add .md extension variations for content files - rel.endsWith('.md') ? rel : rel + '.md', - withLang.endsWith('.md') ? withLang : withLang + '.md', - withoutLang.endsWith('.md') ? withoutLang : withoutLang + '.md', - path.posix.join('content', lang, rel.endsWith('.md') ? rel : rel + '.md'), - path.posix.join('content', lang, withoutLang.endsWith('.md') ? withoutLang : withoutLang + '.md'), - path.posix.join('content', withLang.endsWith('.md') ? withLang : withLang + '.md'), - path.posix.join('content', withoutLang.endsWith('.md') ? withoutLang : withoutLang + '.md'), - // Special handling for index files - path.posix.join('content', lang, '_index.md'), - path.posix.join('content', lang, 'index.md'), - ].filter(Boolean).map(k => k.replace(/\\/g, '/'))); - - // Debug log for new pages - if (p.path && p.path.includes('dspy')) { - core.info(`Debug: Page ${p.path} (lang: ${lang}) has keys: ${Array.from(keys).join(', ')}`); - } - - for (const k of keys) byPath.set(k, p); - } - - // Find Cloudflare preview base URL from existing PR comments - const comments = await github.paginate(github.rest.issues.listComments, { - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - per_page: 100, - }); - // Helpers to extract and sanitize pages.dev URLs - function htmlDecode(s) { - return s - .replace(/&/g, '&') - .replace(/</g, '<') - .replace(/>/g, '>') - .replace(/"/g, '"') - .replace(/'/g, "'"); - } - function sanitizeUrl(u) { - if (!u) return ''; - u = htmlDecode(u.trim()); - // trim surrounding quotes or angle brackets - u = u.replace(/^['"<]+/, '').replace(/[>'"]+$/, ''); - // cut at first disallowed delimiter if present - u = u.split(/[\s<>'"\]\)]/)[0]; - try { u = decodeURI(u); } catch (e) {} - // remove trailing slash - return u.replace(/\/$/, ''); - } - function extractUrls(body) { - const urls = []; - const regex = /https?:\/\/[^\s'"<>]+pages\.dev[^\s'"<>]*/ig; - const matches = (body || '').match(regex) || []; - for (let m of matches) { - const clean = sanitizeUrl(m); - if (clean && !urls.includes(clean)) urls.push(clean); - } - return urls; - } - - // Use Branch Preview URL extracted from Cloudflare comment - const previewBase = (process.env.PREVIEW_BASE || '').replace(/\/$/, ''); - if (!previewBase) { - core.warning('No Branch Preview URL found yet; leaving links unlinked rather than using commit URL.'); - } - core.info(`Preview base: ${previewBase || '(not found yet)'}`); - - function mapEntry(filePath) { - const norm = filePath.replace(/\\/g, '/'); - - // Try multiple variations to find the item - let item = byPath.get(norm); - if (!item) item = byPath.get(norm.replace(/^content\//, '')); - if (!item) item = byPath.get(norm.replace(/\.md$/, '')); - if (!item) item = byPath.get(norm.replace(/^content\//, '').replace(/\.md$/, '')); - - // Debug log for unmatched files - if (!item) { - core.info(`Debug: Could not find mapping for ${norm}`); - // For new files, construct the URL based on the file path - if (norm.startsWith('content/') && norm.endsWith('.md')) { - // Extract language and path - const pathParts = norm.replace(/^content\//, '').replace(/\.md$/, '').split('/'); - let lang = 'en'; - let urlPath = pathParts.join('/'); - - // Check if first part is a language code - if (['en', 'ja', 'ko'].includes(pathParts[0])) { - lang = pathParts[0]; - urlPath = pathParts.slice(1).join('/'); - } - - // Handle _index.md files - if (urlPath.endsWith('/_index') || urlPath === '_index') { - urlPath = urlPath.replace(/\/_index$/, '').replace(/^_index$/, ''); - } - - // Construct the URL - const rel = lang === 'en' ? `/${urlPath}/` : `/${lang}/${urlPath}/`; - const href = previewBase ? (previewBase.replace(/\/$/, '') + rel) : ''; - - core.info(`Debug: Constructed URL for new file ${norm}: ${href}`); - return { title: titleFromPath(norm), rel, href, path: norm }; - } - } - - if (!item) return { title: titleFromPath(norm), rel: '', href: '', path: norm }; - const rel = item.relPermalink || ''; - const href = previewBase ? (previewBase.replace(/\/$/, '') + rel) : ''; - const title = item.title || titleFromPath(norm); - return { title, rel, href, path: norm }; - } - - function titleFromPath(p) { - const stem = p.replace(/^content\//, '').replace(/\.(md|markdown)$/, ''); - const parts = stem.split('/'); - const last = parts[parts.length - 1]; - const base = last === 'index' ? (parts[parts.length - 2] || 'index') : last; - return base.replace(/[\-_]+/g, ' ').replace(/\b\w/g, c => c.toUpperCase()); - } - - // Function to check if a file is an include - function isIncludeFile(filePath) { - return /^content\/[^\/]+\/_includes\//.test(filePath); - } - - // Function to find pages that use a specific include - function findPagesUsingInclude(includePath) { - const includeFileName = includePath.split('/').pop(); - const pagesUsingInclude = []; - - // Search through all pages in pageMap - for (const page of pageMap) { - if (page.path && page.path.endsWith('.md')) { - try { - // Construct the correct file path - // page.path might already include content/ prefix, so handle both cases - let contentPath = page.path; - if (!contentPath.startsWith('content/')) { - contentPath = path.join('content', page.lang || 'en', page.path); - } - if (fs.existsSync(contentPath)) { - const content = fs.readFileSync(contentPath, 'utf8'); - - // Check for usage of the include file with various path formats - // The include might be referenced as: - // - /_includes/filename.md - // - /content/en/_includes/filename.md - // - /content//_includes/filename.md - const escapedFileName = includeFileName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); - - // Pattern to match any path ending with /_includes/filename - const includePattern = `[^"']*\\/_includes\\/${escapedFileName}`; - - // Check for both readfile syntaxes with flexible path matching - const pattern1 = new RegExp(`\\{\\{%\\s*readfile\\s+(?:file=)?["'](${includePattern})["']\\s*%\\}\\}`, 'i'); - const pattern2 = new RegExp(`\\{\\{<\\s*readfile\\s+file=["'](${includePattern})["']\\s*>\\}\\}`, 'i'); - - if (pattern1.test(content) || pattern2.test(content)) { - pagesUsingInclude.push(page); - } - } - } catch (e) { - // Skip if file can't be read - } - } - } - - return pagesUsingInclude; - } - - function buildRows(files, isDeleted = false) { - const rows = []; - - for (const fp of files) { - if (fp.startsWith('content/')) { - // Check if this is an include file - if (isIncludeFile(fp)) { - // Use just the filename for includes - const filename = fp.split('/').pop(); - - // Find pages that use this include - const dependentPages = findPagesUsingInclude(fp); - - // Build the title cell with filename and dependent pages - let titleCell = `\`${filename}\``; - if (dependentPages.length > 0) { - // Add dependent pages as a nested list - const pageLinks = dependentPages.map(page => { - const href = previewBase ? (previewBase + page.relPermalink) : ''; - const linkText = page.title || titleFromPath(page.path); - return href ? `[${linkText}](${href})` : linkText; - }); - - const dependentList = pageLinks.map(link => `
↳ ${link}`).join(''); - titleCell += `:${dependentList}`; - } - - rows.push(`| ${titleCell} | \`${fp}\` |`); - } else { - // Regular content file - const e = mapEntry(fp); - // Don't create links for deleted files - const titleCell = (e.href && !isDeleted) ? `[${e.title}](${e.href})` : e.title; - const pathCell = '`' + e.path + '`'; - rows.push(`| ${titleCell} | ${pathCell} |`); - } - } else { - // Static/assets: create direct preview links if base is known - // Only link common web assets; skip JSON, map files, etc. - const isLinkableAsset = /\.(png|jpe?g|gif|webp|svg|css|js|ico|txt|pdf|mp4|webm)$/i.test(fp); - const rel = fp.replace(/^static\//, '/').replace(/^assets\//, '/assets/'); - const href = (previewBase && isLinkableAsset && !isDeleted) ? (previewBase + rel) : ''; - const title = titleFromPath(fp); - const titleCell = href ? `[${title}](${href})` : title; - const pathCell = '`' + fp + '`'; - rows.push(`| ${titleCell} | ${pathCell} |`); - } - } - - return rows; - } - - // Calculate file sizes/changes for sorting by delta - function getFileStats(files) { - const { execSync } = require('child_process'); - return files.map(fp => { - let size = 0; - try { - // Use git to get the number of changed lines - // For added files, count all lines; for modified, count insertions + deletions - const diffStat = execSync(`git diff --numstat origin/${{ github.base_ref }}...HEAD -- "${fp}" 2>/dev/null || echo "0 0 ${fp}"`, { encoding: 'utf8' }).trim(); - const parts = diffStat.split(/\s+/); - if (parts.length >= 2) { - const insertions = parseInt(parts[0]) || 0; - const deletions = parseInt(parts[1]) || 0; - size = insertions + deletions; - } - } catch (e) { - // If git diff fails, try file size as fallback - try { - if (fs.existsSync(fp)) { - const stats = fs.statSync(fp); - size = stats.size; - } - } catch (e2) { - // Ignore errors - } - } - return { path: fp, size }; - }); - } - - // Sort files by size (as a proxy for change delta) and limit to maxRows - function limitAndSortFiles(files, maxRows = 20) { - if (files.length <= maxRows) { - return { files: files.sort(), truncated: false }; - } - - // Get file stats and sort by size descending - const stats = getFileStats(files); - stats.sort((a, b) => b.size - a.size); - - // Take top maxRows files - const topFiles = stats.slice(0, maxRows).map(s => s.path); - // Sort alphabetically for consistent display - topFiles.sort(); - - return { files: topFiles, truncated: true, total: files.length }; - } - - function buildRenamedRows(renamedFiles) { - const rows = []; - - for (const rename of renamedFiles) { - const oldPath = rename.old; - const newPath = rename.new; - - if (newPath.startsWith('content/')) { - // Map the new path to get the preview link - const e = mapEntry(newPath); - const titleCell = e.href ? `[${e.title}](${e.href})` : e.title; - const pathCell = `\`${oldPath}\` → \`${newPath}\``; - rows.push(`| ${titleCell} | ${pathCell} |`); - } else { - // Static/assets: create direct preview links if base is known - const isLinkableAsset = /\.(png|jpe?g|gif|webp|svg|css|js|ico|txt|pdf|mp4|webm)$/i.test(newPath); - const rel = newPath.replace(/^static\//, '/').replace(/^assets\//, '/assets/'); - const href = (previewBase && isLinkableAsset) ? (previewBase + rel) : ''; - const title = titleFromPath(newPath); - const titleCell = href ? `[${title}](${href})` : title; - const pathCell = `\`${oldPath}\` → \`${newPath}\``; - rows.push(`| ${titleCell} | ${pathCell} |`); - } - } - - return rows; - } - - const MAX_ROWS_PER_TABLE = 20; - const addedInfo = limitAndSortFiles(addedFiltered, MAX_ROWS_PER_TABLE); - const modifiedInfo = limitAndSortFiles(modified, MAX_ROWS_PER_TABLE); - const deletedInfo = limitAndSortFiles(deletedFiltered, MAX_ROWS_PER_TABLE); - const renamedInfo = { files: renamedFiles.slice(0, MAX_ROWS_PER_TABLE), truncated: renamedFiles.length > MAX_ROWS_PER_TABLE, total: renamedFiles.length }; - - const addedRows = buildRows(addedInfo.files); - const modifiedRows = buildRows(modifiedInfo.files); - const deletedRows = buildRows(deletedInfo.files, true); // Pass true for deleted files - const renamedRows = buildRenamedRows(renamedInfo.files); - - const header = '\n\n**PR Preview: Changed content**' + (previewBase ? `\n\nBase preview: ${previewBase}` : '\n\n⏳ *Links will be added automatically when Cloudflare Pages finishes deploying (typically 2-5 minutes)*'); - if (!previewBase) { - core.info('Preview base URL not available yet. Comment will be automatically updated when Cloudflare posts the Branch Preview URL.'); - } - - function section(title, rows, info) { - if (rows.length === 0 && !info.truncated) return ''; - - let sectionTitle = title; - if (info.truncated) { - sectionTitle += ` (showing ${rows.length} of ${info.total} files with largest changes)`; - } - - return `\n\n### ${sectionTitle}\n\n| Title | Path |\n| --- | --- |\n${rows.join('\n')}`; - } - - const body = [ - header, - section('Renamed/Moved', renamedRows, renamedInfo), - section('Added', addedRows, addedInfo), - section('Modified', modifiedRows, modifiedInfo), - section('Deleted', deletedRows, deletedInfo), - ].join(''); - - // Check if body exceeds GitHub's limit - const MAX_COMMENT_SIZE = 65536; - if (body.length > MAX_COMMENT_SIZE) { - core.warning(`Preview comment size (${body.length}) exceeds GitHub's limit (${MAX_COMMENT_SIZE}). This should not happen with row limits in place.`); - } - - // Update the existing comment - const commentId = process.env.COMMENT_ID; - if (!commentId) { - core.error('No comment ID found'); - return; - } - - await github.rest.issues.updateComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: parseInt(commentId), - body, - }); - - core.info(`Updated preview comment ${commentId} with ${addedFiltered.length + modified.length + deletedFiltered.length + renamedFiles.length} changed files`); - - // Add link to PR description if we have preview links and this is the first time - if (previewBase && (addedFiltered.length + modified.length + renamedFiles.length) > 0) { - try { - const pr = await github.rest.pulls.get({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.issue.number, - }); - - const currentBody = pr.data.body || ''; - const commentUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/pull/${context.issue.number}#issuecomment-${commentId}`; - const linkMarker = ''; - const linkText = `\n\n${linkMarker}\n📄 **[View preview links for changed pages](${commentUrl})**`; - - // Only add if not already present - if (!currentBody.includes(linkMarker)) { - await github.rest.pulls.update({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.issue.number, - body: currentBody + linkText, - }); - core.info('Added preview link to PR description'); - } - } catch (e) { - core.warning(`Could not update PR description: ${e.message}`); - } - } diff --git a/README.md b/README.md index 0635aa3a79..6f245570e2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Weights & Biases Documentation -The Weights & Biases Docs ([https://docs.wandb.ai/](https://docs.wandb.ai/)) is built using Docsy, a technical documentation theme for Hugo, a static website generator. The high level overview of the doc writing process is: +The Weights & Biases Docs ([https://docs.wandb.ai/](https://docs.wandb.ai/)) is built using Mintlify, a static website generator. The high level overview of the doc writing process is: 1. Edit the desired files 2. Create a pull request proposing your changes @@ -30,10 +30,11 @@ This section shows how to edit a page or report a bug from within your browser w If you work for Weights & Biases, file a doc JIRA, using this template: https://wandb.atlassian.net/secure/CreateIssueDetails!init.jspa?priority=3&pid=10026&issuetype=10047. - +{/* To report a bug on a page you're reading on docs.wandb.com: 1. Scroll to the bottom of the page and click **Report issue**. 1. Provide a title and optionally edit the description, then click **Create**. +*/} To report a bug from https://github.com/wandb/docs: 1. Click the **Issues** tab. @@ -42,227 +43,105 @@ To report a bug from https://github.com/wandb/docs: ## Prerequisites -A current version of NodeJS is required; ideally, something newer than version 20. If you still need to use an old version of node for other projects, we suggest using `nvm` and setting up version 20 using that, which you can swap into with the `use` command: +The `mint` CLI is required for local builds. See https://www.mintlify.com/docs/installation. Install it from `npx` or from Homebrew. -``` -nvm install 20 -nvm use 20 -``` ### macOS -After cloning this repo, `cd` into your local clone directory and these commands: - -``` -brew install go -brew install hugo -brew install npm -npm install -hugo mod get -u -``` - -The last lines critical, as it downloads Hugo, the [Docsy](https://docsy.dev) module for Hugo, and the dependencies of each. - -## Running the website locally - -```bash -hugo server -``` - -## Exiting `hugo server` - -Hit `CTRL+C` in the terminal that is showing `hugo` activity to interrupt the server and exit to the terminal prompt. - -## Hugo and Docsy shortcodes - -- We use Docsy's `alert` shortcode for admonitions. The alert `color` determines the admonition type. Refer to [alerts](https://www.docsy.dev/docs/adding-content/shortcodes/#alert) for details. Examples: - ```markdown - {{% alert %}} - Only **public** reports are viewable when embedded. - {{% /alert %}} - ``` - ```markdown - {{% alert title="Undo changes to your workspace" %}} - Select the undo button (arrow that points left) to undo any unwanted changes. - {{% /alert %}} - ``` - ```markdown - {{% alert title="Warning" color="warning" %}} - This is a warning. - {{% /alert %}} - ``` -- We use Docsy's `tabpane` and `tab` shortcodes for tabbed content. Refer to [tabpane](https://www.docsy.dev/docs/adding-content/shortcodes/#tabpane) for details. Example: - ```markdown - {{< tabpane text=true >}} - {{% tab header="GitHub repository dispatch" value="github" %}} - ... Markdown contents ... - {{% /tab %}} - - {{% tab header="Microsoft Teams notification" value="microsoft"%}} - ... Markdown contents ... - {{% /tab %}} - {{< /tabpane >}} - ``` -- We use a custom `img` shortcode for images. It is implemented in `layouts/shortcodes/img.html`. Examples: - ```markdown - {{< img src="/images/app_ui/automated_workspace.svg" >}} - ``` - ```markdown - {{< img src="/images/app_ui/automated_workspace.svg" alt="automated workspace icon" >}} +After cloning this repo: +1. `cd` into the clone. +2. Create a working branch: + ```shell + git checkout -b my_working_branch origin/main ``` - ```markdown - {{< img src="/images/app_ui/automated_workspace.svg" alt="automated workspace icon" width="32px" >}} +3. Build and build and serve the docs locally: + ```shell + mint dev ``` - ```markdown - {{< img src="/images/app_ui/demo_make_a_custom_chart_bar_chart.gif" alt="Creating a custom bar chart showing accuracy across runs in a project" max-width="90%" >}} + By default, content is served from `https://localhost:3000/`. +4. Check for broken links and images: + ```shell + mint broken-links + ``` +5. Push your branch to `origin`: + ```shell + git push origin my_working_branch ``` -- We use a custom `ctabutton` shortcode to link to Colab notebooks. It is implemented in `layouts/shortcodes/cta-button.html`. Examples: - ```markdown - {{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/boosting/Using_W&B_Sweeps_with_XGBoost.ipynb" >}} - ``` -- We use a custom `prism` shortcode to load titled code examples from `static/` within the docs repo. Example for a file stored in `static/webhook_test.sh`: - ```markdown - {{< prism file="/webhook_test.sh" title="webhook_test.sh">}}{{< /prism >}} - ``` -- We are _experimenting_ with using `readfile` for includes. If you run into issues, report it in a Github issue. - - Add a Markdown file with no front matter to `content/_includes/`. Subdirectories are supported. Include the file using the [`readfile`](https://www.docsy.dev/docs/adding-content/shortcodes/#reuse-documentation) shortcode. For example: - ```markdown - {{< readfile file="/_includes/enterprise-only.md" >}} - ``` - - - If you change an include, the `hugo serve` incremental build does not pick up the change. Stop and restart `hugo serve`. - - Hugo and Docsy shortcodes are **not** supported inside the include file. -## Editing style - -Style overrides are in `/assets/scss/_variables_project.scss`. Here we can override all the styles that ship with the Docsy theme. O - -## Troubleshooting - -As you run the website locally, you may run into the following error: - -```console -$ hugo server -WARN 2023/06/27 16:59:06 Module "project" is not compatible with this Hugo version; run "hugo mod graph" for more information. -Start building sites … -hugo v0.101.0-466fa43c16709b4483689930a4f9ac8add5c9f66+extended windows/amd64 BuildDate=2022-06-16T07:09:16Z VendorInfo=gohugoio -Error: Error building site: "C:\Users\foo\path\to\docsy-example\content\en\_index.md:5:1": failed to extract shortcode: template for shortcode "blocks/cover" not found -Built in 27 ms -``` - -This error occurs if you are running an outdated version of Hugo. As of docsy theme version `v0.7.0`, hugo version `0.110.0` or higher is required. -See this [section](https://www.docsy.dev/docs/get-started/docsy-as-module/installation-prerequisites/#install-hugo) of the user guide for instructions on how to install Hugo. - -Or you may be confronted with the following error: - -```console -$ hugo server - -INFO 2021/01/21 21:07:55 Using config file: -Building sites … INFO 2021/01/21 21:07:55 syncing static files to / -Built in 288 ms -Error: Error building site: TOCSS: failed to transform "scss/main.scss" (text/x-scss): resource "scss/scss/main.scss_9fadf33d895a46083cdd64396b57ef68" not found in file cache -``` - -This error occurs if you have not installed the extended version of Hugo. -See this [section](https://www.docsy.dev/docs/get-started/docsy-as-module/installation-prerequisites/#install-hugo) of the user guide for instructions on how to install Hugo. +6. The first time you push a new branch, the terminal output includes a link to create a PR. Click the link and create a draft PR. CI tests will run. +7. When you are satisfied with your PR and all tests pass, click **Ready for review** to convert the draft PR to a reviewable PR. A member of the W&B docs team will review your changes and give feedback. +8. When all feedback is addressed and the PR is approved, the reviewer will merge the PR. -Or you may encounter the following error: -```console -$ hugo server +## Running the website locally -Error: failed to download modules: binary with name "go" not found -``` +Build and build and serve the docs locally: + ```shell + mint dev + ``` -This error occurs if you have not installed the `go` programming language on your system. -See this [section](https://www.docsy.dev/docs/get-started/docsy-as-module/installation-prerequisites/#install-go-language) of the user guide for instructions on how to install `go`. +## Exiting `mint dev` +To interrupt the Mintlify server, type `CTRL+C` in the terminal where it is running. -[alternate dashboard]: https://app.netlify.com/sites/goldydocs/deploys -[deploys]: https://app.netlify.com/sites/docsy-example/deploys -[Docsy user guide]: https://docsy.dev/docs -[Docsy]: https://github.com/google/docsy -[example.docsy.dev]: https://example.docsy.dev -[Hugo theme module]: https://gohugo.io/hugo-modules/use-modules/#use-a-module-for-a-theme -[Netlify]: https://netlify.com -[Docker Compose documentation]: https://docs.docker.com/compose/gettingstarted/ +## Mintlify compatibility +Mintlify processes Markdown files in `.mdx` format, which has stricter requirements than `.md`. If a file contains incompatible Markdown, `mint dev` will fail and `mint broken-links` will show errors. For example, HTML comments (``) are not supported. Instead, use this syntax for comments: `{/* like this */}`. +For general guidelinest, refer to the **Create content** section of the [Mintlify documentation](https://www.mintlify.com/docs/). For example: +- [Format text](https://www.mintlify.com/docs/create/text) +- [Lists and tables](https://www.mintlify.com/docs/create/list-table) +- [Images and embeds](https://www.mintlify.com/docs/create/image-embeds) +- [Callouts](https://www.mintlify.com/docs/components/callouts) +- [Cards](https://www.mintlify.com/docs/components/cards) +- [Tabs](https://www.mintlify.com/docs/components/tabs) +This list of links is not exhaustive. Check the Mintlify documentation for full details. ## How to edit the docs locally 1. Navigate to your local clone this repo and pull the latest changes from main: - -```bash -git pull origin main -``` - + ```bash + git pull origin main + ``` 2. Create a feature branch off of `main`. - -```bash -git checkout -b -``` - + ```bash + git checkout -b + ``` 3. After installing the prerequsites documented above, start a local preview of the docs. - -```bash -hugo server -``` - -This will return the localhost URL and port number where you can preview your changes to the docs as you make them (e.g. `https://localhost:1313`). - + ```bash + mint dev + ``` + This will return the localhost URL and port number where you can preview your changes to the docs as you make them (e.g. `https://localhost:3000`). 4. Make your changes on the new branch. -5. Check your changes are rendered correctly. Any time you save a file, the preview should automatically update. +5. Check your changes are rendered correctly. Any time you save a file, the preview automatically updates. 7. Commit the changes to the branch. - -```bash -git add . -git commit -m 'Useful commit message.' -``` - + ```bash + git add . + git commit -m 'Useful commit message.' + ``` 8. Push the branch to GitHub. - -```bash -git push origin -``` - + ```bash + git push origin + ``` 9. Open a pull request from the new branch to the original repo. - ## What files do I edit? +You can edit most `.mdx` files in the repo directly. Content in a few directories is generated from upstream code. Edit the code in the source repo, not in `wandb/docs`. After your upstream change is merged and released, when the relevant content is next generated, your change will be included. -There are two types of docs in our Docs site: Developer Guide and the API Reference Guide. - -### Developer Guide - -All markdown files for the [W&B Developer Guide](https://docs.wandb.ai/) are stored in: - -```bash -content/guides/ -``` - -The PR you create will get reviewed and (if approved) merged by the Docs Team. - -### API Reference Guide - -All markdown files for the [W&B API Reference Guide](https://docs.wandb.ai/ref) are stored in: - -```bash -content/ref -``` - -The markdown files are generated from docstrings in https://github.com/wandb/wandb. Modify the docstring from the appropriate Python Class, function, or CLI definition to update the public-facing documentation API. - -Once you are done, create a pull request from https://github.com/wandb/wandb. The PR you create will get reviewed and (if approved) merged by the SDK Team. The Docs are updated when the W&B SDK Team makes an W&BSDK Release. SDK Releases occur about every 2-4 weeks. +| Directory | Source repo | +|-----------|-------------| +| `/ref/python/`| [`wandb/wandb`](https://github.com/wandb/wandb) | +| `/models/ref/cli/` | [`wandb/wandb`](https://github.com/wandb/wandb)| +| `/weave/api-reference/` | [`wandb/weave`](https://github.com/wandb/weave) | +| `/weave/cookbooks/` | [`wandb/weave`](https://github.com/wandb/weave) | +| `/weave/reference/` | [`wandb/weave`](https://github.com/wandb/weave) | ## AI resources -The `.ai/` directory contains resources specifically designed for AI agents working with this repository. These include: +The `.ai/` directory contains experimental resources specifically designed for AI agents working with this repository. These include: - **[Runbooks](.ai/runbooks/)**: Step-by-step instructions for complex, recurring tasks (e.g., testing GitHub Actions changes) - **[Style guide](.ai/style-guide.md)**: Quick reference for AI agents on wandb/docs style conventions -If you're using an AI agent to help with documentation tasks, provide these resources as context to ensure consistent, high-quality contributions. See the [.ai/README.md](.ai/README.md) for more details. +If you're using an AI agent to help with documentation tasks, provide these resources as context to ensure consistent, high-quality contributions. Agents do not discover or load the prompts in `.ai/` automatically. See the [.ai/README.md](.ai/README.md) for more details. ## License @@ -278,7 +157,7 @@ The source for this documentation is offered under the Apache 2.0 license. ## Attributions -- This project uses Docsy, a Hugo theme by Google. [License](https://github.com/google/docsy/blob/main/LICENSE) +- This project uses Mintlify. [License](https://github.com/mintlify) - A dependency of Docsy is the `caniuse-lite` package, offered under CC-BY-4.0. [License](https://github.com/browserslist/caniuse-lite/blob/main/LICENSE) - Another dependency of Docsy is Font Awesome Free, offered under the CC-BY-4.0, SIL OFL 1.1, and MIT licenses. [License notice](https://github.com/FortAwesome/Font-Awesome/blob/master/LICENSE.txt) - This site is built using Hugo, a static site generator. [License](https://github.com/gohugoio/hugo/blob/master/LICENSE) diff --git a/archetypes/support.md b/archetypes/support.md deleted file mode 100644 index 25c8ab376f..0000000000 --- a/archetypes/support.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: Your Title Here -toc_hide: true -type: docs -url: /support/:filename -support: - - your-term-here ---- - -Your content here. diff --git a/assets/images/app_ui/custom-charts-query-example.png b/assets/images/app_ui/custom-charts-query-example.png deleted file mode 100644 index a3861e85dc..0000000000 Binary files a/assets/images/app_ui/custom-charts-query-example.png and /dev/null differ diff --git a/assets/images/app_ui/custom-charts-script-plots.png b/assets/images/app_ui/custom-charts-script-plots.png deleted file mode 100644 index 52d5462c63..0000000000 Binary files a/assets/images/app_ui/custom-charts-script-plots.png and /dev/null differ diff --git a/assets/images/app_ui/manual-line-plot.png b/assets/images/app_ui/manual-line-plot.png deleted file mode 100644 index e256d7651f..0000000000 Binary files a/assets/images/app_ui/manual-line-plot.png and /dev/null differ diff --git a/assets/images/app_ui/run-colors-colorblind-deuteranomaly.png b/assets/images/app_ui/run-colors-colorblind-deuteranomaly.png deleted file mode 100644 index 059c04fb08..0000000000 Binary files a/assets/images/app_ui/run-colors-colorblind-deuteranomaly.png and /dev/null differ diff --git a/assets/images/app_ui/run-colors-colorblind-other.png b/assets/images/app_ui/run-colors-colorblind-other.png deleted file mode 100644 index 54f66db76e..0000000000 Binary files a/assets/images/app_ui/run-colors-colorblind-other.png and /dev/null differ diff --git a/assets/images/app_ui/run-colors-default.png b/assets/images/app_ui/run-colors-default.png deleted file mode 100644 index e0486f7fb0..0000000000 Binary files a/assets/images/app_ui/run-colors-default.png and /dev/null differ diff --git a/assets/images/app_ui/run-colors-key-based.png b/assets/images/app_ui/run-colors-key-based.png deleted file mode 100644 index 8890cbce9a..0000000000 Binary files a/assets/images/app_ui/run-colors-key-based.png and /dev/null differ diff --git a/assets/images/general/architecture.png b/assets/images/general/architecture.png deleted file mode 100644 index 4a877d94cc..0000000000 Binary files a/assets/images/general/architecture.png and /dev/null differ diff --git a/assets/images/hosting/saas_cloud_arch.png b/assets/images/hosting/saas_cloud_arch.png deleted file mode 100644 index 7a0bbf499b..0000000000 Binary files a/assets/images/hosting/saas_cloud_arch.png and /dev/null differ diff --git a/assets/scss/_variables_project.scss b/assets/scss/_variables_project.scss deleted file mode 100644 index edaf1036fe..0000000000 --- a/assets/scss/_variables_project.scss +++ /dev/null @@ -1,1493 +0,0 @@ -/* - -Add styles or override variables from the theme here. - -*/ - -@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,200..900;1,8..60,200..900&display=swap'); - -// First define the base color tokens -// Moon (Grayscale) -$moon-white: #ffffff; -$moon-50: #fafafa; -$moon-100: #f5f6f7; -$moon-200: #e4e6eb; -$moon-250: #dfe0e2; -$moon-300: #d3d7de; -$moon-350: #c1c6cf; -$moon-400: #aeb3bd; -$moon-500: #79808a; -$moon-600: #565c66; -$moon-650: #4a4f58; -$moon-700: #3f464f; -$moon-750: #363c44; -$moon-800: #2b3038; -$moon-900: #1a1d24; -$moon-950: #171a1f; - -// Teal colors -$teal-300: #a9edf2; -$teal-400: #58d3db; -$teal-450: #10bfcc; -$teal-500: #13a9ba; -$teal-550: #0e97a7; -$teal-600: #038194; - -// Border colors -$border-default: $moon-200; // Using moon-200 instead of moon-250 -$border-hover: $moon-350; // color/moon/350 -$border-active: $teal-500; // color/teal/500 -$border-subtle: $moon-100; // color/moon/100 -$dark-border-default: $moon-750; // color/moon/750 -$dark-border-hover: $moon-650; // color/moon/650 -$dark-border-subtle: $moon-800; // color/moon/800 - -// Border radius -$border-radius-medium: 8px; // Used for most components -$border-radius-large: 12px; // Used for modals and larger components - -// Then define the semantic color tokens -// Text colors -$text-primary: $moon-800; // color/moon/800 -$text-secondary: $moon-600; // color/moon/600 -$text-tertiary: $moon-500; // color/moon/500 -$text-disabled: $moon-350; // color/moon/350 - -// Link colors -$link-primary: $teal-600; // color/teal/600 -$link-hover: $teal-550; // color/teal/550 -$link-secondary: $moon-600; // color/moon/600 -$link-secondary-hover: $moon-500; // color/moon/500 - -// Background colors -$bg-primary: $moon-white; // White background -$bg-secondary: $moon-50; // color/moon/50 -$bg-tertiary: $moon-100; // color/moon/100 -$bg-disabled: $moon-350; // color/moon/350 - -// Dark mode colors -$dark-text-primary: $moon-200; // color/moon/200 -$dark-text-secondary: $moon-400; // color/moon/400 -$dark-text-tertiary: $moon-500; // color/moon/500 -$dark-text-disabled: $moon-650; // color/moon/650 - -$dark-link-primary: $teal-500; // color/teal/500 -$dark-link-hover: $teal-450; // color/teal/450 -$dark-link-secondary: $moon-600; // color/moon/600 -$dark-link-secondary-hover: $moon-500; // color/moon/500 - -$dark-bg-primary: $moon-900; // color/moon/900 -$dark-bg-secondary: $moon-800; // color/moon/800 -$dark-bg-tertiary: $moon-700; // color/moon/700 -$dark-bg-disabled: $moon-650; // color/moon/650 - -// Other brand colors -$nav-bg: rgb(26, 28, 31); -$wandb-gold: #FFCC33; -$wandb-link-blue: rgb(7, 177, 196); -$hover-bg: #A9EDF260; - -// Gradients -$sunset-gradient: linear-gradient(98deg, #e180ff 0%, #ffcf4d 100%); -$wandb-gradient: linear-gradient(180deg, #ffcc33 39%, #ffad33 72%); - -// Font weights -$font-weight-light: 300; -$font-weight-regular: 400; -$font-weight-medium: 500; -$font-weight-semibold: 600; -$font-weight-bold: 700; - -// Bootstrap overrides -:root { - --bs-nav-link-font-size: 18px; -} - -// Typography Component -// Base body styles -body { - font-family: "Source Sans Pro", sans-serif; - font-size: 16px; - font-weight: $font-weight-regular; - color: $text-primary; - background-color: $bg-primary; - - [data-bs-theme=dark] & { - color: $dark-text-primary; - background-color: $dark-bg-primary; - } -} -p, td, div -{ - font-family: "Source Sans Pro", sans-serif; -} -.td-sidebar-nav__section-title, .td-sidebar-nav__section without-child -{ - font-size: 16px; - font-weight: $font-weight-bold; -} - -// Headings -h1, h2, h3, h4, h5, h6 { - font-weight: $font-weight-regular !important; - font-family: "Source Serif 4", sans-serif; - color: $text-primary; - - [data-bs-theme=dark] & { - color: $dark-text-primary; - } -} - -// Heading sizes -h1, .td-content h1 { font-size: 32px !important; } -h2, .td-content h2 { font-size: 24px !important; } -h3, .td-content h3 { font-size: 20px !important; } -h4, .td-content h4 { font-size: 18px !important; } -h5, .td-content h5 { font-size: 17px !important; } -h6, .td-content h6 { font-size: 16px !important; } - -// Lead paragraph -.td-content .lead { - font-size: 16px !important; - font-weight: $font-weight-regular !important; -} - -// Reading time -.reading-time { - font-size: 14px; - color: $text-secondary; - - [data-bs-theme=dark] & { - color: $dark-text-secondary; - } -} - -// Links -a { - color: $link-primary !important; - text-decoration: none !important; - - &:hover { - color: $link-hover !important; - text-decoration: none !important; - } - - [data-bs-theme=dark] & { - color: $dark-link-primary !important; - - &:hover { - color: $dark-link-hover !important; - } - } -} - -// hide "create child" and "create project issue" links -.td-page-meta__child, .td-page-meta__project-issue { display: none !important; } - -// shrink the right nav a bit -.td-page-meta { - display: none !important; - font-size: 16px !important; - a { - padding-bottom: 15px; - line-height: 22px; - } -} - -// hide left nav label -.tree-root { display: none !important;} - -// First define breakpoints -$breakpoint-sm: 576px; // Phone -$breakpoint-md: 768px; // Tablet -$breakpoint-lg: 992px; // Desktop -$breakpoint-xl: 1200px; // Large desktop - -// Consolidated navbar styles with mobile-first approach -.td-navbar { - background-color: $bg-primary !important; - padding: 0 !important; - border-bottom: 1px solid $border-default !important; - - // Base styles (mobile first) - .container-fluid { - padding: 8px !important; - gap: 16px !important; - - .td-navbar-nav-scroll { - align-items: center !important; - height: auto !important; - margin: 0 !important; - padding: 0 !important; - gap: 16px !important; - - .navbar-nav { - display: flex !important; - align-items: center !important; - padding-left: 0 !important; - margin: 0 !important; - gap: 8px !important; - - .nav-item { - padding-inline-end: 0 !important; - } - - &.main-nav { - padding: 0 !important; - margin: 0 !important; - - // Nav links base styles - .nav-link { - color: $text-secondary !important; - font-weight: $font-weight-regular !important; - transition: all 0.2s ease-in-out !important; - border-bottom: none !important; - border-radius: $border-radius-medium !important; - padding: 8px 10px !important; - font-size: 16px !important; - - &:hover { - text-decoration: none !important; - background-color: rgba($moon-300, 0.2) !important; - } - - &.active { - color: $link-primary !important; - background-color: rgba($moon-300, 0.2) !important; - font-weight: $font-weight-regular !important; - } - } - - } - - &.main-nav-right { - padding: 0 !important; - margin: 0 !important; - align-items: center !important; - gap: 0 !important; - - // Update mobile light/dark toggle styles - .td-light-dark-menu { - display: flex !important; - align-items: center !important; - margin: 0 !important; - gap: 0 !important; - min-width: 0 !important; - } - - // Dropdown styles - .nav-item.dropdown { - margin: 0 !important; - - .nav-link { - font-size: 16px !important; - font-weight: $font-weight-regular !important; - color: $text-secondary !important; - - &:hover { - background-color: transparent !important; - } - - &::after { - display: none !important; - } - - [data-bs-theme=dark] & { - color: $dark-text-secondary !important; - } - } - } - } - } - } - } - - // Brand/logo styles - .navbar-brand { - display: flex !important; - align-items: center !important; - padding: 0 !important; - margin-right: 0 !important; - - .navbar-logo { - display: block; - width: auto; - height: auto; - margin: 0 !important; - - svg { - margin: 0 !important; - width: 100%; - } - } - } - - // Hide the doc site name - .navbar-brand__name { - display: none !important; - } - - - // Tablet styles (577px and up) - @media (min-width: $breakpoint-sm + 1) { - .container-fluid { - padding: 8px 12px !important; - } - - .navbar-brand { - margin-right: 1rem !important; - } - } - - // Desktop styles (992px and up) - @media (min-width: $breakpoint-lg) { - .container-fluid { - padding: 8px 24px !important; - flex-direction: row !important; - align-items: center !important; - justify-content: flex-start !important; - gap: 32px !important; - - .td-navbar-nav-scroll { - flex-grow: 1 !important; - - .navbar-nav { - - &.main-nav { - flex-grow: 1 !important; - gap: 16px !important; - - .nav-link { - padding: 6px 12px !important; - font-size: 18px !important; - } - } - - &.main-nav-right { - gap: 16px !important; - - .nav-link{ - font-size: 16px !important; - color: $text-secondary !important; - } - } - } - .main-nav-search { - min-width: 300px !important; - - .DocSearch.DocSearch-Button { - margin: 0 !important; - min-width: 100% !important; - } - } - } - } - - - .nav-item.dropdown { - &.d-none.d-lg-block, - &.td-light-dark-menu { - margin: 0 4px !important; - - .nav-link { - font-size: 16px !important; - } - } - } - } - - // Dark mode styles - [data-bs-theme=dark] & { - background-color: $dark-bg-primary !important; - border-bottom: 1px solid $dark-border-default !important; - - &.js-navbar-scroll { - background-color: $dark-bg-primary !important; - } - - .td-navbar-nav-scroll { - - .navbar-nav { - - &.main-nav { - .nav-link { - color: $moon-white !important; - - &:hover { - color: $teal-500 !important; - } - - &.active { - color: $teal-500 !important; - } - } - } - - .nav-item.dropdown { - &.d-none.d-lg-block, - &.td-light-dark-menu { - .nav-link { - color: $dark-text-primary !important; - - &:hover { - color: $dark-link-primary !important; - } - } - } - } - } - } - } - - // Update the light/dark menu styles - .td-light-dark-menu { - &.nav-item.dropdown { - margin: 0 2px !important; - display: flex !important; - align-items: center !important; - } - - // Hide from navbar-right on mobile - &.d-none { - @media (max-width: #{$breakpoint-lg - 1}) { - display: none !important; - } - } - } -} - -// headings use WandB serif font -h1, h2, h3, h4, h5, h6 { - font-weight: $font-weight-regular !important; - font-family: "Source Serif 4", sans-serif; - color: $text-primary; -} - -.td-sidebar-nav-active-item { - text-decoration: none; -} - -ol.breadcrumb li { - font-size: 13px; -} -ol.breadcrumb li:not(:first-child):before { - content: ">" !important; -} - -.td-sidebar-nav__section-title, .td-sidebar-nav__section { - margin-bottom: 10px !important; - .nav-link.dropdown-toggle { - margin-left: -5px !important; - } -} - -.td-content .lead { - font-size: 16px !important; - font-weight: $font-weight-regular !important; -} - -// Table of Contents Component -#TableOfContents { - - font-size: 13px !important; - font-family: "Source Sans Pro", sans-serif; - a{ - margin: 0px !important; - padding: 8px !important; - font-weight: 500 !important; - } - // List styles - ul { - padding: 0px !important; - li { - padding: 0px !important; - line-height: 14px; - } - } - - // Link styles - a { - display: block; - color: $text-secondary !important; - - &:hover { - color: $link-primary !important; - text-decoration: none !important; - } - - [data-bs-theme=dark] & { - color: $dark-text-secondary !important; - - &:hover { - color: $dark-link-primary !important; - } - } - } - - // Dark mode - [data-bs-theme=dark] & { - color: $dark-text-primary; - } -} - -// tabs -ul { - &.nav-tabs { - border-bottom: none !important; - - li { - &.nav-item { - margin: 0 !important; - - button { - color: $text-primary !important; - - &.active { - color: $link-primary !important; - background-color: var(--td-pre-bg) !important; - border-bottom-color: var(--td-pre-bg) !important; - } - - // Add dark mode styles - [data-bs-theme=dark] & { - color: $dark-text-primary !important; - - &.active { - color: $dark-link-primary !important; - } - } - } - } - } - } -} - -.tab-content { - > .tab-pane { - border-radius: 0 $border-radius-medium $border-radius-medium $border-radius-medium !important; - border: 1px solid $border-default !important; - - // Add dark mode styles - [data-bs-theme=dark] & { - border-color: $dark-border-default !important; - } - } -} - -// Buttons Component -// Base button styles -.button-base { - display: inline-flex; - align-items: center; - justify-content: center; - font-size: 16px; - line-height: 20px; - font-weight: $font-weight-semibold; - padding: 0 12px; - min-height: 40px; - border-radius: $border-radius-medium; - transition: background-color 0.3s, color 0.3s; - text-decoration: none !important; - border: none; - - &:hover { - text-decoration: none !important; - } -} - -// CTA Container styles -.cta-container { - display: flex; - align-items: center; // Vertically center the buttons - gap: 16px; // Consistent spacing between buttons - margin: 24px 0; - flex-wrap: wrap; // Allow wrapping on smaller screens -} - -// CTA Button -.cta-button { - @extend .button-base; - color: $moon-800 !important; - background-color: $moon-100; - height: 40px; // Fixed height for consistency - padding: 0 16px; - display: inline-flex; - align-items: center; // Center button contents vertically - white-space: nowrap; // Prevent text wrapping inside button - - &:hover { - background-color: $hover-bg; - } - - // Icon styles - svg, img { - width: 24px; - height: 24px; - margin-right: 8px; - } - - [data-bs-theme=dark] & { - color: $dark-text-primary !important; - background-color: $dark-bg-secondary; - - &:hover { - background-color: $dark-bg-tertiary; - } - } -} - -// Contact Us Button -.contact-us-button { - @extend .button-base; - background-color: $teal-500; - color: $moon-white !important; - gap: 8px; - - &:hover { - background-color: $teal-450; - } - - img { - width: 112px; - height: 24px; - } - - p { - margin: 0; - color: $moon-white; - } - - [data-bs-theme=dark] & { - background-color: $teal-450; - - &:hover { - background-color: $teal-400; - } - } -} - -// Banners Component -// Base banner styles -.banner-base { - display: flex; - padding: 32px 40px; - flex-direction: column; - align-items: flex-start; - gap: 24px; - border-radius: $border-radius-large; - margin-bottom: 30px; - - h1, h2, p, div { - filter: drop-shadow(5px 5px 5px rgba(0, 0, 0, 0.5)); - } -} - -// Standard Banner -.banner { - @extend .banner-base; - background-position: center; - background-repeat: no-repeat; - background-size: cover; - min-height: 200px; - color: $moon-white; - overflow: hidden; -} - -// Help Banner -.help-banner { - @extend .banner-base; - padding: 56px 40px 72px 40px; - background: $moon-900; - background-image: url('/images/support/support_banner.png'); - background-size: cover; - background-position: center; - box-shadow: none; - - &.card:hover { - box-shadow: none; - transform: none; - } - - h2 { - color: $moon-50; - font-size: 40px; - font-weight: $font-weight-semibold; - font-family: "Source Sans Pro"; - line-height: 140%; - } - - p { - color: $moon-250; - font-size: 20px; - font-weight: $font-weight-regular; - font-family: "Source Sans Pro"; - line-height: 140%; - } -} - -// Card Banner -.card-banner { - @extend .banner-base; - align-items: center; - background: $moon-50; - color: $moon-800; - - h2 { - font-size: 24px; - font-weight: $font-weight-semibold; - color: $moon-900; - margin: 0; - } - - p { - font-size: 16px; - font-weight: $font-weight-regular; - margin: 0; - } - - &.card-banner-gray { - &:hover { - box-shadow: none; - transform: none; - } - } - - // Icon container - &-icon { - display: flex; - width: 64px; - height: 64px; - justify-content: center; - align-items: center; - border-radius: 100px; - background: rgba($teal-300, 0.48); - - img { - width: 32px; - height: 32px; - } - } - - [data-bs-theme=dark] & { - background: $dark-bg-secondary; - color: $dark-text-primary; - - h2 { - color: $dark-text-primary; - } - - p { - color: $dark-text-secondary; - } - } -} - -// Add border radius to all images, code blocks and alerts -img, pre, .highlight, .code-toolbar, .alert { - border-radius: $border-radius-medium !important; -} - -// Style images and iframes consistently -img, iframe { - margin-top: 1rem; - margin-bottom: 2rem; - display: block; -} - -.section-index { - max-width: 80%; -} - -.section-index .entry p { - margin-top: 5px; -} - -@media (min-width: $breakpoint-lg) { - img, iframe { - max-width: 80% !important; - } -} - -// Override section index heading font weight -.section-index h5 a, .section-index .h5 a { - font-size: 20px !important; - font-weight: $font-weight-regular !important; -} - -// Add dark mode styles using data-bs-theme attribute -[data-bs-theme=dark] { - body { - color: $dark-text-primary; - background-color: $dark-bg-primary; - } - - // Update sidebar nav colors for dark mode - .td-sidebar-nav { - a { - color: $dark-text-primary !important; - &:hover { - color: $dark-link-primary !important; - } - .td-sidebar-nav-active-item { - color: $dark-link-primary !important; - } - } - } - - // Update headings color for dark mode - h1, h2, h3, h4, h5, h6 { - color: $dark-text-primary; - } - - // Update reading time color for dark mode - .reading-time { - color: $dark-text-secondary; - } - - // Update table of contents color - #TableOfContents { - color: $dark-text-primary; - } - - .td-footer { - background-color: transparent !important; - color: $dark-text-primary !important; - border-top: 1px solid $moon-750 !important; - } - - // Update border colors for dark mode - .border, - .border-top, - .border-right, - .border-bottom, - .border-left { - border-color: $dark-border-default !important; - - &:hover { - border-color: $dark-border-hover !important; - } - } -} - -// For light mode (default) borders -.border, -.border-top, -.border-right, -.border-bottom, -.border-left { - border-color: $border-default !important; - - &:hover { - border-color: $border-hover !important; - } -} - -// Footer Component -.td-footer { - background-color: transparent !important; - color: $text-primary !important; - border-top: 1px solid $moon-200 !important; - padding: 1.5rem 0 !important; - min-height: auto !important; - margin: 0 !important; - - // Container styles - .container-fluid { - padding: 0 2rem !important; - } - - // Row alignment - .row { - align-items: center !important; - } - - // Footer links - &__links-item { - margin-bottom: 0 !important; - } - - // Links and icons - a, i { - color: inherit !important; - transition: color 0.3s !important; - - &:hover { - color: $link-hover !important; - } - } - - // Dark mode styles - [data-bs-theme=dark] & { - background-color: transparent !important; - color: $dark-text-primary !important; - border-top: 1px solid $moon-750 !important; - - a:hover, - i:hover { - color: $wandb-gold !important; - } - } -} - -// Feedback Component -.td-content > .d-print-none { // Target only the feedback section at bottom of content - margin-top: 4rem; - display: flex; - align-items: center; // Change back to center for vertical alignment - flex-wrap: wrap; // Allow wrapping on smaller screens - gap: 8px; // Consistent spacing between elements - - // Hide feedback title - .feedback--title { - display: none; - } - - // Question and buttons container - .feedback--question { - margin: 0; - display: flex; - align-items: center; - gap: 16px; - } - - // Buttons container - .btn { - min-width: 50px; - display: flex; - align-items: center; - justify-content: center; - - &.feedback--answer-no { - margin: 0 !important; - } - } - - // Response styling - .feedback--response { - width: 100%; - margin-top: 1rem; - } -} - -// Last modified date with feedback links - mobile styles -div.td-page-meta__lastmod { - display: flex !important; - flex-direction: column !important; // Stack elements vertically on mobile - gap: 8px !important; - color: $text-secondary !important; - font-size: 14px !important; - margin-top: 0 !important; - - // Container for last modified text and commit link - &:first-child { - display: flex !important; - align-items: center !important; - gap: 4px !important; - } - - // Style the commit link - a { - color: $text-secondary !important; - &:hover { - color: $link-primary !important; - } - } - - .feedback--links { - display: flex !important; - margin-top: 8px !important; - align-items: center !important; - gap: 16px !important; - - // Style the edit/issue links - a { - color: $text-secondary !important; - &:hover { - color: $link-primary !important; - } - } - } - - // Tablet and desktop styles - @media (min-width: $breakpoint-lg) { - flex-direction: row !important; // Switch to horizontal layout - align-items: center !important; - justify-content: space-between !important; - - .feedback--links { - margin-top: 0 !important; - margin-left: auto !important; - } - } - - // Dark mode styles - [data-bs-theme=dark] & { - color: $dark-text-secondary !important; - - a { - color: $dark-text-secondary !important; - &:hover { - color: $dark-link-primary !important; - } - } - } -} - -// Feedback buttons -.feedback--answer { - @extend .button-base; - color: $moon-800 !important; - background-color: $moon-100 !important; - background-image: none !important; - margin-right: 8px !important; - box-shadow: none !important; - display: inline-block !important; - margin-bottom: 0 !important; - border: none !important; - - &:hover { - background-color: $hover-bg !important; - text-decoration: none !important; - border: none !important; - box-shadow: none !important; - } - - // Remove unwanted margin - &.mb-4 { - margin-bottom: 0 !important; - } - - // Hide disabled buttons - &:disabled { - display: none !important; - } - - // Dark mode styles - [data-bs-theme=dark] & { - color: $dark-text-primary !important; - background-color: $dark-bg-secondary !important; - border: none !important; - - &:hover { - background-color: $dark-bg-tertiary !important; - border: none !important; - box-shadow: none !important; - } - } -} - -// Remove feedback links from original location -.td-content > .d-print-none .feedback--links { - display: none !important; -} - -// Update the sidebar navigation styles -.td-sidebar-nav { - font-family: "Source Sans Pro", sans-serif; - padding-left: 15px !important; - - // Base link styles - a { - color: $text-secondary !important; - font-weight: $font-weight-regular; - text-decoration: none !important; - - &:hover { - color: $link-primary !important; - text-decoration: none !important; - } - } - - // Active item styles - .td-sidebar-nav-active-item { - color: $link-primary !important; - font-weight: $font-weight-medium !important; - text-decoration: none !important; - - &:hover { - text-decoration: none !important; - } - } - - // Section title styles - &__section-title { - display: block; - font-weight: $font-weight-regular !important; - line-height: 19px; - margin-bottom: 10px !important; - margin-top: 5px !important; - - .active { - font-weight: $font-weight-regular !important; - } - - a { - color: var(--bs-secondary-color); - font-weight: $font-weight-regular !important; - } - } - - // Dark mode overrides - [data-bs-theme=dark] & { - a { - color: $dark-text-secondary !important; - - &:hover { - color: $dark-link-primary !important; - } - } - - .td-sidebar-nav-active-item { - color: $dark-link-primary !important; - } - } -} - -// Foldable Nav -nav.foldable-nav .with-child, nav.foldable-nav .without-child { - padding-left: 10px !important; - } - // Update existing chevron styles - nav.foldable-nav .ul-1 .with-child { - & > label { - display: flex; - justify-content: space-between; - align-items: center; - width: 100%; - position: relative; - padding-right: 20px; // Space for chevron - - // Remove default chevrons - &:before { - display: none !important; - } - } - } - - // Add chevrons to all expandable items - nav.foldable-nav .ul-1 .with-child > label:after { - content: "\f105" !important; // fa-angle-right (thinner chevron) - font-family: "Font Awesome 6 Free", "Font Awesome 5 Free"; - font-weight: 900; - color: $moon-500; - transition: color 0.3s; - font-size: 14px; - position: absolute; - right: 0px; - top: 35%; - transform: translateY(-50%); - } - - // Change chevron for expanded items - nav.foldable-nav .ul-1 .with-child > input:checked + label:after { - content: "\f107" !important; // fa-angle-down (thinner chevron) - } - - // Hover states - nav.foldable-nav .ul-1 .with-child > label:hover:after { - color: $teal-600 !important; - } - - // Dark mode hover state - [data-bs-theme=dark] nav.foldable-nav .ul-1 .with-child > label:hover:after { - color: $wandb-gold !important; - } - - // Dark mode hover state - [data-bs-theme=dark] nav.foldable-nav .ul-1 .with-child > label:hover:after { - color: $wandb-gold !important; - } - - -// Theme-based logo visibility -[data-bs-theme="dark"] { - .theme-light-only { - display: none; - } - .theme-dark-only { - display: block; - } -} - -[data-bs-theme="light"] { - .theme-light-only { - display: block; - } - .theme-dark-only { - display: none; - } -} - - -// Add consistent padding for main content -.td-main { - main { - &.ps-md-5 { - padding-left: 2rem !important; - padding-right: 2rem !important; - - // Tablet (768px and up) - @media (min-width: $breakpoint-md) { - padding-left: 3rem !important; - padding-right: 3rem !important; - } - } - } -} - -// Google Search style overrides -.gsc-control-cse, .gsc-webResult.gsc-result, .gsc-cursor-page, .gsc-refinementHeader, .gs-no-results-result div { - background-color: transparent !important; - border: 0px !important; -} -.gs-title { - font-family: "Source Serif 4", sans-serif !important; -} -.gs-title b, .gs-title a, .gsc-cursor-page, .gsc-above-wrapper-area, .gcsc-find-more-on-google-query, .gcsc-find-more-on-google-magnifier { - color: $link-primary !important; - text-decoration: none !important; - font-size: 18px !important; - &:hover { - color: $link-hover !important; - text-decoration: none !important; - } - [data-bs-theme=dark] & { - color: $dark-link-primary !important; - - &:hover { - color: $dark-link-hover !important; - } - } -} -.gsc-above-wrapper-area a:hover{ - background-color: $bg-secondary !important; -} -.gsc-result-info, .gs-per-result-labels { - font-family: "Source Sans Pro", sans-serif !important; - font-size: 14px !important; - color: $text-secondary !important; - [data-bs-theme=dark] & { - color: $dark-text-secondary !important; - } -} -.gsc-refinementBlock span { - margin-left: 10px !important; - margin-right: 10px !important; -} -.gs-visibleUrl-breadcrumb { - font-family: "Source Sans Pro", sans-serif !important; - font-size: 14px !important; - color: $text-tertiary !important; - [data-bs-theme=dark] & { - color: $wandb-gold !important; - } -} - -.gs-snippet, .gsc-refinementHeader { - font-family: "Source Sans Pro", sans-serif !important; - font-size: 16px !important; - color: $text-primary !important; - [data-bs-theme=dark] & { - color: $dark-text-primary !important; - } -} -.gsc-above-wrapper-area { - display: none !important; -} -body > div.container-fluid.td-default.td-outer > main > section > div > h2 { - margin-left: 1.0rem !important; -} -.gs-per-result-labels { - padding: 5px !important; - border-radius: $border-radius-medium; - font-size: 12px; - max-width: fit-content; -} -.gs-per-result-labels span { - display: none; -} -.gsc-inline-block:hover, .gsc-refinementhActive, .gs-per-result-labels { - background-color: $bg-tertiary !important; - [data-bs-theme=dark] & { - background-color: $dark-bg-tertiary !important; - } -} -.td-search__input, .form-control, .td-search-input -{ - color: $text-tertiary !important; - border: $text-tertiary !important; - background-color: transparent !important; - [data-bs-theme=dark] & { - color: $dark-text-tertiary !important; - border: $dark-text-tertiary !important; - } -} -.gcsc-find-more-on-google { - display: none !important; -} - -// DocSearch Component -.DocSearch { - // Button styles - &-Button { - font-family: "Source Sans Pro", sans-serif; - font-size: 16px; - background: transparent !important; - border: 1px solid $border-default !important; - - &:active, - &:focus, - &:hover { - background: var(--docsearch-searchbox-focus-background); - box-shadow: inset 0 0 0 2px $teal-500 !important; - color: var(--docsearch-text-color); - outline: none; - border-color: $teal-500 !important; - } - - // Dark mode styles - [data-bs-theme=dark] & { - border: 1px solid $dark-border-default !important; - - &:hover, &:focus, &:active { - border-color: $teal-500 !important; - box-shadow: inset 0 0 0 2px $teal-450 !important; - } - } - } - - // Placeholder text color - &-Button-Placeholder { - color: $text-secondary !important; - - [data-bs-theme=dark] & { - color: $dark-text-secondary !important; - } - } - - // Search icon color - &-Search-Icon { - color: $text-secondary !important; - - [data-bs-theme=dark] & { - color: $dark-text-secondary !important; - } - } - - // Modal styles - &-Modal { - border-radius: $border-radius-large !important; - } - - // Hide footer - &-Footer { - display: none !important; - } -} - -// DocSearch Container with CSS Variables -.DocSearch-Container { - font-family: "Source Sans Pro", sans-serif; - font-size: 16px; - - // Light mode variables - --docsearch-primary-color: #{$teal-500} !important; - --docsearch-highlight-color: #{$teal-500} !important; - --docsearch-text-color: #{$moon-800} !important; - --docsearch-muted-color: #{$moon-500} !important; - --docsearch-container-background: rgba(101, 108, 133, 0.8) !important; - --docsearch-modal-background: #{$moon-white} !important; - --docsearch-searchbox-background: #{$moon-100} !important; - --docsearch-searchbox-focus-background: #{$moon-white} !important; - --docsearch-hit-color: #{$moon-800} !important; - --docsearch-hit-background: #{$moon-white} !important; - --docsearch-hit-active-background: #{$teal-500} !important; - --docsearch-footer-background: #{$moon-white} !important; - --docsearch-logo-color: #{$teal-500} !important; - --docsearch-key-gradient: linear-gradient(-26.5deg, #{$moon-200}, #{$moon-100}) !important; - --docsearch-key-shadow: inset 0 -2px 0 0 #{$moon-300} !important; - --docsearch-searchbox-shadow: inset 0 0 0 2px #{$teal-500} !important; - - .DocSearch-Modal { - border-radius: 0 !important; - max-width: 800px !important; - } - - // Search form styles - .DocSearch-Form { - border-radius: 30px !important; - } - - // Search results styles - .DocSearch-Hit { - border-radius: $border-radius-medium; - - > a { - box-shadow: none !important; - border-radius: $border-radius-medium; - border: 1px solid $border-default !important; - - } - } - - // Dark mode styles - [data-bs-theme=dark] & { - --docsearch-primary-color: #{$teal-400} !important; - --docsearch-highlight-color: #{$teal-400} !important; - --docsearch-text-color: #{$moon-200} !important; - --docsearch-muted-color: #{$moon-400} !important; - --docsearch-container-background: rgba(21, 23, 31, 0.8) !important; - --docsearch-modal-background: #{$moon-800} !important; - --docsearch-searchbox-background: #{$moon-900} !important; - --docsearch-searchbox-focus-background: #{$moon-900} !important; - --docsearch-hit-color: #{$moon-200} !important; - --docsearch-hit-background: #{$moon-800} !important; - --docsearch-hit-active-background: #{$teal-400} !important; - --docsearch-footer-background: #{$moon-800} !important; - --docsearch-logo-color: #{$teal-400} !important; - --docsearch-key-gradient: linear-gradient(-26.5deg, #{$moon-800}, #{$moon-750}) !important; - --docsearch-key-shadow: inset 0 -2px 0 0 #{$moon-700} !important; - --docsearch-searchbox-shadow: inset 0 0 0 2px #{$teal-400} !important; - } - - .DocSearch-Hit-source { - color: $text-secondary !important; - font-size: 14px !important; - } - - .DocSearch-Hit-title { - font-size: 1rem !important; - } - - // Dark mode styles - [data-bs-theme=dark] & { - - .DocSearch-Modal { - box-shadow: inset 1px 1px 0 0 hsla(0, 0%, 18%, 0.5), 0 3px 8px 0 $moon-900; - } - - .DocSearch-Hit { - > a { - border: 1px solid $dark-border-default !important; - } - } - - .DocSearch-Hit-source { - color: $dark-text-secondary !important; - font-size: 14px !important; - } - - .DocSearch-Hit-title { - font-size: 1rem !important; - } - } -} - -@media (min-width: $breakpoint-lg) { - .DocSearch { - - .DocSearch-Modal { - border-radius: $border-radius-large !important; - } - } -} diff --git a/blog.mdx b/blog.mdx new file mode 100644 index 0000000000..a9fc4170fa --- /dev/null +++ b/blog.mdx @@ -0,0 +1,4 @@ +--- +title: "W&B Tutorials & Blog" +url: "https://wandb.ai/fully-connected" +--- \ No newline at end of file diff --git a/content/en/_includes/_index.md b/content/en/_includes/_index.md deleted file mode 100644 index f26bedc3a6..0000000000 --- a/content/en/_includes/_index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -headless: true -cascade: - headless: true ---- \ No newline at end of file diff --git a/content/en/_includes/enterprise-cloud-only.md b/content/en/_includes/enterprise-cloud-only.md deleted file mode 100644 index 79dfef4358..0000000000 --- a/content/en/_includes/enterprise-cloud-only.md +++ /dev/null @@ -1,2 +0,0 @@ -This feature requires a [Pro or Enterprise plan](https://wandb.ai/site/pricing/). - diff --git a/content/en/_includes/enterprise-only.md b/content/en/_includes/enterprise-only.md deleted file mode 100644 index f9f25d8b80..0000000000 --- a/content/en/_includes/enterprise-only.md +++ /dev/null @@ -1,2 +0,0 @@ -This feature is available for all [Enterprise](https://wandb.ai/site/pricing/) licenses. - diff --git a/content/en/_includes/metric-naming-examples.md b/content/en/_includes/metric-naming-examples.md deleted file mode 100644 index 35c37f22d4..0000000000 --- a/content/en/_includes/metric-naming-examples.md +++ /dev/null @@ -1,15 +0,0 @@ -**Valid metric names:** -```python -with wandb.init() as run: - run.log({"accuracy": 0.9, "val_loss": 0.1, "epoch_5": 5}) - run.log({"modelAccuracy": 0.95, "learning_rate": 0.001}) -``` - -**Invalid metric names (avoid these):** -```python -with wandb.init() as run: - run.log({"acc,val": 0.9}) # Contains comma - run.log({"loss-train": 0.1}) # Contains hyphen - run.log({"test acc": 0.95}) # Contains space - run.log({"5_fold_cv": 0.8}) # Starts with number -``` diff --git a/content/en/_includes/metric-naming-rules.md b/content/en/_includes/metric-naming-rules.md deleted file mode 100644 index 1ea9c267f2..0000000000 --- a/content/en/_includes/metric-naming-rules.md +++ /dev/null @@ -1,3 +0,0 @@ -* **Allowed characters**: Letters (A-Z, a-z), digits (0-9), and underscores (_) -* **Starting character**: Names must start with a letter or underscore -* **Pattern**: Metric names should match `/^[_a-zA-Z][_a-zA-Z0-9]*$/` \ No newline at end of file diff --git a/content/en/_includes/project-visibility-settings.md b/content/en/_includes/project-visibility-settings.md deleted file mode 100644 index 1fdea11bce..0000000000 --- a/content/en/_includes/project-visibility-settings.md +++ /dev/null @@ -1,15 +0,0 @@ -1. In the W&B App, from any page in the project, click **Overview** in the left navigation. -1. At the top right, click **Edit**. -1. Choose a new value for **Project visibility**: - - - **Team** (default): Only your team can view and edit the project. - - **Restricted**: Only invited members can access the project, and public access is turned off. - - **Open**: Anyone can submit runs or create reports, but only your team can edit it. Appropriate only for classroom settings, public benchmark competitions, or other non-durable contexts. - - **Public**: Anyone can view the project, but only your team can edit it. - - {{% alert %}} - If your W&B admins have turned off **Public** visibility, you cannot choose it. Instead, you can share a view-only [W&B Report]({{< relref "/guides/core/reports/collaborate-on-reports.md#share-a-report" >}}), or contact your W&B organization's admins for assistance. - {{% /alert %}} -1. Click **Save**. - -If you update a project to a more strict privacy setting, you may need to re-invite individual users to restore their ability to access the project. \ No newline at end of file diff --git a/content/en/_includes/public-api-use.md b/content/en/_includes/public-api-use.md deleted file mode 100644 index ca360bef77..0000000000 --- a/content/en/_includes/public-api-use.md +++ /dev/null @@ -1 +0,0 @@ -> Training and fine-tuning models is done elsewhere in [the W&B Python SDK]({{< relref "/ref/python" >}}). Use the Public API for querying and managing data *after* it has been logged to W&B. diff --git a/content/en/_includes/release-notes-support-eol-reminder.md b/content/en/_includes/release-notes-support-eol-reminder.md deleted file mode 100644 index 4330765d5a..0000000000 --- a/content/en/_includes/release-notes-support-eol-reminder.md +++ /dev/null @@ -1,3 +0,0 @@ -A W&B Server release is supported for 12 months from its initial release date. As a reminder, customers using [Self-managed](/guides/hosting/hosting-options/self-managed/) are responsible to upgrade to a [supported release](/ref/releases-notes/) in time to maintain support. - -Refer to [Release policies and processes](/ref/release-notes/release-policies/). For assistance or questions, contact [support](mailto:support@wandb.com). \ No newline at end of file diff --git a/content/en/_includes/service-account-benefits.md b/content/en/_includes/service-account-benefits.md deleted file mode 100644 index cb0bcf0544..0000000000 --- a/content/en/_includes/service-account-benefits.md +++ /dev/null @@ -1,6 +0,0 @@ -Key benefits of service accounts: -- **No license consumption**: Service accounts do not consume user seats or licenses -- **Dedicated API keys**: Secure credentials for automated workflows -- **User attribution**: Optionally attribute automated runs to human users -- **Enterprise-ready**: Built for production automation at scale -- **Delegated operations**: Service accounts operate on behalf of the user or organization that creates them \ No newline at end of file diff --git a/content/en/_includes/unsupported_server_version.md b/content/en/_includes/unsupported_server_version.md deleted file mode 100644 index 95c709f1a5..0000000000 --- a/content/en/_includes/unsupported_server_version.md +++ /dev/null @@ -1,3 +0,0 @@ -This release is no longer supported. A major release and its patches are supported for 12 months from the initial release date. - -Customers using [Self-managed](/guides/hosting/hosting-options/self-managed/) are responsible to upgrade to a [supported release](/ref/releases-notes/) in time to maintain support. For assistance or questions, contact [support](mailto:support@wandb.com). \ No newline at end of file diff --git a/content/en/_index.md b/content/en/_index.md deleted file mode 100644 index a303b77bb4..0000000000 --- a/content/en/_index.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -title: Weights & Biases Documentation ---- - -
 
-
-{{< banner title="Weights & Biases Documentation" background="/images/support/support_banner.png" >}} -Choose the product for which you need documentation. -{{< /banner >}} - -
-{{< cardpane >}} -{{% card %}}
- -
-{{< img src="/icons/Name=Models, Mode=Dark.svg" width="60" height="60" >}} -
-

W&B Models

- -### Develop AI models - -Use [W&B Models]({{< relref "/guides/" >}}) to manage AI model development. Features include training, fine-tuning, reporting, automating hyperparameter sweeps, and utilizing the model registry for versioning and reproducibility. - -- [Introduction]({{< relref "/guides/" >}}) -- [Quickstart]({{< relref "/guides/quickstart/" >}}) -- [YouTube Tutorial](https://www.youtube.com/watch?v=tHAFujRhZLA) -- [Online Course](https://wandb.ai/site/courses/101/) - -
{{% /card %}} - -{{% card %}}
- -
-{{< img src="/icons/Name=Weave, Mode=Dark.svg" width="60" height="60" >}} -
-

W&B Weave

- -### Use AI models in your app - -Use [W&B Weave](https://weave-docs.wandb.ai/) to manage AI models in your code. Features include tracing, output evaluation, cost estimates, and a hosted inference service and playground for comparing different large language models (LLMs) and settings. - -- [Introduction](https://weave-docs.wandb.ai/) -- [Quickstart](https://weave-docs.wandb.ai/quickstart) -- [YouTube Demo](https://www.youtube.com/watch?v=IQcGGNLN3zo) -- [Try the Playground](https://weave-docs.wandb.ai/guides/tools/playground/) -- [Use Weave in your W&B runs]({{< relref "/guides/weave/set-up-weave" >}}) - -
{{% /card %}} -{{< /cardpane >}} - -
- -
-{{< cardpane >}} -{{% card %}}
- -
-{{< img src="/icons/Name=Inference, Mode=Dark.svg" width="60" height="60" >}} -
-

W&B Inference

- -### Access foundation models - -Use [W&B Inference]({{< relref "/guides/inference/" >}}) to access leading open-source foundation models through an OpenAI-compatible API. Features include multiple model options, usage tracking, and integration with Weave for tracing and evaluation. - -- [Introduction]({{< relref "/guides/inference/" >}}) -- [Available Models]({{< relref "/guides/inference/models/" >}}) -- [API Reference]({{< relref "/guides/inference/api-reference/" >}}) -- [Try in Playground](https://wandb.ai/inference) - -
{{% /card %}} - -{{% card %}}
- -
-{{< img src="/icons/Name=Training, Mode=Dark.svg" width="60" height="60" >}} -
-

W&B Training

- -### Post-train your models - -Now in public preview, use [W&B Training]({{< relref "/guides/training/" >}}) to post-train large language models using serverless reinforcement learning (RL). Features include fully managed GPU infrastructure, integration with ART and RULER, and automatic scaling for multi-turn agentic tasks. - -- [Introduction]({{< relref "/guides/training/" >}}) -- [Prerequisites]({{< relref "/guides/training/prerequisites/" >}}) -- [Serverless RL]({{< relref "/guides/training/serverless-rl/" >}}) -- [API Reference]({{< relref "/ref/training" >}}) - -
{{% /card %}} -{{< /cardpane >}} - -
- - -
- - diff --git a/content/en/guides/_index.md b/content/en/guides/_index.md deleted file mode 100644 index 62ae807b51..0000000000 --- a/content/en/guides/_index.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -description: An overview of W&B and how to get started. -menu: - default: - identifier: guides - weight: 1 -type: docs -cascade: - type: docs -title: Guides -no_list: true ---- - -## What is W&B? - -W&B is the AI developer platform, with tools for training models, fine-tuning models, and leveraging foundation models. - -{{< img src="/images/general/architecture.png" alt="W&B platform architecture diagram" >}} - -W&B consists of three major components: [Models]({{< relref "/guides/models.md" >}}), [Weave](https://wandb.github.io/weave/), and [Core]({{< relref "/guides/core/" >}}): - -**[W&B Models]({{< relref "/guides/models/" >}})** is a set of lightweight, interoperable tools for machine learning practitioners training and fine-tuning models. -- [Experiments]({{< relref "/guides/models/track/" >}}): Machine learning experiment tracking -- [Sweeps]({{< relref "/guides/models/sweeps/" >}}): Hyperparameter tuning and model optimization -- [Registry]({{< relref "/guides/core/registry/" >}}): Publish and share your ML models and datasets - -**[W&B Weave]({{< relref "/guides/weave/" >}})** is a lightweight toolkit for tracking and evaluating LLM applications. - -**[W&B Core]({{< relref "/guides/core/" >}})** is set of powerful building blocks for tracking and visualizing data and models, and communicating results. -- [Artifacts]({{< relref "/guides/core/artifacts/" >}}): Version assets and track lineage -- [Tables]({{< relref "/guides/models/tables/" >}}): Visualize and query tabular data -- [Reports]({{< relref "/guides/core/reports/" >}}): Document and collaborate on your discoveries - -**[W&B Inference]({{< relref "/guides/inference/" >}})** is a set of tools for accessing open-source foundation models through W&B Weave and an OpenAI-compatible API. - -**[W&B Training]({{< relref "/guides/training/" >}})** provides serverless reinforcement learning for post-training LLMs to improve reliability on multi-turn agentic tasks. - -{{% alert %}} -Learn about recent releases in the [W&B release notes]({{< relref "/ref/release-notes/" >}}). -{{% /alert %}} - -## How does W&B work? - -Read the following sections in this order if you are a first-time user of W&B and you are interested in training, tracking, and visualizing machine learning models and experiments: - -1. Learn about [runs]({{< relref "/guides/models/track/runs/" >}}), W&B's basic unit of computation. -2. Create and track machine learning experiments with [Experiments]({{< relref "/guides/models/track/" >}}). -3. Discover W&B's flexible and lightweight building block for dataset and model versioning with [Artifacts]({{< relref "/guides/core/artifacts/" >}}). -4. Automate hyperparameter search and explore the space of possible models with [Sweeps]({{< relref "/guides/models/sweeps/" >}}). -5. Manage the model lifecycle from training to production with [Registry]({{< relref "/guides/core/registry/" >}}). -6. Visualize predictions across model versions with our [Data Visualization]({{< relref "/guides/models/tables/" >}}) guide. -7. Organize runs, embed and automate visualizations, describe your findings, and share updates with collaborators with [Reports]({{< relref "/guides/core/reports/" >}}). - - - -## Are you a first-time user of W&B? - -Try the [quickstart]({{< relref "/guides/quickstart/" >}}) to learn how to install W&B and how to add W&B to your code. \ No newline at end of file diff --git a/content/en/guides/core/_index.md b/content/en/guides/core/_index.md deleted file mode 100644 index da95cd63f0..0000000000 --- a/content/en/guides/core/_index.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -menu: - default: - identifier: core -title: W&B Core -weight: 70 -no_list: true ---- - -W&B Core is the foundational framework supporting [W&B Models]({{< relref "/guides/models/" >}}) and [W&B Weave]({{< relref "/guides/weave/" >}}), and is itself supported by the [W&B Platform]({{< relref "/guides/hosting/" >}}). - -{{< img src="/images/general/core.png" alt="W&B Core framework diagram" >}} - -W&B Core provides capabilities across the entire ML lifecycle. With W&B Core, you can: - -- [Version and manage ML]({{< relref "/guides/core/artifacts/" >}}) pipelines with full lineage tracing for easy auditing and reproducibility. -- Explore and evaluate data and metrics using [interactive, configurable visualizations]({{< relref "/guides/models/tables/" >}}). -- [Document and share]({{< relref "/guides/core/reports/" >}}) insights across the entire organization by generating live reports in digestible, visual formats that are easily understood by non-technical stakeholders. -- [Query and create visualizations of your data]({{< relref "/guides/models/app/features/panels/query-panels/" >}}) that serve your custom needs. -- [Protect sensitive strings using secrets]({{< relref "/guides/core/secrets.md" >}}). -- Configure automations that trigger key workflows for [model CI/CD]({{< relref "/guides/core/automations/" >}}). diff --git a/content/en/guides/core/artifacts/_index.md b/content/en/guides/core/artifacts/_index.md deleted file mode 100644 index d8ae8a76e1..0000000000 --- a/content/en/guides/core/artifacts/_index.md +++ /dev/null @@ -1,93 +0,0 @@ ---- -description: Overview of W&B Artifacts, how they work, and how to get started using them. -menu: - default: - identifier: artifacts - parent: core -title: Artifacts -url: guides/artifacts -cascade: -- url: guides/artifacts/:filename -weight: 1 ---- - - -{{< cta-button productLink="https://wandb.ai/wandb/arttest/artifacts/model/iv3_trained/5334ab69740f9dda4fed/lineage" colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/wandb-artifacts/Artifact_fundamentals.ipynb" >}} - -Use W&B Artifacts to track and version data as the inputs and outputs of your [W&B Runs]({{< relref "/guides/models/track/runs/" >}}). For example, a model training run might take in a dataset as input and produce a trained model as output. You can log hyperparameters, metadata, and metrics to a run, and you can use an artifact to log, track, and version the dataset used to train the model as input and another artifact for the resulting model checkpoints as output. - -## Use cases -You can use artifacts throughout your entire ML workflow as inputs and outputs of [runs]({{< relref "/guides/models/track/runs/" >}}). You can use datasets, models, or even other artifacts as inputs for processing. - -{{< img src="/images/artifacts/artifacts_landing_page2.png" >}} - -| Use Case | Input | Output | -|------------------------|-----------------------------|------------------------------| -| Model Training | Dataset (training and validation data) | Trained Model | -| Dataset Pre-Processing | Dataset (raw data) | Dataset (pre-processed data) | -| Model Evaluation | Model + Dataset (test data) | [W&B Table]({{< relref "/guides/models/tables/" >}}) | -| Model Optimization | Model | Optimized Model | - - -{{% alert %}} -The proceeding code snippets are meant to be run in order. -{{% /alert %}} - -## Create an artifact - -Create an artifact with four lines of code: -1. Create a [W&B run]({{< relref "/guides/models/track/runs/" >}}). -2. Create an artifact object with the [`wandb.Artifact`]({{< relref "/ref/python/experiments/artifact.md" >}}) API. -3. Add one or more files, such as a model file or dataset, to your artifact object. -4. Log your artifact to W&B. - -For example, the proceeding code snippet shows how to log a file called `dataset.h5` to an artifact called `example_artifact`: - -```python -import wandb - -run = wandb.init(project="artifacts-example", job_type="add-dataset") -artifact = wandb.Artifact(name="example_artifact", type="dataset") -artifact.add_file(local_path="./dataset.h5", name="training_dataset") -artifact.save() - -# Logs the artifact version "my_data" as a dataset with data from dataset.h5 -``` - -- The `type` of the artifact affects how it appears in the W&B platform. If you do not specify a `type`, it defaults to `unspecified`. -- Each label of the dropdown represents a different `type` parameter value. In the above code snippet, the artifact's `type` is `dataset`. - -{{% alert %}} -See the [track external files]({{< relref "./track-external-files.md" >}}) page for information on how to add references to files or directories stored in external object storage, like an Amazon S3 bucket. -{{% /alert %}} - -## Download an artifact -Indicate the artifact you want to mark as input to your run with the [`use_artifact`]({{< relref "/ref/python/experiments/run.md#use_artifact" >}}) method. - -Following the preceding code snippet, this next code block shows how to use the `training_dataset` artifact: - -```python -artifact = run.use_artifact( - "training_dataset:latest" -) # returns a run object using the "my_data" artifact -``` -This returns an artifact object. - -Next, use the returned object to download all contents of the artifact: - -```python -datadir = ( - artifact.download() -) # downloads the full `my_data` artifact to the default directory. -``` - -{{% alert %}} -You can pass a custom path into the `root` [parameter]({{< relref "/ref/python/experiments/artifact.md" >}}) to download an artifact to a specific directory. For alternate ways to download artifacts and to see additional parameters, see the guide on [downloading and using artifacts]({{< relref "./download-and-use-an-artifact.md" >}}). -{{% /alert %}} - - -## Next steps -* Learn how to [version]({{< relref "./create-a-new-artifact-version.md" >}}) and [update]({{< relref "./update-an-artifact.md" >}}) artifacts. -* Learn how to trigger downstream workflows or notify a Slack channel in response to changes to your artifacts with [automations]({{< relref "/guides/core/automations/" >}}). -* Learn about the [registry]({{< relref "/guides/core/registry/" >}}), a space that houses trained models. -* Explore the [Python SDK]({{< relref "/ref/python/experiments/artifact.md" >}}) and [CLI]({{< relref "/ref/cli/wandb-artifact/" >}}) reference guides. diff --git a/content/en/guides/core/artifacts/artifacts-walkthrough.md b/content/en/guides/core/artifacts/artifacts-walkthrough.md deleted file mode 100644 index dbee141b1a..0000000000 --- a/content/en/guides/core/artifacts/artifacts-walkthrough.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -description: >- - Artifacts quickstart shows how to create, track, and use a dataset artifact - with W&B. -displayed_sidebar: default -title: "Tutorial: Create, track, and use a dataset artifact" ---- -This walkthrough demonstrates how to create, track, and use a dataset artifact from [W&B Runs]({{< relref "/guides/models/track/runs/" >}}). - -## 1. Log into W&B - -Import the W&B library and log in to W&B. You will need to sign up for a free W&B account if you have not done so already. - -```python -import wandb - -wandb.login() -``` - -## 2. Initialize a run - -Use the [`wandb.init()`]({{< relref "/ref/python/functions/init.md" >}}) API to generate a background process to sync and log data as a W&B Run. Provide a project name and a job type: - -```python -# Create a W&B Run. Here we specify 'dataset' as the job type since this example -# shows how to create a dataset artifact. -run = wandb.init(project="artifacts-example", job_type="upload-dataset") -``` - -## 3. Create an artifact object - -Create an artifact object with the [`wandb.Artifact()`]({{< relref "/ref/python/experiments/artifact.md" >}}) API. Provide a name for the artifact and a description of the file type for the `name` and `type` parameters, respectively. - -For example, the following code snippet demonstrates how to create an artifact called `‘bicycle-dataset’` with a `‘dataset’` label: - -```python -artifact = wandb.Artifact(name="bicycle-dataset", type="dataset") -``` - -For more information about how to construct an artifact, see [Construct artifacts]({{< relref "./construct-an-artifact.md" >}}). - -## Add the dataset to the artifact - -Add a file to the artifact. Common file types include models and datasets. The following example adds a dataset named `dataset.h5` that is saved locally on our machine to the artifact: - -```python -# Add a file to the artifact's contents -artifact.add_file(local_path="dataset.h5") -``` - -Replace the filename `dataset.h5` in the preceding code snippet with the path to the file you want to add to the artifact. - -## 4. Log the dataset - -Use the W&B run objects `log_artifact()` method to both save your artifact version and declare the artifact as an output of the run. - -```python -# Save the artifact version to W&B and mark it -# as the output of this run -run.log_artifact(artifact) -``` - -A `'latest'` alias is created by default when you log an artifact. For more information about artifact aliases and versions, see [Create a custom alias]({{< relref "./create-a-custom-alias.md" >}}) and [Create new artifact versions]({{< relref "./create-a-new-artifact-version.md" >}}), respectively. - -## 5. Download and use the artifact - -The following code example demonstrates the steps you can take to use an artifact you have logged and saved to the W&B servers. - -1. First, initialize a new run object with **`wandb.init()`.** -2. Second, use the run objects [`use_artifact()`]({{< relref "/ref/python/experiments/run.md#use_artifact" >}}) method to tell W&B what artifact to use. This returns an artifact object. -3. Third, use the artifacts [`download()`]({{< relref "/ref/python/experiments/artifact.md#download" >}}) method to download the contents of the artifact. - -```python -# Create a W&B Run. Here we specify 'training' for 'type' -# because we will use this run to track training. -run = wandb.init(project="artifacts-example", job_type="training") - -# Query W&B for an artifact and mark it as input to this run -artifact = run.use_artifact("bicycle-dataset:latest") - -# Download the artifact's contents -artifact_dir = artifact.download() -``` - -Alternatively, you can use the Public API (`wandb.Api`) to export (or update data) data already saved in a W&B outside of a Run. See [Track external files]({{< relref "./track-external-files.md" >}}) for more information. diff --git a/content/en/guides/core/artifacts/construct-an-artifact.md b/content/en/guides/core/artifacts/construct-an-artifact.md deleted file mode 100644 index 57430a7c73..0000000000 --- a/content/en/guides/core/artifacts/construct-an-artifact.md +++ /dev/null @@ -1,258 +0,0 @@ ---- -description: Create, construct a W&B Artifact. Learn how to add one or more files - or a URI reference to an Artifact. -menu: - default: - identifier: construct-an-artifact - parent: artifacts -title: Create an artifact -weight: 2 ---- - -Use the W&B Python SDK to construct artifacts from [W&B Runs]({{< relref "/ref/python/experiments/run.md" >}}). You can add [files, directories, URIs, and files from parallel runs to artifacts]({{< relref "#add-files-to-an-artifact" >}}). After you add a file to an artifact, save the artifact to the W&B Server or [your own private server]({{< relref "/guides/hosting/hosting-options/self-managed.md" >}}). - -For information on how to track external files, such as files stored in Amazon S3, see the [Track external files]({{< relref "./track-external-files.md" >}}) page. - -## How to construct an artifact - -Construct a [W&B Artifact]({{< relref "/ref/python/experiments/artifact.md" >}}) in three steps: - -### 1. Create an artifact Python object with `wandb.Artifact()` - -Initialize the [`wandb.Artifact()`]({{< relref "/ref/python/experiments/artifact.md" >}}) class to create an artifact object. Specify the following parameters: - -* **Name**: Specify a name for your artifact. The name should be unique, descriptive, and easy to remember. Use an artifacts name to both: identify the artifact in the W&B App UI and when you want to use that artifact. -* **Type**: Provide a type. The type should be simple, descriptive and correspond to a single step of your machine learning pipeline. Common artifact types include `'dataset'` or `'model'`. - - -{{% alert %}} -The "name" and "type" you provide is used to create a directed acyclic graph. This means you can view the lineage of an artifact on the W&B App. - -See the [Explore and traverse artifact graphs]({{< relref "./explore-and-traverse-an-artifact-graph.md" >}}) for more information. -{{% /alert %}} - - -{{% alert color="secondary" %}} -Artifacts can not have the same name, even if you specify a different type for the types parameter. In other words, you can not create an artifact named `cats` of type `dataset` and another artifact with the same name of type `model`. -{{% /alert %}} - -You can optionally provide a description and metadata when you initialize an artifact object. For more information on available attributes and parameters, see the [`wandb.Artifact`]({{< relref "/ref/python/experiments/artifact.md" >}}) Class definition in the Python SDK Reference Guide. - -The proceeding example demonstrates how to create a dataset artifact: - -```python -import wandb - -artifact = wandb.Artifact(name="", type="") -``` - -Replace the string arguments in the preceding code snippet with your own name and type. - -### 2. Add one more files to the artifact - -Add files, directories, external URI references (such as Amazon S3) and more with artifact methods. For example, to add a single text file, use the [`add_file`]({{< relref "/ref/python/experiments/artifact.md#add_file" >}}) method: - -```python -artifact.add_file(local_path="hello_world.txt", name="optional-name") -``` - -You can also add multiple files with the [`add_dir`]({{< relref "/ref/python/experiments/artifact.md#add_dir" >}}) method. To add files, see [Update an artifact]({{< relref "./update-an-artifact.md" >}}). - -### 3. Save your artifact to the W&B server - -Finally, save your artifact to the W&B server. Artifacts are associated with a run. Therefore, use a run objects [`log_artifact()`]({{< relref "/ref/python/experiments/run.md#log_artifact" >}}) method to save the artifact. - -```python -# Create a W&B Run. Replace 'job-type'. -run = wandb.init(project="artifacts-example", job_type="job-type") - -run.log_artifact(artifact) -``` - -{{% alert title="When to use Artifact.save() or wandb.Run.log_artifact()" %}} -- Use `Artifact.save()` to update an existing artifact without creating a new run. -- Use `wandb.Run.log_artifact()` to create a new artifact and associate it with a specific run. -{{% /alert %}} - -{{% alert color="secondary" %}} -Calls to `log_artifact` are performed asynchronously for performant uploads. This can cause surprising behavior when logging artifacts in a loop. For example: - -```python -for i in range(10): - a = wandb.Artifact( - "race", - type="dataset", - metadata={ - "index": i, - }, - ) - # ... add files to artifact a ... - run.log_artifact(a) -``` - -The artifact version **v0** is NOT guaranteed to have an index of 0 in its metadata, as the artifacts may be logged in an arbitrary order. -{{% /alert %}} - -## Add files to an artifact - -The following sections demonstrate how to construct artifacts with different file types and from parallel runs. - -For the following examples, assume you have a project directory with multiple files and a directory structure: - -``` -project-directory -|-- images -| |-- cat.png -| +-- dog.png -|-- checkpoints -| +-- model.h5 -+-- model.h5 -``` - -### Add a single file - -The proceeding code snippet demonstrates how to add a single, local file to your artifact: - -```python -# Add a single file -artifact.add_file(local_path="path/file.format") -``` - -For example, suppose you had a file called `'file.txt'` in your working local directory. - -```python -artifact.add_file("path/file.txt") # Added as `file.txt' -``` - -The artifact now has the following content: - -``` -file.txt -``` - -Optionally, pass the desired path within the artifact for the `name` parameter. - -```python -artifact.add_file(local_path="path/file.format", name="new/path/file.format") -``` - -The artifact is stored as: - -``` -new/path/file.txt -``` - -| API Call | Resulting artifact | -| --------------------------------------------------------- | ------------------ | -| `artifact.add_file('model.h5')` | model.h5 | -| `artifact.add_file('checkpoints/model.h5')` | model.h5 | -| `artifact.add_file('model.h5', name='models/mymodel.h5')` | models/mymodel.h5 | - -### Add multiple files - -The proceeding code snippet demonstrates how to add an entire, local directory to your artifact: - -```python -# Recursively add a directory -artifact.add_dir(local_path="path/file.format", name="optional-prefix") -``` - -The proceeding API calls produce the proceeding artifact content: - -| API Call | Resulting artifact | -| ------------------------------------------- | ------------------------------------------------------ | -| `artifact.add_dir('images')` |

cat.png

dog.png

| -| `artifact.add_dir('images', name='images')` |

images/cat.png

images/dog.png

| -| `artifact.new_file('hello.txt')` | `hello.txt` | - -### Add a URI reference - -Artifacts track checksums and other information for reproducibility if the URI has a scheme that W&B library knows how to handle. - -Add an external URI reference to an artifact with the [`add_reference`]({{< relref "/ref/python/experiments/artifact.md#add_reference" >}}) method. Replace the `'uri'` string with your own URI. Optionally pass the desired path within the artifact for the name parameter. - -```python -# Add a URI reference -artifact.add_reference(uri="uri", name="optional-name") -``` - -Artifacts currently support the following URI schemes: - -* `http(s)://`: A path to a file accessible over HTTP. The artifact will track checksums in the form of etags and size metadata if the HTTP server supports the `ETag` and `Content-Length` response headers. -* `s3://`: A path to an object or object prefix in S3. The artifact will track checksums and versioning information (if the bucket has object versioning enabled) for the referenced objects. Object prefixes are expanded to include the objects under the prefix, up to a maximum of 10,000 objects. -* `gs://`: A path to an object or object prefix in GCS. The artifact will track checksums and versioning information (if the bucket has object versioning enabled) for the referenced objects. Object prefixes are expanded to include the objects under the prefix, up to a maximum of 10,000 objects. - -The proceeding API calls will produce the proceeding artifacts: - -| API call | Resulting artifact contents | -| ----------------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `artifact.add_reference('s3://my-bucket/model.h5')` | `model.h5` | -| `artifact.add_reference('s3://my-bucket/checkpoints/model.h5')` | `model.h5` | -| `artifact.add_reference('s3://my-bucket/model.h5', name='models/mymodel.h5')` | `models/mymodel.h5` | -| `artifact.add_reference('s3://my-bucket/images')` |

cat.png

dog.png

| -| `artifact.add_reference('s3://my-bucket/images', name='images')` |

images/cat.png

images/dog.png

| - -### Add files to artifacts from parallel runs - -For large datasets or distributed training, multiple parallel runs might need to contribute to a single artifact. - -```python -import wandb -import time - -# We will use ray to launch our runs in parallel -# for demonstration purposes. You can orchestrate -# your parallel runs however you want. -import ray - -ray.init() - -artifact_type = "dataset" -artifact_name = "parallel-artifact" -table_name = "distributed_table" -parts_path = "parts" -num_parallel = 5 - -# Each batch of parallel writers should have its own -# unique group name. -group_name = "writer-group-{}".format(round(time.time())) - - -@ray.remote -def train(i): - """ - Our writer job. Each writer will add one image to the artifact. - """ - with wandb.init(group=group_name) as run: - artifact = wandb.Artifact(name=artifact_name, type=artifact_type) - - # Add data to a wandb table. In this case we use example data - table = wandb.Table(columns=["a", "b", "c"], data=[[i, i * 2, 2**i]]) - - # Add the table to folder in the artifact - artifact.add(table, "{}/table_{}".format(parts_path, i)) - - # Upserting the artifact creates or appends data to the artifact - run.upsert_artifact(artifact) - - -# Launch your runs in parallel -result_ids = [train.remote(i) for i in range(num_parallel)] - -# Join on all the writers to make sure their files have -# been added before finishing the artifact. -ray.get(result_ids) - -# Once all the writers are finished, finish the artifact -# to mark it ready. -with wandb.init(group=group_name) as run: - artifact = wandb.Artifact(artifact_name, type=artifact_type) - - # Create a "PartitionTable" pointing to the folder of tables - # and add it to the artifact. - artifact.add(wandb.data_types.PartitionedTable(parts_path), table_name) - - # Finish artifact finalizes the artifact, disallowing future "upserts" - # to this version. - run.finish_artifact(artifact) -``` \ No newline at end of file diff --git a/content/en/guides/core/artifacts/create-a-custom-alias.md b/content/en/guides/core/artifacts/create-a-custom-alias.md deleted file mode 100644 index b6c0fcf20e..0000000000 --- a/content/en/guides/core/artifacts/create-a-custom-alias.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -description: Create custom aliases for W&B Artifacts. -menu: - default: - identifier: create-a-custom-alias - parent: artifacts -title: Create an artifact alias -weight: 5 ---- - -Use aliases as pointers to specific versions. By default, `Run.log_artifact` adds the `latest` alias to the logged version. - -An artifact version `v0` is created and attached to your artifact when you log an artifact for the first time. W&B checksums the contents when you log again to the same artifact. If the artifact changed, W&B saves a new version `v1`. - -For example, if you want your training script to pull the most recent version of a dataset, specify `latest` when you use that artifact. The proceeding code example demonstrates how to download a recent dataset artifact named `bike-dataset` that has an alias, `latest`: - -```python -import wandb - -run = wandb.init(project="") - -artifact = run.use_artifact("bike-dataset:latest") - -artifact.download() -``` - -You can also apply a custom alias to an artifact version. For example, if you want to mark that model checkpoint is the best on the metric AP-50, you could add the string `'best-ap50'` as an alias when you log the model artifact. - -```python -artifact = wandb.Artifact("run-3nq3ctyy-bike-model", type="model") -artifact.add_file("model.h5") -run.log_artifact(artifact, aliases=["latest", "best-ap50"]) -``` \ No newline at end of file diff --git a/content/en/guides/core/artifacts/create-a-new-artifact-version.md b/content/en/guides/core/artifacts/create-a-new-artifact-version.md deleted file mode 100644 index 07d64c2b8e..0000000000 --- a/content/en/guides/core/artifacts/create-a-new-artifact-version.md +++ /dev/null @@ -1,270 +0,0 @@ ---- -description: Create a new artifact version from a single run or from a distributed - process. -menu: - default: - identifier: create-a-new-artifact-version - parent: artifacts -title: Create an artifact version -weight: 6 ---- - -Create a new artifact version with a single [run]({{< relref "/guides/models/track/runs/" >}}) or collaboratively with distributed runs. You can optionally create a new artifact version from a previous version known as an [incremental artifact]({{< relref "#create-a-new-artifact-version-from-an-existing-version" >}}). - -{{% alert %}} -We recommend that you create an incremental artifact when you need to apply changes to a subset of files in an artifact, where the size of the original artifact is significantly larger. -{{% /alert %}} - -## Create new artifact versions from scratch -There are two ways to create a new artifact version: from a single run and from distributed runs. They are defined as follows: - - -* **Single run**: A single run provides all the data for a new version. This is the most common case and is best suited when the run fully recreates the needed data. For example: outputting saved models or model predictions in a table for analysis. -* **Distributed runs**: A set of runs collectively provides all the data for a new version. This is best suited for distributed jobs which have multiple runs generating data, often in parallel. For example: evaluating a model in a distributed manner, and outputting the predictions. - - -W&B will create a new artifact and assign it a `v0` alias if you pass a name to the `wandb.Artifact` API that does not exist in your project. W&B checksums the contents when you log again to the same artifact. If the artifact changed, W&B saves a new version `v1`. - -W&B will retrieve an existing artifact if you pass a name and artifact type to the `wandb.Artifact` API that matches an existing artifact in your project. The retrieved artifact will have a version greater than 1. - -{{< img src="/images/artifacts/single_distributed_artifacts.png" alt="Artifact workflow comparison" >}} - -### Single run -Log a new version of an Artifact with a single run that produces all the files in the artifact. This case occurs when a single run produces all the files in the artifact. - -Based on your use case, select one of the tabs below to create a new artifact version inside or outside of a run: - -{{< tabpane text=true >}} - {{% tab header="Inside a run" %}} -Create an artifact version within a W&B run: - -1. Create a run with `wandb.init`. -2. Create a new artifact or retrieve an existing one with `wandb.Artifact`. -3. Add files to the artifact with `.add_file`. -4. Log the artifact to the run with `.log_artifact`. - -```python -with wandb.init() as run: - artifact = wandb.Artifact("artifact_name", "artifact_type") - - # Add Files and Assets to the artifact using - # `.add`, `.add_file`, `.add_dir`, and `.add_reference` - artifact.add_file("image1.png") - run.log_artifact(artifact) -``` - {{% /tab %}} - {{% tab header="Outside of a run" %}} -Create an artifact version outside of a W&B run: - -1. Create a new artifact or retrieve an existing one with `wanb.Artifact`. -2. Add files to the artifact with `.add_file`. -3. Save the artifact with `.save`. - -```python -artifact = wandb.Artifact("artifact_name", "artifact_type") -# Add Files and Assets to the artifact using -# `.add`, `.add_file`, `.add_dir`, and `.add_reference` -artifact.add_file("image1.png") -artifact.save() -``` - {{% /tab %}} -{{< /tabpane >}} - - - - -### Distributed runs - -Allow a collection of runs to collaborate on a version before committing it. This is in contrast to single run mode described above where one run provides all the data for a new version. - - -{{% alert %}} -1. Each run in the collection needs to be aware of the same unique ID (called `distributed_id`) in order to collaborate on the same version. By default, if present, W&B uses the run's `group` as set by `wandb.init(group=GROUP)` as the `distributed_id`. -2. There must be a final run that "commits" the version, permanently locking its state. -3. Use `upsert_artifact` to add to the collaborative artifact and `finish_artifact` to finalize the commit. -{{% /alert %}} - -Consider the following example. Different runs (labelled below as **Run 1**, **Run 2**, and **Run 3**) add a different image file to the same artifact with `upsert_artifact`. - - -#### Run 1: - -```python -with wandb.init() as run: - artifact = wandb.Artifact("artifact_name", "artifact_type") - # Add Files and Assets to the artifact using - # `.add`, `.add_file`, `.add_dir`, and `.add_reference` - artifact.add_file("image1.png") - run.upsert_artifact(artifact, distributed_id="my_dist_artifact") -``` - -#### Run 2: - -```python -with wandb.init() as run: - artifact = wandb.Artifact("artifact_name", "artifact_type") - # Add Files and Assets to the artifact using - # `.add`, `.add_file`, `.add_dir`, and `.add_reference` - artifact.add_file("image2.png") - run.upsert_artifact(artifact, distributed_id="my_dist_artifact") -``` - -#### Run 3 - -Must run after Run 1 and Run 2 complete. The Run that calls `finish_artifact` can include files in the artifact, but does not need to. - -```python -with wandb.init() as run: - artifact = wandb.Artifact("artifact_name", "artifact_type") - # Add Files and Assets to the artifact - # `.add`, `.add_file`, `.add_dir`, and `.add_reference` - artifact.add_file("image3.png") - run.finish_artifact(artifact, distributed_id="my_dist_artifact") -``` - - - - -## Create a new artifact version from an existing version - -Add, modify, or remove a subset of files from a previous artifact version without the need to re-index the files that didn't change. Adding, modifying, or removing a subset of files from a previous artifact version creates a new artifact version known as an *incremental artifact*. - -{{< img src="/images/artifacts/incremental_artifacts.png" alt="Incremental artifact versioning" >}} - -Here are some scenarios for each type of incremental change you might encounter: - -- add: you periodically add a new subset of files to a dataset after collecting a new batch. -- remove: you discovered several duplicate files and want to remove them from your artifact. -- update: you corrected annotations for a subset of files and want to replace the old files with the correct ones. - -You could create an artifact from scratch to perform the same function as an incremental artifact. However, when you create an artifact from scratch, you will need to have all the contents of your artifact on your local disk. When making an incremental change, you can add, remove, or modify a single file without changing the files from a previous artifact version. - - -{{% alert %}} -You can create an incremental artifact within a single run or with a set of runs (distributed mode). -{{% /alert %}} - - -Follow the procedure below to incrementally change an artifact: - -1. Obtain the artifact version you want to perform an incremental change on: - - -{{< tabpane text=true >}} -{{% tab header="Inside a run" %}} - -```python -saved_artifact = run.use_artifact("my_artifact:latest") -``` - -{{% /tab %}} -{{% tab header="Outside of a run" %}} - -```python -client = wandb.Api() -saved_artifact = client.artifact("my_artifact:latest") -``` - -{{% /tab %}} -{{< /tabpane >}} - - - -2. Create a draft with: - -```python -draft_artifact = saved_artifact.new_draft() -``` - -3. Perform any incremental changes you want to see in the next version. You can either add, remove, or modify an existing entry. - -Select one of the tabs for an example on how to perform each of these changes: - - -{{< tabpane text=true >}} - {{% tab header="Add" %}} -Add a file to an existing artifact version with the `add_file` method: - -```python -draft_artifact.add_file("file_to_add.txt") -``` - -{{% alert %}} -You can also add multiple files by adding a directory with the `add_dir` method. -{{% /alert %}} - {{% /tab %}} - {{% tab header="Remove" %}} -Remove a file from an existing artifact version with the `remove` method: - -```python -draft_artifact.remove("file_to_remove.txt") -``` - -{{% alert %}} -You can also remove multiple files with the `remove` method by passing in a directory path. -{{% /alert %}} - {{% /tab %}} - {{% tab header="Modify" %}} -Modify or replace contents by removing the old contents from the draft and adding the new contents back in: - -```python -draft_artifact.remove("modified_file.txt") -draft_artifact.add_file("modified_file.txt") -``` - {{% /tab %}} -{{< /tabpane >}} - - - - -4. Lastly, log or save your changes. The following tabs show you how to save your changes inside and outside of a W&B run. Select the tab that is appropriate for your use case: - -{{< tabpane text=true >}} - {{% tab header="Inside a run" %}} -```python -run.log_artifact(draft_artifact) -``` - - {{% /tab %}} - {{% tab header="Outside of a run" %}} -```python -draft_artifact.save() -``` - {{% /tab %}} -{{< /tabpane >}} - - -Putting it all together, the code examples above look like: - -{{< tabpane text=true >}} - {{% tab header="Inside a run" %}} -```python -with wandb.init(job_type="modify dataset") as run: - saved_artifact = run.use_artifact( - "my_artifact:latest" - ) # fetch artifact and input it into your run - draft_artifact = saved_artifact.new_draft() # create a draft version - - # modify a subset of files in the draft version - draft_artifact.add_file("file_to_add.txt") - draft_artifact.remove("dir_to_remove/") - run.log_artifact( - draft_artifact - ) # log your changes to create a new version and mark it as output to your run -``` - {{% /tab %}} - {{% tab header="Outside of a run" %}} -```python -client = wandb.Api() -saved_artifact = client.artifact("my_artifact:latest") # load your artifact -draft_artifact = saved_artifact.new_draft() # create a draft version - -# modify a subset of files in the draft version -draft_artifact.remove("deleted_file.txt") -draft_artifact.add_file("modified_file.txt") -draft_artifact.save() # commit changes to the draft -``` - {{% /tab %}} -{{< /tabpane >}} diff --git a/content/en/guides/core/artifacts/data-privacy-and-compliance.md b/content/en/guides/core/artifacts/data-privacy-and-compliance.md deleted file mode 100644 index f63d2ed840..0000000000 --- a/content/en/guides/core/artifacts/data-privacy-and-compliance.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -description: Learn where W&B files are stored by default. Explore how to save, store - sensitive information. -menu: - default: - identifier: data-privacy-and-compliance - parent: artifacts -title: Artifact data privacy and compliance ---- - -Files are uploaded to Google Cloud bucket managed by W&B when you log artifacts. The contents of the bucket are encrypted both at rest and in transit. Artifact files are only visible to users who have access to the corresponding project. - -{{< img src="/images/artifacts/data_and_privacy_compliance_1.png" alt="GCS W&B Client Server diagram" >}} - -When you delete a version of an artifact, it is marked for soft deletion in our database and removed from your storage cost. When you delete an entire artifact, it is queued for permanently deletion and all of its contents are removed from the W&B bucket. If you have specific needs around file deletion please reach out to [Customer Support](mailto:support@wandb.com). - -For sensitive datasets that cannot reside in a multi-tenant environment, you can use either a private W&B server connected to your cloud bucket or _reference artifacts_. Reference artifacts track references to private buckets without sending file contents to W&B. Reference artifacts maintain links to files on your buckets or servers. In other words, W&B only keeps track of the metadata associated with the files and not the files themselves. - -{{< img src="/images/artifacts/data_and_privacy_compliance_2.png" alt="W&B Client Server Cloud diagram" >}} - -Create a reference artifact similar to how you create a non reference artifact: - -```python -import wandb - -run = wandb.init() -artifact = wandb.Artifact("animals", type="dataset") -artifact.add_reference("s3://my-bucket/animals") -``` - -For alternatives, contact us at [contact@wandb.com](mailto:contact@wandb.com) to talk about private cloud and on-premises installations. \ No newline at end of file diff --git a/content/en/guides/core/artifacts/download-and-use-an-artifact.md b/content/en/guides/core/artifacts/download-and-use-an-artifact.md deleted file mode 100644 index aa61771a2e..0000000000 --- a/content/en/guides/core/artifacts/download-and-use-an-artifact.md +++ /dev/null @@ -1,133 +0,0 @@ ---- -description: Download and use Artifacts from multiple projects. -menu: - default: - identifier: download-and-use-an-artifact - parent: artifacts -title: Download and use artifacts -weight: 3 ---- - -Download and use an artifact that is already stored on the W&B server or construct an artifact object and pass it in to for de-duplication as necessary. - -{{% alert %}} -Team members with view-only seats cannot download artifacts. -{{% /alert %}} - - -### Download and use an artifact stored on W&B - -Download and use an artifact stored in W&B either inside or outside of a W&B Run. Use the Public API ([`wandb.Api`]({{< relref "/ref/python/public-api/api.md" >}})) to export (or update data) already saved in W&B. For more information, see the W&B [Public API Reference guide]({{< relref "/ref/python/public-api/index.md" >}}). - -{{< tabpane text=true >}} - {{% tab header="During a run" %}} -First, import the W&B Python SDK. Next, create a W&B [Run]({{< relref "/ref/python/experiments/run.md" >}}): - -```python -import wandb - -run = wandb.init(project="", job_type="") -``` - -Indicate the artifact you want to use with the [`use_artifact`]({{< relref "/ref/python/experiments/run.md#use_artifact" >}}) method. This returns a run object. In the proceeding code snippet specifies an artifact called `'bike-dataset'` with the alias `'latest'`: - -```python -artifact = run.use_artifact("bike-dataset:latest") -``` - -Use the object returned to download all the contents of the artifact: - -```python -datadir = artifact.download() -``` - -You can optionally pass a path to the root parameter to download the contents of the artifact to a specific directory. For more information, see the [Python SDK Reference Guide]({{< relref "/ref/python/experiments/artifact.md#download" >}}). - -Use the [`get_path`]({{< relref "/ref/python/experiments/artifact.md#get_path" >}}) method to download only subset of files: - -```python -path = artifact.get_path(name) -``` - -This fetches only the file at the path `name`. It returns an `Entry` object with the following methods: - -* `Entry.download`: Downloads file from the artifact at path `name` -* `Entry.ref`: If `add_reference` stored the entry as a reference, returns the URI - -References that have schemes that W&B knows how to handle get downloaded just like artifact files. For more information, see [Track external files]({{< relref "/guides/core/artifacts/track-external-files.md" >}}). - {{% /tab %}} - {{% tab header="Outside of a run" %}} -First, import the W&B SDK. Next, create an artifact from the Public API Class. Provide the entity, project, artifact, and alias associated with that artifact: - -```python -import wandb - -api = wandb.Api() -artifact = api.artifact("entity/project/artifact:alias") -``` - -Use the object returned to download the contents of the artifact: - -```python -artifact.download() -``` - -You can optionally pass a path the `root` parameter to download the contents of the artifact to a specific directory. For more information, see the [API Reference Guide]({{< relref "/ref/python/experiments/artifact.md#download" >}}). - {{% /tab %}} - {{% tab header="W&B CLI" %}} -Use the `wandb artifact get` command to download an artifact from the W&B server. - -``` -$ wandb artifact get project/artifact:alias --root mnist/ -``` - {{% /tab %}} -{{< /tabpane >}} - - -### Partially download an artifact - -You can optionally download part of an artifact based on a prefix. Using the `path_prefix` parameter, you can download a single file or the content of a sub-folder. - -```python -artifact = run.use_artifact("bike-dataset:latest") - -artifact.download(path_prefix="bike.png") # downloads only bike.png -``` - -Alternatively, you can download files from a certain directory: - -```python -artifact.download(path_prefix="images/bikes/") # downloads files in the images/bikes directory -``` -### Use an artifact from a different project - -Specify the name of artifact along with its project name to reference an artifact. You can also reference artifacts across entities by specifying the name of the artifact with its entity name. - -The following code example demonstrates how to query an artifact from another project as input to the current W&B run. - -```python -import wandb - -run = wandb.init(project="", job_type="") -# Query W&B for an artifact from another project and mark it -# as an input to this run. -artifact = run.use_artifact("my-project/artifact:alias") - -# Use an artifact from another entity and mark it as an input -# to this run. -artifact = run.use_artifact("my-entity/my-project/artifact:alias") -``` - -### Construct and use an artifact simultaneously - -Simultaneously construct and use an artifact. Create an artifact object and pass it to use_artifact. This creates an artifact in W&B if it does not exist yet. The [`use_artifact`]({{< relref "/ref/python/experiments/run.md#use_artifact" >}}) API is idempotent, so you can call it as many times as you like. - -```python -import wandb - -artifact = wandb.Artifact("reference model") -artifact.add_file("model.h5") -run.use_artifact(artifact) -``` - -For more information about constructing an artifact, see [Construct an artifact]({{< relref "/guides/core/artifacts/construct-an-artifact.md" >}}). \ No newline at end of file diff --git a/content/en/guides/core/artifacts/explore-and-traverse-an-artifact-graph.md b/content/en/guides/core/artifacts/explore-and-traverse-an-artifact-graph.md deleted file mode 100644 index 25a74a1360..0000000000 --- a/content/en/guides/core/artifacts/explore-and-traverse-an-artifact-graph.md +++ /dev/null @@ -1,84 +0,0 @@ ---- -description: Traverse automatically created direct acyclic W&B Artifact graphs. -menu: - default: - identifier: explore-and-traverse-an-artifact-graph - parent: artifacts -title: Explore artifact graphs -weight: 9 ---- - -W&B automatically tracks the artifacts a given run logged as well as the artifacts a given run uses. These artifacts can include datasets, models, evaluation results, or more. You can explore an artifact's lineage to track and manage the various artifacts produced throughout the machine learning lifecycle. - -## Lineage -Tracking an artifact's lineage has several key benefits: - -- Reproducibility: By tracking the lineage of all artifacts, teams can reproduce experiments, models, and results, which is essential for debugging, experimentation, and validating machine learning models. - -- Version Control: Artifact lineage involves versioning artifacts and tracking their changes over time. This allows teams to roll back to previous versions of data or models if needed. - -- Auditing: Having a detailed history of the artifacts and their transformations enables organizations to comply with regulatory and governance requirements. - -- Collaboration and Knowledge Sharing: Artifact lineage facilitates better collaboration among team members by providing a clear record of attempts as well as what worked, and what didn’t. This helps in avoiding duplication of efforts and accelerates the development process. - -### Finding an artifact's lineage -When selecting an artifact in the **Artifacts** tab, you can see your artifact's lineage. This graph view shows a general overview of your pipeline. - -To view an artifact graph: - -1. Navigate to your project in the W&B App UI -2. Choose the artifact icon on the left panel. -3. Select **Lineage**. - -{{< img src="/images/artifacts/lineage1.gif" alt="Getting to the Lineage tab" >}} - -### Navigating the lineage graph - -The artifact or job type you provide appears in front of its name, with artifacts represented by blue icons and runs represented by green icons. Arrows detail the input and output of a run or artifact on the graph. - -{{< img src="/images/artifacts/lineage2.png" alt="Run and artifact nodes" >}} - -{{% alert %}} -You can view the type and the name of artifact in both the left sidebar and in the **Lineage** tab. -{{% /alert %}} - -{{< img src="/images/artifacts/lineage2a.gif" alt="Inputs and outputs" >}} - -For a more detailed view, click any individual artifact or run to get more information on a particular object. - -{{< img src="/images/artifacts/lineage3a.gif" alt="Previewing a run" >}} - -### Artifact clusters - -When a level of the graph has five or more runs or artifacts, it creates a cluster. A cluster has a search bar to find specific versions of runs or artifacts and pulls an individual node from a cluster to continue investigating the lineage of a node inside a cluster. - -Clicking on a node opens a preview with an overview of the node. Clicking on the arrow extracts the individual run or artifact so you can examine the lineage of the extracted node. - -{{< img src="/images/artifacts/lineage3b.gif" alt="Searching a run cluster" >}} - -## Use the API to track lineage -You can also navigate a graph using the [W&B API]({{< relref "/ref/python/public-api/api.md" >}}). - -Create an artifact. First, create a run with `wandb.init`. Then,create a new artifact or retrieve an existing one with `wandb.Artifact`. Next, add files to the artifact with `.add_file`. Finally, log the artifact to the run with `.log_artifact`. The finished code looks something like this: - -```python -with wandb.init() as run: - artifact = wandb.Artifact("artifact_name", "artifact_type") - - # Add Files and Assets to the artifact using - # `.add`, `.add_file`, `.add_dir`, and `.add_reference` - artifact.add_file("image1.png") - run.log_artifact(artifact) -``` - -Use the artifact object's [`logged_by`]({{< relref "/ref/python/experiments/artifact.md#logged_by" >}}) and [`used_by`]({{< relref "/ref/python/experiments/artifact.md#used_by" >}}) methods to walk the graph from the artifact: - -```python -# Walk up and down the graph from an artifact: -producer_run = artifact.logged_by() -consumer_runs = artifact.used_by() -``` -## Next steps -- [Explore artifacts in more detail]({{< relref "/guides/core/artifacts/artifacts-walkthrough.md" >}}) -- [Manage artifact storage]({{< relref "/guides/core/artifacts/manage-data/delete-artifacts.md" >}}) -- [Explore an artifacts project](https://wandb.ai/wandb-smle/artifact_workflow/artifacts/raw_dataset/raw_data/v0/lineage) \ No newline at end of file diff --git a/content/en/guides/core/artifacts/manage-data/_index.md b/content/en/guides/core/artifacts/manage-data/_index.md deleted file mode 100644 index e99dec6127..0000000000 --- a/content/en/guides/core/artifacts/manage-data/_index.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -menu: - default: - identifier: manage-data - parent: artifacts -title: Manage data -weight: 8 -url: guides/artifacts/manage-data ---- - diff --git a/content/en/guides/core/artifacts/manage-data/delete-artifacts.md b/content/en/guides/core/artifacts/manage-data/delete-artifacts.md deleted file mode 100644 index 7b6fafac51..0000000000 --- a/content/en/guides/core/artifacts/manage-data/delete-artifacts.md +++ /dev/null @@ -1,194 +0,0 @@ ---- -description: Delete artifacts interactively with the App UI or programmatically with - the W&B SDK/ -menu: - default: - identifier: delete-artifacts - parent: manage-data -title: Delete an artifact ---- - -Delete artifacts interactively with the App UI or programmatically with the W&B SDK. When you delete an artifact, W&B marks that artifact as a *soft-delete*. In other words, the artifact is marked for deletion but files are not immediately deleted from storage. - -The contents of the artifact remain as a soft-delete, or pending deletion state, until a regularly run garbage collection process reviews all artifacts marked for deletion. The garbage collection process deletes associated files from storage if the artifact and its associated files are not used by a previous or subsequent artifact versions. - -## Artifact garbage collection workflow - -The following diagram illustrates the complete artifact garbage collection process: - -```mermaid -graph TB - Start([Artifact Deletion Initiated]) --> DeleteMethod{Deletion Method} - - DeleteMethod -->|UI| UIDelete[Delete via W&B App UI] - DeleteMethod -->|SDK| SDKDelete[Delete via W&B SDK] - DeleteMethod -->|TTL| TTLDelete[TTL Policy Expires] - - UIDelete --> SoftDelete[Artifact Marked as
'Soft Delete'] - SDKDelete --> SoftDelete - TTLDelete --> SoftDelete - - SoftDelete --> GCWait[(Wait for
Garbage Collection
Process)] - - GCWait --> GCRun[Garbage Collection
Process Runs

- Reviews all soft-deleted artifacts
- Checks file dependencies] - - GCRun --> CheckUsage{Are files used by
other artifact versions?} - - CheckUsage -->|Yes| KeepFiles[Files Kept in Storage

- Artifact marked deleted
- Files remain for other versions] - CheckUsage -->|No| DeleteFiles[Files Deleted from Storage

- Artifact fully removed
- Storage space reclaimed] - - KeepFiles --> End([End]) - DeleteFiles --> End - - style Start fill:#e1f5fe,stroke:#333,stroke-width:2px,color:#000 - style SoftDelete fill:#fff3e0,stroke:#333,stroke-width:2px,color:#000 - style GCRun fill:#f3e5f5,stroke:#333,stroke-width:2px,color:#000 - style KeepFiles fill:#e8f5e9,stroke:#333,stroke-width:2px,color:#000 - style DeleteFiles fill:#ffebee,stroke:#333,stroke-width:2px,color:#000 - style End fill:#e0e0e0,stroke:#333,stroke-width:2px,color:#000 -``` - -The sections in this page describe how to delete specific artifact versions, how to delete an artifact collection, how to delete artifacts with and without aliases, and more. You can schedule when artifacts are deleted from W&B with TTL policies. For more information, see [Manage data retention with Artifact TTL policy]({{< relref "./ttl.md" >}}). - -{{% alert %}} -Artifacts that are scheduled for deletion with a TTL policy, deleted with the W&B SDK, or deleted with the W&B App UI are first soft-deleted. Artifacts that are soft deleted undergo garbage collection before they are hard-deleted. -{{% /alert %}} - -{{% alert %}} -Deleting an entity, project, or artifact collection will also trigger the artifact deletion process described on this page. When deleting a run, if you choose to delete associated artifacts, those artifacts will follow the same soft-delete and garbage collection workflow. -{{% /alert %}} - -### Delete an artifact version - -To delete an artifact version: - -1. Select the name of the artifact. This will expand the artifact view and list all the artifact versions associated with that artifact. -2. From the list of artifacts, select the artifact version you want to delete. -3. On the right hand side of the workspace, select the kebab dropdown. -4. Choose Delete. - -An artifact version can also be deleted programmatically via the [delete()]({{< relref "/ref/python/experiments/artifact.md#delete" >}}) method. See the examples below. - -### Delete multiple artifact versions with aliases - -The following code example demonstrates how to delete artifacts that have aliases associated with them. Provide the entity, project name, and run ID that created the artifacts. - -```python -import wandb - -run = api.run("entity/project/run_id") - -for artifact in run.logged_artifacts(): - artifact.delete() -``` - -Set the `delete_aliases` parameter to the boolean value, `True` to delete aliases if the artifact has one or more aliases. - -```python -import wandb - -run = api.run("entity/project/run_id") - -for artifact in run.logged_artifacts(): - # Set delete_aliases=True in order to delete - # artifacts with one more aliases - artifact.delete(delete_aliases=True) -``` - -### Delete multiple artifact versions with a specific alias - -The proceeding code demonstrates how to delete multiple artifact versions that have a specific alias. Provide the entity, project name, and run ID that created the artifacts. Replace the deletion logic with your own: - -```python -import wandb - -runs = api.run("entity/project_name/run_id") - -# Delete artifact ith alias 'v3' and 'v4 -for artifact_version in runs.logged_artifacts(): - # Replace with your own deletion logic. - if artifact_version.name[-2:] == "v3" or artifact_version.name[-2:] == "v4": - artifact.delete(delete_aliases=True) -``` - -### Protected aliases and deletion permissions - -Artifacts with protected aliases have special deletion restrictions. [Protected aliases]({{< relref "/guides/core/registry/model_registry/access_controls.md" >}}) are aliases in the Model Registry that registry admins can set to prevent unauthorized deletion. - -{{% alert %}} -**Important considerations for protected aliases:** -- Artifacts with protected aliases cannot be deleted by non-registry admins -- Within a registry, registry admins can unlink protected artifact versions and delete collections/registries that contain protected aliases -- For source artifacts: if a source artifact is linked to a registry with a protected alias, it cannot be deleted by any user -- Registry admins can remove the protected aliases from source artifacts and then delete them -{{% /alert %}} - -### Delete all versions of an artifact that do not have an alias - -The following code snippet demonstrates how to delete all versions of an artifact that do not have an alias. Provide the name of the project and entity for the `project` and `entity` keys in `wandb.Api`, respectively. Replace the `<>` with the name of your artifact: - -```python -import wandb - -# Provide your entity and a project name when you -# use wandb.Api methods. -api = wandb.Api(overrides={"project": "project", "entity": "entity"}) - -artifact_type, artifact_name = "<>" # provide type and name -for v in api.artifact_versions(artifact_type, artifact_name): - # Clean up versions that don't have an alias such as 'latest'. - # NOTE: You can put whatever deletion logic you want here. - if len(v.aliases) == 0: - v.delete() -``` - -### Delete an artifact collection - -To delete an artifact collection: - -1. Navigate to the artifact collection you want to delete and hover over it. -3. Select the kebab dropdown next to the artifact collection name. -4. Choose Delete. - -You can also delete artifact collection programmatically with the [delete()]({{< relref "/ref/python/experiments/artifact.md#delete" >}}) method. Provide the name of the project and entity for the `project` and `entity` keys in `wandb.Api`, respectively: - -```python -import wandb - -# Provide your entity and a project name when you -# use wandb.Api methods. -api = wandb.Api(overrides={"project": "project", "entity": "entity"}) -collection = api.artifact_collection( - "", "entity/project/artifact_collection_name" -) -collection.delete() -``` - -## How to enable garbage collection based on how W&B is hosted -Garbage collection is enabled by default if you use W&B's shared cloud. Based on how you host W&B, you might need to take additional steps to enable garbage collection, this includes: - - -* Set the `GORILLA_ARTIFACT_GC_ENABLED` environment variable to true: `GORILLA_ARTIFACT_GC_ENABLED=true` -* Enable bucket versioning if you use [AWS](https://docs.aws.amazon.com/AmazonS3/latest/userguide/manage-versioning-examples.html), [GCP](https://cloud.google.com/storage/docs/object-versioning) or any other storage provider such as [Minio](https://min.io/docs/minio/linux/administration/object-management/object-versioning.html#enable-bucket-versioning). If you use Azure, [enable soft deletion](https://learn.microsoft.com/azure/storage/blobs/soft-delete-blob-overview). - {{% alert %}} - Soft deletion in Azure is equivalent to bucket versioning in other storage providers. - {{% /alert %}} - -The following table describes how to satisfy requirements to enable garbage collection based on your deployment type. - -The `X` indicates you must satisfy the requirement: - -| | Environment variable | Enable versioning | -| -----------------------------------------------| ------------------------| ----------------- | -| Shared cloud | | | -| Shared cloud with [secure storage connector]({{< relref "/guides/hosting/data-security/secure-storage-connector.md" >}})| | X | -| Dedicated cloud | | | -| Dedicated cloud with [secure storage connector]({{< relref "/guides/hosting/data-security/secure-storage-connector.md" >}})| | X | -| Customer-managed cloud | X | X | -| Customer managed on-prem | X | X | - - - -{{% alert %}}note -Secure storage connector is currently only available for Google Cloud Platform and Amazon Web Services. -{{% /alert %}} \ No newline at end of file diff --git a/content/en/guides/core/artifacts/manage-data/storage.md b/content/en/guides/core/artifacts/manage-data/storage.md deleted file mode 100644 index 91842e9183..0000000000 --- a/content/en/guides/core/artifacts/manage-data/storage.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -description: Manage storage, memory allocation of W&B Artifacts. -menu: - default: - identifier: storage - parent: manage-data -title: Manage artifact storage and memory allocation ---- - -W&B stores artifact files in a private Google Cloud Storage bucket located in the United States by default. All files are encrypted at rest and in transit. - -For sensitive files, we recommend you set up [Private Hosting]({{< relref "/guides/hosting/" >}}) or use [reference artifacts]({{< relref "../track-external-files.md" >}}). - -During training, W&B locally saves logs, artifacts, and configuration files in the following local directories: - -| File | Default location | To change default location set: | -| ---- | ---------------- | ------------------------------- | -| logs | `./wandb` | `dir` in `wandb.init` or set the `WANDB_DIR` environment variable | -| artifacts | `~/.cache/wandb` | the `WANDB_CACHE_DIR` environment variable | -| configs | `~/.config/wandb` | the `WANDB_CONFIG_DIR` environment variable | -| staging artifacts for upload | `~/.cache/wandb-data/` | the `WANDB_DATA_DIR` environment variable | -| downloaded artifacts | `./artifacts` | the `WANDB_ARTIFACT_DIR` environment variable | - -For a complete guide to using environment variables to configure W&B, see the [environment variables reference]({{< relref "/guides/models/track/environment-variables.md" >}}). - -{{% alert color="secondary" %}} -Depending on the machine on `wandb` is initialized on, these default folders may not be located in a writeable part of the file system. This might trigger an error. -{{% /alert %}} - -### Clean up local artifact cache - -W&B caches artifact files to speed up downloads across versions that share files in common. Over time this cache directory can become large. Run the [`wandb artifact cache cleanup`]({{< relref "/ref/cli/wandb-artifact/wandb-artifact-cache/" >}}) command to prune the cache and to remove any files that have not been used recently. - -The proceeding code snippet demonstrates how to limit the size of the cache to 1GB. Copy and paste the code snippet into your terminal: - -```bash -$ wandb artifact cache cleanup 1GB -``` diff --git a/content/en/guides/core/artifacts/manage-data/ttl.md b/content/en/guides/core/artifacts/manage-data/ttl.md deleted file mode 100644 index b7751604fb..0000000000 --- a/content/en/guides/core/artifacts/manage-data/ttl.md +++ /dev/null @@ -1,238 +0,0 @@ ---- -description: Time to live policies (TTL) -menu: - default: - identifier: ttl - parent: manage-data -title: Manage artifact data retention ---- - - -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/kas-artifacts-ttl-colab/colabs/wandb-artifacts/WandB_Artifacts_Time_to_live_TTL_Walkthrough.ipynb" >}} - -Schedule when artifacts are deleted from W&B with a W&B Artifact time-to-live (TTL) policy. When you delete an artifact, W&B marks that artifact as a *soft-delete*. In other words, the artifact is marked for deletion but files are not immediately deleted from storage. For more information on how W&B deletes artifacts, see the [Delete artifacts]({{< relref "./delete-artifacts.md" >}}) page. - -Watch a [Managing data retention with Artifacts TTL](https://www.youtube.com/watch?v=hQ9J6BoVmnc) video tutorial to learn how to manage data retention with Artifacts TTL in the W&B App. - -{{% alert %}} -W&B deactivates the option to set a TTL policy for model artifacts linked to the Model Registry. This is to help ensure that linked models do not accidentally expire if used in production workflows. -{{% /alert %}} -{{% alert %}} -* Only team admins can view a [team's settings]({{< relref "/guides/models/app/settings-page/teams.md" >}}) and access team level TTL settings such as (1) permitting who can set or edit a TTL policy or (2) setting a team default TTL. -* If you do not see the option to set or edit a TTL policy in an artifact's details in the W&B App UI or if setting a TTL programmatically does not successfully change an artifact's TTL property, your team admin has not given you permissions to do so. -{{% /alert %}} - -## Auto-generated Artifacts -Only user-generated artifacts can use TTL policies. Artifacts auto-generated by W&B cannot have TTL policies set for them. - -The following Artifact types indicate an auto-generated Artifact: -- `run_table` -- `code` -- `job` -- Any Artifact type starting with: `wandb-*` - -You can check an Artifact's type on the [W&B platform]({{< relref "/guides/core/artifacts/explore-and-traverse-an-artifact-graph.md" >}}) or programmatically: - -```python -import wandb - -run = wandb.init(project="") -artifact = run.use_artifact(artifact_or_name="") -print(artifact.type) -``` - -Replace the values enclosed with `<>` with your own. - -## Define who can edit and set TTL policies -Define who can set and edit TTL policies within a team. You can either grant TTL permissions only to team admins, or you can grant both team admins and team members TTL permissions. - -{{% alert %}} -Only team admins can define who can set or edit a TTL policy. -{{% /alert %}} - -1. Navigate to your team’s profile page. -2. Select the **Settings** tab. -3. Navigate to the **Artifacts time-to-live (TTL) section**. -4. From the **TTL permissions dropdown**, select who can set and edit TTL policies. -5. Click on **Review and save settings**. -6. Confirm the changes and select **Save settings**. - -{{< img src="/images/artifacts/define_who_sets_ttl.gif" alt="Setting TTL permissions" >}} - -## Create a TTL policy -Set a TTL policy for an artifact either when you create the artifact or retroactively after the artifact is created. - -For all the code snippets below, replace the content wrapped in `<>` with your information to use the code snippet. - -### Set a TTL policy when you create an artifact -Use the W&B Python SDK to define a TTL policy when you create an artifact. TTL policies are typically defined in days. - -{{% alert %}} -Defining a TTL policy when you create an artifact is similar to how you normally [create an artifact]({{< relref "../construct-an-artifact.md" >}}). With the exception that you pass in a time delta to the artifact's `ttl` attribute. -{{% /alert %}} - -The steps are as follows: - -1. [Create an artifact]({{< relref "../construct-an-artifact.md" >}}). -2. [Add content to the artifact]({{< relref "../construct-an-artifact.md#add-files-to-an-artifact" >}}) such as files, a directory, or a reference. -3. Define a TTL time limit with the [`datetime.timedelta`](https://docs.python.org/3/library/datetime.html) data type that is part of Python's standard library. -4. [Log the artifact]({{< relref "../construct-an-artifact.md#3-save-your-artifact-to-the-wb-server" >}}). - -The following code snippet demonstrates how to create an artifact and set a TTL policy. - -```python -import wandb -from datetime import timedelta - -run = wandb.init(project="", entity="") -artifact = wandb.Artifact(name="", type="") -artifact.add_file("") - -artifact.ttl = timedelta(days=30) # Set TTL policy -run.log_artifact(artifact) -``` - -The preceding code snippet sets the TTL policy for the artifact to 30 days. In other words, W&B deletes the artifact after 30 days. - -### Set or edit a TTL policy after you create an artifact -Use the W&B App UI or the W&B Python SDK to define a TTL policy for an artifact that already exists. - -{{% alert %}} -When you modify an artifact's TTL, the time the artifact takes to expire is still calculated using the artifact's `createdAt` timestamp. -{{% /alert %}} - -{{< tabpane text=true >}} - {{% tab header="Python SDK" %}} -1. [Fetch your artifact]({{< relref "../download-and-use-an-artifact.md" >}}). -2. Pass in a time delta to the artifact's `ttl` attribute. -3. Update the artifact with the [`save`]({{< relref "/ref/python/experiments/run.md#save" >}}) method. - - -The following code snippet shows how to set a TTL policy for an artifact: -```python -import wandb -from datetime import timedelta - -artifact = run.use_artifact("") -artifact.ttl = timedelta(days=365 * 2) # Delete in two years -artifact.save() -``` - -The preceding code example sets the TTL policy to two years. - {{% /tab %}} - {{% tab header="W&B App" %}} -1. Navigate to your W&B project in the W&B App UI. -2. Select the artifact icon on the left panel. -3. From the list of artifacts, expand the artifact type you -4. Select on the artifact version you want to edit the TTL policy for. -5. Click on the **Version** tab. -6. From the dropdown, select **Edit TTL policy**. -7. Within the modal that appears, select **Custom** from the TTL policy dropdown. -8. Within the **TTL duration** field, set the TTL policy in units of days. -9. Select the **Update TTL** button to save your changes. - -{{< img src="/images/artifacts/edit_ttl_ui.gif" alt="Editing TTL policy" >}} - {{% /tab %}} -{{< /tabpane >}} - - - -### Set default TTL policies for a team - -{{% alert %}} -Only team admins can set a default TTL policy for a team. -{{% /alert %}} - -Set a default TTL policy for your team. Default TTL policies apply to all existing and future artifacts based on their respective creation dates. Artifacts with existing version-level TTL policies are not affected by the team's default TTL. - -1. Navigate to your team’s profile page. -2. Select the **Settings** tab. -3. Navigate to the **Artifacts time-to-live (TTL) section**. -4. Click on the **Set team's default TTL policy**. -5. Within the **Duration** field, set the TTL policy in units of days. -6. Click on **Review and save settings**. -7/ Confirm the changes and then select **Save settings**. - -{{< img src="/images/artifacts/set_default_ttl.gif" alt="Setting default TTL policy" >}} - -### Set a TTL policy outside of a run - -Use the public API to retrieve an artifact without fetching a run, and set the TTL policy. TTL policies are typically defined in days. - -The following code sample shows how to fetch an artifact using the public API and set the TTL policy. - -```python -api = wandb.Api() - -artifact = api.artifact("entity/project/artifact:alias") - -artifact.ttl = timedelta(days=365) # Delete in one year - -artifact.save() -``` - -## Deactivate a TTL policy -Use the W&B Python SDK or W&B App UI to deactivate a TTL policy for a specific artifact version. - - -{{< tabpane text=true >}} - {{% tab header="Python SDK" %}} -1. [Fetch your artifact]({{< relref "../download-and-use-an-artifact.md" >}}). -2. Set the artifact's `ttl` attribute to `None`. -3. Update the artifact with the [`save`]({{< relref "/ref/python/experiments/run.md#save" >}}) method. - - -The following code snippet shows how to turn off a TTL policy for an artifact: -```python -artifact = run.use_artifact("") -artifact.ttl = None -artifact.save() -``` - {{% /tab %}} - {{% tab header="W&B App" %}} -1. Navigate to your W&B project in the W&B App UI. -2. Select the artifact icon on the left panel. -3. From the list of artifacts, expand the artifact type you -4. Select on the artifact version you want to edit the TTL policy for. -5. Click on the Version tab. -6. Click on the meatball UI icon next to the **Link to registry** button. -7. From the dropdown, select **Edit TTL policy**. -8. Within the modal that appears, select **Deactivate** from the TTL policy dropdown. -9. Select the **Update TTL** button to save your changes. - -{{< img src="/images/artifacts/remove_ttl_polilcy.gif" alt="Removing TTL policy" >}} - {{% /tab %}} -{{< /tabpane >}} - - - - -## View TTL policies -View TTL policies for artifacts with the Python SDK or with the W&B App UI. - -{{< tabpane text=true >}} - {{% tab header="Python SDK" %}} -Use a print statement to view an artifact's TTL policy. The following example shows how to retrieve an artifact and view its TTL policy: - -```python -artifact = run.use_artifact("") -print(artifact.ttl) -``` - {{% /tab %}} - {{% tab header="W&B App" %}} -View a TTL policy for an artifact with the W&B App UI. - -1. Navigate to the [W&B App](https://wandb.ai). -2. Go to your W&B Project. -3. Within your project, select the Artifacts tab in the left sidebar. -4. Click on a collection. - -Within the collection view you can see all of the artifacts in the selected collection. Within the `Time to Live` column you will see the TTL policy assigned to that artifact. - -{{< img src="/images/artifacts/ttl_collection_panel_ui.png" alt="TTL collection view" >}} - {{% /tab %}} -{{< /tabpane >}} - diff --git a/content/en/guides/core/artifacts/track-external-files.md b/content/en/guides/core/artifacts/track-external-files.md deleted file mode 100644 index aea0f08afa..0000000000 --- a/content/en/guides/core/artifacts/track-external-files.md +++ /dev/null @@ -1,253 +0,0 @@ ---- -description: Track files saved in an external bucket, HTTP file server, or an NFS share. -menu: - default: - identifier: track-external-files - parent: artifacts -title: Track external files -weight: 7 ---- - -Use **reference artifacts** to track and use files saved outside of W&B servers, for example in CoreWeave AI Object Storage, an Amazon Simple Storage Service (Amazon S3) bucket, GCS bucket, Azure blob, HTTP file server, or NFS share. - -W&B logs metadata about the the object, such as the object's ETag and size. If object versioning is enabled on the bucket, the version ID is also logged. - -{{% alert %}} -If you log an artifact that does not track external files, W&B saves the artifact's files to W&B servers. This is the default behavior when you log artifacts with the W&B Python SDK. - -See the [Artifacts quickstart]({{< relref "/guides/core/artifacts/artifacts-walkthrough" >}}) for information on how to save files and directories to W&B servers instead. -{{% /alert %}} - -The following describes how to construct reference artifacts. - -## Track an artifact in an external bucket - -Use the W&B Python SDK to track references to files stored outside of W&B. - -1. Initialize a run with `wandb.init()`. -2. Create an artifact object with `wandb.Artifact()`. -3. Specify the reference to the bucket path with the artifact object's `add_reference()` method. -4. Log the artifact's metadata with `run.log_artifact()`. - -```python -import wandb - -# Initialize a W&B run -run = wandb.init() - -# Create an artifact object -artifact = wandb.Artifact(name="name", type="type") - -# Add a reference to the bucket path -artifact.add_reference(uri = "uri/to/your/bucket/path") - -# Log the artifact's metadata -run.log_artifact(artifact) -run.finish() -``` - -Suppose your bucket has the following directory structure: - -```text -s3://my-bucket - -|datasets/ - |---- mnist/ -|models/ - |---- cnn/ -``` - -The `datasets/mnist/` directory contains a collection of images. Track the directory as a dataset with `wandb.Artifact.add_reference()`. The following code sample creates a reference artifact `mnist:latest` using the artifact object's `add_reference()` method. - -```python -import wandb - -run = wandb.init() -artifact = wandb.Artifact(name="mnist", type="dataset") -artifact.add_reference(uri="s3://my-bucket/datasets/mnist") -run.log_artifact(artifact) -run.finish() -``` - -Within the W&B App, you can look through the contents of the reference artifact using the file browser, [explore the full dependency graph]({{< relref "/guides/core/artifacts/explore-and-traverse-an-artifact-graph" >}}), and scan through the versioned history of your artifact. The W&B App does not render rich media such as images, audio, and so forth because the data itself is not contained within the artifact. - -{{% alert %}} -W&B Artifacts support any Amazon S3 compatible interface, including CoreWeave Storage and MinIO. The scripts described below work as-is with both providers, when you set the `AWS_S3_ENDPOINT_URL` environment variable to point at your CoreWeave Storage or MinIO server. -{{% /alert %}} - -{{% alert color="secondary" %}} -By default, W&B imposes a 10,000 object limit when adding an object prefix. You can adjust this limit by specifying `max_objects=` when you call `add_reference()`. -{{% /alert %}} - -## Download an artifact from an external bucket - -W&B retrieves the files from the underlying bucket when it downloads a reference artifact using the metadata recorded when the artifact is logged. If your bucket has object versioning enabled, W&B retrieves the object version that corresponds to the state of the file at the time an artifact was logged. As you evolve the contents of your bucket, you can always point to the exact version of your data a given model was trained on, because the artifact serves as a snapshot of your bucket during the training run. - -The following code sample shows how to download a reference artifact. The the APIs for downloading artifacts are the same for both reference and non-reference artifacts: - -```python -import wandb - -run = wandb.init() -artifact = run.use_artifact("mnist:latest", type="dataset") -artifact_dir = artifact.download() -``` - -{{% alert %}} -W&B recommends that you enable 'Object Versioning' on your storage buckets if you overwrite files as part of your workflow. With versioning enabled on your buckets, artifacts with references to files that have been overwritten will still be intact because the older object versions are retained. - -Based on your use case, read the instructions to enable object versioning: [AWS](https://docs.aws.amazon.com/AmazonS3/latest/userguide/manage-versioning-examples.html), [GCP](https://cloud.google.com/storage/docs/using-object-versioning#set), [Azure](https://learn.microsoft.com/azure/storage/blobs/versioning-enable). -{{% /alert %}} - -### Add and download an external reference example - -The following code sample uploads a dataset to an Amazon S3 bucket, tracks it with a reference artifact, then downloads it: - -```python -import boto3 -import wandb - -run = wandb.init() - -# Training here... - -s3_client = boto3.client("s3") -s3_client.upload_file(file_name="my_model.h5", bucket="my-bucket", object_name="models/cnn/my_model.h5") - -# Log the model artifact -model_artifact = wandb.Artifact("cnn", type="model") -model_artifact.add_reference("s3://my-bucket/models/cnn/") -run.log_artifact(model_artifact) -``` - -At a later point, you can download the model artifact. Specify the name of the artifact and its type: - -```python -import wandb - -run = wandb.init() -artifact = run.use_artifact(artifact_or_name = "cnn", type="model") -datadir = artifact.download() -``` - -{{% alert %}} -See the following reports for an end-to-end walkthrough on how to track artifacts by reference for GCP or Azure: - -* [Guide to Tracking Artifacts by Reference with GCP](https://wandb.ai/stacey/artifacts/reports/Tracking-Artifacts-by-Reference--Vmlldzo1NDMwOTE) -* [Working with Reference Artifacts in Microsoft Azure](https://wandb.ai/andrea0/azure-2023/reports/Efficiently-Harnessing-Microsoft-Azure-Blob-Storage-with-Weights-Biases--Vmlldzo0NDA2NDgw) -{{% /alert %}} - -## Cloud storage credentials - -W&B uses the default mechanism to look for credentials based on the cloud provider you use. Read the documentation from your cloud provider to learn more about the credentials used: - -| Cloud provider | Credentials Documentation | -| -------------- | ------------------------- | -| CoreWeave AI Object Storage | [CoreWeave AI Object Storage documentation](https://docs.coreweave.com/docs/products/storage/object-storage/how-to/manage-access-keys/cloud-console-tokens) | -| AWS | [Boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html#configuring-credentials) | -| GCP | [Google Cloud documentation](https://cloud.google.com/docs/authentication/provide-credentials-adc) | -| Azure | [Azure documentation](https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential?view=azure-python) | - -For AWS, if the bucket is not located in the configured user's default region, you must set the `AWS_REGION` environment variable to match the bucket region. - -{{% alert color="secondary" %}} -Rich media such as images, audio, video, and point clouds may fail to render in the App UI depending on the CORS configuration of your bucket. Allow listing **app.wandb.ai** in your bucket's CORS settings will allow the App UI to properly render such rich media. - -If rich media such as images, audio, video, and point clouds does not render in the App UI, ensure that `app.wandb.ai` is allowlisted in your bucket's CORS policy. -{{% /alert %}} - -## Track an artifact in a filesystem - -Another common pattern for fast access to datasets is to expose an NFS mount point to a remote filesystem on all machines running training jobs. This can be an even simpler solution than a cloud storage bucket because from the perspective of the training script, the files look just like they are sitting on your local filesystem. Luckily, that ease of use extends into using Artifacts to track references to file systems, whether they are mounted or not. - -Suppose you have a filesystem mounted at `/mount` with the following structure: - -```bash -mount -|datasets/ - |-- mnist/ -|models/ - |-- cnn/ -``` - -Within `mnist/` is a dataset, a collection of images. You can track it with an artifact: - -```python -import wandb - -run = wandb.init() -artifact = wandb.Artifact("mnist", type="dataset") -artifact.add_reference("file:///mount/datasets/mnist/") -run.log_artifact(artifact) -``` -{{% alert color="secondary" %}} -By default, W&B imposes a 10,000 file limit when adding a reference to a directory. You can adjust this limit by specifying `max_objects=` when you call `add_reference()`. -{{% /alert %}} - -Note the triple slash in the URL. The first component is the `file://` prefix that denotes the use of filesystem references. The second component begins the path to the dataset, `/mount/datasets/mnist/`. - -The resulting artifact `mnist:latest` looks and acts like a regular artifact. The only difference is that the artifact only consists of metadata about the files, such as their sizes and MD5 checksums. The files themselves never leave your system. - -You can interact with this artifact just as you would a normal artifact. In the UI, you can browse the contents of the reference artifact using the file browser, explore the full dependency graph, and scan through the versioned history of your artifact. However, the UI cannot render rich media such as images, audio, because the data itself is not contained within the artifact. - -Downloading a reference artifact: - -```python -import wandb - -run = wandb.init() -artifact = run.use_artifact("entity/project/mnist:latest", type="dataset") -artifact_dir = artifact.download() -``` - -For a filesystem reference, a `download()` operation copies the files from the referenced paths to construct the artifact directory. In the above example, the contents of `/mount/datasets/mnist` are copied into the directory `artifacts/mnist:v0/`. If an artifact contains a reference to a file that was overwritten, then `download()` will throw an error because the artifact can no longer be reconstructed. - -Putting it all together, you can use the following code to track a dataset under a mounted filesystem that feeds into a training job: - -```python -import wandb - -run = wandb.init() - -artifact = wandb.Artifact("mnist", type="dataset") -artifact.add_reference("file:///mount/datasets/mnist/") - -# Track the artifact and mark it as an input to -# this run in one swoop. A new artifact version -# is only logged if the files under the directory -# changed. -run.use_artifact(artifact) - -artifact_dir = artifact.download() - -# Perform training here... -``` - -To track a model, log the model artifact after the training script writes the model files to the mount point: - -```python -import wandb - -run = wandb.init() - -# Training here... - -# Write model to disk - -model_artifact = wandb.Artifact("cnn", type="model") -model_artifact.add_reference("file:///mount/cnn/my_model.h5") -run.log_artifact(model_artifact) -``` - - - \ No newline at end of file diff --git a/content/en/guides/core/artifacts/update-an-artifact.md b/content/en/guides/core/artifacts/update-an-artifact.md deleted file mode 100644 index 5930171342..0000000000 --- a/content/en/guides/core/artifacts/update-an-artifact.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -description: Update an existing Artifact inside and outside of a W&B Run. -menu: - default: - identifier: update-an-artifact - parent: artifacts -title: Update an artifact -weight: 4 ---- - -Pass desired values to update the `description`, `metadata`, and `alias` of an artifact. Call the `save()` method to update the artifact on the W&B servers. You can update an artifact during a W&B Run or outside of a Run. - -{{% alert title="When to use Artifact.save() or wandb.Run.log_artifact()" %}} -- Use `Artifact.save()` to update an existing artifact without creating a new run. -- Use `wandb.Run.log_artifact()` to create a new artifact and associate it with a specific run. -{{% /alert %}} - -Use the W&B Public API ([`wandb.Api`]({{< relref "/ref/python/public-api/api.md" >}})) to update an artifact outside of a run. Use the Artifact API ([`wandb.Artifact`]({{< relref "/ref/python/experiments/artifact.md" >}})) to update an artifact during a run. - -{{% alert color="secondary" %}} -You can not update the alias of artifact linked to a model in Model Registry. -{{% /alert %}} - -{{< tabpane text=true >}} - {{% tab header="During a run" %}} - -The proceeding code example demonstrates how to update the description of an artifact using the [`wandb.Artifact`]({{< relref "/ref/python/experiments/artifact.md" >}}) API: - -```python -import wandb - -run = wandb.init(project="") -artifact = run.use_artifact(":") -artifact.description = "" -artifact.save() -``` - {{% /tab %}} - {{% tab header="Outside of a run" %}} -The proceeding code example demonstrates how to update the description of an artifact using the `wandb.Api` API: - -```python -import wandb - -api = wandb.Api() - -artifact = api.artifact("entity/project/artifact:alias") - -# Update the description -artifact.description = "My new description" - -# Selectively update metadata keys -artifact.metadata["oldKey"] = "new value" - -# Replace the metadata entirely -artifact.metadata = {"newKey": "new value"} - -# Add an alias -artifact.aliases.append("best") - -# Remove an alias -artifact.aliases.remove("latest") - -# Completely replace the aliases -artifact.aliases = ["replaced"] - -# Persist all artifact modifications -artifact.save() -``` - -For more information, see the Weights and Biases [Artifact API]({{< relref "/ref/python/experiments/artifact.md" >}}). - {{% /tab %}} - {{% tab header="With collections" %}} -You can also update an Artifact collection in the same way as a singular artifact: - -```python -import wandb -run = wandb.init(project="") -api = wandb.Api() -artifact = api.artifact_collection(type="", collection="") -artifact.name = "" -artifact.description = "" -artifact.save() -``` -For more information, see the [Artifacts Collection]({{< relref "/ref/python/public-api/api.md" >}}) reference. - {{% /tab %}} -{{% /tabpane %}} - diff --git a/content/en/guides/core/automations/_index.md b/content/en/guides/core/automations/_index.md deleted file mode 100644 index ebc72b6259..0000000000 --- a/content/en/guides/core/automations/_index.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -menu: - default: - identifier: automations - parent: core -title: Automations -weight: 4 -url: guides/automations -cascade: -- url: guides/automations/:filename ---- -{{% pageinfo color="info" %}} -{{< readfile file="/_includes/enterprise-cloud-only.md" >}} -{{% /pageinfo %}} - -This page describes _automations_ in W&B. [Create an automation]({{< relref "create-automations/" >}}) to trigger workflow steps, such as automated model testing and deployment, based on an event in W&B, such as when an [artifact]({{< relref "/guides/core/artifacts" >}}) artifact version is created or when a [run metric]({{< relref "/guides/models/track/runs.md" >}}) meets or changes by a threshold. - -For example, an automation can notify a Slack channel when a new version is created, trigger an automated testing webhook when the `production` alias is added to an artifact, or start a validation job only when a run's `loss` is within acceptable bounds. - -## Overview -An automation can start when a specific [event]({{< relref "automation-events.md" >}}) occurs in a registry or project. - -In a [Registry]({{< relref "/guides/core/registry/">}}), an automation can start: -- When a new artifact version is linked to a collection. For example, trigger testing and validation workflows for new candidate models. -- When an alias is added to an artifact version. For example, trigger a deployment workflow when an alias is added to a model version. - -In a [project]({{< relref "/guides/models/track/project-page.md" >}}), an automation can start: -- When a new version is added to an artifact. For example, start a training job when a new version of a dataset artifact is added to a given collection. -- When an alias is added to an artifact version. For example, trigger a PII redaction workflow when the alias "redaction" is added to a dataset artifact. -- When a tag is added to an artifact version. For example, trigger a geo-specific workflow when the tag "europe" is added to an artifact version. -- When a metric for a run meets or exceeds a configured threshold. -- When a metric for a run changes by a configured threshold. -- When a run's status changes to **Running**, **Failed**, or **Finished**. - -Optionally, you can: -- Filter artifacts, aliases, or tags by name -- Filter runs by user or run name. - -For more details, see [Automation events and scopes]({{< relref "automation-events.md" >}}). - -To [create an automation]({{< relref "create-automations/" >}}), you: - -1. If required, configure [secrets]({{< relref "/guides/core/secrets.md" >}}) for sensitive strings the automation requires, such as access tokens, passwords, or sensitive configuration details. Secrets are defined in your **Team Settings**. Secrets are most commonly used in webhook automations to securely pass credentials or tokens to the webhook's external service without exposing it in plain text or hard-coding it in the webhook's payload. -1. Configure team-level webhook or Slack integrations to authorize W&B to post to Slack or run the webhook on your behalf. A single automation action (webhook or Slack notification) can be used by multiple automations. These actions are defined in your **Team Settings**. -1. In the project or registry, create the automation: - 1. Define the [event]({{< relref "#automation-events" >}}) to watch for, such as when a new artifact version is added. - 1. Define the action to take when the event occurs (posting to a Slack channel or running a webhook). For a webhook, specify a secret to use for the access token and/or a secret to send with the payload, if required. - -## Limitations -[Run metric automations]({{< relref "automation-events.md#run-metrics-events">}}) are currently supported only in [W&B Multi-tenant Cloud]({{< relref "/guides/hosting/#wb-multi-tenant-cloud" >}}). - -## Next steps -- [Create an automation]({{< relref "create-automations/" >}}). -- Learn about [Automation events and scopes]({{< relref "automation-events.md" >}}). -- [Create a secret]({{< relref "/guides/core/secrets.md" >}}). diff --git a/content/en/guides/core/automations/automation-events.md b/content/en/guides/core/automations/automation-events.md deleted file mode 100644 index bb781baeb1..0000000000 --- a/content/en/guides/core/automations/automation-events.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -menu: - default: - identifier: automation-scopes - parent: automations -title: Automation events and scopes -weight: 2 ---- -{{% pageinfo color="info" %}} -{{< readfile file="/_includes/enterprise-cloud-only.md" >}} -{{% /pageinfo %}} - -An automation can start when a specific event occurs within a project or registry. This page describes the events that can trigger an automation within each scope. Learn more about automations in the [Automations overview]({{< relref "/guides/core/automations/" >}}) or [Create an automation]({{< relref "create-automations/" >}}). - -## Registry -This section describes the scopes and events for an automation in a [Registry]({{< relref "/guides/core/registry/">}}). - -1. Navigate to the **Registry** App at https://wandb.ai/registry/. -1. Click the name of a registry, then view and create automations in the **Automations** tab. - -![Screenshot of the Registry Automations tab with an automation](/images/automations/registry_automations_tab.png) - -Learn more about [creating automations]({{< relref "create-automations/" >}}). - -### Scopes -A [Registry]({{< relref "/guides/core/registry/">}}) automation watches for the event taking place on any collection within a specific registry, including collections added in the future. - -### Events {#registry-events} -A Registry automation can watch for these events: -- **A new version is linked to a collection**: Test and validate new models or datasets when they are added to a registry. -- **An artifact alias is added**: Trigger a specific step of your workflow when a new artifact version has a specific alias applied. For example, deploy a model when it has the `production` alias applied. - -## Project -This section describes the scopes and events for an automation in a [project]({{< relref "/guides/models/track/project-page.md" >}}). - -1. Navigate to your W&B project on the W&B App at `https://wandb.ai//`. -1. View and create automations in the **Automations** tab. - -![Screenshot of the Project Automations tab with an automation](/images/automations/project_automations_tab.png) - -Learn more about [creating automations]({{< relref "create-automations/" >}}). - -### Scopes -A project-level automation watches for the event taking place on any collection in the project. Depending on the event you specify, you can further limit the scope of the automation. - -### Artifact events -This section describes the events related to an artifact that can trigger an automation. - -- **A new version is added to an artifact**: Apply recurring actions to each version of an artifact. For example, start a training job when a new dataset artifact version is created. To limit the automation's scope, select a specific artifact in the **Artifact filter** field. -- **An artifact alias is added**: Trigger a specific step of your workflow when a new artifact version in a project has an alias applied that matches the **Alias regex** you specify. For example, run a series of downstream processing steps when an artifact has the `test-set-quality-check` alias applied, or run a workflow each time a new artifact version has the `latest` alias. Only one artifact version can have a given alias at a point in time. -- **An artifact tag is added**: Trigger a specific step of your workflow when an artifact version in a project has a tag applied that matches the **Tag regex** you specify. For example, specify `^europe.*` to trigger a geo-specific workflow when a tag beginning with the string `europe` is added to an artifact version. Artifact tags are used for grouping and filtering, and a given tag can be assigned to multiple artifact versions simultaneously. - -### Run events -An automation can be triggered by a change in a [run's status]({{< relref "/guides/models/track/runs/#run-states" >}}) or a change in a [metric value]({{< relref "/guides/models/track/log/#what-data-is-logged-with-specific-wb-api-calls" >}}). - -#### Run status change -{{% alert %}} -- Currently available only in [W&B Multi-tenant Cloud]({{< relref "/guides/hosting/#wb-multi-tenant-cloud" >}}). -- A run with **Killed** status cannot trigger an automation. This status indicates that the run was stopped forcibly by an admin user. -{{% /alert %}} - -Trigger a workflow when a run changes its [status]({{< relref "/guides/models/track/runs/_index.md#run-states" >}}) to **Running**, **Finished**, or **Failed**. Optionally, you can further limit the runs that can trigger an automation by specifying a user or run name filter. - -![Screenshot showing a run status change automation](/images/automations/run_status_change.png) - -Because run status is a property of the entire run, you can create a run status automation only from the the **Automations** page, not from a workspace. - -#### Run metrics change -{{% alert %}} -Currently available only in [W&B Multi-tenant Cloud]({{< relref "/guides/hosting/#wb-multi-tenant-cloud" >}}). -{{% /alert %}} - -Trigger a workflow based on a logged value for a metric, either a metric in a run's history or a [system metric]({{< relref "/ref/python/experiments/system-metrics.md" >}}) such as `cpu`, which tracks the percentage of CPU utilization. W&B logs system metrics automatically every 15 seconds. - -You can create a run metrics automation from the project's **Automations** tab or directly from a line plot panel in a workspace. - -To set up a run metric automation, you configure how to compare the metric's value with the threshold you specify. Your choices depend on the event type and on any filters you specify. - -Optionally, you can further limit the runs that can trigger an automation by specifying a user or run name filter. - -##### Threshold -For **Run metrics threshold met** events, you configure: -1. The window of most recently logged values to consider (defaults to 5). -1. Whether to evaluate the **Average**, **Min**, or **Max** value within the window. -1. The comparison to make: - - Above - - Above or equal to - - Below - - Below or equal to - - Not equal to - - Equal to - -For example, trigger an automation when average `accuracy` is above `.6`. - -![Screenshot showing a run metrics threshold automation](/images/automations/run_metrics_threshold_automation.png) - -##### Change threshold -For **Run metrics change threshold met** events, the automation uses two "windows" of values to check whether to start: - -- The _current window_ of recently logged values to consider (defaults to 10). -- The _prior window_ of recently logged values to consider (defaults to 50). - -The current and prior windows are consecutive and do not overlap. - -To create the automation, you configure: -1. The current window of logged values (defaults to 10). -1. The prior window of logged values (defaults to 50). -1. Whether to evaluate the values as relative or absolute (defaults to **Relative**). -1. The comparison to make: - - Increases by at least - - Decreases by at least - - Increases or decreases by at least - -For example, trigger an automation when average `loss` decreases by at least `.25`. - -![Screenshot showing a run metrics change threshold automation](/images/automations/run_metrics_change_threshold_automation.png) - -#### Run filters -This section describes how the automation selects runs to evaluate. - -- By default, any run in the project triggers the automation when the event occurs. You can limit which runs trigger an automation by configuring one of the following filters: - - **Filter to one user's runs**: Include only runs created by the specified user. - - **Filter on run name**: Include only runs whose names match the given regular expression. - - For details, see [Create automations]({{< relref "/guides/core/automations/create-automations/" >}}). -- Each run is considered individually and can potentially trigger the automation. -- Each run's values are put into a separate window and compared to the threshold separately. -- In a 24 hour period, a particular automation can fire at most once per run. - -## Next steps -- [Create a Slack automation]({{< relref "create-automations/slack.md" >}}) -- [Create a webhook automation]({{< relref "create-automations/webhook.md" >}}) diff --git a/content/en/guides/core/automations/create-automations/_index.md b/content/en/guides/core/automations/create-automations/_index.md deleted file mode 100644 index fdca881772..0000000000 --- a/content/en/guides/core/automations/create-automations/_index.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -menu: - default: - identifier: create-automations - parent: automations -title: Create an automation -weight: 1 -url: guides/automations/create-automations -cascade: -- url: guides/automations/create-automations/:filename ---- -{{% pageinfo color="info" %}} -{{< readfile file="/_includes/enterprise-cloud-only.md" >}} -{{% /pageinfo %}} - -This page gives an overview of creating and managing W&B [automations]({{< relref "/guides/core/automations/">}}). For more detailed instructions, refer to [Create a Slack automation]({{< relref "/guides/core/automations/create-automations/slack.md" >}}) or [Create a webhook automation]({{< relref "/guides/core/automations/create-automations/webhook.md" >}}). - -{{% alert %}} -Looking for companion tutorials for automations? -- [Learn to automatically triggers a Github Action for model evaluation and deployment](https://wandb.ai/wandb/wandb-model-cicd/reports/Model-CI-CD-with-W-B--Vmlldzo0OTcwNDQw). -- [Watch a video demonstrating automatically deploying a model to a Sagemaker endpoint](https://www.youtube.com/watch?v=s5CMj_w3DaQ). -- [Watch a video series introducing automations](https://youtube.com/playlist?list=PLD80i8An1OEGECFPgY-HPCNjXgGu-qGO6&feature=shared). -{{% /alert %}} - -## Requirements -- A team admin can create and manage automations for the team's projects, as well as components of their automations, such as webhooks, secrets, and Slack integrations. Refer to [Team settings]({{< relref "/guides/models/app/settings-page/teams/" >}}). -- To create a registry automation, you must have access to the registry. Refer to [Configure Registry access]({{< relref "/guides/core/registry/configure_registry.md#registry-roles" >}}). -- To create a Slack automation, you must have permission to post to the Slack instance and channel you select. - -## Create an automation -Create an automation from the project or registry's **Automations** tab. At a high level, to create an automation, follow these steps: - -1. If necessary, [create a W&B secret]({{< relref "/guides/core/secrets.md" >}}) for each sensitive string required by the automation, such as an access token, password, or SSH key. Secrets are defined in your **Team Settings**. Secrets are most commonly used in webhook automations. -1. Configure the webhook or Slack integration to authorize W&B to post to Slack or run the webhook on your behalf. A single webhook or Slack integration can be used by multiple automations. These actions are defined in your **Team Settings**. -1. In the project or registry, create the automation, which specifies the event to watch for and the action to take (such as posting to Slack or running a webhook). When you create a webhook automation, you configure the payload it sends. - -Or, from a line plot in the workspace, you can quickly create a [run metric automation]({{< relref "/guides/core/automations/automation-events.md#run-events" >}}) for the metric it shows: - -1. Hover over the panel, then click the bell icon at the top of the panel. - - {{< img src="/images/automations/run_metric_automation_from_panel.png" alt="Automation bell icon location" >}} -1. Configure the automation using the basic or advanced configuration controls. For example, apply a run filter to limit the scope of the automation, or configure an absolute threshold. - -For details, refer to: - -- [Create a Slack automation]({{< relref "slack.md" >}}) -- [Create a webhook automation]({{< relref "webhook.md" >}}) - -## View and manage automations -View and manage automations from a project or registry's **Automations** tab. - -- To view an automation's details, click its name. -- To edit an automation, click its action `...` menu, then click **Edit automation**. -- To delete an automation, click its action `...` menu, then click **Delete automation**. - -## Next steps -- Learn more about [automation events and scopes]({{< relref "/guides/core/automations/automation-events.md" >}}) -- [Create a Slack automation]({{< relref "slack.md" >}}). -- [Create a webhook automation]({{< relref "webhook.md" >}}). -- [Create a secret]({{< relref "/guides/core/secrets.md" >}}). diff --git a/content/en/guides/core/automations/create-automations/slack.md b/content/en/guides/core/automations/create-automations/slack.md deleted file mode 100644 index 40e05c108f..0000000000 --- a/content/en/guides/core/automations/create-automations/slack.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -menu: - default: - identifier: create-slack-automations - parent: create-automations -title: Create a Slack automation -weight: 1 ---- -{{% pageinfo color="info" %}} -{{< readfile file="/_includes/enterprise-cloud-only.md" >}} -{{% /pageinfo %}} - -This page shows how to create a Slack [automation]({{< relref "/guides/core/automations/" >}}> ). To create a webhook automation, refer to [Create a webhook automation]({{< relref "/guides/core/automations/create-automations/webhook.md" >}}) instead. - -At a high level, to create a Slack automation, you take these steps: -1. [Add a Slack integration]({{< relref "#add-a-slack-integration" >}}), which authorizes W&B to post to the Slack instance and channel. -1. [Create the automation]({{< relref "#create-an-automation" >}}), which defines the [event]({{< relref "/guides/core/automations/automation-events.md" >}}) to watch for and the channel to notify. - -## Add a Slack integration -A team admin can add a Slack integration to the team. - -1. Log in to W&B and go to **Team Settings**. -1. In the **Slack channel integrations** section, click **Connect Slack** to add a new Slack instance. To add a channel for an existing Slack instance, click **New integration**. - - ![Screenshot showing two Slack integrations in a Team](/images/automations/slack_integrations.png) -1. If necessary, sign in to Slack in your browser. When prompted, grant W&B permission to post to the Slack channel you select. Read the page, then click **Search for a channel** and begin typing the channel name. Select the channel from the list, then click **Allow**. -1. In Slack, go to the channel you selected. If you see a post like `[Your Slack handle] added an integration to this channel: Weights & Biases`, the integration is configured correctly. - -Now you can [create an automation]({{< relref "#create-an-automation" >}}) that notifies the Slack channel you configured. - -## View and manage Slack integrations -A team admin can view and manage the team's Slack instances and channels. - -1. Log in to W&B and go to **Team Settings**. -1. View each Slack destination in the **Slack channel integrations** section. -1. Delete a destination by clicking its trash icon. - -## Create an automation -After you [add a Slack integration]({{< relref "#add-a-slack-integreation" >}}), select **Registry** or **Project**, then follow these steps to create an automation that notifies the Slack channel. - -{{< tabpane text=true >}} -{{% tab "Registry" %}} -A Registry admin can create automations in that registry. - -1. Log in to W&B. -1. Click the name of a registry to view its details, -1. To create an automation scoped to the registry, click the **Automations** tab, then click **Create automation**. An automation that is scoped to a registry is automatically applied to all of its collections (including those created in the future). -1. Choose the [event]({{< relref "/guides/core/automations/automation-events.md#registry-events" >}}) to watch for. - - Fill in any additional fields that appear, which depend upon the event. For example, if you select **An artifact alias is added**, you must specify the **Alias regex**. - - Click **Next step**. - -1. Select the team that owns the [Slack integration]({{< relref "#add-a-slack-integration" >}}). -1. Set **Action type** to **Slack notification**. Select the Slack channel, then click **Next step**. -1. Provide a name for the automation. Optionally, provide a description. -1. Click **Create automation**. - -{{% /tab %}} -{{% tab "Project" %}} -A W&B admin can create automations in a project. - -1. Log in to W&B. -1. Go the project page and click the **Automations** tab, then click **Create automation**. - - Or, from a line plot in the workspace, you can quickly create a [run metric automation]({{< relref "/guides/core/automations/automation-events.md#run-events" >}}) for the metric it shows. Hover over the panel, then click the bell icon at the top of the panel. - {{< img src="/images/automations/run_metric_automation_from_panel.png" alt="Automation bell icon location" >}} -1. Choose the [event]({{< relref "/guides/core/automations/automation-events.md#project" >}}) to watch for. - - 1. Fill in any additional fields that appear. For example, if you select **An artifact alias is added**, you must specify the **Alias regex**. - - 1. For automations triggered by a run, optionally specify one or more run filters. - - - **Filter to one user's runs**: Include only runs created by the specified user. Click the toggle to turn on the filter, then specify a username. - - **Filter on run name**: Include only runs whose names match the given regular expression. Click the toggle to turn on the filter, then specify a regular expression. - 1. Click **Next step**. - -1. Select the team that owns the [Slack integration]({{< relref "#add-a-slack-integration" >}}). -1. Set **Action type** to **Slack notification**. Select the Slack channel, then click **Next step**. -1. Provide a name for the automation. Optionally, provide a description. -1. Click **Create automation**. - -{{% /tab %}} -{{< /tabpane >}} - -## View and manage automations - -{{< tabpane text=true >}} -{{% tab "Registry" %}} - -Manage the registry's automations from the registry's **Automations** tab. -- To view an automation's details, click its name. -- To edit an automation, click its action `...` menu, then click **Edit automation**. -- To delete an automation, click its action `...` menu, then click **Delete automation**. Confirmation is required. -{{% /tab %}} -{{% tab "Project" %}} -A W&B admin can view and manage a project's automations from the project's **Automations** tab. - -- To view an automation's details, click its name. -- To edit an automation, click its action `...` menu, then click **Edit automation**. -- To delete an automation, click its action `...` menu, then click **Delete automation**. Confirmation is required. -{{% /tab %}} -{{< /tabpane >}} diff --git a/content/en/guides/core/automations/create-automations/webhook.md b/content/en/guides/core/automations/create-automations/webhook.md deleted file mode 100644 index 833cc531a5..0000000000 --- a/content/en/guides/core/automations/create-automations/webhook.md +++ /dev/null @@ -1,313 +0,0 @@ ---- -menu: - default: - identifier: create-webhook-automations - parent: automations -title: Create a webhook automation -weight: 3 ---- -{{% pageinfo color="info" %}} -{{< readfile file="/_includes/enterprise-cloud-only.md" >}} -{{% /pageinfo %}} - -This page shows how to create a webhook [automation]({{< relref "/guides/core/automations/" >}}> ). To create a Slack automation, refer to [Create a Slack automation]({{< relref "/guides/core/automations/create-automations/slack.md" >}}) instead. - -At a high level, to create a webhook automation, you take these steps: -1. If necessary, [create a W&B secret]({{< relref "/guides/core/secrets.md" >}}) for each sensitive string required by the automation, such as an access token, password, or SSH key. Secrets are defined in your **Team Settings**. -1. [Create a webhook]({{< relref "#create-a-webhook" >}}) to define the endpoint and authorization details and grant the integration access to any secrets it needs. -1. [Create the automation]({{< relref "#create-an-automation" >}}) to define the [event]({{< relref "/guides/core/automations/automation-events.md" >}}) to watch for and the payload W&B will send. Grant the automation access to any secrets it needs for the payload. - -## Create a webhook -A team admin can add a webhook for the team. - -{{% alert %}} -If the webhook requires a Bearer token or its payload requires a sensitive string, [create a secret that contains it]({{< relref "/guides/core/secrets.md#add-a-secret" >}}) before creating the webhook. You can configure at most one access token and one other secret for a webhook. Your webhook's authentication and authorization requirements are determined by the webhook's service. -{{% /alert %}} - -1. Log in to W&B and go to **Team Settings** page. -1. In the **Webhooks** section, click **New webhook**. -1. Provide a name for the webhook. -1. Provide the endpoint URL for the webhook. -1. If the webhook requires a Bearer token, set **Access token** to the [secret]({{< relref "/guides/core/secrets.md" >}}) that contains it. When using the webhook automation, W&B sets the `Authorization: Bearer` HTTP header to the access token, and you can access the token in the `${ACCESS_TOKEN}` [payload variable]({{< relref "#payload-variables" >}}). Learn more about the structure of the `POST` request W&B sends to the webhook service in [Troubleshoot your webhook]({{< relref "#troubleshoot-your-webhook" >}}). -1. If the webhook requires a password or other sensitive string in its payload, set **Secret** to the secret that contains it. When you configure the automation that uses the webhook, you can access the secret as a [payload variable]({{< relref "#payload-variables" >}}) by prefixing its name with `$`. - - If the webhook's access token is stored in a secret, you must _also_ complete the next step to specify the secret as the access token. -1. To verify that the W&B can connect and authenticate to the endpoint: - 1. Optionally, provide a payload to test. To refer to a secret the webhook has access to in the payload, prefix its name with `$`. This payload is only used for testing and is not saved. You configure an automation's payload when you [create the automation]({{< relref "#create-a-webhook-automation" >}}). See [Troubleshoot your webhook]({{< relref "#troubleshoot-your-webhook" >}}) to view where the secret and access token are specified in the `POST` request. - 1. Click **Test**. W&B attempts to connect to the webhook's endpoint using the credentials you configured. If you provided a payload, W&B sends it. - - If the test does not succeed, verify the webhook's configuration and try again. If necessary, refer to [Troubleshoot your webhook]({{< relref "#troubleshoot-your-webhook" >}}). - -![Screenshot showing two webhooks in a Team](/images/automations/webhooks.png) - -Now you can [create an automation]({{< relref "#create-a-webhook-automation" >}}) that uses the webhook. - -## Create an automation -After you [configure a webhook]({{< relref "#create-a-webhook" >}}), select **Registry** or **Project**, then follow these steps to create an automation that triggers the webhook. - -{{< tabpane text=true >}} -{{% tab "Registry" %}} -A Registry admin can create automations in that registry. Registry automations are applied to all collections in the registry, including those added in the future. - -1. Log in to W&B. -1. Click the name of a registry to view its details, -1. To create an automation scoped to the registry, click the **Automations** tab, then click **Create automation**. - -1. Choose the [event]({{< relref "/guides/core/automations/automation-events.md#registry-events" >}}) to watch for. - - Fill in any additional fields that appear. For example, if you select **An artifact alias is added**, you must specify the **Alias regex**. - - Click **Next step**. - -1. Select the team that owns the [webhook]({{< relref "#create-a-webhook" >}}). -1. Set **Action type** to **Webhooks**. then select the [webhook]({{< relref "#create-a-webhook" >}}) to use. -1. If you configured an access token for the webhook, you can access the token in the `${ACCESS_TOKEN}` [payload variable]({{< relref "#payload-variables" >}}). If you configured a secret for the webhook, you can access it in the payload by prefixing its name with `$`. Your webhook's requirements are determined by the webhook's service. -1. Click **Next step**. -1. Provide a name for the automation. Optionally, provide a description. Click **Create automation**. - -{{% /tab %}} -{{% tab "Project" %}} -A W&B admin can create automations in a project. - -1. Log in to W&B and go to the project page. -1. In the sidebar, click **Automations**, then click **Create automation**. - - Or, from a line plot in the workspace, you can quickly create a [run metric automation]({{< relref "/guides/core/automations/automation-events.md#run-events" >}}) for the metric it shows. Hover over the panel, then click the bell icon at the top of the panel. - {{< img src="/images/automations/run_metric_automation_from_panel.png" alt="Automation bell icon location" >}} -1. Choose the [event]({{< relref "/guides/core/automations/automation-events.md#project" >}}) to watch for, such as when an artifact alias is added or when a run metric meets a given threshold. - - 1. Fill in any additional fields that appear, which depend upon the event. For example, if you select **An artifact alias is added**, you must specify the **Alias regex**. - - 1. For automations triggered by a run, optionally specify one or more run filters. - - - **Filter to one user's runs**: Include only runs created by the specified user. Click the toggle to turn on the filter, then specify a username. - - **Filter on run name**: Include only runs whose names match the given regular expression. Click the toggle to turn on the filter, then specify a regular expression. - - The automation is applied to all collections in the project, including those added in the future. - 1. Click **Next step**. -1. Select the team that owns the [webhook]({{< relref "#create-a-webhook" >}}). -1. Set **Action type** to **Webhooks**. then select the [webhook]({{< relref "#create-a-webhook" >}}) to use. -1. If your webhook requires a payload, construct it and paste it into the **Payload** field. If you configured an access token for the webhook, you can access the token in the `${ACCESS_TOKEN}` [payload variable]({{< relref "#payload-variables" >}}). If you configured a secret for the webhook, you can access it in the payload by prefixing its name with `$`. Your webhook's requirements are determined by the webhook's service. -1. Click **Next step**. -1. Provide a name for the automation. Optionally, provide a description. Click **Create automation**. - -{{% /tab %}} -{{< /tabpane >}} - -## View and manage automations -{{< tabpane text=true >}} -{{% tab "Registry" %}} - -Manage a registry's automations from the registry's **Automations** tab. - -- To view an automation's details, click its name. -- To edit an automation, click its action `...` menu, then click **Edit automation**. -- To delete an automation, click its action `...` menu, then click **Delete automation**. Confirmation is required. - -{{% /tab %}} -{{% tab "Project" %}} -A W&B admin can view and manage a project's automations from the project's **Automations** tab. - -- To view an automation's details, click its name. -- To edit an automation, click its action `...` menu, then click **Edit automation**. -- To delete an automation, click its action `...` menu, then click **Delete automation**. Confirmation is required. -{{% /tab %}} -{{< /tabpane >}} - -## Payload reference -Use these sections to construct your webhoook's payload. For details about testing your webhook and its payload, refer to [Troubleshoot your webhook]({{< relref "#troubleshoot-your-webhook" >}}). - -### Payload variables -This section describes the variables you can use to construct your webhook's payload. - -| Variable | Details | -|----------|---------| -| `${project_name}` | The name of the project that owns the mutation that triggered the action. | -| `${entity_name}` | The name of the entity or team that owns the mutation that triggered the action. -| `${event_type}` | The type of event that triggered the action. | -| `${event_author}` | The user that triggered the action. | -| `${alias}` | Contains an artifact's alias if the automation is triggered by the **An artifact alias is added** event. For other automations, this variable is blank. | -| `${tag}` | Contains an artifact's tags if the automation is triggered by the **An artifact tag is added** event. For other automations, this variable is blank. | -| `${artifact_collection_name}` | The name of the artifact collection that the artifact version is linked to. | -| `${artifact_metadata.}` | The value of an arbitrary top-level metadata key from the artifact version that triggered the action. Replace `` with the name of a top-level metadata key. Only top-level metadata keys are available in the webhook's payload. | -| `${artifact_version}` | The [`Wandb.Artifact`]({{< relref "/ref/python/experiments/artifact.md/" >}}) representation of the artifact version that triggered the action. | -| `${artifact_version_string}` | The `string` representation of the artifact version that triggered the action. | -| `${ACCESS_TOKEN}` | The value of the access token configured in the [webhook]({{< relref "#create-a-webhook" >}}), if an access token is configured. The access token is automatically passed in the `Authorization: Bearer` HTTP header. | -| `${SECRET_NAME}` | If configured, the value of a secret configured in the [webhook]({{< relref "#create-a-webhook" >}}). Replace `SECRET_NAME` with the name of the secret. | - -### Payload examples -This section includes examples of webhook payloads for some common use cases. The examples demonstrate how to use [payload variables]({{< relref "#payload-variables" >}}). - -{{< tabpane text=true >}} -{{% tab header="GitHub repository dispatch" value="github" %}} - -{{% alert %}} -Verify that your access tokens have required set of permissions to trigger your GHA workflow. For more information, [see these GitHub Docs](https://docs.github.com/en/rest/repos/repos?#create-a-repository-dispatch-event). -{{% /alert %}} - -Send a repository dispatch from W&B to trigger a GitHub action. For example, suppose you have a GitHub workflow file that accepts a repository dispatch as a trigger for the `on` key: - -```yaml -on: -repository_dispatch: - types: BUILD_AND_DEPLOY -``` - -The payload for the repository might look something like: - -```json -{ - "event_type": "BUILD_AND_DEPLOY", - "client_payload": - { - "event_author": "${event_author}", - "artifact_version": "${artifact_version}", - "artifact_version_string": "${artifact_version_string}", - "artifact_collection_name": "${artifact_collection_name}", - "project_name": "${project_name}", - "entity_name": "${entity_name}" - } -} -``` - -{{% alert %}} -The `event_type` key in the webhook payload must match the `types` field in the GitHub workflow YAML file. -{{% /alert %}} - -The contents and positioning of rendered template strings depends on the event or model version the automation is configured for. `${event_type}` will render as either `LINK_ARTIFACT` or `ADD_ARTIFACT_ALIAS`. See below for an example mapping: - -```text -${event_type} --> "LINK_ARTIFACT" or "ADD_ARTIFACT_ALIAS" -${event_author} --> "" -${artifact_version} --> "wandb-artifact://_id/QXJ0aWZhY3Q6NTE3ODg5ODg3"" -${artifact_version_string} --> "/model-registry/:" -${artifact_collection_name} --> "" -${project_name} --> "model-registry" -${entity_name} --> "" -``` - -Use template strings to dynamically pass context from W&B to GitHub Actions and other tools. If those tools can call Python scripts, they can consume the registered model artifacts through the [W&B API]({{< relref "/guides/core/artifacts/download-and-use-an-artifact.md" >}}). - -- For more information about repository dispatch, see the [official documentation on the GitHub Marketplace](https://github.com/marketplace/actions/repository-dispatch). - -- Watch the videos [Webhook Automations for Model Evaluation](https://www.youtube.com/watch?v=7j-Mtbo-E74&ab_channel=Weights%26Biases) and [Webhook Automations for Model Deployment](https://www.youtube.com/watch?v=g5UiAFjM2nA&ab_channel=Weights%26Biases), which guide you to create automations for model evaluation and deployment. - -- Review a W&B [report](https://wandb.ai/wandb/wandb-model-cicd/reports/Model-CI-CD-with-W-B--Vmlldzo0OTcwNDQw), which illustrates how to use a Github Actions webhook automation for Model CI. Check out this [GitHub repository](https://github.com/hamelsmu/wandb-modal-webhook) to learn how to create model CI with a Modal Labs webhook. - -{{% /tab %}} - -{{% tab header="Microsoft Teams notification" value="microsoft"%}} - -This example payload shows how to notify your Teams channel using a webhook: - -```json -{ -"@type": "MessageCard", -"@context": "http://schema.org/extensions", -"summary": "New Notification", -"sections": [ - { - "activityTitle": "Notification from WANDB", - "text": "This is an example message sent via Teams webhook.", - "facts": [ - { - "name": "Author", - "value": "${event_author}" - }, - { - "name": "Event Type", - "value": "${event_type}" - } - ], - "markdown": true - } -] -} -``` - -You can use template strings to inject W&B data into your payload at the time of execution (as shown in the Teams example above). - -{{% /tab %}} - -{{% tab header="Slack notifications" value="slack"%}} - -{{% alert %}} -This section is provided for historical purposes. If you currently use a webhook to integrate with Slack, W&B recommends that you update your configuration to use the [new Slack integration]({{ relref "#create-a-slack-automation"}}) instead. -{{% /alert %}} - -Set up your Slack app and add an incoming webhook integration with the instructions highlighted in the [Slack API documentation](https://api.slack.com/messaging/webhooks). Ensure that you have the secret specified under `Bot User OAuth Token` as your W&B webhook’s access token. - -The following is an example payload: - -```json -{ - "text": "New alert from WANDB!", -"blocks": [ - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "Registry event: ${event_type}" - } - }, - { - "type":"section", - "text": { - "type": "mrkdwn", - "text": "New version: ${artifact_version_string}" - } - }, - { - "type": "divider" - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "Author: ${event_author}" - } - } - ] -} -``` - -{{% /tab %}} -{{< /tabpane >}} - -## Troubleshoot your webhook -Interactively troubleshoot your webhook with the W&B App UI or programmatically with a Bash script. You can troubleshoot a webhook when you create a new webhook or edit an existing webhook. - -For details about the format W&B uses for the `POST` request, refer to the **Bash script** tab. - -{{< tabpane text=true >}} -{{% tab header="W&B App UI" value="app" %}} - -A team admin can test a webhook interactively with the W&B App UI. - -1. Navigate to your W&B Team Settings page. -2. Scroll to the **Webhooks** section. -3. Click on the horizontal three docs (meatball icon) next to the name of your webhook. -4. Select **Test**. -5. From the UI panel that appears, paste your POST request to the field that appears. - {{< img src="/images/models/webhook_ui.png" alt="Demo of testing a webhook payload" >}} -6. Click on **Test webhook**. Within the W&B App UI, W&B posts the response from your endpoint. - {{< img src="/images/models/webhook_ui_testing.gif" alt="Demo of testing a webhook" >}} - -Watch the video [Testing Webhooks in W&B](https://www.youtube.com/watch?v=bl44fDpMGJw&ab_channel=Weights%26Biases) for a demonstration. -{{% /tab %}} - -{{% tab header="Bash script" value="bash"%}} - -This shell script shows one method to generate a `POST` request similar to the request W&B sends to your webhook automation when it is triggered. - -Copy and paste the code below into a shell script to troubleshoot your webhook. Specify your own values for: - -* `ACCESS_TOKEN` -* `SECRET` -* `PAYLOAD` -* `API_ENDPOINT` - -{{< prism file="/webhook_test.sh" title="webhook_test.sh">}}{{< /prism >}} - -{{% /tab %}} -{{< /tabpane >}} diff --git a/content/en/guides/core/registry/_index.md b/content/en/guides/core/registry/_index.md deleted file mode 100644 index 33392f337f..0000000000 --- a/content/en/guides/core/registry/_index.md +++ /dev/null @@ -1,141 +0,0 @@ ---- -menu: - default: - identifier: registry - parent: core -title: Registry -weight: 3 -url: guides/registry -cascade: -- url: guides/registry/:filename ---- -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/wandb_registry/zoo_wandb.ipynb" >}} - -W&B Registry is a curated central repository of [W&B Artifact]({{< relref "/guides/core/artifacts/" >}}) versions within your organization. Users who [have permission]({{< relref "./configure_registry.md" >}}) within your organization can [download and use artifacts]({{< relref "./download_use_artifact.md" >}}), share, and collaboratively manage the lifecycle of all artifacts, regardless of the team that user belongs to. - -You can use the Registry to [track artifact versions]({{< relref "./link_version.md" >}}), audit the history of an artifact's usage and changes, ensure governance and compliance of your artifacts, and [automate downstream processes such as model CI/CD]({{< relref "/guides/core/automations/" >}}). - -In summary, use W&B Registry to: - -- [Promote]({{< relref "./link_version.md" >}}) artifact versions that satisfy a machine learning task to other users in your organization. -- Organize [artifacts with tags]({{< relref "./organize-with-tags.md" >}}) so that you can find or reference specific artifacts. -- Track an [artifact’s lineage]({{< relref "/guides/core/registry/lineage.md" >}}) and audit the history of changes. -- [Automate]({{< relref "/guides/core/automations/" >}}) downstream processes such as model CI/CD. -- [Limit who in your organization]({{< relref "./configure_registry.md" >}}) can access artifacts in each registry. - - - -{{< img src="/images/registry/registry_landing_page.png" alt="W&B Registry" >}} - -The preceding image shows the Registry App with "Model" and "Dataset" core registries along with custom registries. - - -## Learn the basics -Each organization initially contains two registries that you can use to organize your model and dataset artifacts called **Models** and **Datasets**, respectively. You can create [additional registries to organize other artifact types based on your organization's needs]({{< relref "./registry_types.md" >}}). - -Each [registry]({{< relref "./configure_registry.md" >}}) consists of one or more [collections]({{< relref "./create_collection.md" >}}). Each collection represents a distinct task or use case. - -{{< img src="/images/registry/homepage_registry.png" alt="W&B Registry" >}} - -To add an artifact to a registry, you first log a [specific artifact version to W&B]({{< relref "/guides/core/artifacts/create-a-new-artifact-version.md" >}}). Each time you log an artifact, W&B automatically assigns a version to that artifact. Artifact versions use 0 indexing, so the first version is `v0`, the second version is `v1`, and so on. - -Once you log an artifact to W&B, you can then link that specific artifact version to a collection in the registry. - -{{% alert %}} -The term "link" refers to pointers that connect where W&B stores the artifact and where the artifact is accessible in the registry. W&B does not duplicate artifacts when you link an artifact to a collection. -{{% /alert %}} - -As an example, the proceeding code example shows how to log and link a model artifact called "my_model.txt" to a collection named "first-collection" in the [core registry]({{< relref "./registry_types.md" >}}): - -1. Initialize a W&B Run. -2. Log the artifact to W&B. -3. Specify the name of the collection and registry to link your artifact version to. -4. Link the artifact to the collection. - -Save this Python code to a script and run it. W&B Python SDK version 0.18.6 or newer is required. - -```python title="hello_collection.py" -import wandb -import random - -# Initialize a W&B Run to track the artifact -run = wandb.init(project="registry_quickstart") - -# Create a simulated model file so that you can log it -with open("my_model.txt", "w") as f: - f.write("Model: " + str(random.random())) - -# Log the artifact to W&B -logged_artifact = run.log_artifact( - artifact_or_path="./my_model.txt", - name="gemma-finetuned", - type="model" # Specifies artifact type -) - -# Specify the name of the collection and registry -# you want to publish the artifact to -COLLECTION_NAME = "first-collection" -REGISTRY_NAME = "model" - -# Link the artifact to the registry -run.link_artifact( - artifact=logged_artifact, - target_path=f"wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}" -) -``` - -W&B automatically creates a collection for you if the collection you specify in the returned run object's `link_artifact(target_path = "")` method does not exist within the registry you specify. - -{{% alert %}} -The URL that your terminal prints directs you to the project where W&B stores your artifact. -{{% /alert %}} - -Navigate to the Registry App to view artifact versions that you and other members of your organization publish. To do so, first navigate to W&B. Select **Registry** in the left sidebar below **Applications**. Select the "Model" registry. Within the registry, you should see the "first-collection" collection with your linked artifact version. - -Once you link an artifact version to a collection within a registry, members of your organization can view, download, and manage your artifact versions, create downstream automations, and more if they have the proper permissions. - -{{% alert %}} -If an artifact version logs metrics (such as by using `run.log_artifact()`), you can view metrics for that version from its details page, and you can compare metrics across artifact versions from the collection's page. Refer to [View linked artifacts in a registry]({{< relref "link_version.md#view-linked-artifacts-in-a-registry" >}}). -{{% /alert %}} - -## Enable W&B Registry - -Based on your deployment type, satisfy the following conditions to enable W&B Registry: - -| Deployment type | How to enable | -| ----- | ----- | -| Multi-tenant Cloud | No action required. W&B Registry is available on the W&B App. | -| Dedicated Cloud | Contact your account team to enable W&B Registry for your deployment. | -| Self-Managed | For Server v0.70.0 or newer, no action required. For older supported Server versions, set the environment variable `ENABLE_REGISTRY_UI` to `true`. Refer to [Configure environment variables]({{< relref "/guides/hosting/env-vars.md" >}}). | - - -## Resources to get started - -Depending on your use case, explore the following resources to get started with the W&B Registry: - -* Check out the tutorial video: - * [Getting started with Registry from W&B](https://www.youtube.com/watch?v=p4XkVOsjIeM) -* Take the W&B [Model CI/CD](https://www.wandb.courses/courses/enterprise-model-management) course and learn how to: - * Use W&B Registry to manage and version your artifacts, track lineage, and promote models through different lifecycle stages. - * Automate your model management workflows using webhooks. - * Integrate the registry with external ML systems and tools for model evaluation, monitoring, and deployment. - - - -## Migrate from the legacy Model Registry to W&B Registry - -The legacy Model Registry is scheduled for deprecation with the exact date not yet decided. Before deprecating the legacy Model Registry, W&B will migrate the contents of the legacy Model Registry to the W&B Registry. - - -See [Migrating from legacy Model Registry]({{< relref "./model_registry_eol.md" >}}) for more information about the migration process from the legacy Model Registry to W&B Registry. - -Until the migration occurs, W&B supports both the legacy Model Registry and the new Registry. - -{{% alert %}} -To view the legacy Model Registry, navigate to the Model Registry in the W&B App. A banner appears at the top of the page that enables you to use the legacy Model Registry App UI. - -{{< img src="/images/registry/nav_to_old_model_reg.gif" alt="Legacy Model Registry UI" >}} -{{% /alert %}} - - -Reach out to support@wandb.com with any questions or to speak to the W&B Product Team about any concerns about the migration. \ No newline at end of file diff --git a/content/en/guides/core/registry/aliases.md b/content/en/guides/core/registry/aliases.md deleted file mode 100644 index daf2103e1a..0000000000 --- a/content/en/guides/core/registry/aliases.md +++ /dev/null @@ -1,171 +0,0 @@ ---- -title: Reference an artifact version with aliases -weight: 5 ---- - -Reference a specific [artifact version]({{< relref "guides/core/artifacts/create-a-new-artifact-version" >}}) with one or more aliases. [W&B automatically assigns aliases]({{< relref "aliases#default-aliases" >}}) to each artifact you link with the same name. You can also [create one or more custom aliases]({{< relref "aliases#custom-aliases" >}}) to reference a specific artifact version. - -Aliases appear as rectangles with the name of that alias in the rectangle in the Registry UI. If an [alias is protected]({{< relref "aliases#protected-aliases" >}}), it appears as a gray rectangle with a lock icon. Otherwise, the alias appears as an orange rectangle. Aliases are not shared across registries. - -{{% alert title="When to use an alias versus using a tag" %}} -Use an alias to reference a specific artifact version. Each alias within a collection is unique. Only one artifact version can have a specific alias at a time. - -Use tags to organize and group artifact versions or collections based on a common theme. Multiple artifact versions and collections can share the same tag. -{{% /alert %}} - -When you add an alias to an artifact version, you can optionally start a [Registry automation]({{< relref "/guides/core/automations/automation-events/#registry" >}}) to notify a Slack channel or trigger a webhook. - -## Default aliases - -W&B automatically assigns the following aliases to each artifact version you link with the same name: - -* The `latest` alias to the most recent artifact version you link to a collection. -* A unique version number. W&B counts each artifact version (zero indexing) you link. W&B uses the count number to assign a unique version number to that artifact. - -For example, if you link an artifact named `zoo_model` three times, W&B creates three aliases `v0`, `v1`, and `v2` respectively. `v2` also has the `latest` alias. - -## Custom aliases - -Create one or more custom aliases for a specific artifact versions based on your unique use case. For example: - -- You might use aliases such as `dataset_version_v0`, `dataset_version_v1`, and `dataset_version_v2` to identify which dataset a model was trained on. -- You might use a `best_model` alias to keep track of the best performing artifact model version. - -Any user with a [**Member** or **Admin** registry role]({{< relref "guides/core/registry/configure_registry/#registry-roles" >}}) on a registry can add or remove a custom alias from a linked artifact in that registry. Users with the [**Restricted Viewer** or **Viewer** roles]({{< relref "guides/core/registry/configure_registry/#registry-roles" >}}) cannot add or remove aliases. - -{{% alert %}} -[Protected aliases]({{< relref "aliases/#protected-aliases" >}}) provide a way to label and identify which artifact versions to protect from modification or deletion. -{{% /alert %}} - - -You can create a custom alias with the W&B Registry or the Python SDK. Based on your use case, click on a tab below that best fits your needs. - -{{< tabpane text=true >}} -{{% tab header="W&B Registry" value="app" %}} - -1. Navigate to the W&B Registry. -2. Click the **View details** button in a collection. -3. Within the **Versions** section, click the **View** button for a specific artifact version. -4. Click the **+** button to add one or more aliases next to the **Aliases** field. - -{{% /tab %}} - -{{% tab header="Python SDK" value="python" %}} -When you link an artifact version to a collection with the Python SDK you can optionally provide a list of one or more aliases as an argument to the `alias` parameter in [`link_artifact()`]({{< relref "/ref/python/experiments/run.md/#link_artifact" >}}). W&B creates an alias ([non protected alias]({{< relref "#custom-aliases" >}})) for you if the alias you provide does not already exist. - -The following code snippet demonstrates how to link an artifact version to a collection and add aliases to that artifact version with the Python SDK. Replace values within `<>` with your own: - -```python -import wandb - -# Initialize a run -run = wandb.init(entity = "", project = "") - -# Create an artifact object -# The type parameter specifies both the type of the -# artifact object and the collection type -artifact = wandb.Artifact(name = "", type = "") - -# Add the file to the artifact object. -# Specify the path to the file on your local machine. -artifact.add_file(local_path = "") - -# Specify the collection and registry to link the artifact to -REGISTRY_NAME = "" -COLLECTION_NAME = "" -target_path=f"wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}" - -# Link the artifact version to the collection -# Add one or more aliases to this artifact version -run.link_artifact( - artifact = artifact, - target_path = target_path, - aliases = ["", ""] - ) -``` -{{% /tab %}} -{{< /tabpane >}} - -### Protected aliases -Use a [protected alias]({{< relref "aliases/#protected-aliases" >}}) to both label and identify artifact versions that should not be modified or deleted. For example, consider using a `production` protected alias to label and identify artifact versions that are in used in your organization's machine learning production pipeline. - -[Registry admin]({{< relref "/guides/core/registry/configure_registry/#registry-roles" >}}) users and [service accounts]({{< relref "/support/kb-articles/service_account_useful" >}}) with the **Admin** role can create protected aliases and add or remove protected aliases from an artifact version. Users and service accounts with **Member**, **Viewer**, and **Restricted Viewer** roles cannot unlink a protected version or delete a collection that contains a protected alias. See [Configure registry access]({{< relref "/guides/core/registry/configure_registry.md" >}}) for details. - -Common protected aliases include: - -- **Production**: The artifact version is ready for production use. -- **Staging**: The artifact version is ready for testing. - -#### Create a protected alias - -The following steps describe how to create a protected alias in the W&B Registry UI: - -1. Navigate to the Registry App. -2. Select a registry. -3. Click the gear button on the top right of the page to view the registry's settings. -4. Within the **Protected Aliases** section, click the **+** button to add one or more protected aliases. - -After creation, each protected alias appears as a gray rectangle with a lock icon in the **Protected Aliases** section. - -{{% alert %}} -Unlike custom aliases that are not protected, creating protected aliases is available exclusively in the W&B Registry UI and not programmatically with the Python SDK. To add a protected alias to an artifact version, you can use the W&B Registry UI or the Python SDK. -{{% /alert %}} - -The following steps describe how to add a protected alias to an artifact version with the W&B Registry UI: - -1. Navigate to the W&B Registry. -2. Click the **View details** button in a collection. -3. Within the **Versions** section, select the **View** button for a specific artifact version. -4. Click the **+** button to add one or more protected aliases next to the **Aliases** field. - -After a protected alias is created, an admin can add it to an artifact version programmatically with the Python SDK. See the W&B Registry and Python SDK tabs in [Create a custom alias](#custom-aliases) section above for an example on how to add a protected alias to an artifact version. - -## Find existing aliases -You can find existing aliases with the [global search bar in the W&B Registry]({{< relref "/guides/core/registry/search_registry/#search-for-registry-items" >}}). To find a protected alias: - -1. Navigate to the W&B Registry App. -2. Specify the search term in the search bar at the top of the page. Press Enter to search. - -Search results appear below the search bar if the term you specify matches an existing registry, collection name, artifact version tag, collection tag, or alias. - -## Example - -{{% alert %}} -The following code example is a continuation of [the W&B Registry Tutorial](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/wandb_registry/zoo_wandb.ipynb). To use the following code, you must first [retrieve and process the Zoo dataset as described in the notebook](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/wandb_registry/zoo_wandb.ipynb#scrollTo=87fecd29-8146-41e2-86fb-0bb4e3e3350a). Once you have the Zoo dataset, you can create an artifact version and add custom aliases to it. -{{% /alert %}} - -The following code snippet shows how to create an artifact version and add custom aliases to it. The example uses the Zoo dataset from the [UCI Machine Learning Repository](https://archive.ics.uci.edu/dataset/111/zoo) and the `Model` collection in the `Zoo_Classifier_Models` registry. - -```python -import wandb - -# Initialize a run -run = wandb.init(entity = "smle-reg-team-2", project = "zoo_experiment") - -# Create an artifact object -# The type parameter specifies both the type of the -# artifact object and the collection type -artifact = wandb.Artifact(name = "zoo_dataset", type = "dataset") - -# Add the file to the artifact object. -# Specify the path to the file on your local machine. -artifact.add_file(local_path="zoo_dataset.pt", name="zoo_dataset") -artifact.add_file(local_path="zoo_labels.pt", name="zoo_labels") - -# Specify the collection and registry to link the artifact to -REGISTRY_NAME = "Model" -COLLECTION_NAME = "Zoo_Classifier_Models" -target_path=f"wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}" - -# Link the artifact version to the collection -# Add one or more aliases to this artifact version -run.link_artifact( - artifact = artifact, - target_path = target_path, - aliases = ["production-us", "production-eu"] - ) -``` - -1. First, you create an artifact object (`wandb.Artifact()`). -2. Next, you add two dataset PyTorch tensors to the artifact object with `wandb.Artifact.add_file()`. -3. Lastly, you link the artifact version to the `Model` collection in the `Zoo_Classifier_Models` registry with `link_artifact()`. You also add two custom aliases to the artifact version by passing `production-us` and `production-eu` as arguments to the `aliases` parameter. diff --git a/content/en/guides/core/registry/configure_registry.md b/content/en/guides/core/registry/configure_registry.md deleted file mode 100644 index 1f551bae5a..0000000000 --- a/content/en/guides/core/registry/configure_registry.md +++ /dev/null @@ -1,170 +0,0 @@ ---- -menu: - default: - identifier: configure_registry - parent: registry -title: Configure registry access -weight: 3 ---- - -A registry admin can [configure registry roles]({{< relref "configure_registry.md#configure-registry-roles" >}}), [add users]({{< relref "configure_registry.md#add-a-user-or-a-team-to-a-registry" >}}), or [remove users]({{< relref "configure_registry.md#remove-a-user-or-team-from-a-registry" >}}) from a registry by configuring the registry's settings. - -## Manage users - -### Add a user or a team - -Registry admins can add individual users or entire teams to a registry. To add a user or team to a registry: - -1. Navigate to the **Registry** App in the W&B App UI. -2. Select the registry you want to add a user or team to. -3. Click on the gear icon on the upper right hand corner to access the registry settings. -4. In the **Registry access** section, click **Add access**. -5. Specify one or more user names, emails, or the team names to the **Include users and teams** field. -6. Click **Add access**. - -{{< img src="/images/registry/add_team_registry.gif" alt="Adding teams to registry" >}} - -Learn more about [configuring user roles in a registry]({{< relref "configure_registry.md#configure-registry-roles" >}}), or [Registry role permissions]({{< relref "configure_registry.md#registry-role-permissions" >}}) . - -### Remove a user or team -A registry admin can remove individual users or entire teams from a registry. To remove a user or team from a registry: - -1. Navigate to the **Registry** App in the W&B App UI. -2. Select the registry you want to remove a user from. -3. Click on the gear icon on the upper right hand corner to access the registry settings. -4. Navigate to the **Registry access** section and type in the username, email, or team you want to remove. -5. Click the **Delete** button. - -{{% alert %}} -Removing a user from a team also removes that user's access to the registry. -{{% /alert %}} - -### Change the owner of a registry - -A registry admin can designate any member as a registry's owner, including a **Restricted Viewer** or a **Viewer**. Registry ownership is primarily for accountability purposes and does not confer any additional permissions beyond those granted by the user's assigned role. - -To change the owner: -1. Navigate to the **Registry** App in the W&B App UI. -2. Select the registry you want to configure. -3. Click the gear icon on the upper right hand corner. -4. Scroll to the **Registry members and roles** section. -5. Hover over the row for a member. -6. Click the **...** action menu at the end of the row, then click **Make owner**. - - -## Configure Registry roles - -This section shows how to configure roles for Registry members. For more information about Registry roles, including the cabilities of each role, order of precedence, defaults, and more, see [Details about Registry roles](#details-about-registry-roles). - -1. Navigate to the **Registry** App in the W&B App UI. -2. Select the registry you want to configure. -3. Click the gear icon on the upper right hand corner. -4. Scroll to the **Registry members and roles** section. -5. Within the **Member** field, search for the user or team you want to edit permissions for. -6. In the **Registry role** column, click the user's role. -7. From the dropdown, select the role you want to assign to the user. - -## Details about Registry roles - -The following sections give more information about Registry roles. - -{{% alert %}} -Your [role in a team]({{< ref "/guides/models/app/settings-page/teams.md#team-roles-and-permissions" >}}) has no impact or relationship to your role in any registry. -{{% /alert %}} - -### Default roles -W&B automatically assigns a default **registry role** to a user or team when they are added to a registry. This role determines what they can do in that registry. - -| Entity | Default registry role
(Dedicated Cloud / Self-Managed) | Default registry role
(Multi-tenant Cloud) | -|----------------------------------------|-------------------------------------------------------------|-------------------------------------------------| -| Team | Viewer | Restricted Viewer | -| User or service account (non admin) | Viewer | Restricted Viewer | -| Service account (non admin) | Member1 | Member1 | -| Org admin | Admin | Admin | - -1: Service accounts cannot have **Viewer** or **Restricted Viewer** roles. - -A registry admin can assign or modify roles for users and teams in the registry. -See [Configure user roles in a registry]({{< relref "configure_registry.md#configure-registry-roles" >}}) for more information. - -{{% alert title="Restricted Viewer role availability" %}} -The **Restricted Viewer** role is currently available only in Multi-Tenant Cloud organizations by invitation only. To request access, or to express interest in the feature on Dedicated Cloud or Self-Managed, [contact support](mailto:support@wandb.ai). - -This role provides read-only access to registry artifacts without the ability to create, update, or delete collections, automations, or other registry resources. - -Unlike a **Viewer**, a **Restricted Viewer**: -- Cannot download artifact files or access file contents. -- Cannot use artifacts with use_artifact() in the W&B SDK. -{{% /alert %}} - -### Role permissions -The following table lists each Registry role, along with the permissions provided by each role: - -| Permission | Permission Group | Restricted Viewer
(Multi-tenant Cloud, by invitation) | Viewer | Member | Admin | -|--------------------------------------------------------------- |------------------|-------------------|--------|--------|-------| -| View a collection's details | Read | ✓ | ✓ | ✓ | ✓ | -| View a linked artifact's details | Read | ✓ | ✓ | ✓ | ✓ | -| Usage: Consume an artifact in a registry with use_artifact | Read | | ✓ | ✓ | ✓ | -| Download a linked artifact | Read | | ✓ | ✓ | ✓ | -| Download files from an artifact's file viewer | Read | | ✓ | ✓ | ✓ | -| Search a registry | Read | ✓ | ✓ | ✓ | ✓ | -| View a registry's settings and user list | Read | ✓ | ✓ | ✓ | ✓ | -| Create a new automation for a collection | Create | | | ✓ | ✓ | -| Turn on Slack notifications for new version being added | Create | | | ✓ | ✓ | -| Create a new collection | Create | | | ✓ | ✓ | -| Create a new custom registry | Create | | | ✓ | ✓ | -| Edit collection card (description) | Update | | | ✓ | ✓ | -| Edit linked artifact description | Update | | | ✓ | ✓ | -| Add or delete a collection's tag | Update | | | ✓ | ✓ | -| Add or delete an alias from a linked artifact | Update | | | ✓ | ✓ | -| Link a new artifact | Update | | | ✓ | ✓ | -| Edit allowed types list for a registry | Update | | | ✓ | ✓ | -| Edit custom registry name | Update | | | ✓ | ✓ | -| Delete a collection | Delete | | | ✓ | ✓ | -| Delete an automation | Delete | | | ✓ | ✓ | -| Unlink an artifact from a registry | Delete | | | ✓ | ✓ | -| Edit accepted artifact types for a registry | Admin | | | | ✓ | -| Change registry visibility (Organization or Restricted) | Admin | | | | ✓ | -| Add users to a registry | Admin | | | | ✓ | -| Assign or change a user's role in a registry | Admin | | | | ✓ | - - -### Inherited Registry role -The registry's membership list shows each user's inherited (effective) registry role (in light gray) next to the role dropdown in their row. - -{{< img src="/images/registry/role_conflict.png" alt="Registry membership list showing the user's effective registry role" >}} - -A user's effective role in a particular registry matches their _highest_ role among their role in the organization, the registry, and the team that owns the registry, whether inherited or explicitly assigned. For example: - -- A team **Admin** or organization **Admin** with the **Viewer** role in a particular registry owned by the team is effectively an **Admin** of the registry. -- A registry **Viewer** with the **Member** role in the team is effectively a **Member** of the registry. -- A team **Viewer** with the **Member** role in a particular registry is effectively a **Member** of the registry. - -### SDK compatibility - -{{% alert title="SDK version requirement" %}} -To use the W&B SDK to access artifacts as a **Restricted Viewer**, you must use W&B SDK version 0.19.9 or higher. Otherwise, some SDK commands will result in permission errors. -{{% /alert %}} - -When a **Restricted Viewer** uses the SDK, certain functions are not available or work differently. - -The following methods are not available and result in permission errors: -- [`Run.use_artifact()`]({{< relref "/ref/python/experiments/run/#method-runuse_artifact" >}}) -- [`Artifact.download()`]({{< relref "/ref/python/experiments/artifact/#method-artifactdownload" >}}) -- [`Artifact.file()`]({{< relref "/ref/python/experiments/artifact/#method-artifactfile" >}}) -- [`Artifact.files()`]({{< relref "/ref/python/experiments/artifact/#method-artifactfiles" >}}) - -The following methods are limited to artifact metadata: -- [`Artifact.get_entry()`]({{< relref "/ref/python/experiments/artifact/#method-artifactget_entry" >}}) -- [`Artifact.get_path()`]({{< relref "/ref/python/experiments/artifact/#method-artifactget_path" >}}) -- [`Artifact.get()`]({{< relref "/ref/python/experiments/artifact/#method-artifactget" >}}) -- [`Artifact.verify()`]({{< relref "/ref/python/experiments/artifact/#method-artifactverify" >}}) - -### Cross-registry permissions - -A user can have different roles in different registries. For example, a user can be a **Restricted Viewer** in Registry A but a **Viewer** in Registry B. In this case: - -- The same artifact linked to both registries will have different access levels -- In Registry A, the user is a **Restricted Viewer** and cannot download files or use the artifact -- In Registry B, the user is a **Viewer** and can download files and use the artifact -- In other words, access is determined by the registry in which the artifact is accessed diff --git a/content/en/guides/core/registry/create_collection.md b/content/en/guides/core/registry/create_collection.md deleted file mode 100644 index 304265437b..0000000000 --- a/content/en/guides/core/registry/create_collection.md +++ /dev/null @@ -1,166 +0,0 @@ ---- -menu: - default: - identifier: create_collection - parent: registry -title: Create a collection -weight: 4 ---- - - -A *collection* is a set of linked artifact versions within a registry. Each collection represents a distinct task or use case. - -For example, within the core Dataset registry you might have multiple collections. Each collection contains a different dataset such as MNIST, CIFAR-10, or ImageNet. - -As another example, you might have a registry called "chatbot" that contains a collection for model artifacts, another collection for dataset artifacts, and another collection for fine-tuned model artifacts. - -How you organize a registry and their collections is up to you. - -{{% alert %}} -If you are familiar with W&B Model Registry, you might aware of registered models. Registered models in the Model Registry are now referred to as collections in the W&B Registry. -{{% /alert %}} - -## Collection types - -Each collection accepts one, and only one, *type* of artifact. The type you specify restricts what sort of artifacts you, and other members of your organization, can link to that collection. - -{{% alert %}} -You can think of artifact types similar to data types in programming languages such as Python. In this analogy, a collection can store strings, integers, or floats but not a mix of these data types. -{{% /alert %}} - -For example, suppose you create a collection that accepts "dataset" artifact types. This means that you can only link future artifact versions that have the type "dataset" to this collection. Similarly, you can only link artifacts of type "model" to a collection that accepts only model artifact types. - -{{% alert %}} -You specify an artifact's type when you create that artifact object. Note the `type` field in `wandb.Artifact()`: - -```python -import wandb - -# Initialize a run -run = wandb.init( - entity = "", - project = "" - ) - -# Create an artifact object -artifact = wandb.Artifact( - name="", - type="" - ) -``` -{{% /alert %}} - - -When you create a collection, you can select from a list of predefined artifact types. The artifact types available to you depend on the registry that the collection belongs to. . - -Before you link an artifact to a collection or create a new collection, [investigate the types of artifacts that collection accepts]({{< relref "#check-the-types-of-artifact-that-a-collection-accepts" >}}). - -### Check the types of artifact that a collection accepts - -Before you link to a collection, inspect the artifact type that the collection accepts. You can inspect the artifact types that collection accepts programmatically with the W&B Python SDK or interactively with the W&B App - -{{% alert %}} -An error message appears if you try to create link an artifact to a collection that does not accept that artifact type. -{{% /alert %}} - -{{< tabpane text=true >}} - {{% tab header="W&B App" %}} -You can find the accepted artifact types on the registry card on the homepage or within a registry's settings page. - -For both methods, first navigate to your W&B Registry App. - -Within the homepage of the Registry App, you can view the accepted artifact types by scrolling to the registry card of that registry. The gray horizontal ovals within the registry card lists the artifact types that registry accepts. - -{{< img src="/images/registry/artifact_types_model_card.png" alt="Artifact types selection" >}} - -For example, the preceding image shows multiple registry cards on the Registry App homepage. Within the **Model** registry card, you can see two artifact types: **model** and **model-new**. - - -To view accepted artifact types within a registry's settings page: - -1. Click on the registry card you want to view the settings for. -2. Click on the gear icon in the upper right corner. -3. Scroll to the **Accepted artifact types** field. - {{% /tab %}} - {{% tab header="Python SDK (Beta)" %}} -Programmatically view the artifact types that a registry accepts with the W&B Python SDK: - -```python -import wandb - -registry_name = "" -artifact_types = wandb.Api().project(name=f"wandb-registry-{registry_name}").artifact_types() -print(artifact_type.name for artifact_type in artifact_types) -``` - -{{% alert %}} -Note that you do not initialize a run with the proceeding code snippet. This is because it is unnecessary to create a run if you are only querying the W&B API and not tracking an experiment, artifact and so on. -{{% /alert %}} - {{% /tab %}} -{{< /tabpane >}} - - - -Once you know what type of artifact a collection accepts, you can [create a collection]({{< relref "#create-a-collection" >}}). - - -## Create a collection - -Interactively or programmatically create a collection within a registry. You can not change the type of artifact that a collection accepts after you create it. - -### Programmatically create a collection - -Use the `wandb.init.link_artifact()` method to link an artifact to a collection. Specify both the collection and the registry to the `target_path` field as a path that takes the form of: - -```python -f"wandb-registry-{registry_name}/{collection_name}" -``` - -Where `registry_name` is the name of the registry and `collection_name` is the name of the collection. Ensure to append the prefix `wandb-registry-` to the registry name. - -{{% alert %}} -W&B automatically creates a collection for you if you try to link an artifact to a collection that does not exist. If you specify a collection that does exists, W&B links the artifact to the existing collection. -{{% /alert %}} - -The proceeding code snippet shows how to programmatically create a collection. Ensure to replace other the values enclosed in `<>` with your own: - -```python -import wandb - -# Initialize a run -run = wandb.init(entity = "", project = "") - -# Create an artifact object -artifact = wandb.Artifact( - name = "", - type = "" - ) - -registry_name = "" -collection_name = "" -target_path = f"wandb-registry-{registry_name}/{collection_name}" - -# Link the artifact to a collection -run.link_artifact(artifact = artifact, target_path = target_path) - -run.finish() -``` - -### Interactively create a collection - -The following steps describe how to create a collection within a registry using the W&B Registry App UI: - -1. Navigate to the **Registry** App in the W&B App UI. -2. Select a registry. -3. Click on the **Create collection** button in the upper right hand corner. -4. Provide a name for your collection in the **Name** field. -5. Select a type from the **Type** dropdown. Or, if the registry enables custom artifact types, provide one or more artifact types that this collection accepts. -6. Optionally provide a description of your collection in the **Description** field. -7. Optionally add one or more tags in the **Tags** field. -8. Click **Link version**. -9. From the **Project** dropdown, select the project where your artifact is stored. -10. From the **Artifact** collection dropdown, select your artifact. -11. From the **Version** dropdown, select the artifact version you want to link to your collection. -12. Click on the **Create collection** button. - -{{< img src="/images/registry/create_collection.gif" alt="Create a new collection" >}} \ No newline at end of file diff --git a/content/en/guides/core/registry/create_registry.md b/content/en/guides/core/registry/create_registry.md deleted file mode 100644 index 981c1ea089..0000000000 --- a/content/en/guides/core/registry/create_registry.md +++ /dev/null @@ -1,96 +0,0 @@ ---- -menu: - default: - identifier: create_registry - parent: registry -title: Create a custom registry -weight: 2 ---- - -A custom registry offers flexibility and control over the artifact types that you can use, allows you to restrict the registry's visibility, and more. - -{{% pageinfo color="info" %}} -See the summary table in [Registry types]({{< relref "registry_types.md#summary" >}}) for a complete comparison of core and custom registries. -{{% /pageinfo %}} - - -## Create a custom registry - -Create a custom registry either programmatically using the Registry App or the W&B Python SDK. - -{{< tabpane text=true >}} - {{% tab header="Registry App" %}} - -1. Navigate to the **Registry** App at https://wandb.ai/registry/. -2. Within **Custom registry**, click on the **Create registry** button. -3. Provide a name for your registry in the **Name** field. -4. Optionally provide a description about the registry. -5. Select who can view the registry from the **Registry visibility** dropdown. See [Registry visibility types]({{< relref "./configure_registry.md#registry-visibility-types" >}}) for more information on registry visibility options. -6. Select either **All types** or **Specify types** from the **Accepted artifacts type** dropdown. -7. (If you select **Specify types**) Add one or more artifact types that your registry accepts. -8. Click on the **Create registry** button. - - {{% /tab %}} - {{% tab header="Python SDK" %}} - -Use the [`wandb.Api().create_registry()`]({{< relref "/ref/python/public-api/Api/#method-apicreate_registry" >}}) method to create a custom registry programmatically. Provide a name and [visibility](#visibility-types) for the registry for the `name` and `visibility` parameters, respectively. - -Copy and paste the code block below. Replace the values enclosed in `<>` with your own: - -```python -import wandb - -registry = wandb.Api().create_registry( - name="", - visibility="< 'restricted' | 'organization' >", -) -``` - -See the [`wandb.Api().create_registry()`]({{< relref "/ref/python/public-api/Api/#method-apicreate_registry" >}}) method reference for a full list of parameters that you can provide when you create a custom registry. - -{{% /tab %}} -{{< /tabpane >}} - -{{% alert %}} -An artifact type cannot be removed from a registry once it is saved in the registry's settings. -{{% /alert %}} - -For example, the proceeding image shows a custom registry called `Fine_Tuned_Models` that a user is about to create. The registry is **Restricted** to only members that are manually added to the registry. - -{{< img src="/images/registry/create_registry.gif" alt="Creating a new registry" >}} - -## Visibility types - -The *visibility* of a registry determines who can access that registry. Restricting the visibility of a custom registry helps ensure that only specified members can access that registry. - -There are two type registry visibility options for a custom registry: - -| Visibility | Description | -| --- | --- | -| Restricted | Only invited organization members can access the registry.| -| Organization | Everyone in the org can access the registry. | - -A team administrator or registry administrator can set the visibility of a custom registry. - -The user who creates a custom registry with Restricted visibility is added to the registry automatically as its registry admin. - - -## Configure the visibility of a custom registry - -A team administrator or registry administrator can assign the visibility of a custom registry during or after the creation of a custom registry. - -To restrict the visibility of an existing custom registry: - -1. Navigate to the **Registry** App at https://wandb.ai/registry/. -2. Select a registry. -3. Click on the gear icon on the upper right hand corner. -4. From the **Registry visibility** dropdown, select the desired registry visibility. -5. if you select **Restricted visibility**: - 1. Add members of your organization that you want to have access to this registry. Scroll to the **Registry members and roles** section and click on the **Add member** button. - 2. Within the **Member** field, add the email or username of the member you want to add. - 3. Click **Add new member**. - -{{< img src="/images/registry/change_registry_visibility.gif" alt="Changing registry visibility settings from private to public or team-restricted access" >}} - -See [Create a custom registry]({{< relref "./create_registry.md#create-a-custom-registry" >}}) for more information on how assign the visibility of a custom registry when a team administrator creates it. - diff --git a/content/en/guides/core/registry/delete_registry.md b/content/en/guides/core/registry/delete_registry.md deleted file mode 100644 index 2b69b45b1d..0000000000 --- a/content/en/guides/core/registry/delete_registry.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -menu: - default: - identifier: delete_registry - parent: registry -title: Delete registry -weight: 8 ---- - -This page shows how a Team admin or Registry admin can delete a custom registry. A [core registry]({{< relref "/guides/core/registry/registry_types#core-registry" >}}) cannot be deleted. - -- A Team admin can delete any custom registry in the organization. -- A Registry admin can delete a custom registry that they created. - -Deleting a registry also deletes collections that belong to that registry, but does not delete artifacts linked to the registry. Such an artifact remains in the original project that the artifact was logged to. - - -{{< tabpane text=true >}} -{{% tab header="Python SDK" value="python" %}} - -Use the `wandb` API's `delete()` method to delete a registry programmatically. The following example illustrates how to: - -1. Fetch the registry you want to delete with `api.registry()`. -1. Call the `delete()` method on the returned registry object to delete the registry. - -```python -import wandb - -# Initialize the W&B API -api = wandb.Api() - -# Fetch the registry you want to delete -fetched_registry = api.registry("") - -# Deleting a registry -fetched_registry.delete() -``` - -{{% /tab %}} - -{{% tab header="W&B App" value="app" %}} - -1. Navigate to the **Registry** App at https://wandb.ai/registry/. -2. Select the custom registry you want to delete. -3. Click the gear icon in the upper right corner to view the registry's settings. -4. To delete the registry, click the trash can icon in the upper right corner of the settings page. -5. Confirm the registry to delete by entering its name in the modal that appears, then click **Delete**. - -{{% /tab %}} -{{< /tabpane >}} \ No newline at end of file diff --git a/content/en/guides/core/registry/download_use_artifact.md b/content/en/guides/core/registry/download_use_artifact.md deleted file mode 100644 index c3b7688550..0000000000 --- a/content/en/guides/core/registry/download_use_artifact.md +++ /dev/null @@ -1,140 +0,0 @@ ---- -menu: - default: - identifier: download_use_artifact - parent: registry -title: Download an artifact from a registry -weight: 6 ---- - -Use the W&B Python SDK to download an artifact linked to a registry. To download and use an artifact, you need to know the name of the registry, the name of the collection, and the alias or index of the artifact version you want to download. - -Once you know the properties of the artifact, you can [construct the path to the linked artifact]({{< relref "#construct-path-to-linked-artifact" >}}) and download the artifact. Alternatively, you can [copy and paste a pre-generated code snippet]({{< relref "#copy-and-paste-pre-generated-code-snippet" >}}) from the W&B App UI to download an artifact linked to a registry. - - -## Construct path to linked artifact - -To download an artifact linked to a registry, you must know the path of that linked artifact. The path consists of the registry name, collection name, and the alias or index of the artifact version you want to access. - -Once you have the registry, collection, and alias or index of the artifact version, you can construct the path to the linked artifact using the proceeding string template: - -```python -# Artifact name with version index specified -f"wandb-registry-{REGISTRY}/{COLLECTION}:v{INDEX}" - -# Artifact name with alias specified -f"wandb-registry-{REGISTRY}/{COLLECTION}:{ALIAS}" -``` - -Replace the values within the curly braces `{}` with the name of the registry, collection, and the alias or index of the artifact version you want to access. - -{{% alert %}} -Specify `model` or `dataset` to link an artifact version to the core Model registry or the core Dataset registry, respectively. -{{% /alert %}} - -Use the `wandb.init.use_artifact` method to access the artifact and download its contents once you have the path of the linked artifact. The proceeding code snippet shows how to use and download an artifact linked to the W&B Registry. Ensure to replace values within `<>` with your own: - -```python -import wandb - -REGISTRY = '' -COLLECTION = '' -ALIAS = '' - -run = wandb.init( - entity = '', - project = '' - ) - -artifact_name = f"wandb-registry-{REGISTRY}/{COLLECTION}:{ALIAS}" -# artifact_name = '' # Copy and paste Full name specified on the Registry App -fetched_artifact = run.use_artifact(artifact_or_name = artifact_name) -download_path = fetched_artifact.download() -``` - -The `.use_artifact()` method both creates a [run]({{< relref "/guides/models/track/runs/" >}}) and marks the artifact you download as the input to that run. -Marking an artifact as the input to a run enables W&B to track the lineage of that artifact. - -If you do not want to create a run, you can use the `wandb.Api()` object to access the artifact: - -```python -import wandb - -REGISTRY = "" -COLLECTION = "" -VERSION = "" - -api = wandb.Api() -artifact_name = f"wandb-registry-{REGISTRY}/{COLLECTION}:{VERSION}" -artifact = api.artifact(name = artifact_name) -``` - -
-Example: Use and download an artifact linked to the W&B Registry - -The proceeding code example shows how a user can download an artifact linked to a collection called `phi3-finetuned` in the **Fine-tuned Models** registry. The alias of the artifact version is set to `production`. - -```python -import wandb - -TEAM_ENTITY = "product-team-applications" -PROJECT_NAME = "user-stories" - -REGISTRY = "Fine-tuned Models" -COLLECTION = "phi3-finetuned" -ALIAS = 'production' - -# Initialize a run inside the specified team and project -run = wandb.init(entity=TEAM_ENTITY, project = PROJECT_NAME) - -artifact_name = f"wandb-registry-{REGISTRY}/{COLLECTION}:{ALIAS}" - -# Access an artifact and mark it as input to your run for lineage tracking -fetched_artifact = run.use_artifact(artifact_or_name = name) - -# Download artifact. Returns path to downloaded contents -downloaded_path = fetched_artifact.download() -``` -
- - - -See [`use_artifact`]({{< relref "/ref/python/experiments/run.md#use_artifact" >}}) and [`Artifact.download()`]({{< relref "/ref/python/experiments/artifact.md#download" >}}) in the API Reference for parameters and return type. - -{{% alert title="Users with a personal entity that belong to multiple organizations" %}} -Users with a personal entity that belong to multiple organizations must also specify either the name of their organization or use a team entity when accessing artifacts linked to a registry. - -```python -import wandb - -REGISTRY = "" -COLLECTION = "" -VERSION = "" - -# Ensure you are using your team entity to instantiate the API -api = wandb.Api(overrides={"entity": ""}) -artifact_name = f"wandb-registry-{REGISTRY}/{COLLECTION}:{VERSION}" -artifact = api.artifact(name = artifact_name) - -# Use org display name or org entity in the path -api = wandb.Api() -artifact_name = f"{ORG_NAME}/wandb-registry-{REGISTRY}/{COLLECTION}:{VERSION}" -artifact = api.artifact(name = artifact_name) -``` - -Where the `ORG_NAME` is the display name of your organization. Multi-tenant SaaS users can find the name of their organization in the organization's settings page at `https://wandb.ai/account-settings/`. Dedicated Cloud and Self-Managed users, contact your account administrator to confirm your organization's display name. -{{% /alert %}} - -## Copy and paste pre-generated code snippet - -W&B creates a code snippet that you can copy and paste into your Python script, notebook, or terminal to download an artifact linked to a registry. - -1. Navigate to the Registry App. -2. Select the name of the registry that contains your artifact. -3. Select the name of the collection. -4. From the list of artifact versions, select the version you want to access. -5. Select the **Usage** tab. -6. Copy the code snippet shown in the **Usage API** section. -7. Paste the code snippet into your Python script, notebook, or terminal. - -{{< img src="/images/registry/find_usage_in_registry_ui.gif" >}} \ No newline at end of file diff --git a/content/en/guides/core/registry/lineage.md b/content/en/guides/core/registry/lineage.md deleted file mode 100644 index 202d7f3dd2..0000000000 --- a/content/en/guides/core/registry/lineage.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -description: Create a lineage map in the W&B Registry. -menu: - default: - parent: registry - identifier: lineage -title: Create and view lineage maps -weight: 8 ---- - -Within a collection in the W&B Registry, you can view a history of the artifacts that an ML experiment uses. This history is called a _lineage graph_. - -{{% pageinfo color="info" %}} -You can also view lineage graphs for artifacts you log to W&B that are not part of a collection. -{{% /pageinfo %}} - -Lineage graphs can show the specific run that logs an artifact. In addition, lineage graphs can also show which run used an artifact as an input. In other words, lineage graphs can show the input and output of a run. - - -For example, the proceeding image shows artifacts created and used throughout an ML experiment: - -{{< img src="/images/registry/registry_lineage.png" alt="Registry lineage" >}} - -From left to right, the image shows: -1. Multiple runs log the `split_zoo_dataset:v4` artifact. -2. The "rural-feather-20" run uses the `split_zoo_dataset:v4` artifact for training. -3. The output of the "rural-feather-20" run is a model artifact called `zoo-ylbchv20:v0`. -4. A run called "northern-lake-21" uses the model artifact `zoo-ylbchv20:v0` to evaluate the model. - - -## Track the input of a run - -Mark an artifact as an input or dependency of a run with the `wandb.init.use_artifact` API. - -The proceeding code snippet shows how to use the `use_artifact`. Replace values enclosed in angle brackets (`< >`) with your values: - -```python -import wandb - -# Initialize a run -run = wandb.init(project="", entity="") - -# Get artifact, mark it as a dependency -artifact = run.use_artifact(artifact_or_name="", aliases="") -``` - - -## Track the output of a run - -Use ([`wandb.init.log_artifact`]({{< relref "/ref/python/experiments/run.md#log_artifact" >}})) to declare an artifact as an output of a run. - -The proceeding code snippet shows how to use the `wandb.init.log_artifact` API. Ensure to replace values enclosed in angle brackets (`< >`) with your values: - -```python -import wandb - -# Initialize a run -run = wandb.init(entity "", project = "",) -artifact = wandb.Artifact(name = "", type = "") -artifact.add_file(local_path = "", name="") - -# Log the artifact as an output of the run -run.log_artifact(artifact_or_path = artifact) -``` - -For more information on about creating artifacts, see [Create an artifact]({{< relref "guides/core/artifacts/construct-an-artifact.md" >}}). - - -## View lineage graphs in a collection - -View the lineage of an artifact linked to a collection in the W&B Registry. - -1. Navigate to the W&B Registry. -2. Select the collection that contains the artifact. -3. From the dropdown, click the artifact version you want to view its lineage graph. -4. Select the "Lineage" tab. - - -Once you are in an artifact's lineage graph page, you can view additional information about any node in that lineage graph. - -Select a run node to view that run's details, such as the run's ID, the run's name, the run's state, and more. As an example, the proceeding image shows information about the `rural-feather-20` run: - -{{< img src="/images/registry/lineage_expanded_node.png" alt="Expanded lineage node" >}} - -Select an artifact node to view that artifact's details, such as its full name, type, creation time, and associated aliases. - -{{< img src="/images/registry/lineage_expanded_artifact_node.png" alt="Expanded artifact node details" >}} \ No newline at end of file diff --git a/content/en/guides/core/registry/link_version.md b/content/en/guides/core/registry/link_version.md deleted file mode 100644 index 33c7c409db..0000000000 --- a/content/en/guides/core/registry/link_version.md +++ /dev/null @@ -1,226 +0,0 @@ ---- -menu: - default: - identifier: link_version - parent: registry -title: Link an artifact version to a registry -weight: 5 ---- - -Link artifact versions to a collection to make them available to other members in your organization. - -When you link an artifact to a registry, this "publishes" that artifact to that registry. Any user that has access to that registry can access the linked artifact versions in the collection. - -In other words, linking an artifact to a registry collection brings that artifact version from a private, project-level scope, to a shared organization level scope. - -{{% alert %}} -The term "type" refers to the artifact object's type. When you create an artifact object ([`wandb.Artifact`]({{< relref "/ref/python/experiments/artifact.md" >}})), or log an artifact ([`wandb.init.log_artifact`]({{< relref "/ref/python/experiments/run.md#log_artifact" >}})), you specify a type for the `type` parameter. - -{{% /alert %}} - -## Link an artifact to a collection - -Link an artifact version to a collection interactively or programmatically. - -{{% alert %}} -Before you link an artifact to a registry, check the types of artifacts that collection permits. For more information about collection types, see "Collection types" within [Create a collection]({{< relref "./create_collection.md" >}}). -{{% /alert %}} - -Based on your use case, follow the instructions described in the tabs below to link an artifact version. - -{{% alert %}} -If an artifact version logs metrics (such as by using `run.log_artifact()`), you can view metrics for that version from its details page, and you can compare metrics across artifact versions from the artifact's page. Refer to [View linked artifacts in a registry]({{< relref "#view-linked-artifacts-in-a-registry" >}}). -{{% /alert %}} - -{{< tabpane text=true >}} - {{% tab header="Python SDK" %}} -{{% alert %}} -Watch a [video demonstrating linking a version](https://www.youtube.com/watch?v=2i_n1ExgO0A) (8 min). -{{% /alert %}} - -Programmatically link an artifact version to a collection with [`wandb.init.Run.link_artifact()`]({{< relref "/ref/python/experiments/run.md#link_artifact" >}}). - -{{% alert %}} -Before you link an artifact to a collection, ensure that the registry that the collection belongs to already exists. To check that the registry exists, navigate to the Registry app on the W&B App UI and search for the name of the registry. -{{% /alert %}} - -Use the `target_path` parameter to specify the collection and registry you want to link the artifact version to. The target path consists of the prefix "wandb-registry", the name of the registry, and the name of the collection separated by a forward slashes: - -```text -wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME} -``` - -Copy and paste the code snippet below to link an artifact version to a collection within an existing registry. Replace values enclosed in `<>` with your own: - -```python -import wandb - -# Initialize a run -run = wandb.init( - entity = "", - project = "" -) - -# Create an artifact object -# The type parameter specifies both the type of the -# artifact object and the collection type -artifact = wandb.Artifact(name = "", type = "") - -# Add the file to the artifact object. -# Specify the path to the file on your local machine. -artifact.add_file(local_path = "") - -# Specify the collection and registry to link the artifact to -REGISTRY_NAME = "" -COLLECTION_NAME = "" -target_path=f"wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}" - -# Link the artifact to the collection -run.link_artifact(artifact = artifact, target_path = target_path) -``` -{{% alert %}} -If you want to link an artifact version to the Model registry or the Dataset registry, set the artifact type to `"model"` or `"dataset"`, respectively. -{{% /alert %}} - - {{% /tab %}} - {{% tab header="Registry App" %}} -1. Navigate to the Registry App. - {{< img src="/images/registry/navigate_to_registry_app.png" alt="Registry App navigation" >}} -2. Hover your mouse next to the name of the collection you want to link an artifact version to. -3. Select the meatball menu icon (three horizontal dots) next to **View details**. -4. From the dropdown, select **Link new version**. -5. From the sidebar that appears, select the name of a team from the **Team** dropdown. -5. From the **Project** dropdown, select the name of the project that contains your artifact. -6. From the **Artifact** dropdown, select the name of the artifact. -7. From the **Version** dropdown, select the artifact version you want to link to the collection. - - - {{% /tab %}} - {{% tab header="Artifact browser" %}} -1. Navigate to your project's artifact browser on the W&B App at: `https://wandb.ai///artifacts` -2. Select the Artifacts icon on the left sidebar. -3. Click on the artifact version you want to link to your registry. -4. Within the **Version overview** section, click the **Link to registry** button. -5. From the modal that appears on the right of the screen, select an artifact from the **Select a register model** menu dropdown. -6. Click **Next step**. -7. (Optional) Select an alias from the **Aliases** dropdown. -8. Click **Link to registry**. - - - - {{% /tab %}} -{{< /tabpane >}} - - - - - -View a linked artifact's metadata, version data, usage, lineage information and more in the Registry App. - -## View linked artifacts in a registry - -View information about linked artifacts such as metadata, lineage, and usage information in the Registry App. - -1. Navigate to the Registry App. -2. Select the name of the registry that you linked the artifact to. -3. Select the name of the collection. -4. If the collection's artifacts log metrics, compare metrics across versions by clicking **Show metrics**. -4. From the list of artifact versions, select the version you want to access. Version numbers are incrementally assigned to each linked artifact version starting with `v0`. -5. To view details about an artifact version, click the version. From the tabs in this page, you can view that version's metadata (including logged metrics), lineage, and usage information. - -Make note of the **Full Name** field within the **Version** tab. The full name of a linked artifact consists of the registry, collection name, and the alias or index of the artifact version. - -```text title="Full name of a linked artifact" -wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}:v{INTEGER} -``` - -You need the full name of a linked artifact to access the artifact version programmatically. - -## Troubleshooting - -Below are some common things to double check if you are not able to link an artifact. - -### Logging artifacts from a personal account - -Artifacts logged to W&B with a personal entity can not be linked to the registry. Make sure that you log artifacts using a team entity within your organization. Only artifacts logged within an organization's team can be linked to the organization's registry. - - -{{% alert title="" %}} -Ensure that you log an artifact with a team entity if you want to link that artifact to a registry. -{{% /alert %}} - - -#### Find your team entity - -W&B uses the name of your team as the team's entity. For example, if your team is called **team-awesome**, your team entity is `team-awesome`. - -You can confirm the name of your team by: - -1. Navigate to your team's W&B profile page. -2. Copy the site's URL. It has the form of `https://wandb.ai/`. Where `` is the both the name of your team and the team's entity. - -#### Log from a team entity -1. Specify the team as the entity when you initialize a run with [`wandb.init()`]({{< relref "/ref/python/functions/init.md" >}}). If you do not specify the `entity` when you initialize a run, the run uses your default entity which may or may not be your team entity. - - ```python - import wandb - - run = wandb.init( - entity='', - project='' - ) - ``` - -2. Log the artifact to the run either with run.log_artifact or by creating an Artifact object and then adding files to it with: - - ```python - artifact = wandb.Artifact(name="", type="") - ``` - To log artifacts, see [Construct artifacts]({{< relref "/guides/core/artifacts/construct-an-artifact.md" >}}). -3. If an artifact is logged to your personal entity, you will need to re-log it to an entity within your organization. - -### Confirm the path of a registry in the W&B App UI - -There are two ways to confirm the path of a registry with the UI: create an empty collection and view the collection details or copy and paste the autogenerated code on the collection's homepage. - -#### Copy and paste autogenerated code - -1. Navigate to the Registry app at https://wandb.ai/registry/. -2. Click the registry you want to link an artifact to. -3. At the top of the page, you will see an autogenerated code block. -4. Copy and paste this into your code, ensure to replace the last part of the path with the name of your collection. - -{{< img src="/images/registry/get_autogenerated_code.gif" alt="Auto-generated code snippet" >}} - -#### Create an empty collection - -1. Navigate to the Registry app at https://wandb.ai/registry/. -2. Click the registry you want to link an artifact to. -4. Click on the empty collection. If an empty collection does not exist, create a new collection. -5. Within the code snippet that appears, identify the `target_path` field within `.link_artifact()`. -6. (Optional) Delete the collection. - -{{< img src="/images/registry/check_empty_collection.gif" alt="Create an empty collection" >}} - -For example, after completing the steps outlined, you find the code block with the `target_path` parameter: - -```python -target_path = - "smle-registries-bug-bash/wandb-registry-Golden Datasets/raw_images" -``` - -Breaking this down into its components, you can see what you will need to use to create the path to link your artifact programmatically: - -```python -ORG_ENTITY_NAME = "smle-registries-bug-bash" -REGISTRY_NAME = "Golden Datasets" -COLLECTION_NAME = "raw_images" -``` - -{{% alert %}} -Ensure that you replace the name of the collection from the temporary collection with the name of the collection that you want to link your artifact to. -{{% /alert %}} \ No newline at end of file diff --git a/content/en/guides/core/registry/model_registry/_index.md b/content/en/guides/core/registry/model_registry/_index.md deleted file mode 100644 index f6811d0154..0000000000 --- a/content/en/guides/core/registry/model_registry/_index.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -description: Model registry to manage the model lifecycle from training to production -menu: - default: - identifier: model-registry - parent: registry -title: Model registry -weight: 9 -url: guides/registry/model_registry -cascade: -- url: guides/registry/model_registry/:filename ---- - -{{% alert %}} -W&B will eventually stop supporting W&B Model Registry. Users are encouraged to instead use [W&B Registry]({{< relref "/guides/core/registry/" >}}) for linking and sharing their model artifacts versions. W&B Registry broadens the capabilities of the legacy W&B Model Registry. For more information about W&B Registry, see the [Registry docs]({{< relref "/guides/core/registry/" >}}). - - -W&B will migrate existing model artifacts linked to the legacy Model Registry to the new W&B Registry in the near future. See [Migrating from legacy Model Registry]({{< relref "/guides/core/registry/model_registry_eol.md" >}}) for information about the migration process. -{{% /alert %}} - -The W&B Model Registry houses a team's trained models where ML Practitioners can publish candidates for production to be consumed by downstream teams and stakeholders. It is used to house staged/candidate models and manage workflows associated with staging. - -{{< img src="/images/models/model_reg_landing_page.png" alt="Model Registry" >}} - -With W&B Model Registry, you can: - -* [Bookmark your best model versions for each machine learning task.]({{< relref "./link-model-version.md" >}}) -* [Automate]({{< relref "/guides/core/automations/" >}}) downstream processes and model CI/CD. -* Move model versions through its ML lifecycle; from staging to production. -* Track a model's lineage and audit the history of changes to production models. - -{{< img src="/images/models/models_landing_page.png" alt="Models overview" >}} - -## How it works -Track and manage your staged models with a few simple steps. - -1. **Log a model version**: In your training script, add a few lines of code to save the model files as an artifact to W&B. -2. **Compare performance**: Check live charts to compare the metrics and sample predictions from model training and validation. Identify which model version performed the best. -3. **Link to registry**: Bookmark the best model version by linking it to a registered model, either programmatically in Python or interactively in the W&B UI. - -The following code snippet demonstrates how to log and link a model to the Model Registry: - -```python -import wandb -import random - -# Start a new W&B run -run = wandb.init(project="models_quickstart") - -# Simulate logging model metrics -run.log({"acc": random.random()}) - -# Create a simulated model file -with open("my_model.h5", "w") as f: - f.write("Model: " + str(random.random())) - -# Log and link the model to the Model Registry -run.link_model(path="./my_model.h5", registered_model_name="MNIST") - -run.finish() -``` - -4. **Connect model transitions to CI/CD workflows**: transition candidate models through workflow stages and [automate downstream actions]({{< relref "/guides/core/automations/" >}}) with webhooks. - - -## How to get started -Depending on your use case, explore the following resources to get started with W&B Models: - -* Check out the two-part video series: - 1. [Logging and registering models](https://www.youtube.com/watch?si=MV7nc6v-pYwDyS-3&v=ZYipBwBeSKE&feature=youtu.be) - 2. [Consuming models and automating downstream processes](https://www.youtube.com/watch?v=8PFCrDSeHzw) in the Model Registry. -* Read the [models walkthrough]({{< relref "./walkthrough.md" >}}) for a step-by-step outline of the W&B Python SDK commands you could use to create, track, and use a dataset artifact. -* Learn about: - * [Protected models and access control]({{< relref "./access_controls.md" >}}). - * [How to connect Registry to CI/CD processes]({{< relref "/guides/core/automations/" >}}). - * Set up [Slack notifications]({{< relref "./notifications.md" >}}) when a new model version is linked to a registered model. -* Review [What is an ML Model Registry?](https://wandb.ai/wandb_fc/model-registry-reports/reports/What-is-an-ML-Model-Registry---Vmlldzo1MTE5MjYx) to learn how to integrate Model Registry into your ML workflow. -* Take the W&B [Enterprise Model Management](https://www.wandb.courses/courses/enterprise-model-management) course and learn how to: - * Use the W&B Model Registry to manage and version your models, track lineage, and promote models through different lifecycle stages - * Automate your model management workflows using webhooks. - * See how the Model Registry integrates with external ML systems and tools in your model development lifecycle for model evaluation, monitoring, and deployment. diff --git a/content/en/guides/core/registry/model_registry/access_controls.md b/content/en/guides/core/registry/model_registry/access_controls.md deleted file mode 100644 index 2542702c60..0000000000 --- a/content/en/guides/core/registry/model_registry/access_controls.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -description: Use model registry role based access controls (RBAC) to control who can - update protected aliases. -menu: - default: - identifier: access_controls - parent: model-registry -title: Manage data governance and access control -weight: 10 ---- - -Use *protected aliases* to represent key stages of your model development pipeline. Only *Model Registry Administrators* can add, modify, or remove protected aliases. Model registry admins can define and use protected aliases. W&B blocks non admin users from adding or removing protected aliases from model versions. - -{{% alert %}} -Only Team admins or current registry admins can manage the list of registry admins. -{{% /alert %}} - -For example, suppose you set `staging` and `production` as protected aliases. Any member of your team can add new model versions. However, only admins can add a `staging` or `production` alias. - - -## Set up access control -The following steps describe how to set up access controls for your team’s model registry. - -1. Navigate to the [W&B Model Registry app](https://wandb.ai/registry/model). -2. Select the gear button on the top right of the page. -{{< img src="/images/models/rbac_gear_button.png" alt="Registry settings gear" >}} -3. Select the **Manage registry admins** button. -4. Within the **Members** tab, select the users you want to grant access to add and remove protected aliases from model versions. -{{< img src="/images/models/access_controls_admins.gif" alt="Managing registry admins" >}} - - -## Add protected aliases -1. Navigate to the [W&B Model Registry app](https://wandb.ai/registry/model). -2. Select the gear button on the top right of the page. -{{< img src="/images/models/rbac_gear_button.png" alt="Registry settings gear button" >}} -3. Scroll down to the **Protected Aliases** section. -4. Click on the plus icon (**+**) icon to add new a new alias. -{{< img src="/images/models/access_controls_add_protected_aliases.gif" alt="Adding protected aliases" >}} \ No newline at end of file diff --git a/content/en/guides/core/registry/model_registry/consume-models.md b/content/en/guides/core/registry/model_registry/consume-models.md deleted file mode 100644 index 6ab2be8953..0000000000 --- a/content/en/guides/core/registry/model_registry/consume-models.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -description: How to download a model with W&B Python SDK -menu: - default: - identifier: consume-models - parent: model-registry -title: Download a model version -weight: 8 ---- - -Use the W&B Python SDK to download a model artifact that you linked to the Model Registry. - -{{% alert %}} -You are responsible for providing additional Python functions, API calls to reconstruct, deserialize your model into a form that you can work with. - -W&B suggests that you document information on how to load models into memory with model cards. For more information, see the [Document machine learning models]({{< relref "./create-model-cards.md" >}}) page. -{{% /alert %}} - - -Replace values within `<>` with your own: - -```python -import wandb - -# Initialize a run -run = wandb.init(project="", entity="") - -# Access and download model. Returns path to downloaded artifact -downloaded_model_path = run.use_model(name="") -``` - -Reference a model version with one of following formats listed: - -* `latest` - Use `latest` alias to specify the model version that is most recently linked. -* `v#` - Use `v0`, `v1`, `v2`, and so on to fetch a specific version in the Registered Model -* `alias` - Specify the custom alias that you and your team assigned to your model version - -See [`use_model`]({{< relref "/ref/python/experiments/run.md#use_model" >}}) in the API Reference guide for more information on possible parameters and return type. - -
-Example: Download and use a logged model - -For example, in the proceeding code snippet a user called the `use_model` API. They specified the name of the model artifact they want to fetch and they also provided a version/alias. They then stored the path that returned from the API to the `downloaded_model_path` variable. - -```python -import wandb - -entity = "luka" -project = "NLP_Experiments" -alias = "latest" # semantic nickname or identifier for the model version -model_artifact_name = "fine-tuned-model" - -# Initialize a run -run = wandb.init() -# Access and download model. Returns path to downloaded artifact - -downloaded_model_path = run.use_model(name=f"{entity/project/model_artifact_name}:{alias}") -``` -
- - -{{% alert title="Planned deprecation for W&B Model Registry in 2024" %}} -The proceeding tabs demonstrate how to consume model artifacts using the soon to be deprecated Model Registry. - -Use the W&B Registry to track, organize and consume model artifacts. For more information see the [Registry docs]({{< relref "/guides/core/registry/" >}}). -{{% /alert %}} - -{{< tabpane text=true >}} - {{% tab header="CLI" %}} -Replace values within `<>` with your own: -```python -import wandb -# Initialize a run -run = wandb.init(project="", entity="") -# Access and download model. Returns path to downloaded artifact -downloaded_model_path = run.use_model(name="") -``` -Reference a model version with one of following formats listed: - -* `latest` - Use `latest` alias to specify the model version that is most recently linked. -* `v#` - Use `v0`, `v1`, `v2`, and so on to fetch a specific version in the Registered Model -* `alias` - Specify the custom alias that you and your team assigned to your model version - -See [`use_model`]({{< relref "/ref/python/experiments/run.md#use_model" >}}) in the API Reference guide for parameters and return type. - {{% /tab %}} - {{% tab header="W&B App" %}} -1. Navigate to the [Model Registry App](https://wandb.ai/registry/model). -2. Select **View details** next to the name of the registered model that contains the model you want to download. -3. Within the Versions section, select the View button next to the model version you want to download. -4. Select the **Files** tab. -5. Click on the download button next to the model file you want to download. -{{< img src="/images/models/download_model_ui.gif" alt="Download model from UI" >}} - {{% /tab %}} -{{< /tabpane >}} - diff --git a/content/en/guides/core/registry/model_registry/create-model-cards.md b/content/en/guides/core/registry/model_registry/create-model-cards.md deleted file mode 100644 index 0de8d46b60..0000000000 --- a/content/en/guides/core/registry/model_registry/create-model-cards.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -description: Add descriptions to model card to document your model -menu: - default: - identifier: create-model-cards - parent: model-registry -title: Document machine learning model -weight: 8 ---- - -Add a description to the model card of your registered model to document aspects of your machine learning model. Some topics worth documenting include: - -* **Summary**: A summary of what the model is. The purpose of the model. The machine learning framework the model uses, and so forth. -* **Training data**: Describe the training data used, processing done on the training data set, where is that data stored and so forth. -* **Architecture**: Information about the model architecture, layers, and any specific design choices. -* **Deserialize the model**: Provide information on how someone on your team can load the model into memory. -* **Task**: The specific type of task or problem that the machine learning model is designed to perform. It's a categorization of the model's intended capability. -* **License**: The legal terms and permissions associated with the use of the machine learning model. It helps model users understand the legal framework under which they can utilize the model. -* **References**: Citations or references to relevant research papers, datasets, or external resources. -* **Deployment**: Details on how and where the model is deployed and guidance on how the model is integrated into other enterprise systems, such as a workflow orchestration platforms. - -## Add a description to the model card - -1. Navigate to the [W&B Model Registry app](https://wandb.ai/registry/model). -2. Select **View details** next to the name of the registered model you want to create a model card for. -2. Go to the **Model card** section. -{{< img src="/images/models/model_card_example.png" alt="Model card example" >}} -3. Within the **Description** field, provide information about your machine learning model. Format text within a model card with [Markdown markup language](https://www.markdownguide.org/). - -For example, the following images shows the model card of a **Credit-card Default Prediction** registered model. -{{< img src="/images/models/model_card_credit_example.png" alt="Model card credit scoring" >}} \ No newline at end of file diff --git a/content/en/guides/core/registry/model_registry/create-registered-model.md b/content/en/guides/core/registry/model_registry/create-registered-model.md deleted file mode 100644 index c063151824..0000000000 --- a/content/en/guides/core/registry/model_registry/create-registered-model.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -description: Create a registered model to hold all the candidate models for your modeling - tasks. -menu: - default: - identifier: create-registered-model - parent: model-registry -title: Create a registered model -weight: 4 ---- - - -Create a [registered model]({{< relref "./model-management-concepts.md#registered-model" >}}) to hold all the candidate models for your modeling tasks. You can create a registered model interactively within the Model Registry or programmatically with the Python SDK. - -## Programmatically create registered a model -Programmatically register a model with the W&B Python SDK. W&B automatically creates a registered model for you if the registered model doesn't exist. - -Ensure to replace other the values enclosed in `<>` with your own: - -```python -import wandb - -run = wandb.init(entity="", project="") -run.link_model(path="", registered_model_name="") -run.finish() -``` - -The name you provide for `registered_model_name` is the name that appears in the [Model Registry App](https://wandb.ai/registry/model). - -## Interactively create a registered model -Interactively create a registered model within the [Model Registry App](https://wandb.ai/registry/model). - -1. Navigate to the [Model Registry App](https://wandb.ai/registry/model). -{{< img src="/images/models/create_registered_model_1.png" alt="Model Registry landing page" >}} -2. Click the **New registered model** button located in the top right of the Model Registry page. -{{< img src="/images/models/create_registered_model_model_reg_app.png" alt="New registered model button" >}} -3. From the panel that appears, select the entity you want the registered model to belong to from the **Owning Entity** dropdown. -{{< img src="/images/models/create_registered_model_3.png" alt="Model creation form" >}} -4. Provide a name for your model in the **Name** field. -5. From the **Type** dropdown, select the type of artifacts to link to the registered model. -6. (Optional) Add a description about your model in the **Description** field. -7. (Optional) Within the **Tags** field, add one or more tags. -8. Click **Register model**. - - -{{% alert %}} -Manual linking a model to the model registry is useful for one-off models. However, it is often useful to [programmatically link model versions to the model registry]({{< relref "link-model-version#programmatically-link-a-model" >}}). - -For example, suppose you have a nightly job. It is tedious to manually link a model created each night. Instead, you could create a script that evaluates the model, and if the model improves in performance, link that model to the model registry with the W&B Python SDK. -{{% /alert %}} \ No newline at end of file diff --git a/content/en/guides/core/registry/model_registry/link-model-version.md b/content/en/guides/core/registry/model_registry/link-model-version.md deleted file mode 100644 index ed6aadf7be..0000000000 --- a/content/en/guides/core/registry/model_registry/link-model-version.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -description: Link a model version to a registered model with the W&B App or programmatically - with the Python SDK. -menu: - default: - identifier: link-model-version - parent: model-registry -title: Link a model version -weight: 5 ---- - - -Link a model version to a registered model with the W&B App or programmatically with the Python SDK. - -## Programmatically link a model - -Use the [`link_model`]({{< relref "/ref/python/experiments/run.md#link_model" >}}) method to programmatically log model files to a W&B run and link it to the [W&B Model Registry]({{< relref "./" >}}). - -Ensure to replace other the values enclosed in `<>` with your own: - -```python -import wandb - -run = wandb.init(entity="", project="") -run.link_model(path="", registered_model_name="") -run.finish() -``` - -W&B creates a registered model for you if the name you specify for the `registered-model-name` parameter does not already exist. - -For example, suppose you have an existing registered model named "Fine-Tuned-Review-Autocompletion"(`registered-model-name="Fine-Tuned-Review-Autocompletion"`) in your Model Registry. And suppose that a few model versions are linked to it: `v0`, `v1`, `v2`. If you programmatically link a new model and use the same registered model name (`registered-model-name="Fine-Tuned-Review-Autocompletion"`), W&B links this model to the existing registered model and assigns it a model version `v3`. If no registered model with this name exists, a new one registered model is created and it will have a model version `v0`. - -See an example ["Fine-Tuned-Review-Autocompletion" registered model here](https://wandb.ai/reviewco/registry/model?selectionPath=reviewco%2Fmodel-registry%2FFinetuned-Review-Autocompletion&view=all-models). - -## Interactively link a model -Interactively link a model with the Model Registry or with the Artifact browser. - -{{< tabpane text=true >}} - {{% tab header="Model Registry" %}} -1. Navigate to the [Model Registry App](https://wandb.ai/registry/model). -2. Hover your mouse next to the name of the registered model you want to link a new model to. -3. Select the meatball menu icon (three horizontal dots) next to **View details**. -4. From the dropdown, select **Link new version**. -5. From the **Project** dropdown, select the name of the project that contains your model. -6. From the **Model Artifact** dropdown, select the name of the model artifact. -7. From the **Version** dropdown, select the model version you want to link to the registered model. - -{{< img src="/images/models/link_model_wmodel_reg.gif" alt="Linking model version to registry" >}} - {{% /tab %}} - {{% tab header="Artifact browser" %}} -1. Navigate to your project's artifact browser on the W&B App at: `https://wandb.ai///artifacts` -2. Select the Artifacts icon on the left sidebar. -3. Click on the model version you want to link to your registry. -4. Within the **Version overview** section, click the **Link to registry** button. -5. From the modal that appears on the right of the screen, select a registered model from the **Select a register model** menu dropdown. -6. Click **Next step**. -7. (Optional) Select an alias from the **Aliases** dropdown. -8. Click **Link to registry**. - -{{< img src="/images/models/manual_linking.gif" alt="Manual model linking" >}} - {{% /tab %}} -{{< /tabpane >}} - - - -## View the source of linked models - -There are two ways to view the source of linked models: The artifact browser within the project that the model is logged to and the W&B Model Registry. - -A pointer connects a specific model version in the model registry to the source model artifact (located within the project the model is logged to). The source model artifact also has a pointer to the model registry. - -{{< tabpane text=true >}} - {{% tab header="Model Registry" %}} -1. Navigate to your [Model Registry App](https://wandb.ai/registry/model). -{{< img src="/images/models/create_registered_model_1.png" alt="Create registered model" >}} -2. Select **View details** next the name of your registered model. -3. Within the **Versions** section, select **View** next to the model version you want to investigate. -4. Click on the **Version** tab within the right panel. -5. Within the **Version overview** section there is a row that contains a **Source Version** field. The **Source Version** field shows both the name of the model and the model's version. - -For example, the following image shows a `v0` model version called `mnist_model` (see **Source version** field `mnist_model:v0`), linked to a registered model called `MNIST-dev`. - -{{< img src="/images/models/view_linked_model_registry.png" alt="Linked model in registry" >}} - {{% /tab %}} - {{% tab header="Artifact browser" %}} -1. Navigate to your project's artifact browser on the W&B App at: `https://wandb.ai///artifacts` -2. Select the Artifacts icon on the left sidebar. -3. Expand the **model** dropdown menu from the Artifacts panel. -4. Select the name and version of the model linked to the model registry. -5. Click on the **Version** tab within the right panel. -6. Within the **Version overview** section there is a row that contains a **Linked To** field. The **Linked To** field shows both the name of the registered model and the version it possesses(`registered-model-name:version`). - -For example, in the following image, there is a registered model called `MNIST-dev` (see the **Linked To** field). A model version called `mnist_model` with a version `v0`(`mnist_model:v0`) points to the `MNIST-dev` registered model. - - -{{< img src="/images/models/view_linked_model_artifacts_browser.png" alt="Model artifacts browser" >}} - {{% /tab %}} -{{< /tabpane >}} diff --git a/content/en/guides/core/registry/model_registry/log-model-to-experiment.md b/content/en/guides/core/registry/model_registry/log-model-to-experiment.md deleted file mode 100644 index 401019408e..0000000000 --- a/content/en/guides/core/registry/model_registry/log-model-to-experiment.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -description: Track a model, the model's dependencies, and other information relevant - to that model with the W&B Python SDK. -menu: - default: - identifier: log-model-to-experiment - parent: model-registry -title: Track a model -weight: 3 ---- - - -Track a model, the model's dependencies, and other information relevant to that model with the W&B Python SDK. - -Under the hood, W&B creates a lineage of [model artifact]({{< relref "./model-management-concepts.md#model-artifact" >}}) that you can view with the W&B App or programmatically with the W&B Python SDK. See the [Create model lineage map]({{< relref "./model-lineage.md" >}}) for more information. - -## How to log a model - -Use the `run.log_model` API to log a model. Provide the path where your model files are saved to the `path` parameter. The path can be a local file, directory, or [reference URI]({{< relref "/guides/core/artifacts/track-external-files.md#amazon-s3--gcs--azure-blob-storage-references" >}}) to an external bucket such as `s3://bucket/path`. - -Optionally provide a name for the model artifact for the `name` parameter. If `name` is not specified, W&B uses the basename of the input path prepended with the run ID. - -Copy and paste the proceeding code snippet. Ensure to replace values enclosed in `<>` with your own. - -```python -import wandb - -# Initialize a W&B run -run = wandb.init(project="", entity="") - -# Log the model -run.log_model(path="", name="") -``` - -
- -Example: Log a Keras model to W&B - -The proceeding code example shows how to log a convolutional neural network (CNN) model to W&B. - -```python -import os -import wandb -from tensorflow import keras -from tensorflow.keras import layers - -config = {"optimizer": "adam", "loss": "categorical_crossentropy"} - -# Initialize a W&B run -run = wandb.init(entity="charlie", project="mnist-project", config=config) - -# Training algorithm -loss = run.config["loss"] -optimizer = run.config["optimizer"] -metrics = ["accuracy"] -num_classes = 10 -input_shape = (28, 28, 1) - -model = keras.Sequential( - [ - layers.Input(shape=input_shape), - layers.Conv2D(32, kernel_size=(3, 3), activation="relu"), - layers.MaxPooling2D(pool_size=(2, 2)), - layers.Conv2D(64, kernel_size=(3, 3), activation="relu"), - layers.MaxPooling2D(pool_size=(2, 2)), - layers.Flatten(), - layers.Dropout(0.5), - layers.Dense(num_classes, activation="softmax"), - ] -) - -model.compile(loss=loss, optimizer=optimizer, metrics=metrics) - -# Save model -model_filename = "model.h5" -local_filepath = "./" -full_path = os.path.join(local_filepath, model_filename) -model.save(filepath=full_path) - -# Log the model -run.log_model(path=full_path, name="MNIST") - -# Explicitly tell W&B to end the run. -run.finish() -``` -
\ No newline at end of file diff --git a/content/en/guides/core/registry/model_registry/model-lineage.md b/content/en/guides/core/registry/model_registry/model-lineage.md deleted file mode 100644 index 693d7f3fde..0000000000 --- a/content/en/guides/core/registry/model_registry/model-lineage.md +++ /dev/null @@ -1,126 +0,0 @@ ---- -description: '' -menu: - default: - identifier: model-lineage - parent: model-registry -title: Create model lineage map -weight: 7 ---- - -This page describes creating lineage graphs in the legacy W&B Model Registry. To learn about lineage graphs in W&B Registry, refer to [Create and view lineage maps]({{< relref "../lineage.md" >}}). - -{{% alert %}} -W&B will transition assets from the legacy [W&B Model Registry]({{< relref "/guides/core/registry/model_registry/" >}}) to the new [W&B Registry]({{< relref "./" >}}). This migration will be fully managed and triggered by W&B, requiring no intervention from users. The process is designed to be as seamless as possible, with minimal disruption to existing workflows. Refer to [Migrate from legacy Model Registry]({{< relref "../model_registry_eol.md" >}}). -{{% /alert %}} - - -A useful feature of logging model artifacts to W&B are lineage graphs. Lineage graphs show artifacts logged by a run as well as artifacts used by specific run. - -This means that, when you log a model artifact, you at a minimum have access to view the W&B run that used or produced the model artifact. If you [track a dependency]({{< relref "#track-an-artifact-dependency" >}}), you also see the inputs used by the model artifact. - -For example, the proceeding image shows artifacts created and used throughout an ML experiment: - -{{< img src="/images/models/model_lineage_example.png" alt="Model lineage graph" >}} - -From left to right, the image shows: -1. The `jumping-monkey-1` W&B run created the `mnist_dataset:v0` dataset artifact. -2. The `vague-morning-5` W&B run trained a model using the `mnist_dataset:v0` dataset artifact. The output of this W&B run was a model artifact called `mnist_model:v0`. -3. A run called `serene-haze-6` used the model artifact (`mnist_model:v0`) to evaluate the model. - - -## Track an artifact dependency - -Declare an dataset artifact as an input to a W&B run with the `use_artifact` API to track a dependency. - -The proceeding code snippet shows how to use the `use_artifact` API: - -```python -# Initialize a run -run = wandb.init(project=project, entity=entity) - -# Get artifact, mark it as a dependency -artifact = run.use_artifact(artifact_or_name="name", aliases="") -``` - -Once you have retrieved your artifact, you can use that artifact to (for example), evaluate the performance of a model. - -
- -Example: Train a model and track a dataset as the input of a model - -```python -job_type = "train_model" - -config = { - "optimizer": "adam", - "batch_size": 128, - "epochs": 5, - "validation_split": 0.1, -} - -run = wandb.init(project=project, job_type=job_type, config=config) - -version = "latest" -name = "{}:{}".format("{}_dataset".format(model_use_case_id), version) - -artifact = run.use_artifact(name) - -train_table = artifact.get("train_table") -x_train = train_table.get_column("x_train", convert_to="numpy") -y_train = train_table.get_column("y_train", convert_to="numpy") - -# Store values from our config dictionary into variables for easy accessing -num_classes = 10 -input_shape = (28, 28, 1) -loss = "categorical_crossentropy" -optimizer = run.config["optimizer"] -metrics = ["accuracy"] -batch_size = run.config["batch_size"] -epochs = run.config["epochs"] -validation_split = run.config["validation_split"] - -# Create model architecture -model = keras.Sequential( - [ - layers.Input(shape=input_shape), - layers.Conv2D(32, kernel_size=(3, 3), activation="relu"), - layers.MaxPooling2D(pool_size=(2, 2)), - layers.Conv2D(64, kernel_size=(3, 3), activation="relu"), - layers.MaxPooling2D(pool_size=(2, 2)), - layers.Flatten(), - layers.Dropout(0.5), - layers.Dense(num_classes, activation="softmax"), - ] -) -model.compile(loss=loss, optimizer=optimizer, metrics=metrics) - -# Generate labels for training data -y_train = keras.utils.to_categorical(y_train, num_classes) - -# Create training and test set -x_t, x_v, y_t, y_v = train_test_split(x_train, y_train, test_size=0.33) - -# Train the model -model.fit( - x=x_t, - y=y_t, - batch_size=batch_size, - epochs=epochs, - validation_data=(x_v, y_v), - callbacks=[WandbCallback(log_weights=True, log_evaluation=True)], -) - -# Save model locally -path = "model.h5" -model.save(path) - -path = "./model.h5" -registered_model_name = "MNIST-dev" -name = "mnist_model" - -run.link_model(path=path, registered_model_name=registered_model_name, name=name) -run.finish() -``` - -
\ No newline at end of file diff --git a/content/en/guides/core/registry/model_registry/model-management-concepts.md b/content/en/guides/core/registry/model_registry/model-management-concepts.md deleted file mode 100644 index 49b174a0b5..0000000000 --- a/content/en/guides/core/registry/model_registry/model-management-concepts.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -description: Model Registry terms and concepts -menu: - default: - identifier: model-management-concepts - parent: model-registry -title: Model Registry Terms and Concepts -weight: 2 ---- - -The following terms describe key components of the W&B Model Registry: [*model version*]({{< relref "#model-version" >}}), [*model artifact*]({{< relref "#model-artifact" >}}), and [*registered model*]({{< relref "#registered-model" >}}). - -## Model version -A model version represents a single model checkpoint. Model versions are a snapshot at a point in time of a model and its files within an experiment. - -A model version is an immutable directory of data and metadata that describes a trained model. W&B suggests that you add files to your model version that let you store (and restore) your model architecture and learned parameters at a later date. - -A model version belongs to one, and only one, [model artifact]({{< relref "#model-artifact" >}}). A model version can belong to zero or more, [registered models]({{< relref "#registered-model" >}}). Model versions are stored in a model artifact in the order they are logged to the model artifact. W&B automatically creates a new model version if it detects that a model you log (to the same model artifact) has different contents than a previous model version. - -Store files within model versions that are produced from the serialization process provided by your modeling library (for example, [PyTorch](https://pytorch.org/tutorials/beginner/saving_loading_models.html) and [Keras](https://www.tensorflow.org/guide/keras/save_and_serialize)). - - - -## Model alias - -Model aliases are mutable strings that allow you to uniquely identify or reference a model version in your registered model with a semantically related identifier. You can only assign an alias to one version of a registered model. This is because an alias should refer to a unique version when used programmatically. It also allows aliases to be used to capture a model's state (champion, candidate, production). - -It is common practice to use aliases such as `"best"`, `"latest"`, `"production"`, or `"staging"` to mark model versions with special purposes. - -For example, suppose you create a model and assign it a `"best"` alias. You can refer to that specific model with `run.use_model` - -```python -import wandb -run = wandb.init() -name = f"{entity/project/model_artifact_name}:{alias}" -run.use_model(name=name) -``` - -## Model tags -Model tags are keywords or labels that belong to one or more registered models. - -Use model tags to organize registered models into categories and to search over those categories in the Model Registry's search bar. Model tags appear at the top of the Registered Model Card. You might choose to use them to group your registered models by ML task, owning team, or priority. The same model tag can be added to multiple registered models to allow for grouping. - -{{% alert %}} -Model tags, which are labels applied to registered models for grouping and discoverability, are different from [model aliases]({{< relref "#model-alias" >}}). Model aliases are unique identifiers or nicknames that you use to fetch a model version programatically. To learn more about using tags to organize the tasks in your Model Registry, see [Organize models]({{< relref "./organize-models.md" >}}). -{{% /alert %}} - - -## Model artifact -A model artifact is a collection of logged [model versions]({{< relref "#model-version" >}}). Model versions are stored in a model artifact in the order they are logged to the model artifact. - -A model artifact can contain one or more model versions. A model artifact can be empty if no model versions are logged to it. - -For example, suppose you create a model artifact. During model training, you periodically save your model during checkpoints. Each checkpoint corresponds to its own [model version]({{< relref "#model-version" >}}). All of the model versions created during your model training and checkpoint saving are stored in the same model artifact you created at the beginning of your training script. - - - - -The proceeding image shows a model artifact that contains three model versions: v0, v1, and v2. - -{{< img src="/images/models/mr1c.png" alt="Model registry concepts" >}} - -View an [example model artifact here](https://wandb.ai/timssweeney/model_management_docs_official_v0/artifacts/model/mnist-zws7gt0n). - -## Registered model -A registered model is a collection of pointers (links) to model versions. You can think of a registered model as a folder of "bookmarks" of candidate models for the same ML task. Each "bookmark" of a registered model is a pointer to a [model version]({{< relref "#model-version" >}}) that belongs to a [model artifact]({{< relref "#model-artifact" >}}). You can use [model tags]({{< relref "#model-tags" >}}) to group your registered models. - -Registered models often represent candidate models for a single modeling use case or task. For example, you might create registered model for different image classification task based on the model you use: `ImageClassifier-ResNet50`, `ImageClassifier-VGG16`, `DogBreedClassifier-MobileNetV2` and so on. Model versions are assigned version numbers in the order in which they were linked to the registered model. - - -View an [example Registered Model here](https://wandb.ai/reviewco/registry/model?selectionPath=reviewco%2Fmodel-registry%2FFinetuned-Review-Autocompletion&view=versions). \ No newline at end of file diff --git a/content/en/guides/core/registry/model_registry/notifications.md b/content/en/guides/core/registry/model_registry/notifications.md deleted file mode 100644 index bdfb8855b4..0000000000 --- a/content/en/guides/core/registry/model_registry/notifications.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -description: Get Slack notifications when a new model version is linked to the model - registry. -menu: - default: - identifier: notifications - parent: model-registry -title: Create alerts and notifications -weight: 9 ---- - - -Receive Slack notifications when a new model version is linked to the model registry. - - -1. Navigate to the [W&B Model Registry app](https://wandb.ai/registry/model). -2. Select the registered model you want to receive notifications from. -3. Click on the **Connect Slack** button. - {{< img src="/images/models/connect_to_slack.png" alt="Connect to Slack" >}} -4. Follow the instructions to enable W&B in your Slack workspace that appear on the OAuth page. - - -Once you have configured Slack notifications for your team, you can pick and choose registered models to get notifications from. - -{{% alert %}} -A toggle that reads **New model version linked to...** appears instead of a **Connect Slack** button if you have Slack notifications configured for your team. -{{% /alert %}} - -The screenshot below shows a FMNIST classifier registered model that has Slack notifications. - -{{< img src="/images/models/conect_to_slack_fmnist.png" alt="Slack notification example" >}} - -A message is automatically posted to the connected Slack channel each time a new model version is linked to the FMNIST classifier registered model. \ No newline at end of file diff --git a/content/en/guides/core/registry/model_registry/organize-models.md b/content/en/guides/core/registry/model_registry/organize-models.md deleted file mode 100644 index c33cb0fb49..0000000000 --- a/content/en/guides/core/registry/model_registry/organize-models.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -menu: - default: - identifier: organize-models - parent: model-registry -title: Organize models -weight: 6 ---- - -Use model tags to organize registered models into categories and to search over those categories. - -1. Navigate to the [W&B Model Registry app](https://wandb.ai/registry/model). -2. Select **View details** next to the name of the registered model you want to add a model tag to. - {{< img src="/images/models/organize-models-model-reg-landing.png" alt="Model Registry view details" >}} -2. Scroll to the **Model card** section. -3. Click the plus button (**+**) next to the **Tags** field. -{{< img src="/images/models/organize-models-seleticon.png" alt="Model tags section" >}} -4. Type in the name for your tag or search for a pre-existing model tag. - For example. the following image shows multiple model tags added to a registered model called **FineTuned-Review-Autocompletion**: - - {{< img src="/images/models/model-tags-modelregview.png" alt="Model with multiple tags" >}} \ No newline at end of file diff --git a/content/en/guides/core/registry/model_registry/walkthrough.md b/content/en/guides/core/registry/model_registry/walkthrough.md deleted file mode 100644 index 8e726c387f..0000000000 --- a/content/en/guides/core/registry/model_registry/walkthrough.md +++ /dev/null @@ -1,300 +0,0 @@ ---- -description: Learn how to use W&B for Model Management -menu: - default: - identifier: walkthrough_model_registry - parent: model-registry -title: 'Tutorial: Use W&B for model management' -weight: 1 ---- - - -The following walkthrough shows you how to log a model to W&B. By the end of the walkthrough you will: - -* Create and train a model with the MNIST dataset and the Keras framework. -* Log the model that you trained to a W&B project -* Mark the dataset used as a dependency to the model you created -* Link the model to the W&B Registry. -* Evaluate the performance of the model you link to the registry -* Mark a model version ready for production. - -{{% alert %}} -* Copy the code snippets in the order presented in this guide. -* Code not unique to the Model Registry are hidden in collapsible cells. -{{% /alert %}} - -## Setting up - -Before you get started, import the Python dependencies required for this walkthrough: - -```python -import wandb -import numpy as np -from tensorflow import keras -from tensorflow.keras import layers -from wandb.integration.keras import WandbMetricsLogger -from sklearn.model_selection import train_test_split -``` - -Provide your W&B entity to the `entity` variable: - -```python -entity = "" -``` - - -### Create a dataset artifact - -First, create a dataset. The proceeding code snippet creates a function that downloads the MNIST dataset: -```python -def generate_raw_data(train_size=6000): - eval_size = int(train_size / 6) - (x_train, y_train), (x_eval, y_eval) = keras.datasets.mnist.load_data() - - x_train = x_train.astype("float32") / 255 - x_eval = x_eval.astype("float32") / 255 - x_train = np.expand_dims(x_train, -1) - x_eval = np.expand_dims(x_eval, -1) - - print("Generated {} rows of training data.".format(train_size)) - print("Generated {} rows of eval data.".format(eval_size)) - - return (x_train[:train_size], y_train[:train_size]), ( - x_eval[:eval_size], - y_eval[:eval_size], - ) - -# Create dataset -(x_train, y_train), (x_eval, y_eval) = generate_raw_data() -``` - -Next, upload the dataset to W&B. To do this, create an [artifact]({{< relref "/guides/core/artifacts/" >}}) object and add the dataset to that artifact. - -```python -project = "model-registry-dev" - -model_use_case_id = "mnist" -job_type = "build_dataset" - -# Initialize a W&B run -run = wandb.init(entity=entity, project=project, job_type=job_type) - -# Create W&B Table for training data -train_table = wandb.Table(data=[], columns=[]) -train_table.add_column("x_train", x_train) -train_table.add_column("y_train", y_train) -train_table.add_computed_columns(lambda ndx, row: {"img": wandb.Image(row["x_train"])}) - -# Create W&B Table for eval data -eval_table = wandb.Table(data=[], columns=[]) -eval_table.add_column("x_eval", x_eval) -eval_table.add_column("y_eval", y_eval) -eval_table.add_computed_columns(lambda ndx, row: {"img": wandb.Image(row["x_eval"])}) - -# Create an artifact object -artifact_name = "{}_dataset".format(model_use_case_id) -artifact = wandb.Artifact(name=artifact_name, type="dataset") - -# Add wandb.WBValue obj to the artifact. -artifact.add(train_table, "train_table") -artifact.add(eval_table, "eval_table") - -# Persist any changes made to the artifact. -artifact.save() - -# Tell W&B this run is finished. -run.finish() -``` - -{{% alert %}} -Storing files (such as datasets) to an artifact is useful in the context of logging models because you lets you track a model's dependencies. -{{% /alert %}} - - -## Train a model -Train a model with the artifact dataset you created in the previous step. - -### Declare dataset artifact as an input to the run - -Declare the dataset artifact you created in a previous step as the input to the W&B run. This is particularly useful in the context of logging models because declaring an artifact as an input to a run lets you track the dataset (and the version of the dataset) used to train a specific model. W&B uses the information collected to create a [lineage map]({{< relref "./model-lineage.md" >}}). - -Use the `use_artifact` API to both declare the dataset artifact as the input of the run and to retrieve the artifact itself. - -```python -job_type = "train_model" -config = { - "optimizer": "adam", - "batch_size": 128, - "epochs": 5, - "validation_split": 0.1, -} - -# Initialize a W&B run -run = wandb.init(project=project, job_type=job_type, config=config) - -# Retrieve the dataset artifact -version = "latest" -name = "{}:{}".format("{}_dataset".format(model_use_case_id), version) -artifact = run.use_artifact(artifact_or_name=name) - -# Get specific content from the dataframe -train_table = artifact.get("train_table") -x_train = train_table.get_column("x_train", convert_to="numpy") -y_train = train_table.get_column("y_train", convert_to="numpy") -``` - -For more information about tracking the inputs and output of a model, see [Create model lineage]({{< relref "./model-lineage.md" >}}) map. - -### Define and train model - -For this walkthrough, define a 2D Convolutional Neural Network (CNN) with Keras to classify images from the MNIST dataset. - -
-Train CNN on MNIST data - -```python -# Store values from our config dictionary into variables for easy accessing -num_classes = 10 -input_shape = (28, 28, 1) -loss = "categorical_crossentropy" -optimizer = run.config["optimizer"] -metrics = ["accuracy"] -batch_size = run.config["batch_size"] -epochs = run.config["epochs"] -validation_split = run.config["validation_split"] - -# Create model architecture -model = keras.Sequential( - [ - layers.Input(shape=input_shape), - layers.Conv2D(32, kernel_size=(3, 3), activation="relu"), - layers.MaxPooling2D(pool_size=(2, 2)), - layers.Conv2D(64, kernel_size=(3, 3), activation="relu"), - layers.MaxPooling2D(pool_size=(2, 2)), - layers.Flatten(), - layers.Dropout(0.5), - layers.Dense(num_classes, activation="softmax"), - ] -) -model.compile(loss=loss, optimizer=optimizer, metrics=metrics) - -# Generate labels for training data -y_train = keras.utils.to_categorical(y_train, num_classes) - -# Create training and test set -x_t, x_v, y_t, y_v = train_test_split(x_train, y_train, test_size=0.33) -``` -Next, train the model: - -```python -# Train the model -model.fit( - x=x_t, - y=y_t, - batch_size=batch_size, - epochs=epochs, - validation_data=(x_v, y_v), - callbacks=[WandbCallback(log_weights=True, log_evaluation=True)], -) -``` - -Finally, save the model locally on your machine: - -```python -# Save model locally -path = "model.h5" -model.save(path) -``` -
- - - -## Log and link a model to the Model Registry -Use the [`link_model`]({{< relref "/ref/python/experiments/run.md#link_model" >}}) API to log model one ore more files to a W&B run and link it to the [W&B Model Registry]({{< relref "./" >}}). - -```python -path = "./model.h5" -registered_model_name = "MNIST-dev" - -run.link_model(path=path, registered_model_name=registered_model_name) -run.finish() -``` - -W&B creates a registered model for you if the name you specify for `registered-model-name` does not already exist. - -See [`link_model`]({{< relref "/ref/python/experiments/run.md#link_model" >}}) in the API Reference guide for optional parameters. - -## Evaluate the performance of a model -It is common practice to evaluate the performance of a one or more models. - -First, get the evaluation dataset artifact stored in W&B in a previous step. - -```python -job_type = "evaluate_model" - -# Initialize a run -run = wandb.init(project=project, entity=entity, job_type=job_type) - -model_use_case_id = "mnist" -version = "latest" - -# Get dataset artifact, mark it as a dependency -artifact = run.use_artifact( - "{}:{}".format("{}_dataset".format(model_use_case_id), version) -) - -# Get desired dataframe -eval_table = artifact.get("eval_table") -x_eval = eval_table.get_column("x_eval", convert_to="numpy") -y_eval = eval_table.get_column("y_eval", convert_to="numpy") -``` - -Download the [model version]({{< relref "./model-management-concepts.md#model-version" >}}) from W&B that you want to evaluate. Use the `use_model` API to access and download your model. - -```python -alias = "latest" # alias -name = "mnist_model" # name of the model artifact - -# Access and download model. Returns path to downloaded artifact -downloaded_model_path = run.use_model(name=f"{name}:{alias}") -``` - -Load the Keras model and compute the loss: - -```python -model = keras.models.load_model(downloaded_model_path) - -y_eval = keras.utils.to_categorical(y_eval, 10) -(loss, _) = model.evaluate(x_eval, y_eval) -score = (loss, _) -``` - -Finally, log the loss metric to the W&B run: - -```python -# # Log metrics, images, tables, or any data useful for evaluation. -run.log(data={"loss": (loss, _)}) -``` - - -## Promote a model version -Mark a model version ready for the next stage of your machine learning workflow with a [*model alias*]({{< relref "./model-management-concepts.md#model-alias" >}}). Each registered model can have one or more model aliases. A model alias can only belong to a single model version at a time. - -For example, suppose that after evaluating a model's performance, you are confident that the model is ready for production. To promote that model version, add the `production` alias to that specific model version. - -{{% alert %}} -The `production` alias is one of the most common aliases used to mark a model as production-ready. -{{% /alert %}} - -You can add an alias to a model version interactively with the W&B App UI or programmatically with the Python SDK. The following steps show how to add an alias with the W&B Model Registry App: - - -1. Navigate to the [Model Registry App](https://wandb.ai/registry/model). -2. Click **View details** next to the name of your registered model. -3. Within the **Versions** section, click the **View** button next to the name of the model version you want to promote. -4. Next to the **Aliases** field, click the plus icon (**+**). -5. Type in `production` into the field that appears. -6. Press Enter on your keyboard. - - -{{< img src="/images/models/promote_model_production.gif" alt="Promote model to production" >}} \ No newline at end of file diff --git a/content/en/guides/core/registry/model_registry_eol.md b/content/en/guides/core/registry/model_registry_eol.md deleted file mode 100644 index 1082fda3a6..0000000000 --- a/content/en/guides/core/registry/model_registry_eol.md +++ /dev/null @@ -1,168 +0,0 @@ ---- -menu: - default: - identifier: model_registry_eol - parent: registry -title: Migrate from legacy Model Registry -weight: 9 ---- - -W&B is migrating from the legacy **Model Registry** to the enhanced **W&B Registry**. This transition is designed to be seamless and fully managed by W&B. The migration process will preserve your workflows while unlocking powerful new features. For any questions or support, contact [support@wandb.com](mailto:support@wandb.com). - -## Reasons for the migration - -W&B Registry offers major improvements over the legacy Model Registry: - -- **Unified, organization-level experience**: Share and manage curated artifacts across your organization, regardless of teams. -- **Improved governance**: Use access control, restricted registries, and visibility settings to manage user access. -- **Enhanced functionality**: New features such as custom registries, better search, audit trails, and automation support help modernize your ML infrastructure. - - -The following table summarizes the key differences between the legacy Model Registry and the new W&B Registry: - -| Feature | Legacy W&B Model Registry | W&B Registry | -| ----- | ----- | ----- | -| Artifact Visibility | Team-level only - access restricted to team members | Org-level visibility with fine-grained permission controls | -| Custom Registries |Not supported | Fully supported — create registries for any artifact type | -| Access Control | Not available | Role-based access (Admin, Member, Viewer) at the registry level | -| Terminology |“Registered models”: pointers to model versions | “Collections”: pointers to any artifact versions | -| Registry Scope |Only supports model versioning | Supports models, datasets, custom artifacts, and more | -| Automations | Registry-level automations | Registry- and collection-level automations supported and copied during migration | -| Search & Discoverability | Limited search and discoverability | Central search within W&B Registry across all registries in the organization | -| API Compatibility | Uses `wandb.init.link_model()` and MR-specific patterns | Modern SDK APIs (`link_artifact()`, `use_artifact()`) with auto-redirection | -| Migration | End-of-life | Automatically migrated and enhanced — data is copied, not deleted | - -## Preparing for the migration - -- **No action required**: The migration is fully automated and managed by W&B. You do not need to run scripts, update configurations, or move data manually. -- **Stay informed**: You will receive communications (banners in the W&B App UI) 2 weeks prior to your scheduled migration. -- **Review permissions**: After the migration, admins should check registry access to ensure alignment with your team’s needs. -- **Use new paths in future work**: Old code continues to work, W&B recommends using the new W&B Registry paths for new projects. - - -## Migration process - -### Temporary write operation pause -During migration, write operations for your team’s Model Registry will be paused to ensure data consistency for up to one hour. Write operations to the newly created migrated W&B Registry will also be paused during the migration. - -### Data migration -W&B will migrate the following data from the legacy Model Registry to the new W&B Registry: - -- Collections -- Linked artifact versions -- Version history -- Aliases, tags, and descriptions -- Automations (both collection and registry-level) -- Permissions, including service account roles and protected aliases - -Within the W&B App UI, the legacy Model Registry will be replaced with the new W&B Registry. Migrated registries will have the name of your team followed by `mr-migrated`: - -```text --mr-migrated -``` - -These registries default to **Restricted** visibility, preserving your existing privacy boundaries. Only the original members of the `` will have access to their respective registries. - - -## After the migration - -After the migration completes: - -- The legacy Model Registry becomes **read-only**. You can still view and access your data, but no new writes will be allowed. -- Data in the legacy Model Registry is **copied** to the new W&B Registry, not moved. No data is deleted. -- Access all your data from the new W&B Registry. -- Use the new Registry UI for versioning, governance, audit trails, and automation. -- Continue using your old code. - - [Existing paths and API calls will automatically redirect to the new W&B Registry.]({{< relref "#code-will-continue-to-work" >}}) - - [Artifact version paths are redirected.]({{< relref "#legacy-paths-will-redirect-to-new-wb-registry-paths" >}}) -- The legacy Model Registry will temporarily remain visible in the UI. W&B will eventually hide the legacy Model Registry. -- Explore enhanced functionality in the Registry such as: - - [Organization-level access]({{< relref "/guides/core/registry/create_registry/#visibility-types" >}}) - - [Role-based access control]({{< relref "/guides/core/registry/configure_registry/" >}}) - - [Registry-level lineage tracking]({{< relref "/guides/core/registry/lineage/" >}}) - - [Automations]({{< relref "/guides/core/automations/" >}}) - -### Code will continue to work - -Existing API calls in your code that refer to the legacy Model Registry will automatically redirect to the new W&B Registry. The following API calls will continue to work without any changes: - -- `wandb.Api().artifact()` -- `wandb.run.use_artifact()` -- `wandb.run.link_artifact()` -- `wandb.Artifact().link()` - -### Legacy paths will redirect to new W&B Registry paths - -W&B will automatically redirect legacy Model Registry paths to the new W&B Registry format. This means you can continue using your existing code without needing to refactor paths immediately. Note that automatic redirection only applies to collections that were created in the legacy Model Registry before migration. - -For example: -- If the legacy Model Registry had collection `"my-model"` already present, the link action will redirect successfully -- If the legacy Model Registry did not have collection `"my-model"`, it will not redirect and will lead to an error - -```python -# This will redirect successfully if "my-model" existed in legacy Model Registry -run.link_artifact(artifact, "team-name/model-registry/my-model") - -# This will fail if "new-model" did not exist in legacy Model Registry -run.link_artifact(artifact, "team-name/model-registry/new-model") -``` - - - -To fetch versions from the legacy Model Registry, paths consisted of a team name, a `"model-registry"` string, collection name, and version: - -```python -f"{team-name}/model-registry/{collection-name}:{version}" -``` - -W&B will automatically redirect these paths to the new W&B Registry format, which includes the organization name, a `"wandb-registry"` string, the team name, collection name, and version: - -```python -# Redirects to new path -f"{org-name}/wandb-registry-{team-name}/{collection-name}:{version}" -``` - - -{{% alert title="Python SDK warnings" %}} - -A warning error may appear if you continue to use legacy Model Registry paths in your code. The warning will not break your code, but it indicates that you should update your paths to the new W&B Registry format. - -Whether a warning appears depends on the version of the W&B Python SDK you are using: - -* Users on the latest W&B SDK (`v0.21.0` and above) will see a non-breaking warning in their logs indicating that a redirect has occurred. -* For older SDK versions, the redirect will still work silently without emitting a warning. Some metadata such as entity or project names may reflect legacy values. - -{{% /alert %}} - - -## Frequently asked questions - -### How will I know when my org is being migrated? - -You will receive advance notice with an in-app banner or direct communication from W&B. - -### Will there be downtime? - -Write operations to the legacy Model Registry and the new W&B Registry will be paused for a approximately one hour during the migration. All other W&B services will remain available. - -### Will this break my code? - -No. All legacy Model Registry paths and Python SDK calls will automatically redirect to the new Registry. - -### Will my data be deleted? - -No. Your data will be copied to the new W&B Registry. The legacy Model Registry becomes read-only and later hidden. No data is removed or lost. - -### What if I’m using an older SDK? - -Redirects will still work, but you will not see warnings about them. For the best experience, upgrade to the latest version of the W&B SDK. - -### Can I rename/modify my migrated registry? - -Yes, renaming and other operations such as adding or removing members from a migrated registry are allowed. These registries are simply custom registries underneath, and the redirection will continue working even after migration. - -## Questions? - -For support or to discuss your migration, contact [support@wandb.com](mailto:support@wandb.com). W&B is committed to helping you transition smoothly to the new W&B Registry. \ No newline at end of file diff --git a/content/en/guides/core/registry/organize-with-tags.md b/content/en/guides/core/registry/organize-with-tags.md deleted file mode 100644 index 51e7d041eb..0000000000 --- a/content/en/guides/core/registry/organize-with-tags.md +++ /dev/null @@ -1,320 +0,0 @@ ---- -description: Use tags to organize collections or artifact versions within collections. - You can add, remove, edit tags with the Python SDK or W&B App UI. -menu: - default: - identifier: organize-with-tags - parent: registry -title: Organize versions with tags -weight: 7 ---- - -Create and add tags to organize your collections or artifact versions within your registry. Add, modify, view, or remove tags to a collection or artifact version with the W&B App UI or the W&B Python SDK. - -{{% alert title="When to use a tag versus using an alias" %}} -Use aliases when you need to reference a specific artifact version uniquely. For example, use an alias such as 'production' or 'latest' to ensure that `artifact_name:alias` always points to a single, specific version. - -Use tags when you want more flexibility for grouping or searching. Tags are ideal when multiple versions or collections can share the same label, and you don’t need the guarantee that only one version is associated with a specific identifier. -{{% /alert %}} - - -## Add a tag to a collection - -Use the W&B App UI or Python SDK to add a tag to a collection: - -{{< tabpane text=true >}} -{{% tab header="W&B App" %}} - -Use the W&B App UI to add a tag to a collection: - -1. Navigate to the [W&B Registry App](https://wandb.ai/registry). -2. Click on a registry card -3. Click **View details** next to the name of a collection -4. Within the collection card, click on the plus icon (**+**) next to the **Tags** field and type in the name of the tag -5. Press **Enter** on your keyboard - -{{< img src="/images/registry/add_tag_collection.gif" alt="Adding tags to a Registry collection" >}} - -{{% /tab %}} -{{% tab header="Python SDK" %}} - -```python -import wandb - -COLLECTION_TYPE = "" -ORG_NAME = "" -REGISTRY_NAME = "" -COLLECTION_NAME = "" - -full_name = f"{ORG_NAME}/wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}" - -collection = wandb.Api().artifact_collection( - type_name = COLLECTION_TYPE, - name = full_name - ) - -collection.tags = ["your-tag"] -collection.save() -``` - -{{% /tab %}} -{{< /tabpane >}} - - - -## Update tags that belong to a collection - -Update a tag programmatically by reassigning or by mutating the `tags` attribute. W&B recommends, and it is good Python practice, that you reassign the `tags` attribute instead of in-place mutation. - -For example, the proceeding code snippet shows common ways to update a list with reassignment. For brevity, we continue the code example from the [Add a tag to a collection section]({{< relref "#add-a-tag-to-a-collection" >}}): - -```python -collection.tags = [*collection.tags, "new-tag", "other-tag"] -collection.tags = collection.tags + ["new-tag", "other-tag"] - -collection.tags = set(collection.tags) - set(tags_to_delete) -collection.tags = [] # deletes all tags -``` - -The following code snippet shows how you can use in-place mutation to update tags that belong to an artifact version: - -```python -collection.tags += ["new-tag", "other-tag"] -collection.tags.append("new-tag") - -collection.tags.extend(["new-tag", "other-tag"]) -collection.tags[:] = ["new-tag", "other-tag"] -collection.tags.remove("existing-tag") -collection.tags.pop() -collection.tags.clear() -``` - -## View tags that belong to a collection - -Use the W&B App UI to view tags added to a collection: - -1. Navigate to the [W&B Registry App](https://wandb.ai/registry). -2. Click on a registry card -3. Click **View details** next to the name of a collection - -If a collection has one or more tags, you can view those tags within the collection card next to the **Tags** field. - -{{< img src="/images/registry/tag_collection_selected.png" alt="Registry collection with selected tags" >}} - -Tags added to a collection also appear next to the name of that collection. - -For example, in the proceeding image, a tag called "tag1" was added to the "zoo-dataset-tensors" collection. - -{{< img src="/images/registry/tag_collection.png" alt="Tag management" >}} - - -## Remove a tag from a collection - -Use the W&B App UI to remove a tag from a collection: - -1. Navigate to the [W&B Registry App](https://wandb.ai/registry). -2. Click on a registry card -3. Click **View details** next to the name of a collection -4. Within the collection card, hover your mouse over the name of the tag you want to remove -5. Click on the cancel button (**X** icon) - -## Add a tag to an artifact version - -Add a tag to an artifact version linked to a collection with the W&B App UI or with the Python SDK. - -{{< tabpane text=true >}} -{{% tab header="W&B App" %}} -1. Navigate to the W&B Registry at https://wandb.ai/registry -2. Click on a registry card -3. Click **View details** next to the name of the collection you want to add a tag to -4. Scroll down to **Versions** -5. Click **View** next to an artifact version -6. Within the **Version** tab, click on the plus icon (**+**) next to the **Tags** field and type in the name of the tag -7. Press **Enter** on your keyboard - -{{< img src="/images/registry/add_tag_linked_artifact_version.gif" alt="Adding tags to artifact versions" >}} - -{{% /tab %}} -{{% tab header="Python SDK" %}} -Fetch the artifact version you want to add or update a tag to. Once you have the artifact version, you can access the artifact object's `tag` attribute to add or modify tags to that artifact. Pass in one or more tags as list to the artifacts `tag` attribute. - -Like other artifacts, you can fetch an artifact from W&B without creating a run or you can create a run and fetch the artifact within that run. In either case, ensure to call the artifact object's `save` method to update the artifact on the W&B servers. - -Copy and paste an appropriate code cells below to add or modify an artifact version's tag. Replace the values in `<>` with your own. - - -The proceeding code snippet shows how to fetch an artifact and add a tag without creating a new run: -```python title="Add a tag to an artifact version without creating a new run" -import wandb - -ARTIFACT_TYPE = "" -ORG_NAME = "" -REGISTRY_NAME = "" -COLLECTION_NAME = "" -VERSION = "" - -artifact_name = f"{ORG_NAME}/wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}:v{VERSION}" - -artifact = wandb.Api().artifact(name = artifact_name, type = ARTIFACT_TYPE) -artifact.tags = ["tag2"] # Provide one or more tags in a list -artifact.save() -``` - - -The proceeding code snippet shows how to fetch an artifact and add a tag by creating a new run: - -```python title="Add a tag to an artifact version during a run" -import wandb - -ORG_NAME = "" -REGISTRY_NAME = "" -COLLECTION_NAME = "" -VERSION = "" - -run = wandb.init(entity = "", project="") - -artifact_name = f"{ORG_NAME}/wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}:v{VERSION}" - -artifact = run.use_artifact(artifact_or_name = artifact_name) -artifact.tags = ["tag2"] # Provide one or more tags in a list -artifact.save() -``` - -{{% /tab %}} -{{< /tabpane >}} - - - -## Update tags that belong to an artifact version - - -Update a tag programmatically by reassigning or by mutating the `tags` attribute. W&B recommends, and it is good Python practice, that you reassign the `tags` attribute instead of in-place mutation. - -For example, the proceeding code snippet shows common ways to update a list with reassignment. For brevity, we continue the code example from the [Add a tag to an artifact version section]({{< relref "#add-a-tag-to-an-artifact-version" >}}): - -```python -artifact.tags = [*artifact.tags, "new-tag", "other-tag"] -artifact.tags = artifact.tags + ["new-tag", "other-tag"] - -artifact.tags = set(artifact.tags) - set(tags_to_delete) -artifact.tags = [] # deletes all tags -``` - -The following code snippet shows how you can use in-place mutation to update tags that belong to an artifact version: - -```python -artifact.tags += ["new-tag", "other-tag"] -artifact.tags.append("new-tag") - -artifact.tags.extend(["new-tag", "other-tag"]) -artifact.tags[:] = ["new-tag", "other-tag"] -artifact.tags.remove("existing-tag") -artifact.tags.pop() -artifact.tags.clear() -``` - - -## View tags that belong to an artifact version - -View tags that belong to an artifact version that is linked to a registry with the W&B App UI or with the Python SDK. - -{{< tabpane text=true >}} -{{% tab header="W&B App" %}} - -1. Navigate to the [W&B Registry App](https://wandb.ai/registry). -2. Click on a registry card -3. Click **View details** next to the name of the collection you want to add a tag to -4. Scroll down to **Versions** section - -If an artifact version has one or more tags, you can view those tags within the **Tags** column. - -{{< img src="/images/registry/tag_artifact_version.png" alt="Artifact version with tags" >}} - -{{% /tab %}} -{{% tab header="Python SDK" %}} - -Fetch the artifact version to view its tags. Once you have the artifact version, you can view tags that belong to that artifact by viewing the artifact object's `tag` attribute. - -Like other artifacts, you can fetch an artifact from W&B without creating a run or you can create a run and fetch the artifact within that run. - -Copy and paste an appropriate code cells below to add or modify an artifact version's tag. Replace the values in `<>` with your own. - -The proceeding code snippet shows how to fetch and view an artifact version's tags without creating a new run: - -```python title="Add a tag to an artifact version without creating a new run" -import wandb - -ARTIFACT_TYPE = "" -ORG_NAME = "" -REGISTRY_NAME = "" -COLLECTION_NAME = "" -VERSION = "" - -artifact_name = f"{ORG_NAME}/wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}:v{VERSION}" - -artifact = wandb.Api().artifact(name = artifact_name, type = artifact_type) -print(artifact.tags) -``` - - -The proceeding code snippet shows how to fetch and view artifact version's tags by creating a new run: - -```python title="Add a tag to an artifact version during a run" -import wandb - -ORG_NAME = "" -REGISTRY_NAME = "" -COLLECTION_NAME = "" -VERSION = "" - -run = wandb.init(entity = "", project="") - -artifact_name = f"{ORG_NAME}/wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}:v{VERSION}" - -artifact = run.use_artifact(artifact_or_name = artifact_name) -print(artifact.tags) -``` - -{{% /tab %}} -{{< /tabpane >}} - - - -## Remove a tag from an artifact version - -1. Navigate to the [W&B Registry App](https://wandb.ai/registry). -2. Click on a registry card -3. Click **View details** next to the name of the collection you want to add a tag to -4. Scroll down to **Versions** -5. Click **View** next to an artifact version -6. Within the **Version** tab, hover your mouse over the name of the tag -7. Click on the cancel button (**X** icon) - -## Search existing tags - -Use the W&B App UI to search existing tags in collections and artifact versions: - -1. Navigate to the [W&B Registry App](https://wandb.ai/registry). -2. Click on a registry card -3. Within the search bar, type in the name of a tag. - -{{< img src="/images/registry/search_tags.gif" alt="Tag-based search" >}} - - -## Find artifact versions with a specific tag - -Use the W&B Python SDK to find artifact versions that have a set of tags: - -```python -import wandb - -api = wandb.Api() -tagged_artifact_versions = api.artifacts( - type_name = "", - name = "", - tags = ["", ""] -) - -for artifact_version in tagged_artifact_versions: - print(artifact_version.tags) -``` \ No newline at end of file diff --git a/content/en/guides/core/registry/registry_cards.md b/content/en/guides/core/registry/registry_cards.md deleted file mode 100644 index 890baf2e81..0000000000 --- a/content/en/guides/core/registry/registry_cards.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -menu: - default: - identifier: registry_cards - parent: registry -title: Annotate collections -weight: 8 ---- - -Add human-friendly text to your collections to help users understand the purpose of the collection and the artifacts it contains. - - -Depending on the collection, you might want to include information about the training data, model architecture, task, license, references, and deployment. The proceeding lists some topics worth documenting in a collection: - - - -W&B recommends including at minimum these details: -* **Summary**: The purpose of the collection. The machine learning framework used for the machine learning experiment. -* **License**: The legal terms and permissions associated with the use of the machine learning model. It helps model users understand the legal framework under which they can utilize the model. Common licenses include Apache 2.0, MIT, and GPL. -* **References**: Citations or references to relevant research papers, datasets, or external resources. - -If your collection contains training data, consider including these additional details: -* **Training data**: Describe the training data used -* **Processing**: Processing done on the training data set. -* **Data storage**: Where is that data stored and how to access it. - - -If your collection contains a machine learning model, consider including these additional details: -* **Architecture**: Information about the model architecture, layers, and any specific design choices. -* **Task**: The specific type of task or problem that the machine that the collection model is designed to perform. It's a categorization of the model's intended capability. -* **Deserialize the model**: Provide information on how someone on your team can load the model into memory. -* **Deployment**: Details on how and where the model is deployed and guidance on how the model is integrated into other enterprise systems, such as a workflow orchestration platforms. - - -## Add a description to a collection - -Interactively or programmatically add a description to a collection with the W&B Registry UI or Python SDK. - -{{< tabpane text=true >}} - {{% tab header="W&B Registry UI" %}} -1. Navigate to the [W&B Registry App](https://wandb.ai/registry/). -2. Click on a collection. -3. Select **View details** next to the name of the collection. -4. Within the **Description** field, provide information about your collection. Format text within with [Markdown markup language](https://www.markdownguide.org/). - - {{% /tab %}} - {{% tab header="Python SDK" %}} - -Use the [`wandb.Api().artifact_collection()`]({{< relref "/ref/python/public-api/api.md#artifact_collection" >}}) method to access a collection's description. Use the returned object's `description` property to add, or update, a description to the collection. - -Specify the collection's type for the `type_name` parameter and the collection's full name for the `name` parameter. A collection's name consists of the prefix “wandb-registry”, the name of the registry, and the name of the collection separated by a forward slashes: - -```text -wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME} -``` - -Copy and paste the proceeding code snippet into your Python script or notebook. Replace values enclosed in angle brackets (`<>`) with your own. - -```python -import wandb - -api = wandb.Api() - -collection = api.artifact_collection( - type_name = "", - name = "" - ) - - -collection.description = "This is a description." -collection.save() -``` - {{% /tab %}} -{{< /tabpane >}} - -For example, the proceeding image shows a collection that documents a model's architecture, intended use, performance information and more. - -{{< img src="/images/registry/registry_card.png" alt="Collection card" >}} diff --git a/content/en/guides/core/registry/registry_types.md b/content/en/guides/core/registry/registry_types.md deleted file mode 100644 index fcfb417eb8..0000000000 --- a/content/en/guides/core/registry/registry_types.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -menu: - default: - identifier: registry_types - parent: registry -title: Registry types -weight: 1 ---- - -W&B supports two types of registries: [Core registries]({{< relref "#core-registry" >}}) and [Custom registries]({{< relref "#custom-registry" >}}). - -## Core registry -A core registry is a template for specific use cases: **Models** and **Datasets**. - -By default, the **Models** registry is configured to accept `"model"` artifact types and the **Dataset** registry is configured to accept `"dataset"` artifact types. An admin can add additional accepted artifact types. - - - -{{< img src="/images/registry/core_registry_example.png" alt="Core registry" >}} - -The preceding image shows the **Models** and the **Dataset** core registry along with a custom registry called **Fine_Tuned_Models** in the W&B Registry App UI. - -A core registry has [organization visibility]({{< relref "./configure_registry.md#registry-visibility-types" >}}). A registry admin can not change the visibility of a core registry. - -## Custom registry -Custom registries are not restricted to `"model"` artifact types or `"dataset"` artifact types. - -You can create a custom registry for each step in your machine learning pipeline, from initial data collection to final model deployment. - -For example, you might create a registry called "Benchmark_Datasets" for organizing curated datasets to evaluate the performance of trained models. Within this registry, you might have a collection called "User_Query_Insurance_Answer_Test_Data" that contains a set of user questions and corresponding expert-validated answers that the model has never seen during training. - -{{< img src="/images/registry/custom_registry_example.png" alt="Custom registry example" >}} - -A custom registry can have either [organization or restricted visibility]({{< relref "./configure_registry.md#registry-visibility-types" >}}). A registry admin can change the visibility of a custom registry from organization to restricted. However, the registry admin can not change a custom registry's visibility from restricted to organizational visibility. - -For information on how to create a custom registry, see [Create a custom registry]({{< relref "./create_collection.md" >}}). - - -## Summary -The proceeding table summarizes the differences between core and custom registries: - -| | Core | Custom| -| -------------- | ----- | ----- | -| Visibility | Organizational visibility only. Visibility can not be altered. | Either organization or restricted. Visibility can be altered from organization to restricted visibility.| -| Metadata | Preconfigured and not editable by users. | Users can edit. | -| Artifact types | Preconfigured and accepted artifact types cannot be removed. Users can add additional accepted artifact types. | Admin can define accepted types. | -| Customization | Can add additional types to the existing list.| Edit registry name, description, visibility, and accepted artifact types.| \ No newline at end of file diff --git a/content/en/guides/core/registry/search_registry.md b/content/en/guides/core/registry/search_registry.md deleted file mode 100644 index 2206328aa1..0000000000 --- a/content/en/guides/core/registry/search_registry.md +++ /dev/null @@ -1,151 +0,0 @@ ---- -menu: - default: - identifier: search_registry - parent: registry -title: Find registry items -weight: 7 ---- - -Use the [global search bar in the W&B Registry App]({{< relref "./search_registry.md#search-for-registry-items" >}}) to find a registry, collection, artifact version tag, collection tag, or alias. You can use MongoDB-style queries to [filter registries, collections, and artifact versions]({{< relref "./search_registry.md#query-registry-items-with-mongodb-style-queries" >}}) based on specific criteria using the W&B Python SDK. - - -Only items that you have permission to view appear in the search results. - -## Search for registry items - -To search for a registry item: - -1. Navigate to the W&B Registry App. -2. Specify the search term in the search bar at the top of the page. Press Enter to search. - -Search results appear below the search bar if the term you specify matches an existing registry, collection name, artifact version tag, collection tag, or alias. - -{{< img src="/images/registry/search_registry.gif" alt="Searching within a Registry" >}} - -## Query registry items with MongoDB-style queries - -Use the [`wandb.Api().registries()`]({{< relref "/ref/python/public-api/api.md#registries" >}}) and [query predicates](https://www.mongodb.com/docs/manual/reference/glossary/#std-term-query-predicate) to filter registries, collections, and artifact versions based on one or more [MongoDB-style queries](https://www.mongodb.com/docs/compass/current/query/filter/). - -The following table lists query names you can use based on the type of item you want to filter: - -| | query name | -| ----- | ----- | -| registries | `name`, `description`, `created_at`, `updated_at` | -| collections | `name`, `tag`, `description`, `created_at`, `updated_at` | -| versions | `tag`, `alias`, `created_at`, `updated_at`, `metadata` | - -The proceeding code examples demonstrate some common search scenarios. - -To use the `wandb.Api().registries()` method, first import the W&B Python SDK ([`wandb`]({{< relref "/ref/python/_index.md" >}})) library: -```python -import wandb - -# (Optional) Create an instance of the wandb.Api() class for readability -api = wandb.Api() -``` - -Filter all registries that contain the string `model`: - -```python -# Filter all registries that contain the string `model` -registry_filters = { - "name": {"$regex": "model"} -} - -# Returns an iterable of all registries that match the filters -registries = api.registries(filter=registry_filters) -``` - -Filter all collections, independent of registry, that contains the string `yolo` in the collection name: - -```python -# Filter all collections, independent of registry, that -# contains the string `yolo` in the collection name -collection_filters = { - "name": {"$regex": "yolo"} -} - -# Returns an iterable of all collections that match the filters -collections = api.registries().collections(filter=collection_filters) -``` - -Filter all collections, independent of registry, that contains the string `yolo` in the collection name and possesses `cnn` as a tag: - -```python -# Filter all collections, independent of registry, that contains the -# string `yolo` in the collection name and possesses `cnn` as a tag -collection_filters = { - "name": {"$regex": "yolo"}, - "tag": "cnn" -} - -# Returns an iterable of all collections that match the filters -collections = api.registries().collections(filter=collection_filters) -``` - -Find all artifact versions that contains the string `model` and has either the tag `image-classification` or an `latest` alias: - -```python -# Find all artifact versions that contains the string `model` and -# has either the tag `image-classification` or an `latest` alias -registry_filters = { - "name": {"$regex": "model"} -} - -# Use logical $or operator to filter artifact versions -version_filters = { - "$or": [ - {"tag": "image-classification"}, - {"alias": "production"} - ] -} - -# Returns an iterable of all artifact versions that match the filters -artifacts = api.registries(filter=registry_filters).collections().versions(filter=version_filters) -``` - -See the MongoDB documentation for more information on [logical query operators](https://www.mongodb.com/docs/manual/reference/operator/query-logical/). - -Each item in the `artifacts` iterable in the previous code snippet is an instance of the `Artifact` class. This means that you can access each artifact's attributes, such as `name`, `collection`, `aliases`, `tags`, `created_at`, and more: - -```python -for art in artifacts: - print(f"artifact name: {art.name}") - print(f"collection artifact belongs to: { art.collection.name}") - print(f"artifact aliases: {art.aliases}") - print(f"tags attached to artifact: {art.tags}") - print(f"artifact created at: {art.created_at}\n") -``` -For a complete list of an artifact object's attributes, see the [Artifacts Class]({{< relref "/ref/python/experiments/artifact/_index.md" >}}) in the API Reference docs. - - -Filter all artifact versions, independent of registry or collection, created between 2024-01-08 and 2025-03-04 at 13:10 UTC: - -```python -# Find all artifact versions created between 2024-01-08 and 2025-03-04 at 13:10 UTC. - -artifact_filters = { - "alias": "latest", - "created_at" : {"$gte": "2024-01-08", "$lte": "2025-03-04 13:10:00"}, -} - -# Returns an iterable of all artifact versions that match the filters -artifacts = api.registries().collections().versions(filter=artifact_filters) -``` - -Specify the date and time in the format `YYYY-MM-DD HH:MM:SS`. You can omit the hours, minutes, and seconds if you want to filter by date only. - -See the MongoDB documentation for more information on [query comparisons](https://www.mongodb.com/docs/manual/reference/operator/query-comparison/). - -## Prioritize registries with stars - -Add a "star" to label important or frequently used registries. Starred registries appear in the **My starred registries** section on the Registry landing page. - -To add a star to a registry: - -1. Navigate to the W&B Registry. -2. Click the star icon next to the name of the registry. - - - diff --git a/content/en/guides/core/reports/_index.md b/content/en/guides/core/reports/_index.md deleted file mode 100644 index 86cfac1b8b..0000000000 --- a/content/en/guides/core/reports/_index.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -description: Project management and collaboration tools for machine learning projects -menu: - default: - identifier: reports - parent: core -title: Reports -weight: 3 -url: guides/reports -cascade: -- url: guides/reports/:filename ---- - - -{{< cta-button productLink="https://wandb.ai/stacey/deep-drive/reports/The-View-from-the-Driver-s-Seat--Vmlldzo1MTg5NQ?utm_source=fully_connected&utm_medium=blog&utm_campaign=view+from+the+drivers+seat" colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/intro/Report_API_Quickstart.ipynb" >}} - -Use W&B Reports to: -- Organize Runs. -- Embed and automate visualizations. -- Describe your findings. -- Share updates with collaborators, either as a LaTeX zip file a PDF. - - - -The following image shows a section of a report created from metrics that were logged to W&B over the course of training. - -{{< img src="/images/reports/safe-lite-benchmark-with-comments.png" alt="W&B report with benchmark results" max-width="90%" >}} - -View the report where the above image was taken from [here](https://wandb.ai/stacey/saferlife/reports/SafeLife-Benchmark-Experiments--Vmlldzo0NjE4MzM). - -## How it works -Create a collaborative report with a few clicks. - -1. Navigate to your W&B project workspace in the W&B App. -2. Click the **Create report** button in the upper right corner of your workspace. - -{{< img src="/images/reports/create_a_report_button.png" alt="Create report button" max-width="90%">}} - -3. A modal titled **Create Report** will appear. Select the charts and panels you want to add to your report. (You can add or remove charts and panels later). -4. Click **Create report**. -5. Edit the report to your desired state. -6. Click **Publish to project**. -7. Click the **Share** button to share your report with collaborators. - -See the [Create a report]({{< relref "./create-a-report.md" >}}) page for more information on how to create reports interactively an programmatically with the W&B Python SDK. - -## How to get started -Depending on your use case, explore the following resources to get started with W&B Reports: - -* Check out our [video demonstration](https://www.youtube.com/watch?v=2xeJIv_K_eI) to get an overview of W&B Reports. -* Explore the [Reports gallery]({{< relref "./reports-gallery.md" >}}) for examples of live reports. -* Try the [Programmatic Workspaces]({{< relref "/tutorials/workspaces.md" >}}) tutorial to learn how to create and customize your workspace. -* Read curated Reports in [W&B Fully Connected](https://wandb.me/fc). - -## Recommended practices and tips - -For best practices and tips for Experiments and logging, see [Best Practices: Reports](https://wandb.ai/wandb/pytorch-lightning-e2e/reports/W-B-Best-Practices-Guide--VmlldzozNTU1ODY1#reports). \ No newline at end of file diff --git a/content/en/guides/core/reports/clone-and-export-reports.md b/content/en/guides/core/reports/clone-and-export-reports.md deleted file mode 100644 index 14bf2afad5..0000000000 --- a/content/en/guides/core/reports/clone-and-export-reports.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -description: Export a W&B Report as a PDF or LaTeX. -menu: - default: - identifier: clone-and-export-reports - parent: reports -title: Clone and export reports -weight: 40 ---- - -{{% alert %}} -W&B Report and Workspace API is in Public Preview. -{{% /alert %}} - -## Export reports - -Export a report as a PDF or LaTeX. Within your report, select the kebab icon to expand the dropdown menu. Choose **Download and** select either PDF or LaTeX output format. - -## Cloning reports - -{{< tabpane text=true >}} -{{% tab header="W&B App" value="app" %}} -Within your report, select the kebab icon to expand the dropdown menu. Choose the **Clone this report** button. Pick a destination for your cloned report in the modal. Choose **Clone report**. - -{{< img src="/images/reports/clone_reports.gif" alt="Cloning reports" >}} - -Clone a report to reuse a project's template and format. Cloned projects are visible to your team if you clone a project within the team's account. Projects cloned within an individual's account are only visible to that user. -{{% /tab %}} - -{{% tab header="Report and Workspace API" value="python_wr_api"%}} - -Load a Report from a URL to use it as a template. - -```python -report = wr.Report( - project=PROJECT, title="Quickstart Report", description="That was easy!" -) # Create -report.save() # Save -new_report = wr.Report.from_url(report.url) # Load -``` - -Edit the content within `new_report.blocks`. - -```python -pg = wr.PanelGrid( - runsets=[ - wr.Runset(ENTITY, PROJECT, "First Run Set"), - wr.Runset(ENTITY, PROJECT, "Elephants Only!", query="elephant"), - ], - panels=[ - wr.LinePlot(x="Step", y=["val_acc"], smoothing_factor=0.8), - wr.BarPlot(metrics=["acc"]), - wr.MediaBrowser(media_keys="img", num_columns=1), - wr.RunComparer(diff_only="split", layout={"w": 24, "h": 9}), - ], -) -new_report.blocks = ( - report.blocks[:1] + [wr.H1("Panel Grid Example"), pg] + report.blocks[1:] -) -new_report.save() -``` -{{% /tab %}} -{{< /tabpane >}} diff --git a/content/en/guides/core/reports/collaborate-on-reports.md b/content/en/guides/core/reports/collaborate-on-reports.md deleted file mode 100644 index 77de631c29..0000000000 --- a/content/en/guides/core/reports/collaborate-on-reports.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -description: Collaborate and share W&B Reports with peers, co-workers, and your team. -menu: - default: - identifier: collaborate-on-reports - parent: reports -title: Collaborate on reports -weight: 30 ---- - -This page describes various ways to collaborate on reports with your team. - -## Share a report -When viewing a report, click **Share**, then: -- To share a link to the report with an email address or a username, click **Invite**. Enter an email address or username, select **Can view** or **Can edit**, then click **Invite**. If you share by email, the email address does not need to be a member of your organization or team. -- To generate a sharing link instead, click **Share**. Adjust the permissions for the link, then click **Copy report link**. Share the link with the member. - -When viewing the report, click a panel to open it in full-screen mode. If you copy the URL from the browser and share it with another user, when they access the link the panel will open directly in full-screen mode. - -## Edit a report -When any team member clicks the **Edit** button to begin editing the report, a draft is automatically saved. Select **Save to report** to publish your changes. - -If an edit conflict occurs, such as when two team members edit the report at once, a warning notification helps you to resolve any conflicts. - -{{< img src="/images/reports/share-report.gif" alt="Report sharing modal for a report in a 'Public' project" max-width="90%">}} - -## Comment on reports -Click **Comment** to leave a comment on a report. - -To comment directly on a panel, hover over the panel, then click the comment button, which looks like a speech bubble. - -{{< img src="/images/reports/demo_comment_on_panels_in_reports.gif" alt="Adding a comment to a panel" >}} - -## Star a report -If your team has a large number of reports, click **Star** at the top of a report to add it to your favorites. When viewing your team's list of reports, click the star in a report's row to add it to your favorites. Starred reports appear at the top of the list. - -From the list of reports, you can see how many members have starred each report to gauge its relative popularity. \ No newline at end of file diff --git a/content/en/guides/core/reports/create-a-report.md b/content/en/guides/core/reports/create-a-report.md deleted file mode 100644 index 9e7cc2278d..0000000000 --- a/content/en/guides/core/reports/create-a-report.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -description: Create a W&B Report with the W&B App or programmatically. -menu: - default: - identifier: create-a-report - parent: reports -title: Create a report -weight: 10 ---- - -{{% alert %}} -W&B Report and Workspace API is in Public Preview. -{{% /alert %}} - -Select a tab below to learn how to create a report in the W&B App or programmatically with the W&B Report and Workspace API. - -See this [Google Colab](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/intro/Report_API_Quickstart.ipynb) for an example on how to programmatically create a report. - - -{{< tabpane text=true >}} -{{% tab header="W&B App" value="app" %}} -1. Navigate to your project workspace in the W&B App. -2. Click **Create report** in the upper right corner of your workspace. - - {{< img src="/images/reports/create_a_report_button.png" alt="Create report button" >}} - -3. A modal will appear. Select the charts you would like to start with. You can add or delete charts later from the report interface. - - {{< img src="/images/reports/create_a_report_modal.png" alt="Create report modal" >}} - -4. Select the **Filter run sets** option to prevent new runs from being added to your report. You can toggle this option on or off. Once you click **Create report,** a draft report will be available in the report tab to continue working on. -{{% /tab %}} - -{{% tab header="Report tab" value="reporttab"%}} -1. Navigate to your project workspace in the W&B App. -2. Select to the **Reports** tab (clipboard image) in your project. -3. Select the **Create Report** button on the report page. - - {{< img src="/images/reports/create_report_button.png" alt="Create report button" >}} -{{% /tab %}} - -{{% tab header="Report and Workspace API" value="python_wr_api"%}} -Create a report programmatically: - -1. Install W&B SDK (`wandb`) and Report and Workspace API (`wandb-workspaces`): - ```bash - pip install wandb wandb-workspaces - ``` -2. Next, import workspaces - ```python - import wandb - import wandb_workspaces.reports.v2 as wr - ``` -3. Create a report with `wandb_workspaces.reports.v2.Report`. Create a report instance with the Report Class Public API ([`wandb.apis.reports`]({{< relref "/ref/python/public-api/api.md#reports" >}})). Specify a name for the project. - ```python - report = wr.Report(project="report_standard") - ``` - -4. Save the report. Reports are not uploaded to the W&B server until you call the .`save()` method: - ```python - report.save() - ``` - -For information on how to edit a report interactively with the App UI or programmatically, see [Edit a report]({{< relref "/guides/core/reports/edit-a-report" >}}). -{{% /tab %}} -{{< /tabpane >}} diff --git a/content/en/guides/core/reports/cross-project-reports.md b/content/en/guides/core/reports/cross-project-reports.md deleted file mode 100644 index 5a9cc7dd2a..0000000000 --- a/content/en/guides/core/reports/cross-project-reports.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -description: Compare runs from two different projects with cross-project reports. -menu: - default: - identifier: cross-project-reports - parent: reports -title: Compare runs across projects -weight: 60 ---- -{{% alert %}} -Watch a [video demonstrating comparing runs across projects](https://www.youtube.com/watch?v=uD4if_nGrs4) (2 min). -{{% /alert %}} - - -Compare runs from two different projects with cross-project reports. Use the project selector in the run set table to pick a project. - -{{< img src="/images/reports/howto_pick_a_different_project_to_draw_runs_from.gif" alt="Compare runs across different projects" >}} - -The visualizations in the section pull columns from the first active runset. Make sure that the first run set checked in the section has that column available if you do not see the metric you are looking for in the line plot. - -This feature supports history data on time series lines, but we don't support pulling different summary metrics from different projects. In other words, you can not create a scatter plot from columns that are only logged in another project. - -If you need to compare runs from two projects and the columns are not working, add a tag to the runs in one project and then move those runs to the other project. You can still filter only the runs from each project, but the report includes all the columns for both sets of runs. - -## View-only report links - -Share a view-only link to a report that is in a private project or team project. - -{{< img src="/images/reports/magic-links.gif" alt="View-only report links" >}} - -View-only report links add a secret access token to the URL, so anyone who opens the link can view the page. Anyone can use the magic link to view the report without logging in first. For customers on [W&B Local]({{< relref "/guides/hosting/" >}}) private cloud installations, these links remain behind your firewall, so only members of your team with access to your private instance _and_ access to the view-only link can view the report. - -In **view-only mode**, someone who is not logged in can see the charts and mouse over to see tooltips of values, zoom in and out on charts, and scroll through columns in the table. When in view mode, they cannot create new charts or new table queries to explore the data. View-only visitors to the report link won't be able to click a run to get to the run page. Also, the view-only visitors would not be able to see the share modal but instead would see a tooltip on hover which says: `Sharing not available for view only access`. - -{{% alert color="info" %}} -The magic links are only available for “Private” and “Team” projects. For “Public” (anyone can view) or “Open” (anyone can view and contribute runs) projects, the links can't turn on/off because this project is public implying that it is already available to anyone with the link. -{{% /alert %}} - -## Send a graph to a report - -Send a graph from your workspace to a report to keep track of your progress. Click the dropdown menu on the chart or panel you'd like to copy to a report and click **Add to report** to select the destination report. \ No newline at end of file diff --git a/content/en/guides/core/reports/edit-a-report.md b/content/en/guides/core/reports/edit-a-report.md deleted file mode 100644 index f607d3aa11..0000000000 --- a/content/en/guides/core/reports/edit-a-report.md +++ /dev/null @@ -1,722 +0,0 @@ ---- -description: Edit a report interactively with the App UI or programmatically with - the W&B SDK. -menu: - default: - identifier: edit-a-report - parent: reports -title: Edit a report -weight: 20 ---- - -{{% alert %}} -W&B Report and Workspace API is in Public Preview. -{{% /alert %}} - -Edit a report interactively with the App UI or programmatically with the W&B SDK. - -Reports consist of _blocks_. Blocks make up the body of a report. Within these blocks you can add text, images, embedded visualizations, plots from experiments and run, and panels grids. - -_Panel grids_ are a specific type of block that hold panels and _run sets_. Run sets are a collection of runs logged to a project in W&B. Panels are visualizations of run set data. - - -{{% alert %}} -Check out the [Programmatic workspaces tutorial]({{< relref "/tutorials/workspaces.md" >}}) for a step by step example on how create and customize a saved workspace view. -{{% /alert %}} - -{{% alert %}} -Verify that you have the W&B Report and Workspace API `wandb-workspaces` installed in addition to the W&B Python SDK if you want to programmatically edit a report: - -```pip -pip install wandb wandb-workspaces -``` -{{% /alert %}} - -## Add plots - -Each panel grid has a set of run sets and a set of panels. The run sets at the bottom of the section control what data shows up on the panels in the grid. Create a new panel grid if you want to add charts that pull data from a different set of runs. - -{{< tabpane text=true >}} -{{% tab header="W&B App" value="app" %}} - -Enter a forward slash (`/`) in the report to display a dropdown menu. Select **Add panel** to add a panel. You can add any panel that is supported by W&B, including a line plot, scatter plot or parallel coordinates chart. - -{{< img src="/images/reports/demo_report_add_panel_grid.gif" alt="Add charts to a report" >}} -{{% /tab %}} - -{{% tab header="Report and Workspace API" value="python_wr_api"%}} -Add plots to a report programmatically with the SDK. Pass a list of one or more plot or chart objects to the `panels` parameter in the `PanelGrid` Public API Class. Create a plot or chart object with its associated Python Class. - - -The proceeding examples demonstrates how to create a line plot and scatter plot. - -```python -import wandb -import wandb_workspaces.reports.v2 as wr - -report = wr.Report( - project="report-editing", - title="An amazing title", - description="A descriptive description.", -) - -blocks = [ - wr.PanelGrid( - panels=[ - wr.LinePlot(x="time", y="velocity"), - wr.ScatterPlot(x="time", y="acceleration"), - ] - ) -] - -report.blocks = blocks -report.save() -``` - -For more information about available plots and charts you can add to a report programmatically, see `wr.panels`. - -{{% /tab %}} -{{< /tabpane >}} - - -## Add run sets - -Add run sets from projects interactively with the App UI or the W&B SDK. - -{{< tabpane text=true >}} -{{% tab header="W&B App" value="app" %}} - -Enter a forward slash (`/`) in the report to display a dropdown menu. From the dropdown, choose **Panel Grid**. This will automatically import the run set from the project the report was created from. - -If you import a panel into a report, run names are inherited from the project. In the report, you can optionally [rename a run]({{< relref "/guides/models/track/runs/#rename-a-run" >}}) to give the reader more context. The run is renamed only in the individual panel. If you clone the panel in the same report, the run is also renamed in the cloned panel. - -1. In the report, click the pencil icon to open the report editor. -1. In the run set, find the run to rename. Hover over the report name, click the three vertical dots. Select one of the following choices, then submit the form. - - - **Rename run for project**: rename the run across the entire project. To generate a new random name, leave the field blank. - - **Rename run for panel grid** rename the run only in the report, preserving the existing name in other contexts. Generating a new random name is not supported. - -1. Click **Publish report**. - -{{% /tab %}} - -{{% tab header="Report and Workspace API" value="python_wr_api"%}} - -Add run sets from projects with the `wr.Runset()` and `wr.PanelGrid` Classes. The proceeding procedure describes how to add a runset: - -1. Create a `wr.Runset()` object instance. Provide the name of the project that contains the run sets for the project parameter and the entity that owns the project for the entity parameter. -2. Create a `wr.PanelGrid()` object instance. Pass a list of one or more runset objects to the `run sets` parameter. -3. Store one or more `wr.PanelGrid()` object instances in a list. -4. Update the report instance blocks attribute with the list of panel grid instances. - -```python -import wandb -import wandb_workspaces.reports.v2 as wr - -report = wr.Report( - project="report-editing", - title="An amazing title", - description="A descriptive description.", -) - -panel_grids = wr.PanelGrid( - runsets=[wr.RunSet(project="", entity="")] -) - -report.blocks = [panel_grids] -report.save() -``` - -You can optionally add runsets and panels with one call to the SDK: - -```python -import wandb - -report = wr.Report( - project="report-editing", - title="An amazing title", - description="A descriptive description.", -) - -panel_grids = wr.PanelGrid( - panels=[ - wr.LinePlot( - title="line title", - x="x", - y=["y"], - range_x=[0, 100], - range_y=[0, 100], - log_x=True, - log_y=True, - title_x="x axis title", - title_y="y axis title", - ignore_outliers=True, - groupby="hyperparam1", - groupby_aggfunc="mean", - groupby_rangefunc="minmax", - smoothing_factor=0.5, - smoothing_type="gaussian", - smoothing_show_original=True, - max_runs_to_show=10, - plot_type="stacked-area", - font_size="large", - legend_position="west", - ), - wr.ScatterPlot( - title="scatter title", - x="y", - y="y", - # z='x', - range_x=[0, 0.0005], - range_y=[0, 0.0005], - # range_z=[0,1], - log_x=False, - log_y=False, - # log_z=True, - running_ymin=True, - running_ymean=True, - running_ymax=True, - font_size="small", - regression=True, - ), - ], - runsets=[wr.RunSet(project="", entity="")], -) - - -report.blocks = [panel_grids] -report.save() -``` - -{{% /tab %}} -{{< /tabpane >}} - - -## Freeze a run set - -A report automatically updates run sets to show the latest data from the project. You can preserve the run set in a report by *freezing* that run set. When you freeze a run set, you preserve the state of the run set in a report at a point in time. - -To freeze a run set when viewing a report, click the snowflake icon in its panel grid near the **Filter** button. - -{{< img src="/images/reports/freeze_runset.png" alt="Freeze runset button" >}} - -## Group a run set programmatically - -Group runs in a run set programmatically with the [Workspace and Reports API]({{< relref "/ref/wandb_workspaces/reports" >}}). - -You can group runs in a run set by config values, run metadata or summary metrics. The following table lists the available grouping methods along with the available keys for that grouping method: - -| Grouping Method | Description |Available keys | -| ---|------| --- | -| Config values| Group runs by config values | Values specified in config parameter in `wandb.init(config=)` | -| Run metadata| Group runs by run metadata | `State`, `Name`, `JobType` | -| Summary metrics| Group runs by summary metrics | Values you log to a run with `wandb.Run.log()` | - - - -### Group runs by config values - -Group runs by config values to compare runs with similar configurations. Config values are parameters you specify in your run configuration `(wandb.init(config=))`. To group runs by config values, use the `config.` syntax, where `` is the name of the config value you want to group by. - -For example, the following code snippet first initializes a run with a config value for `group`, then groups runs in a report based on the `group` config value. Replace values for `` and `` with your W&B entity and project names. - -```python -import wandb -import wandb_workspaces.reports.v2 as wr - -entity = "" -project = "" - -for group in ["control", "experiment_a", "experiment_b"]: - for i in range(3): - with wandb.init(entity=entity, project=project, group=group, config={"group": group, "run": i}, name=f"{group}_run_{i}") as run: - # Simulate some training - for step in range(100): - run.log({ - "acc": 0.5 + (step / 100) * 0.3 + (i * 0.05), - "loss": 1.0 - (step / 100) * 0.5 - }) -``` - -Within your Python script or notebook, you can then group runs by the `config.group` value: - -```python -runset = wr.Runset( - project=project, - entity=entity, - groupby=["config.group"] # Group by the "group" config value -) -``` - -Continuing from the previous example, you can create a report with the grouped run set: - -```python -report = wr.Report( - entity=entity, - project=project, - title="Grouped Runs Example", -) - -report.blocks = [ - wr.PanelGrid( - runsets=[runset], - ) - ] - -report.save() -``` - -### Group runs by run metadata - -Group runs by a run's name (`Name`), state (`State`), or job type (`JobType`). - -Continuing from the previous example, you can group your runs by their name with the following code snippet: - -```python -runset = wr.Runset( - project=project, - entity=entity, - groupby=["Name"] # Group by run names -) -``` - -{{% alert %}} -The name of the run is the name you specify in the `wandb.init(name=)` parameter. If you do not specify a name, W&B generates a random name for the run. - -You can find the name of the run in the **Overview** page of a run in the W&B App or programmatically with `Api.runs().run.name`. -{{% /alert %}} - -### Group runs by summary metrics - -The following examples demonstrate how to group runs by summary metrics. Summary metrics are the values you log to a run with `wandb.Run.log()`. After you log a run, you can find the names of your summary metrics in the W&B App under the **Summary** section of a run's **Overview** page. - -The syntax for grouping runs by summary metrics is `summary.`, where `` is the name of the summary metric you want to group by. - -For example, suppose you log a summary metric called `acc`: - -```python -import wandb -import wandb_workspaces.reports.v2 as wr - -entity = "" -project = "" - -for group in ["control", "experiment_a", "experiment_b"]: - for i in range(3): - with wandb.init(entity=entity, project=project, group=group, config={"group": group, "run": i}, name=f"{group}_run_{i}") as run: - # Simulate some training - for step in range(100): - run.log({ - "acc": 0.5 + (step / 100) * 0.3 + (i * 0.05), - "loss": 1.0 - (step / 100) * 0.5 - }) - -``` - -You can then group runs by the `summary.acc` summary metric: - -```python -runset = wr.Runset( - project=project, - entity=entity, - groupby=["summary.acc"] # Group by summary values -) -``` - -## Filter a run set programmatically - -Programmatically filter run sets and add them to a report with the [Workspace and Reports API]({{< relref "/ref/wandb_workspaces/reports" >}}). - -The general syntax for a filter expression is: - -```text -Filter('key') operation -``` - -Where `key` is the name of the filter, `operation` is a comparison operator (e.g., `>`, `<`, `==`, `in`, `not in`, `or`, and `and`), and `` is the value to compare against. `Filter` is a placeholder for the type of filter you want to apply. The following table lists the available filters and their descriptions: - -| Filter | Description | Available keys | -| ---|---| --- | -|`Config('key')` | Filter by config values | Values specified in `config` parameter in `wandb.init(config=)`. | -|`SummaryMetric('key')` | Filter by summary metrics | Values you log to a run with `wandb.Run.log()`. | -|`Tags('key')` | Filter by tags | Tag values that you add to your run (programmatically or with the W&B App). | -|`Metric('key')` | Filter by run properties | `tags`, `state`, `displayName`, `jobType` | - -Once you have defined your filters, you can create a report and pass the filtered run sets to `wr.PanelGrid(runsets=)`. See the **Report and Workspace API** tabs throughout this page for more information on how to add various elements to a report programmatically. - -The following examples demonstrate how to filter run sets in a report. Replace values enclosed in `<>` with your own values. - -### Config filters - -Filter a runset by one or more config values. Config values are parameters you specify in your run configuration (`wandb.init(config=)`). - -For example, the following code snippet first initializes a run with a config value for `learning_rate` and `batch_size`, then filters runs in a report based on the `learning_rate` config value. - -```python -import wandb - -config = { - "learning_rate": 0.01, - "batch_size": 32, -} - -with wandb.init(project="", entity="", config=config) as run: - # Your training code here - pass -``` - -Within your Python script or notebook, you can then programmatically filter runs that have a learning rate greater than `0.01`. - -```python -import wandb_workspaces.reports.v2 as wr - -runset = wr.Runset( - entity="", - project="", - filters="Config('learning_rate') > 0.01" -) -``` - -You can also filter by multiple config values with the `and` operator: - -```python -runset = wr.Runset( - entity="", - project="", - filters="Config('learning_rate') > 0.01 and Config('batch_size') == 32" -) -``` - -Continuing from the previous example, you can create a report with the filtered runset as follows: - -```python -report = wr.Report( - entity="", - project="", - title="My Report" -) - -report.blocks = [ - wr.PanelGrid( - runsets=[runset], - panels=[ - wr.LinePlot( - x="Step", - y=["accuracy"], - ) - ] - ) -] - -report.save() -``` - -### Metric filters - -Filter run sets based on a run's: tag (`tags`), run state (`state`), run name (`displayName`), or job type (`jobType`). - -{{% alert %}} -`Metric` filters posses a different syntax. Pass a list of values as a list. - -```text -Metric('key') operation [] -``` -{{% /alert %}} - -For example, consider the following Python snippet that creates three runs and assigns each of them a name: - -```python -import wandb - -with wandb.init(project="", entity="") as run: - for i in range(3): - run.name = f"run{i+1}" - # Your training code here - pass -``` - -When you create your report, you can filter runs by their display name. For example, to filter runs with names `run1`, `run2`, and `run3`, you can use the following code: - -```python -runset = wr.Runset( - entity="", - project="", - filters="Metric('displayName') in ['run1', 'run2', 'run3']" -) -``` - -{{% alert %}} -You can find the name of the run in the **Overview** page of a run in the W&B App or programmatically with `Api.runs().run.name`. -{{% /alert %}} - -The following examples demonstrate how to filter a runset by the run's state (`finished`, `crashed`, or `running`): - -```python -runset = wr.Runset( - entity="", - project="", - filters="Metric('state') in ['finished']" -) -``` - -```python -runset = wr.Runset( - entity="", - project="", - filters="Metric('state') not in ['crashed']" -) -``` - - -### SummaryMetric filters - -The following examples demonstrate how to filter a run set by summary metrics. Summary metrics are the values you log to a run with `wandb.Run.log()`. After you log a run, you can find the names of your summary metrics in the W&B App under the **Summary** section of a run's **Overview** page. - -```python -runset = wr.Runset( - entity="", - project="", - filters="SummaryMetric('accuracy') > 0.9" -) -``` - -```python -runset = wr.Runset( - entity="", - project="", - filters="Metric('state') in ['finished'] and SummaryMetric('train/train_loss') < 0.5" -) -``` - -### Tags filters - -The following code snippet shows how to filter a runs set by its tags. Tags are values you add to a run (programmatically or with the W&B App). - -```python -runset = wr.Runset( - entity="", - project="", - filters="Tags('training') == 'training'" -) -``` - -## Add code blocks - -Add code blocks to your report interactively with the App UI or with the W&B SDK. - -{{< tabpane text=true >}} -{{% tab header="App UI" value="app" %}} - -Enter a forward slash (`/`) in the report to display a dropdown menu. From the dropdown choose **Code**. - -Select the name of the programming language on the right hand of the code block. This will expand a dropdown. From the dropdown, select your programming language syntax. You can choose from Javascript, Python, CSS, JSON, HTML, Markdown, and YAML. - -{{% /tab %}} - -{{% tab header="Report and Workspace API" value="python_wr_api" %}} - -Use the `wr.CodeBlock` Class to create a code block programmatically. Provide the name of the language and the code you want to display for the language and code parameters, respectively. - -For example the proceeding example demonstrates a list in YAML file: - -```python -import wandb -import wandb_workspaces.reports.v2 as wr - -report = wr.Report(project="report-editing") - -report.blocks = [ - wr.CodeBlock( - code=["this:", "- is", "- a", "cool:", "- yaml", "- file"], language="yaml" - ) -] - -report.save() -``` - -This will render a code block similar to: - -```yaml -this: -- is -- a -cool: -- yaml -- file -``` - -The proceeding example demonstrates a Python code block: - -```python -report = wr.Report(project="report-editing") - - -report.blocks = [wr.CodeBlock(code=["Hello, World!"], language="python")] - -report.save() -``` - -This will render a code block similar to: - -```md -Hello, World! -``` - -{{% /tab %}} - -{{% /tabpane %}} - -## Add markdown - -Add markdown to your report interactively with the App UI or with the W&B SDK. - -{{< tabpane text=true >}} -{{% tab header="App UI" value="app" %}} - -Enter a forward slash (`/`) in the report to display a dropdown menu. From the dropdown choose **Markdown**. - -{{% /tab %}} - -{{% tab header="Report and Workspace API" value="python_wr_api" %}} - -Use the `wandb.apis.reports.MarkdownBlock` Class to create a markdown block programmatically. Pass a string to the `text` parameter: - -```python -import wandb -import wandb_workspaces.reports.v2 as wr - -report = wr.Report(project="report-editing") - -report.blocks = [ - wr.MarkdownBlock(text="Markdown cell with *italics* and **bold** and $e=mc^2$") -] -``` - -This will render a markdown block similar to: - -{{< img src="/images/reports/markdown.png" alt="Rendered markdown block" >}} - -{{% /tab %}} - -{{% /tabpane %}} - - -## Add HTML elements - -Add HTML elements to your report interactively with the App UI or with the W&B SDK. - -{{< tabpane text=true >}} -{{% tab header="App UI" value="app" %}} - -Enter a forward slash (`/`) in the report to display a dropdown menu. From the dropdown select a type of text block. For example, to create an H2 heading block, select the `Heading 2` option. - -{{% /tab %}} - -{{% tab header="Report and Workspace API" value="python_wr_api" %}} - -Pass a list of one or more HTML elements to `wandb.apis.reports.blocks` attribute. The proceeding example demonstrates how to create an H1, H2, and an unordered list: - -```python -import wandb -import wandb_workspaces.reports.v2 as wr - -report = wr.Report(project="report-editing") - -report.blocks = [ - wr.H1(text="How Programmatic Reports work"), - wr.H2(text="Heading 2"), - wr.UnorderedList(items=["Bullet 1", "Bullet 2"]), -] - -report.save() -``` - -This will render a HTML elements to the following: - - -{{< img src="/images/reports/render_html.png" alt="Rendered HTML elements" >}} - -{{% /tab %}} - -{{% /tabpane %}} - -## Embed rich media links - -Embed rich media within the report with the App UI or with the W&B SDK. - -{{< tabpane text=true >}} -{{% tab header="App UI" value="app" %}} - -Copy and past URLs into reports to embed rich media within the report. The following animations demonstrate how to copy and paste URLs from Twitter, YouTube, and SoundCloud. - -### Twitter - -Copy and paste a Tweet link URL into a report to view the Tweet within the report. - -{{< img src="/images/reports/twitter.gif" alt="Embedding Twitter content" >}} - -### Youtube - -Copy and paste a YouTube video URL link to embed a video in the report. - -{{< img src="/images/reports/youtube.gif" alt="Embedding YouTube videos" >}} - -### SoundCloud - -Copy and paste a SoundCloud link to embed an audio file into a report. - -{{< img src="/images/reports/soundcloud.gif" alt="Embedding SoundCloud audio" >}} - -{{% /tab %}} - -{{% tab header="Report and Workspace API" value="python_wr_api" %}} - -Pass a list of one or more embedded media objects to the `wandb.apis.reports.blocks` attribute. The proceeding example demonstrates how to embed video and Twitter media into a report: - -```python -import wandb -import wandb_workspaces.reports.v2 as wr - -report = wr.Report(project="report-editing") - -report.blocks = [ - wr.Video(url="https://www.youtube.com/embed/6riDJMI-Y8U"), - wr.Twitter( - embed_html='\n' - ), -] -report.save() -``` - -{{% /tab %}} - -{{% /tabpane %}} - -## Duplicate and delete panel grids - -If you have a layout that you would like to reuse, you can select a panel grid and copy-paste it to duplicate it in the same report or even paste it into a different report. - -Highlight a whole panel grid section by selecting the drag handle in the upper right corner. Click and drag to highlight and select a region in a report such as panel grids, text, and headings. - -{{< img src="/images/reports/demo_copy_and_paste_a_panel_grid_section.gif" alt="Copying panel grids" >}} - -Select a panel grid and press `delete` on your keyboard to delete a panel grid. - -{{< img src="/images/reports/delete_panel_grid.gif" alt="Deleting panel grids" >}} - -## Collapse headers to organize Reports - -Collapse headers in a Report to hide content within a text block. When the report is loaded, only headers that are expanded will show content. Collapsing headers in reports can help organize your content and prevent excessive data loading. The proceeding gif demonstrates the process. - -{{< img src="/images/reports/collapse_headers.gif" alt="Collapsing headers in a report." >}} - -## Visualize relationships across multiple dimensions - -To effectively visualize relationships across multiple dimensions, use a color gradient to represent one of the variables. This enhances clarity and makes patterns easier to interpret. - -1. Choose a variable to represent with a color gradient (e.g., penalty scores, learning rates, etc.). This allows for a clearer understanding of how penalty (color) interacts with reward/side effects (y-axis) over training time (x-axis). -2. Highlight key trends. Hovering over a specific group of runs highlights them in the visualization. - diff --git a/content/en/guides/core/reports/embed-reports.md b/content/en/guides/core/reports/embed-reports.md deleted file mode 100644 index d1e00ca180..0000000000 --- a/content/en/guides/core/reports/embed-reports.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -description: Embed W&B reports directly into Notion or with an HTML IFrame element. -menu: - default: - identifier: embed-reports - parent: reports -title: Embed a report -weight: 50 ---- - -## HTML iframe element - -Select the **Share** button on the upper right hand corner within a report. A modal window will appear. Within the modal window, select **Copy embed code**. The copied code will render within an Inline Frame (IFrame) HTML element. Paste the copied code into an iframe HTML element of your choice. - -{{% alert %}} -Only **public** reports are viewable when embedded. -{{% /alert %}} - -{{< img src="/images/reports/get_embed_url.gif" alt="Getting embed code" >}} - -## Confluence - -The proceeding animation demonstrates how to insert the direct link to the report within an IFrame cell in Confluence. - -{{< img src="//images/reports/embed_iframe_confluence.gif" alt="Embedding in Confluence" >}} - -## Notion - -The proceeding animation demonstrates how to insert a report into a Notion document using an Embed block in Notion and the report's embedded code. - -{{< img src="//images/reports/embed_iframe_notion.gif" alt="Embedding in Notion" >}} - -## Gradio - -You can use the `gr.HTML` element to embed W&B Reports within Gradio Apps and use them within Hugging Face Spaces. - -```python -import gradio as gr - - -def wandb_report(url): - iframe = f' - -## Related resources - -* [Examples](https://github.com/wandb/examples): Try the code with notebook and script examples for each integration. -* [Video Tutorials](https://www.youtube.com/playlist?list=PLD80i8An1OEGajeVo15ohAQYF1Ttle0lk): Learn to use W&B with YouTube video tutorials diff --git a/content/en/guides/integrations/accelerate.md b/content/en/guides/integrations/accelerate.md deleted file mode 100644 index 4e5760bde7..0000000000 --- a/content/en/guides/integrations/accelerate.md +++ /dev/null @@ -1,88 +0,0 @@ ---- -description: Training and inference at scale made simple, efficient and adaptable -menu: - default: - identifier: accelerate - parent: integrations -title: Hugging Face Accelerate -weight: 140 ---- - -Hugging Face Accelerate is a library that enables the same PyTorch code to run across any distributed configuration, to simplify model training and inference at scale. - -Accelerate includes a W&B Tracker which we show how to use below. You can also read more about [Accelerate Trackers in Hugging Face](https://huggingface.co/docs/accelerate/main/en/usage_guides/tracking). - -## Start logging with Accelerate - -To get started with Accelerate and W&B you can follow the pseudocode below: - -```python -from accelerate import Accelerator - -# Tell the Accelerator object to log with wandb -accelerator = Accelerator(log_with="wandb") - -# Initialise your wandb run, passing wandb parameters and any config information -accelerator.init_trackers( - project_name="my_project", - config={"dropout": 0.1, "learning_rate": 1e-2} - init_kwargs={"wandb": {"entity": "my-wandb-team"}} - ) - -... - -# Log to wandb by calling `accelerator.log`, `step` is optional -accelerator.log({"train_loss": 1.12, "valid_loss": 0.8}, step=global_step) - - -# Make sure that the wandb tracker finishes correctly -accelerator.end_training() -``` - -Explaining more, you need to: -1. Pass `log_with="wandb"` when initialising the Accelerator class -2. Call the [`init_trackers`](https://huggingface.co/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator.init_trackers) method and pass it: -- a project name via `project_name` -- any parameters you want to pass to [`wandb.init()`]({{< relref "/ref/python/functions/init.md" >}}) via a nested dict to `init_kwargs` -- any other experiment config information you want to log to your wandb run, via `config` -3. Use the `.log` method to log to Weigths & Biases; the `step` argument is optional -4. Call `.end_training` when finished training - -## Access the W&B tracker - -To access the W&B tracker, use the `Accelerator.get_tracker()` method. Pass in the string corresponding to a tracker’s `.name` attribute, which returns the tracker on the `main` process. - -```python -wandb_tracker = accelerator.get_tracker("wandb") - -``` -From there you can interact with wandb’s run object like normal: - -```python -wandb_tracker.log_artifact(some_artifact_to_log) -``` - -{{% alert color="secondary" %}} -Trackers built in Accelerate will automatically execute on the correct process, so if a tracker is only meant to be ran on the main process it will do so automatically. - -If you want to truly remove Accelerate’s wrapping entirely, you can achieve the same outcome with: - -```python -wandb_tracker = accelerator.get_tracker("wandb", unwrap=True) -with accelerator.on_main_process: - wandb_tracker.log_artifact(some_artifact_to_log) -``` -{{% /alert %}} - -## Accelerate Articles -Below is an Accelerate article you may enjoy - -
- -HuggingFace Accelerate Super Charged With W&B - -* In this article, we'll look at what HuggingFace Accelerate has to offer and how simple it is to perform distributed training and evaluation, while logging results to W&B. - -Read the [Hugging Face Accelerate Super Charged with W&B report](https://wandb.ai/gladiator/HF%20Accelerate%20+%20W&B/reports/Hugging-Face-Accelerate-Super-Charged-with-Weights-Biases--VmlldzoyNzk3MDUx?utm_source=docs&utm_medium=docs&utm_campaign=accelerate-docs). -
-

\ No newline at end of file diff --git a/content/en/guides/integrations/add-wandb-to-any-library.md b/content/en/guides/integrations/add-wandb-to-any-library.md deleted file mode 100644 index 3522936ab4..0000000000 --- a/content/en/guides/integrations/add-wandb-to-any-library.md +++ /dev/null @@ -1,430 +0,0 @@ ---- -menu: - default: - identifier: add-wandb-to-any-library - parent: integrations -title: Add wandb to any library -weight: 10 ---- - -## Add wandb to any library - -This guide provides best practices on how to integrate W&B into your Python library to get powerful Experiment Tracking, GPU and System Monitoring, Model Checkpointing, and more for your own library. - -{{% alert %}} -If you are still learning how to use W&B, we recommend exploring the other W&B Guides in these docs, such as [Experiment Tracking]({{< relref "/guides/models/track" >}}), before reading further. -{{% /alert %}} - -Below we cover best tips and best practices when the codebase you are working on is more complicated than a single Python training script or Jupyter notebook. The topics covered are: - -* Setup requirements -* User Login -* Starting a wandb Run -* Defining a Run Config -* Logging to W&B -* Distributed Training -* Model Checkpointing and More -* Hyper-parameter tuning -* Advanced Integrations - -### Setup requirements - -Before you get started, decide whether or not to require W&B in your library’s dependencies: - -#### Require W&B on installation - -Add the W&B Python library (`wandb`) to your dependencies file, for example, in your `requirements.txt` file: - -```python -torch==1.8.0 -... -wandb==0.13.* -``` - -#### Make W&B optional on installation - -There are two ways to make the W&B SDK (`wandb`) optional: - -A. Raise an error when a user tries to use `wandb` functionality without installing it manually and show an appropriate error message: - -```python -try: - import wandb -except ImportError: - raise ImportError( - "You are trying to use wandb which is not currently installed." - "Please install it using pip install wandb" - ) -``` - -B. Add `wandb` as an optional dependency to your `pyproject.toml` file, if you are building a Python package: - -```toml -[project] -name = "my_awesome_lib" -version = "0.1.0" -dependencies = [ - "torch", - "sklearn" -] - -[project.optional-dependencies] -dev = [ - "wandb" -] -``` - -### User login - -#### Create an API key - -An API key authenticates a client or machine to W&B. You can generate an API key from your user profile. - -{{% alert %}} -For a more streamlined approach, you can generate an API key by going directly to the [W&B authorization page](https://wandb.ai/authorize). Copy the displayed API key and save it in a secure location such as a password manager. -{{% /alert %}} - -1. Click your user profile icon in the upper right corner. -1. Select **User Settings**, then scroll to the **API Keys** section. -1. Click **Reveal**. Copy the displayed API key. To hide the API key, reload the page. - -#### Install the `wandb` library and log in - -To install the `wandb` library locally and log in: - -{{< tabpane text=true >}} -{{% tab header="Command Line" value="cli" %}} - -1. Set the `WANDB_API_KEY` [environment variable]({{< relref "/guides/models/track/environment-variables.md" >}}) to your API key. - - ```bash - export WANDB_API_KEY= - ``` - -1. Install the `wandb` library and log in. - - - - ```shell - pip install wandb - - wandb login - ``` - -{{% /tab %}} - -{{% tab header="Python" value="python" %}} - -```bash -pip install wandb -``` -```python -import wandb -wandb.login() -``` - -{{% /tab %}} - -{{% tab header="Python notebook" value="python-notebook" %}} - -```notebook -!pip install wandb - -import wandb -wandb.login() -``` - -{{% /tab %}} -{{< /tabpane >}} - -If a user is using wandb for the first time without following any of the steps mentioned above, they will automatically be prompted to log in when your script calls `wandb.init`. - -### Start a run - -A W&B Run is a unit of computation logged by W&B. Typically, you associate a single W&B Run per training experiment. - -Initialize W&B and start a Run within your code with: - -```python -run = wandb.init() -``` - -Optionally, you can provide a name for their project, or let the user set it themselves with parameters such as `wandb_project` in your code along with the username or team name, such as `wandb_entity`, for the entity parameter: - -```python -run = wandb.init(project=wandb_project, entity=wandb_entity) -``` - -You must call `run.finish()` to finish the run. If this works with your integration's design, use the run as a context manager: - -```python -# When this block exits, it calls run.finish() automatically. -# If it exits due to an exception, it uses run.finish(exit_code=1) which -# marks the run as failed. -with wandb.init() as run: - ... -``` - - -#### When to call `wandb.init`? - -Your library should create W&B Run as early as possible because any output in your console, including error messages, is logged as part of the W&B Run. This makes debugging easier. - -#### Use `wandb` as an optional dependency - -If you want to make `wandb` optional when your users use your library, you can either: - -* Define a `wandb` flag such as: - -{{< tabpane text=true >}} - -{{% tab header="Python" value="python" %}} - -```python -trainer = my_trainer(..., use_wandb=True) -``` -{{% /tab %}} - -{{% tab header="Bash" value="bash" %}} - -```bash -python train.py ... --use-wandb -``` -{{% /tab %}} - -{{< /tabpane >}} - -* Or, set `wandb` to be `disabled` in `wandb.init`: - -{{< tabpane text=true >}} - -{{% tab header="Python" value="python" %}} - -```python -wandb.init(mode="disabled") -``` -{{% /tab %}} - -{{% tab header="Bash" value="bash" %}} - -```bash -export WANDB_MODE=disabled -``` - -or - -```bash -wandb disabled -``` -{{% /tab %}} - -{{< /tabpane >}} - -* Or, set `wandb` to be offline - note this will still run `wandb`, it just won't try and communicate back to W&B over the internet: - -{{< tabpane text=true >}} - -{{% tab header="Environment Variable" value="environment" %}} - -```bash -export WANDB_MODE=offline -``` - -or - -```python -os.environ['WANDB_MODE'] = 'offline' -``` -{{% /tab %}} - -{{% tab header="Bash" value="bash" %}} - -```bash -wandb offline -``` -{{% /tab %}} - -{{< /tabpane >}} - -### Define a run config -With a `wandb` run config, you can provide metadata about your model, dataset, and so on when you create a W&B Run. You can use this information to compare different experiments and quickly understand the main differences. - -{{< img src="/images/integrations/integrations_add_any_lib_runs_page.png" alt="W&B Runs table" >}} - -Typical config parameters you can log include: - -* Model name, version, architecture parameters, etc. -* Dataset name, version, number of train/val examples, etc. -* Training parameters such as learning rate, batch size, optimizer, etc. - -The following code snippet shows how to log a config: - -```python -config = {"batch_size": 32, ...} -wandb.init(..., config=config) -``` - -#### Update the run config -Use `wandb.Run.config.update` to update the config. Updating your configuration dictionary is useful when parameters are obtained after the dictionary was defined. For example, you might want to add a model’s parameters after the model is instantiated. - -```python -run.config.update({"model_parameters": 3500}) -``` - -For more information on how to define a config file, see [Configure experiments]({{< relref "/guides/models/track/config" >}}). - -### Log to W&B - -#### Log metrics - -Create a dictionary where the key value is the name of the metric. Pass this dictionary object to [`run.log`]({{< relref "/guides/models/track/log" >}}): - -```python -for epoch in range(NUM_EPOCHS): - for input, ground_truth in data: - prediction = model(input) - loss = loss_fn(prediction, ground_truth) - metrics = { "loss": loss } - run.log(metrics) -``` - -If you have a lot of metrics, you can have them automatically grouped in the UI by using prefixes in the metric name, such as `train/...` and `val/...`. This will create separate sections in your W&B Workspace for your training and validation metrics, or other metric types you'd like to separate: - -```python -metrics = { - "train/loss": 0.4, - "train/learning_rate": 0.4, - "val/loss": 0.5, - "val/accuracy": 0.7 -} -run.log(metrics) -``` - -{{< img src="/images/integrations/integrations_add_any_lib_log.png" alt="W&B Workspace" >}} - -See the [`wandb.Run.log()` reference]({{< relref "/guides/models/track/log" >}}). - -#### Prevent x-axis misalignments - -If you perform multiple calls to `run.log` for the same training step, the wandb SDK increments an internal step counter for each call to `run.log`. This counter may not align with the training step in your training loop. - -To avoid this situation, define your x-axis step explicitly with `run.define_metric`, one time, immediately after you call `wandb.init`: - -```python -with wandb.init(...) as run: - run.define_metric("*", step_metric="global_step") -``` - -The glob pattern, `*`, means that every metric will use `global_step` as the x-axis in your charts. If you only want certain metrics to be logged against `global_step`, you can specify them instead: - -```python -run.define_metric("train/loss", step_metric="global_step") -``` - -Now, log your metrics, your `step` metric, and your `global_step` each time you call `run.log`: - -```python -for step, (input, ground_truth) in enumerate(data): - ... - run.log({"global_step": step, "train/loss": 0.1}) - run.log({"global_step": step, "eval/loss": 0.2}) -``` - -If you do not have access to the independent step variable, for example "global_step" is not available during your validation loop, the previously logged value for "global_step" is automatically used by wandb. In this case, ensure you log an initial value for the metric so it has been defined when it’s needed. - -#### Log images, tables, audio, and more - -In addition to metrics, you can log plots, histograms, tables, text, and media such as images, videos, audios, 3D, and more. - -Some considerations when logging data include: - -* How often should the metric be logged? Should it be optional? -* What type of data could be helpful in visualizing? - * For images, you can log sample predictions, segmentation masks, etc., to see the evolution over time. - * For text, you can log tables of sample predictions for later exploration. - -See the [logging guide]({{< relref "/guides/models/track/log" >}}) for media, objects, plots, and more. - -### Distributed training - -For frameworks supporting distributed environments, you can adapt any of the following workflows: - -* Detect which is the "main" process and only use `wandb` there. Any required data coming from other processes must be routed to the main process first. (This workflow is encouraged). -* Call `wandb` in every process and auto-group them by giving them all the same unique `group` name. - -See [Log Distributed Training Experiments]({{< relref "/guides/models/track/log/distributed-training.md" >}}) for more details. - -### Log model checkpoints and more - -If your framework uses or produces models or datasets, you can log them for full traceability and have wandb automatically monitor your entire pipeline through W&B Artifacts. - -{{< img src="/images/integrations/integrations_add_any_lib_dag.png" alt="Stored Datasets and Model Checkpoints in W&B" >}} - -When using Artifacts, it might be useful but not necessary to let your users define: - -* The ability to log model checkpoints or datasets (in case you want to make it optional). -* The path/reference of the artifact being used as input, if any. For example, `user/project/artifact`. -* The frequency for logging Artifacts. - -#### Log model checkpoints - -You can log Model Checkpoints to W&B. It is useful to leverage the unique `wandb` Run ID to name output Model Checkpoints to differentiate them between Runs. You can also add useful metadata. In addition, you can also add aliases to each model as shown below: - -```python -metadata = {"eval/accuracy": 0.8, "train/steps": 800} - -artifact = wandb.Artifact( - name=f"model-{run.id}", - metadata=metadata, - type="model" - ) -artifact.add_dir("output_model") # local directory where the model weights are stored - -aliases = ["best", "epoch_10"] -run.log_artifact(artifact, aliases=aliases) -``` - -For information on how to create a custom alias, see [Create a Custom Alias]({{< relref "/guides/core/artifacts/create-a-custom-alias/" >}}). - -You can log output Artifacts at any frequency (for example, every epoch, every 500 steps, and so on) and they are automatically versioned. - -#### Log and track pre-trained models or datasets - -You can log artifacts that are used as inputs to your training such as pre-trained models or datasets. The following snippet demonstrates how to log an Artifact and add it as an input to the ongoing Run as shown in the graph above. - -```python -artifact_input_data = wandb.Artifact(name="flowers", type="dataset") -artifact_input_data.add_file("flowers.npy") -run.use_artifact(artifact_input_data) -``` - -#### Download an artifact - -You re-use an Artifact (dataset, model, etc.) and `wandb` will download a copy locally (and cache it): - -```python -artifact = run.use_artifact("user/project/artifact:latest") -local_path = artifact.download("./tmp") -``` - -Artifacts can be found in the Artifacts section of W&B and can be referenced with aliases generated automatically (`latest`, `v2`, `v3`) or manually when logging (`best_accuracy`, etc.). - -To download an Artifact without creating a `wandb` run (through `wandb.init`), for example in distributed environments or for simple inference, you can instead reference the artifact with the [wandb API]({{< relref "/ref/python/public-api/index.md" >}}): - -```python -artifact = wandb.Api().artifact("user/project/artifact:latest") -local_path = artifact.download() -``` - -For more information, see [Download and Use Artifacts]({{< relref "/guides/core/artifacts/download-and-use-an-artifact" >}}). - -### Tune hyper-parameters - -If your library would like to leverage W&B hyper-parameter tuning, [W&B Sweeps]({{< relref "/guides/models/sweeps/" >}}) can also be added to your library. - -### Advanced integrations - -You can also see what an advanced W&B integrations look like in the following integrations. Note most integrations will not be as complex as these: - -* [Hugging Face Transformers `WandbCallback`](https://github.com/huggingface/transformers/blob/49629e7ba8ef68476e08b671d6fc71288c2f16f1/src/transformers/integrations.py#L639) -* [PyTorch Lightning `WandbLogger`](https://github.com/Lightning-AI/lightning/blob/18f7f2d3958fb60fcb17b4cb69594530e83c217f/src/pytorch_lightning/loggers/wandb.py#L53) \ No newline at end of file diff --git a/content/en/guides/integrations/autotrain.md b/content/en/guides/integrations/autotrain.md deleted file mode 100644 index 15580da8a7..0000000000 --- a/content/en/guides/integrations/autotrain.md +++ /dev/null @@ -1,142 +0,0 @@ ---- -menu: - default: - identifier: autotrain - parent: integrations -title: Hugging Face AutoTrain -weight: 130 ---- -[Hugging Face AutoTrain](https://huggingface.co/docs/autotrain/index) is a no-code tool for training state-of-the-art models for Natural Language Processing (NLP) tasks, for Computer Vision (CV) tasks, and for Speech tasks and even for Tabular tasks. - -[W&B](https://wandb.com/) is directly integrated into Hugging Face AutoTrain, providing experiment tracking and config management. It's as easy as using a single parameter in the CLI command for your experiments. - -{{< img src="/images/integrations/hf-autotrain-1.png" alt="Experiment metrics logging" >}} - -## Install prerequisites - -Install `autotrain-advanced` and `wandb`. - -{{< tabpane text=true >}} - -{{% tab header="Command Line" value="script" %}} - -```shell -pip install --upgrade autotrain-advanced wandb -``` - -{{% /tab %}} - -{{% tab header="Notebook" value="notebook" %}} - -```notebook -!pip install --upgrade autotrain-advanced wandb -``` - -{{% /tab %}} - -{{< /tabpane >}} - -To demonstrate these changes, this page fine-tines an LLM on a math dataset to achieve SoTA result in `pass@1` on the [GSM8k Benchmarks](https://github.com/openai/grade-school-math). - -## Prepare the dataset - -Hugging Face AutoTrain expects your CSV custom dataset to have a specific format to work properly. - -- Your training file must contain a `text` column, which the training uses. For best results, the `text` column's data must conform to the `### Human: Question?### Assistant: Answer.` format. Review a great example in [`timdettmers/openassistant-guanaco`](https://huggingface.co/datasets/timdettmers/openassistant-guanaco). - - However, the [MetaMathQA dataset](https://huggingface.co/datasets/meta-math/MetaMathQA) includes the columns `query`, `response`, and `type`. First, pre-process this dataset. Remove the `type` column and combine the content of the `query` and `response` columns into a new `text` column in the `### Human: Query?### Assistant: Response.` format. Training uses the resulting dataset, [`rishiraj/guanaco-style-metamath`](https://huggingface.co/datasets/rishiraj/guanaco-style-metamath). - -## Train using `autotrain` - -You can start training using the `autotrain` advanced from the command line or a notebook. Use the `--log` argument, or use `--log wandb` to log your results to a [W&B Run]({{< relref "/guides/models/track/runs/" >}}). - -{{< tabpane text=true >}} - -{{% tab header="Command Line" value="script" %}} - -```shell -autotrain llm \ - --train \ - --model HuggingFaceH4/zephyr-7b-alpha \ - --project-name zephyr-math \ - --log wandb \ - --data-path data/ \ - --text-column text \ - --lr 2e-5 \ - --batch-size 4 \ - --epochs 3 \ - --block-size 1024 \ - --warmup-ratio 0.03 \ - --lora-r 16 \ - --lora-alpha 32 \ - --lora-dropout 0.05 \ - --weight-decay 0.0 \ - --gradient-accumulation 4 \ - --logging_steps 10 \ - --fp16 \ - --use-peft \ - --use-int4 \ - --merge-adapter \ - --push-to-hub \ - --token \ - --repo-id -``` - -{{% /tab %}} - -{{% tab header="Notebook" value="notebook" %}} - -```notebook -# Set hyperparameters -learning_rate = 2e-5 -num_epochs = 3 -batch_size = 4 -block_size = 1024 -trainer = "sft" -warmup_ratio = 0.03 -weight_decay = 0. -gradient_accumulation = 4 -lora_r = 16 -lora_alpha = 32 -lora_dropout = 0.05 -logging_steps = 10 - -# Run training -!autotrain llm \ - --train \ - --model "HuggingFaceH4/zephyr-7b-alpha" \ - --project-name "zephyr-math" \ - --log "wandb" \ - --data-path data/ \ - --text-column text \ - --lr str(learning_rate) \ - --batch-size str(batch_size) \ - --epochs str(num_epochs) \ - --block-size str(block_size) \ - --warmup-ratio str(warmup_ratio) \ - --lora-r str(lora_r) \ - --lora-alpha str(lora_alpha) \ - --lora-dropout str(lora_dropout) \ - --weight-decay str(weight_decay) \ - --gradient-accumulation str(gradient_accumulation) \ - --logging-steps str(logging_steps) \ - --fp16 \ - --use-peft \ - --use-int4 \ - --merge-adapter \ - --push-to-hub \ - --token str(hf_token) \ - --repo-id "rishiraj/zephyr-math" -``` - -{{% /tab %}} - -{{< /tabpane >}} - - -{{< img src="/images/integrations/hf-autotrain-2.gif" alt="Experiment config saving" >}} - -## More Resources - -* [AutoTrain Advanced now supports Experiment Tracking](https://huggingface.co/blog/rishiraj/log-autotrain) by [Rishiraj Acharya](https://huggingface.co/rishiraj). -* [Hugging Face AutoTrain Docs](https://huggingface.co/docs/autotrain/index) \ No newline at end of file diff --git a/content/en/guides/integrations/azure-openai-fine-tuning.md b/content/en/guides/integrations/azure-openai-fine-tuning.md deleted file mode 100644 index fcb6a5b8dc..0000000000 --- a/content/en/guides/integrations/azure-openai-fine-tuning.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -description: How to Fine-Tune Azure OpenAI models using W&B. -menu: - default: - identifier: azure-openai-fine-tuning - parent: integrations -title: Azure OpenAI Fine-Tuning -weight: 20 ---- - -## Introduction -Fine-tuning GPT-3.5 or GPT-4 models on Microsoft Azure using W&B tracks, analyzes, and improves model performance by automatically capturing metrics and facilitating systematic evaluation through W&B's experiment tracking and evaluation tools. - -{{< img src="/images/integrations/aoai_ft_plot.png" alt="Azure OpenAI fine-tuning metrics" >}} - -## Prerequisites -- Set up Azure OpenAI service according to [official Azure documentation](https://wandb.me/aoai-wb-int). -- Configure a W&B account with an API key. - -## Workflow overview - -### 1. Fine-tuning setup -- Prepare training data according to Azure OpenAI requirements. -- Configure the fine-tuning job in Azure OpenAI. -- W&B automatically tracks the fine-tuning process, logging metrics and hyperparameters. - -### 2. Experiment tracking -During fine-tuning, W&B captures: -- Training and validation metrics -- Model hyperparameters -- Resource utilization -- Training artifacts - -### 3. Model evaluation -After fine-tuning, use [W&B Weave](https://weave-docs.wandb.ai) to: -- Evaluate model outputs against reference datasets -- Compare performance across different fine-tuning runs -- Analyze model behavior on specific test cases -- Make data-driven decisions for model selection - -## Real-world example -* Explore the [medical note generation demo](https://wandb.me/aoai-ft-colab) to see how this integration facilitates: - - Systematic tracking of fine-tuning experiments - - Model evaluation using domain-specific metrics -* Go through an [interactive demo of fine-tuning a notebook](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/azure/azure_gpt_medical_notes.ipynb) - -## Additional resources -- [Azure OpenAI W&B Integration Guide](https://wandb.me/aoai-wb-int) -- [Azure OpenAI Fine-tuning Documentation](https://learn.microsoft.com/azure/ai-services/openai/how-to/fine-tuning?tabs=turbo%2Cpython&pivots=programming-language-python) \ No newline at end of file diff --git a/content/en/guides/integrations/catalyst.md b/content/en/guides/integrations/catalyst.md deleted file mode 100644 index 838b7284ff..0000000000 --- a/content/en/guides/integrations/catalyst.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -description: How to integrate W&B for Catalyst, a Pytorch framework. -menu: - default: - identifier: catalyst - parent: integrations -title: Catalyst -weight: 30 ---- - -[Catalyst](https://github.com/catalyst-team/catalyst) is a PyTorch framework for deep learning R&D that focuses on reproducibility, rapid experimentation, and codebase reuse so you can create something new. - -Catalyst includes a W&B integration for logging parameters, metrics, images, and other artifacts. - -Check out their [documentation of the integration](https://catalyst-team.github.io/catalyst/api/loggers.html#catalyst.loggers.wandb.WandbLogger), which includes examples using Python and Hydra. - -## Interactive Example - -Run an [example colab](https://colab.research.google.com/drive/1PD0LnXiADCtt4mu7bzv7VfQkFXVrPxJq?usp=sharing) to see Catalyst and W&B integration in action. \ No newline at end of file diff --git a/content/en/guides/integrations/cohere-fine-tuning.md b/content/en/guides/integrations/cohere-fine-tuning.md deleted file mode 100644 index f39e8ac1a6..0000000000 --- a/content/en/guides/integrations/cohere-fine-tuning.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -description: How to Fine-Tune Cohere models using W&B. -menu: - default: - identifier: cohere-fine-tuning - parent: integrations -title: Cohere fine-tuning -weight: 40 ---- -With W&B you can log your Cohere model's fine-tuning metrics and configuration to analyze and understand the performance of your models and share the results with your colleagues. - -This [guide from Cohere](https://docs.cohere.com/page/convfinqa-finetuning-wandb) has a full example of how to kick off a fine-tuning run and you can find the [Cohere API docs here](https://docs.cohere.com/reference/createfinetunedmodel#request.body.settings.wandb) - -## Log your Cohere fine-tuning results - -To add Cohere fine-tuning logging to your W&B workspace: - -1. Create a `WandbConfig` with your W&B API key, W&B `entity` and `project` name. You can find your W&B API key at https://wandb.ai/authorize - -2. Pass this config to the `FinetunedModel` object along with your model name, dataset and hyperparameters to kick off your fine-tuning run. - - - ```python - from cohere.finetuning import WandbConfig, FinetunedModel - - # create a config with your W&B details - wandb_ft_config = WandbConfig( - api_key="", - entity="my-entity", # must be a valid enitity associated with the provided API key - project="cohere-ft", - ) - - ... # set up your datasets and hyperparameters - - # start a fine-tuning run on cohere - cmd_r_finetune = co.finetuning.create_finetuned_model( - request=FinetunedModel( - name="command-r-ft", - settings=Settings( - base_model=... - dataset_id=... - hyperparameters=... - wandb=wandb_ft_config # pass your W&B config here - ), - ), - ) - ``` - -3. View your model's fine-tuning training and validation metrics and hyperparameters in the W&B project that you created. - - {{< img src="/images/integrations/cohere_ft.png" alt="Cohere fine-tuning dashboard" >}} - - -## Organize runs - -Your W&B runs are automatically organized and can be filtered/sorted based on any configuration parameter such as job type, base model, learning rate and any other hyper-parameter. - -In addition, you can rename your runs, add notes or create tags to group them. - - -## Resources - -* [Cohere Fine-tuning Example](https://github.com/cohere-ai/notebooks/blob/kkt_ft_cookbooks/notebooks/finetuning/convfinqa_finetuning_wandb.ipynb) \ No newline at end of file diff --git a/content/en/guides/integrations/composer.md b/content/en/guides/integrations/composer.md deleted file mode 100644 index d6ac673896..0000000000 --- a/content/en/guides/integrations/composer.md +++ /dev/null @@ -1,101 +0,0 @@ ---- -description: State of the art algorithms to train your neural networks -menu: - default: - identifier: composer - parent: integrations -title: MosaicML Composer -weight: 230 ---- -{{< cta-button colabLink="https://github.com/wandb/examples/blob/master/colabs/mosaicml/MosaicML_Composer_and_wandb.ipynb" >}} - -[Composer](https://github.com/mosaicml/composer) is a library for training neural networks better, faster, and cheaper. It contains many state-of-the-art methods for accelerating neural network training and improving generalization, along with an optional [Trainer](https://docs.mosaicml.com/projects/composer/en/stable/trainer/using_the_trainer.html) API that makes _composing_ many different enhancements easy. - -W&B provides a lightweight wrapper for logging your ML experiments. But you don't need to combine the two yourself: W&B is incorporated directly into the Composer library via the [WandBLogger](https://docs.mosaicml.com/projects/composer/en/stable/trainer/file_uploading.html#weights-biases-artifacts). - -## Start logging to W&B - -```python -from composer import Trainer -from composer.loggers import WandBLogger - -trainer = Trainer(..., logger=WandBLogger()) -``` - -{{< img src="/images/integrations/n6P7K4M.gif" alt="Interactive dashboards" >}} - -## Use Composer's `WandBLogger` - -The Composer library uses [WandBLogger](https://docs.mosaicml.com/projects/composer/en/stable/trainer/file_uploading.html#weights-biases-artifacts) class in the `Trainer` to log metrics to W&B. It is as simple as instantiating the logger and passing it to the `Trainer`. - -```python -wandb_logger = WandBLogger(project="gpt-5", log_artifacts=True) -trainer = Trainer(logger=wandb_logger) -``` - -## Logger arguments - -Below the parameters for `WandbLogger`, see the [Composer documentation](https://docs.mosaicml.com/projects/composer/en/stable/api_reference/generated/composer.loggers.WandBLogger.html) for a full list and description. - -| Parameter | Description | -| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `project` | W&B Project name (str, optional) -| `group` | W&B group name (str, optional) -| `name` | W&B Run name. If not specified, the State.run_name is used (str, optional) -| `entity` | W&B entity name, such as your username or W&B Team name (str, optional) -| `tags` | W&B tags (List[str], optional) -| `log_artifacts` | Whether to log checkpoints to wandb, default: `false` (bool, optional)| -| `rank_zero_only` | Whether to log only on the rank-zero process. When logging artifacts, it is highly recommended to log on all ranks. Artifacts from ranks ≥1 are not stored, which may discard pertinent information. For example, when using Deepspeed ZeRO, it would be impossible to restore from checkpoints without artifacts from all ranks, default: `True` (bool, optional) -| `init_kwargs` | Params to pass to `wandb.init()` such as your wandb `config` etc. See the [`wandb.init()` parameters]({{< relref "/ref/python/functions/init.md" >}}) for parameters that `wandb.init()` accepts. - -A typical usage would be: - -``` -init_kwargs = {"notes":"Testing higher learning rate in this experiment", - "config":{"arch":"Llama", - "use_mixed_precision":True - } - } - -wandb_logger = WandBLogger(log_artifacts=True, init_kwargs=init_kwargs) -``` - -## Log prediction samples - -You can use [Composer's Callbacks](https://docs.mosaicml.com/projects/composer/en/stable/trainer/callbacks.html) system to control when you log to W&B via the `WandBLogger`, in this example a sample of the validation images and predictions is logged: - -```python -import wandb -from composer import Callback, State, Logger - -class LogPredictions(Callback): - def __init__(self, num_samples=100, seed=1234): - super().__init__() - self.num_samples = num_samples - self.data = [] - - def eval_batch_end(self, state: State, logger: Logger): - """Compute predictions per batch and stores them on self.data""" - - if state.timer.epoch == state.max_duration: #on last val epoch - if len(self.data) < self.num_samples: - n = self.num_samples - x, y = state.batch_pair - outputs = state.outputs.argmax(-1) - data = [[wandb.Image(x_i), y_i, y_pred] for x_i, y_i, y_pred in list(zip(x[:n], y[:n], outputs[:n]))] - self.data += data - - def eval_end(self, state: State, logger: Logger): - with wandb.init() as run: - "Create a wandb.Table and logs it" - columns = ['image', 'ground truth', 'prediction'] - table = wandb.Table(columns=columns, data=self.data[:self.num_samples]) - run.log({'sample_table':table}, step=int(state.timer.batch)) -... - -trainer = Trainer( - ... - loggers=[WandBLogger()], - callbacks=[LogPredictions()] -) -``` \ No newline at end of file diff --git a/content/en/guides/integrations/databricks.md b/content/en/guides/integrations/databricks.md deleted file mode 100644 index 6ff51d751e..0000000000 --- a/content/en/guides/integrations/databricks.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -description: How to integrate W&B with Databricks. -menu: - default: - identifier: databricks - parent: integrations -title: Databricks -weight: 50 ---- - -W&B integrates with [Databricks](https://www.databricks.com/) by customizing the W&B Jupyter notebook experience in the Databricks environment. - -## Configure Databricks - -1. Install wandb in the cluster - - Navigate to your cluster configuration, choose your cluster, click **Libraries**. Click **Install New**, choose **PyPI**, and add the package `wandb`. - -2. Set up authentication - - To authenticate your W&B account you can add a Databricks secret which your notebooks can query. - - ```bash - # install databricks cli - pip install databricks-cli - - # Generate a token from databricks UI - databricks configure --token - - # Create a scope with one of the two commands (depending if you have security features enabled on databricks): - # with security add-on - databricks secrets create-scope --scope wandb - # without security add-on - databricks secrets create-scope --scope wandb --initial-manage-principal users - - # Add your api_key from: https://app.wandb.ai/authorize - databricks secrets put --scope wandb --key api_key - ``` - -## Examples - -### Simple example - -```python -import os -import wandb - -api_key = dbutils.secrets.get("wandb", "api_key") -wandb.login(key=api_key) - -with wandb.init() as run: - run.log({"foo": 1}) -``` - -### Sweeps - -Setup required (temporary) for notebooks attempting to use wandb.sweep() or wandb.agent(): - -```python -import os - -# These will not be necessary in the future -os.environ["WANDB_ENTITY"] = "my-entity" -os.environ["WANDB_PROJECT"] = "my-project-that-exists" -``` \ No newline at end of file diff --git a/content/en/guides/integrations/deepchecks.md b/content/en/guides/integrations/deepchecks.md deleted file mode 100644 index fac9bcc7bd..0000000000 --- a/content/en/guides/integrations/deepchecks.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -description: How to integrate W&B with DeepChecks. -menu: - default: - identifier: deepchecks - parent: integrations -title: DeepChecks -weight: 60 ---- -{{< cta-button colabLink="https://colab.research.google.com/github/deepchecks/deepchecks/blob/0.5.0-1-g5380093/docs/source/examples/guides/export_outputs_to_wandb.ipynb" >}} - -DeepChecks helps you validate your machine learning models and data, such as verifying your data’s integrity, inspecting its distributions, validating data splits, evaluating your model and comparing between different models, all with minimal effort. - -[Read more about DeepChecks and the wandb integration ->](https://docs.deepchecks.com/stable/general/usage/exporting_results/auto_examples/plot_exports_output_to_wandb.html) - -## Getting Started - -To use DeepChecks with W&B you will first need to sign up for a [W&B account](https://wandb.ai/site). With the W&B integration in DeepChecks you can quickly get started like so: - -```python -import wandb - -wandb.login() - -# import your check from deepchecks -from deepchecks.checks import ModelErrorAnalysis - -# run your check -result = ModelErrorAnalysis() - -# push that result to wandb -result.to_wandb() -``` - -You can also log an entire DeepChecks test suite to W&B. - -```python -import wandb - -wandb.login() - -# import your full_suite tests from deepchecks -from deepchecks.suites import full_suite - -# create and run a DeepChecks test suite -suite_result = full_suite().run(...) - -# push thes results to wandb -# here you can pass any wandb.init configs and arguments you need -suite_result.to_wandb(project="my-suite-project", config={"suite-name": "full-suite"}) -``` - -## Example - -[This Report](https://wandb.ai/cayush/deepchecks/reports/Validate-your-Data-and-Models-with-Deepchecks-and-W-B--VmlldzoxNjY0ODc5) shows off the power of using DeepChecks and W&B. - -{{< img src="/images/integrations/deepchecks_example.png" alt="Deepchecks data validation results" >}} - -Any questions or issues about this W&B integration? Open an issue in the [DeepChecks github repository](https://github.com/deepchecks/deepchecks) and we'll catch it and get you an answer. \ No newline at end of file diff --git a/content/en/guides/integrations/deepchem.md b/content/en/guides/integrations/deepchem.md deleted file mode 100644 index 120cb3ee2d..0000000000 --- a/content/en/guides/integrations/deepchem.md +++ /dev/null @@ -1,126 +0,0 @@ ---- -description: How to integrate W&B with DeepChem library. -menu: - default: - identifier: deepchem - parent: integrations -title: DeepChem -weight: 70 ---- -The [DeepChem library](https://github.com/deepchem/deepchem) provides open source tools that democratize the use of deep-learning in drug discovery, materials science, chemistry, and biology. This W&B integration adds simple and easy-to-use experiment tracking and model checkpointing while training models using DeepChem. - -## DeepChem logging in 3 lines of code - -```python -logger = WandbLogger(…) -model = TorchModel(…, wandb_logger=logger) -model.fit(…) -``` - -{{< img src="/images/integrations/cd.png" alt="DeepChem molecular analysis" >}} - -## Report and Google Colab - -Explore the Using [W&B with DeepChem: Molecular Graph Convolutional Networks](https://wandb.ai/kshen/deepchem_graphconv/reports/Using-W-B-with-DeepChem-Molecular-Graph-Convolutional-Networks--Vmlldzo4MzU5MDc?galleryTag=) article for an example charts generated using the W&B DeepChem integration. - -To dive straight into working code, check out this [Google Colab](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/deepchem/W%26B_x_DeepChem.ipynb). - -## Track experiments - -Set up W&B for DeepChem models of type [KerasModel](https://deepchem.readthedocs.io/en/latest/api_reference/models.html#keras-models) or [TorchModel](https://deepchem.readthedocs.io/en/latest/api_reference/models.html#pytorch-models). - -### Sign up and create an API key - -An API key authenticates your machine to W&B. You can generate an API key from your user profile. - -{{% alert %}} -For a more streamlined approach, you can generate an API key by going directly to the [W&B authorization page](https://wandb.ai/authorize). Copy the displayed API key and save it in a secure location such as a password manager. -{{% /alert %}} - -1. Click your user profile icon in the upper right corner. -1. Select **User Settings**, then scroll to the **API Keys** section. -1. Click **Reveal**. Copy the displayed API key. To hide the API key, reload the page. - -### Install the `wandb` library and log in - -To install the `wandb` library locally and log in: - -{{< tabpane text=true >}} -{{% tab header="Command Line" value="cli" %}} - -1. Set the `WANDB_API_KEY` [environment variable]({{< relref "/guides/models/track/environment-variables.md" >}}) to your API key. - - ```bash - export WANDB_API_KEY= - ``` - -1. Install the `wandb` library and log in. - - - - ```shell - pip install wandb - - wandb login - ``` - -{{% /tab %}} - -{{% tab header="Python" value="python" %}} - -```bash -pip install wandb -``` -```python -import wandb -wandb.login() -``` - -{{% /tab %}} - -{{% tab header="Python notebook" value="python-notebook" %}} - -```notebook -!pip install wandb - -import wandb -wandb.login() -``` - -{{% /tab %}} - -{{< /tabpane >}} - -### Log your training and evaluation data to W&B - -Training loss and evaluation metrics can be automatically logged to W&B. Optional evaluation can be enabled using the DeepChem [ValidationCallback](https://github.com/deepchem/deepchem/blob/master/deepchem/models/callbacks.py), the `WandbLogger` will detect ValidationCallback callback and log the metrics generated. - -{{< tabpane text=true >}} - -{{% tab header="TorchModel" value="torch" %}} - -```python -from deepchem.models import TorchModel, ValidationCallback - -vc = ValidationCallback(…) # optional -model = TorchModel(…, wandb_logger=logger) -model.fit(…, callbacks=[vc]) -logger.finish() -``` - -{{% /tab %}} - -{{% tab header="KerasModel" value="keras" %}} - -```python -from deepchem.models import KerasModel, ValidationCallback - -vc = ValidationCallback(…) # optional -model = KerasModel(…, wandb_logger=logger) -model.fit(…, callbacks=[vc]) -logger.finish() -``` - -{{% /tab %}} - -{{< /tabpane >}} diff --git a/content/en/guides/integrations/diffusers.md b/content/en/guides/integrations/diffusers.md deleted file mode 100644 index b3060aa437..0000000000 --- a/content/en/guides/integrations/diffusers.md +++ /dev/null @@ -1,300 +0,0 @@ ---- -menu: - default: - identifier: diffusers - parent: integrations -title: Hugging Face Diffusers -weight: 120 ---- -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/diffusers/lcm-diffusers.ipynb" >}} - -[Hugging Face Diffusers](https://huggingface.co/docs/diffusers) is the go-to library for state-of-the-art pre-trained diffusion models for generating images, audio, and even 3D structures of molecules. The W&B integration adds rich, flexible experiment tracking, media visualization, pipeline architecture, and configuration management to interactive centralized dashboards without compromising that ease of use. - -## Next-level logging in just two lines - -Log all the prompts, negative prompts, generated media, and configs associated with your experiment by simply including 2 lines of code. Here are the 2 lines of code to begin logging: - -```python -# import the autolog function -from wandb.integration.diffusers import autolog - -# call the autolog before calling the pipeline -autolog(init=dict(project="diffusers_logging")) -``` - -| {{< img src="/images/integrations/diffusers-autolog-4.gif" alt="Experiment results logging" >}} | -|:--:| -| **An example of how the results of your experiment are logged.** | - -## Get started - -1. Install `diffusers`, `transformers`, `accelerate`, and `wandb`. - - - Command line: - - ```shell - pip install --upgrade diffusers transformers accelerate wandb - ``` - - - Notebook: - - ```bash - !pip install --upgrade diffusers transformers accelerate wandb - ``` - - -2. Use `autolog` to initialize a W&B Run and automatically track the inputs and the outputs from [all supported pipeline calls](https://github.com/wandb/wandb/blob/main/wandb/integration/diffusers/autologger.py#L12-L72). - - You can call the `autolog()` function with the `init` parameter, which accepts a dictionary of parameters required by [`wandb.init()`]({{< relref "/ref/python/functions/init.md" >}}). - - When you call `autolog()`, it initializes a W&B Run and automatically tracks the inputs and the outputs from [all supported pipeline calls](https://github.com/wandb/wandb/blob/main/wandb/integration/diffusers/autologger.py#L12-L72). - - - Each pipeline call is tracked into its own [table]({{< relref "/guides/models/tables/" >}}) in the workspace, and the configs associated with the pipeline call is appended to the list of workflows in the configs for that run. - - The prompts, negative prompts, and the generated media are logged in a [`wandb.Table`]({{< relref "/guides/models/tables/" >}}). - - All other configs associated with the experiment including seed and the pipeline architecture are stored in the config section for the run. - - The generated media for each pipeline call are also logged in [media panels]({{< relref "/guides/models/track/log/media" >}}) in the run. - - {{% alert %}} - You can find a [list of supported pipeline calls](https://github.com/wandb/wandb/blob/main/wandb/integration/diffusers/autologger.py#L12-L72). In case, you want to request a new feature of this integration or report a bug associated with it, open an issue on the [W&B GitHub issues page](https://github.com/wandb/wandb/issues). - {{% /alert %}} - -## Examples - -### Autologging - -Here is a brief end-to-end example of the autolog in action: - -{{< tabpane text=true >}} -{{% tab header="Script" value="script" %}} -```python -import torch -from diffusers import DiffusionPipeline - -# import the autolog function -from wandb.integration.diffusers import autolog - -# call the autolog before calling the pipeline -autolog(init=dict(project="diffusers_logging")) - -# Initialize the diffusion pipeline -pipeline = DiffusionPipeline.from_pretrained( - "stabilityai/stable-diffusion-2-1", torch_dtype=torch.float16 -).to("cuda") - -# Define the prompts, negative prompts, and seed. -prompt = ["a photograph of an astronaut riding a horse", "a photograph of a dragon"] -negative_prompt = ["ugly, deformed", "ugly, deformed"] -generator = torch.Generator(device="cpu").manual_seed(10) - -# call the pipeline to generate the images -images = pipeline( - prompt, - negative_prompt=negative_prompt, - num_images_per_prompt=2, - generator=generator, -) -``` -{{% /tab %}} - -{{% tab header="Notebook" value="notebook"%}} -```python -import torch -from diffusers import DiffusionPipeline - -import wandb - -# import the autolog function -from wandb.integration.diffusers import autolog - -run = wandb.init() - -# call the autolog before calling the pipeline -autolog(init=dict(project="diffusers_logging")) - -# Initialize the diffusion pipeline -pipeline = DiffusionPipeline.from_pretrained( - "stabilityai/stable-diffusion-2-1", torch_dtype=torch.float16 -).to("cuda") - -# Define the prompts, negative prompts, and seed. -prompt = ["a photograph of an astronaut riding a horse", "a photograph of a dragon"] -negative_prompt = ["ugly, deformed", "ugly, deformed"] -generator = torch.Generator(device="cpu").manual_seed(10) - -# call the pipeline to generate the images -images = pipeline( - prompt, - negative_prompt=negative_prompt, - num_images_per_prompt=2, - generator=generator, -) - -# Finish the experiment -run.finish() -``` -{{% /tab %}} -{{< /tabpane >}} - - -- The results of a single experiment: - - {{< img src="/images/integrations/diffusers-autolog-2.gif" alt="Experiment results logging" >}} - -- The results of multiple experiments: - - {{< img src="/images/integrations/diffusers-autolog-1.gif" alt="Experiment results logging" >}} - -- The config of an experiment: - - {{< img src="/images/integrations/diffusers-autolog-3.gif" alt="Experiment config logging" >}} - -{{% alert %}} -You need to explicitly call [`wandb.Run.finish()`]({{< relref "/ref/python/functions/finish.md" >}}) when executing the code in IPython notebook environments after calling the pipeline. This is not necessary when executing python scripts. -{{% /alert %}} - -### Tracking multi-pipeline workflows - -This section demonstrates the autolog with a typical [Stable Diffusion XL + Refiner](https://huggingface.co/docs/diffusers/using-diffusers/sdxl#base-to-refiner-model) workflow, in which the latents generated by the [`StableDiffusionXLPipeline`](https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/stable_diffusion_xl) is refined by the corresponding refiner. - -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/diffusers/sdxl-diffusers.ipynb" >}} - -{{< tabpane text=true >}} - -{{% tab header="Python Script" value="script" %}} - -```python -import torch -from diffusers import StableDiffusionXLImg2ImgPipeline, StableDiffusionXLPipeline -from wandb.integration.diffusers import autolog - -# initialize the SDXL base pipeline -base_pipeline = StableDiffusionXLPipeline.from_pretrained( - "stabilityai/stable-diffusion-xl-base-1.0", - torch_dtype=torch.float16, - variant="fp16", - use_safetensors=True, -) -base_pipeline.enable_model_cpu_offload() - -# initialize the SDXL refiner pipeline -refiner_pipeline = StableDiffusionXLImg2ImgPipeline.from_pretrained( - "stabilityai/stable-diffusion-xl-refiner-1.0", - text_encoder_2=base_pipeline.text_encoder_2, - vae=base_pipeline.vae, - torch_dtype=torch.float16, - use_safetensors=True, - variant="fp16", -) -refiner_pipeline.enable_model_cpu_offload() - -prompt = "a photo of an astronaut riding a horse on mars" -negative_prompt = "static, frame, painting, illustration, sd character, low quality, low resolution, greyscale, monochrome, nose, cropped, lowres, jpeg artifacts, deformed iris, deformed pupils, bad eyes, semi-realistic worst quality, bad lips, deformed mouth, deformed face, deformed fingers, deformed toes standing still, posing" - -# Make the experiment reproducible by controlling randomness. -# The seed would be automatically logged to WandB. -seed = 42 -generator_base = torch.Generator(device="cuda").manual_seed(seed) -generator_refiner = torch.Generator(device="cuda").manual_seed(seed) - -# Call WandB Autolog for Diffusers. This would automatically log -# the prompts, generated images, pipeline architecture and all -# associated experiment configs to W&B, thus making your -# image generation experiments easy to reproduce, share and analyze. -autolog(init=dict(project="sdxl")) - -# Call the base pipeline to generate the latents -image = base_pipeline( - prompt=prompt, - negative_prompt=negative_prompt, - output_type="latent", - generator=generator_base, -).images[0] - -# Call the refiner pipeline to generate the refined image -image = refiner_pipeline( - prompt=prompt, - negative_prompt=negative_prompt, - image=image[None, :], - generator=generator_refiner, -).images[0] -``` - -{{% /tab %}} - -{{% tab header="Notebook" value="notebook" %}} - -```python -import torch -from diffusers import StableDiffusionXLImg2ImgPipeline, StableDiffusionXLPipeline - -import wandb -from wandb.integration.diffusers import autolog - -run = wandb.init() - -# initialize the SDXL base pipeline -base_pipeline = StableDiffusionXLPipeline.from_pretrained( - "stabilityai/stable-diffusion-xl-base-1.0", - torch_dtype=torch.float16, - variant="fp16", - use_safetensors=True, -) -base_pipeline.enable_model_cpu_offload() - -# initialize the SDXL refiner pipeline -refiner_pipeline = StableDiffusionXLImg2ImgPipeline.from_pretrained( - "stabilityai/stable-diffusion-xl-refiner-1.0", - text_encoder_2=base_pipeline.text_encoder_2, - vae=base_pipeline.vae, - torch_dtype=torch.float16, - use_safetensors=True, - variant="fp16", -) -refiner_pipeline.enable_model_cpu_offload() - -prompt = "a photo of an astronaut riding a horse on mars" -negative_prompt = "static, frame, painting, illustration, sd character, low quality, low resolution, greyscale, monochrome, nose, cropped, lowres, jpeg artifacts, deformed iris, deformed pupils, bad eyes, semi-realistic worst quality, bad lips, deformed mouth, deformed face, deformed fingers, deformed toes standing still, posing" - -# Make the experiment reproducible by controlling randomness. -# The seed would be automatically logged to WandB. -seed = 42 -generator_base = torch.Generator(device="cuda").manual_seed(seed) -generator_refiner = torch.Generator(device="cuda").manual_seed(seed) - -# Call WandB Autolog for Diffusers. This would automatically log -# the prompts, generated images, pipeline architecture and all -# associated experiment configs to W&B, thus making your -# image generation experiments easy to reproduce, share and analyze. -autolog(init=dict(project="sdxl")) - -# Call the base pipeline to generate the latents -image = base_pipeline( - prompt=prompt, - negative_prompt=negative_prompt, - output_type="latent", - generator=generator_base, -).images[0] - -# Call the refiner pipeline to generate the refined image -image = refiner_pipeline( - prompt=prompt, - negative_prompt=negative_prompt, - image=image[None, :], - generator=generator_refiner, -).images[0] - -# Finish the experiment -run.finish() -``` - -{{% /tab %}} - -{{< /tabpane >}} - -- Example of a Stable Diffisuion XL + Refiner experiment: - {{< img src="/images/integrations/diffusers-autolog-6.gif" alt="Stable Diffusion XL experiment tracking" >}} - -## More resources - -* [A Guide to Prompt Engineering for Stable Diffusion](https://wandb.ai/geekyrakshit/diffusers-prompt-engineering/reports/A-Guide-to-Prompt-Engineering-for-Stable-Diffusion--Vmlldzo1NzY4NzQ3) -* [PIXART-α: A Diffusion Transformer Model for Text-to-Image Generation](https://wandb.ai/geekyrakshit/pixart-alpha/reports/PIXART-A-Diffusion-Transformer-Model-for-Text-to-Image-Generation--Vmlldzo2MTE1NzM3) diff --git a/content/en/guides/integrations/docker.md b/content/en/guides/integrations/docker.md deleted file mode 100644 index 2d662987f3..0000000000 --- a/content/en/guides/integrations/docker.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -description: How to integrate W&B with Docker. -menu: - default: - identifier: docker - parent: integrations -title: Docker -weight: 80 ---- - -## Docker Integration - -W&B can store a pointer to the Docker image that your code ran in, giving you the ability to restore a previous experiment to the exact environment it was run in. The wandb library looks for the **WANDB_DOCKER** environment variable to persist this state. We provide a few helpers that automatically set this state. - -### Local Development - -`wandb docker` is a command that starts a docker container, passes in wandb environment variables, mounts your code, and ensures wandb is installed. By default the command uses a docker image with TensorFlow, PyTorch, Keras, and Jupyter installed. You can use the same command to start your own docker image: `wandb docker my/image:latest`. The command mounts the current directory into the "/app" directory of the container, you can change this with the "--dir" flag. - -### Production - -The `wandb docker-run` command is provided for production workloads. It's meant to be a drop in replacement for `nvidia-docker`. It's a simple wrapper to the `docker run` command that adds your credentials and the **WANDB_DOCKER** environment variable to the call. If you do not pass the "--runtime" flag and `nvidia-docker` is available on the machine, this also ensures the runtime is set to nvidia. - -### Kubernetes - -If you run your training workloads in Kubernetes and the k8s API is exposed to your pod \(which is the case by default\). wandb will query the API for the digest of the docker image and automatically set the **WANDB_DOCKER** environment variable. - -## Restoring - -If a run was instrumented with the **WANDB_DOCKER** environment variable, calling `wandb restore username/project:run_id` will checkout a new branch restoring your code then launch the exact docker image used for training pre-populated with the original command. \ No newline at end of file diff --git a/content/en/guides/integrations/dspy.md b/content/en/guides/integrations/dspy.md deleted file mode 100644 index d31bf161ea..0000000000 --- a/content/en/guides/integrations/dspy.md +++ /dev/null @@ -1,199 +0,0 @@ ---- -description: Track and optimize DSPy programs with W&B. -menu: - default: - identifier: dspy - parent: integrations -title: DSPy -weight: 80 ---- - - -Use W&B with DSPy to track and optimize your language model programs. W&B complements the [Weave DSPy integration](https://weave-docs.wandb.ai/guides/integrations/dspy) by providing: - -- Evaluation metrics tracking over time -- W&B Tables for program signature evolution -- Integration with DSPy optimizers like MIPROv2 - -For comprehensive observability when optimizing DSPy modules, enable the integration in both W&B and Weave. - -{{< alert title="Note" color="info" >}} -As of `wandb==0.21.2` and `weave==0.52.5`, Weave initializes automatically when used with W&B: - -- If `weave` is imported and then `wandb.init()` is called (script case) -- If `wandb.init()` was called and then `weave` is imported later (notebook/Jupyter case) - -No explicit `weave.init(...)` call is required. -{{< /alert >}} - -## Install and authenticate - -Install the required libraries and authenticate with W&B: - -{{< tabpane text=true >}} -{{% tab header="Command Line" %}} - -1. Install the required libraries: - - ```shell - pip install wandb weave dspy - ``` - -1. Set the `WANDB_API_KEY` [environment variable]({{< relref "/guides/models/track/environment-variables.md" >}}) and log in: - - ```bash - export WANDB_API_KEY= - wandb login - ``` - -{{% /tab %}} - -{{% tab header="Python" %}} -1. Install the required libraries: - - ```bash - pip install wandb weave dspy - ``` -1. In your code, log in to W&B: - - ```python - import wandb - wandb.login() - ``` -{{% /tab %}} - -{{% tab header="Notebook" %}} -Install and import the required libraries, then log in to W&B: -```notebook -!pip install wandb weave dspy - -import wandb -wandb.login() -``` -{{% /tab %}} -{{< /tabpane >}} - -New to W&B? See our [quickstart guide]({{< relref "/guides/quickstart.md" >}}). - - -## Track program optimization (experimental) {#track-program-optimization} - - -For DSPy optimizers that use `dspy.Evaluate` (such as MIPROv2), use the `WandbDSPyCallback` to log evaluation metrics over time and track program signature evolution in W&B Tables. - -```python -import dspy -from dspy.datasets import MATH - -import weave -import wandb -from wandb.integration.dspy import WandbDSPyCallback - -# Initialize W&B (importing weave is sufficient; no explicit weave.init needed) -project_name = "dspy-optimization" -with wandb.init(project=project_name) as run: - # Add W&B callback to DSPy - dspy.settings.callbacks.append( - WandbDSPyCallback(run=run) - ) - - # Configure language models - teacher_lm = dspy.LM('openai/gpt-4o', max_tokens=2000, cache=True) - student_lm = dspy.LM('openai/gpt-4o-mini', max_tokens=2000) - dspy.configure(lm=student_lm) - - # Load dataset and define program - dataset = MATH(subset='algebra') - program = dspy.ChainOfThought("question -> answer") - - # Configure and run optimizer - optimizer = dspy.MIPROv2( - metric=dataset.metric, - auto="light", - num_threads=24, - teacher_settings=dict(lm=teacher_lm), - prompt_model=student_lm - ) - - optimized_program = optimizer.compile( - program, - trainset=dataset.train, - max_bootstrapped_demos=2, - max_labeled_demos=2 - ) -``` - -After running this code, you receive both a W&B Run URL and a Weave URL. W&B displays evaluation metrics over time, along with Tables that show the evolution of program signatures. The run's **Overview** tab includes links to Weave traces for detailed inspection. - -If a `run` object is not passed to `WandbDSPyCallback`, the global `run` object is used. - -{{< img src="/images/integrations/dspy_run_page.png" alt="DSPy optimization run in W&B" >}} - -For comprehensive details about Weave tracing, evaluation, and optimization with DSPy, see the [Weave DSPy integration guide](https://weave-docs.wandb.ai/guides/integrations/dspy). - -## Log predictions to W&B Tables - -Enable detailed prediction logging to inspect individual examples during optimization. The callback creates a W&B Tables for each evaluation step, which can help you to analyze specific successes and failures. - -```python -from wandb.integration.dspy import WandbDSPyCallback - -# Enable prediction logging (enabled by default) -callback = WandbDSPyCallback(log_results=True) -dspy.settings.callbacks.append(callback) - -# Run your optimization -optimized_program = optimizer.compile(program, trainset=train_data) - -# Disable prediction logging if needed -# callback = WandbDSPyCallback(log_results=False) -``` - -### Access prediction data - -After optimization, find your prediction data in W&B: - -1. Navigate to your run's **Overview** page. -2. Look for Table panels named with a pattern like `predictions_0`, `predictions_1`, and so forth. -3. Filter by `is_correct` to analyze failures. -4. Compare tables across runs in the project workspace. - -Each table includes columns for: -- `example`: Input data -- `prediction`: Model output -- `is_correct`: Evaluation result - -Learn more in the [W&B Tables guide](../models/tables/visualize-tables.md) and the [Tables tutorial](../../tutorials/tables.md). - -## Save and version DSPy programs - -To reproduce and version your best DSpy programs, save them as W&B Artifacts. Choose between saving the complete program or only the state. - -```python -from wandb.integration.dspy import WandbDSPyCallback - -# Create callback instance -callback = WandbDSPyCallback() -dspy.settings.callbacks.append(callback) - -# Run optimization -optimized_program = optimizer.compile(program, trainset=train_data) - -# Save options: - -# 1. Complete program (recommended) - includes architecture and state -callback.log_best_model(optimized_program, save_program=True) - -# 2. State only as JSON - lighter weight, human-readable -callback.log_best_model(optimized_program, save_program=False, filetype="json") - -# 3. State only as pickle - preserves Python objects -callback.log_best_model(optimized_program, save_program=False, filetype="pkl") - -# Add custom aliases for versioning -callback.log_best_model( - optimized_program, - save_program=True, - aliases=["best", "production", "v2.0"] -) -``` diff --git a/content/en/guides/integrations/farama-gymnasium.md b/content/en/guides/integrations/farama-gymnasium.md deleted file mode 100644 index a47b6a07e3..0000000000 --- a/content/en/guides/integrations/farama-gymnasium.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -description: How to integrate W&B with Farama Gymnasium. -menu: - default: - identifier: farama-gymnasium - parent: integrations -title: Farama Gymnasium -weight: 90 ---- - -If you're using [Farama Gymnasium](https://gymnasium.farama.org/#) we will automatically log videos of your environment generated by `gymnasium.wrappers.Monitor`. Just set the `monitor_gym` keyword argument to [`wandb.init`]({{< relref "/ref/python/functions/init.md" >}}) to `True`. - -Our gymnasium integration is very light. We simply [look at the name of the video file](https://github.com/wandb/wandb/blob/c5fe3d56b155655980611d32ef09df35cd336872/wandb/integration/gym/__init__.py#LL69C67-L69C67) being logged from `gymnasium` and name it after that or fall back to `"videos"` if we don't find a match. If you want more control, you can always just manually [log a video]({{< relref "/guides/models/track/log/media.md" >}}). - -Check out this [report](https://wandb.ai/raph-test/cleanrltest/reports/Mario-Bros-but-with-AI-Gymnasium-and-CleanRL---Vmlldzo0NTcxNTcw) to learn more on how to use Gymnasium with the CleanRL library. - -{{< img src="/images/integrations/gymnasium.png" alt="Gymnasium RL environment" >}} \ No newline at end of file diff --git a/content/en/guides/integrations/fastai/_index.md b/content/en/guides/integrations/fastai/_index.md deleted file mode 100644 index f1b4adc8e8..0000000000 --- a/content/en/guides/integrations/fastai/_index.md +++ /dev/null @@ -1,278 +0,0 @@ ---- -menu: - default: - identifier: README - parent: integrations -title: fastai -cascade: -- url: guides/integrations/fastai/:filename -weight: 100 ---- -If you're using **fastai** to train your models, W&B has an easy integration using the `WandbCallback`. Explore the details in[ interactive docs with examples →](https://app.wandb.ai/borisd13/demo_config/reports/Visualize-track-compare-Fastai-models--Vmlldzo4MzAyNA) - -## Sign up and create an API key - -An API key authenticates your machine to W&B. You can generate an API key from your user profile. - -{{% alert %}} -For a more streamlined approach, you can generate an API key by going directly to the [W&B authorization page](https://wandb.ai/authorize). Copy the displayed API key and save it in a secure location such as a password manager. -{{% /alert %}} - -1. Click your user profile icon in the upper right corner. -1. Select **User Settings**, then scroll to the **API Keys** section. -1. Click **Reveal**. Copy the displayed API key. To hide the API key, reload the page. - -## Install the `wandb` library and log in - -To install the `wandb` library locally and log in: - -{{< tabpane text=true >}} -{{% tab header="Command Line" value="cli" %}} - -1. Set the `WANDB_API_KEY` [environment variable]({{< relref "/guides/models/track/environment-variables.md" >}}) to your API key. - - ```bash - export WANDB_API_KEY= - ``` - -1. Install the `wandb` library and log in. - - - - ```shell - pip install wandb - - wandb login - ``` - -{{% /tab %}} - -{{% tab header="Python" value="python" %}} - -```bash -pip install wandb -``` -```python -import wandb -wandb.login() -``` - -{{% /tab %}} - -{{% tab header="Python notebook" value="python-notebook" %}} - -```notebook -!pip install wandb - -import wandb -wandb.login() -``` - -{{% /tab %}} -{{< /tabpane >}} - -## Add the `WandbCallback` to the `learner` or `fit` method - -```python -import wandb -from fastai.callback.wandb import * - -# start logging a wandb run -wandb.init(project="my_project") - -# To log only during one training phase -learn.fit(..., cbs=WandbCallback()) - -# To log continuously for all training phases -learn = learner(..., cbs=WandbCallback()) -``` - -{{% alert %}} -If you use version 1 of Fastai, refer to the [Fastai v1 docs]({{< relref "v1.md" >}}). -{{% /alert %}} - -## WandbCallback Arguments - -`WandbCallback` accepts the following arguments: - -| Args | Description | -| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| log | Whether to log the model's: `gradients` , `parameters`, `all` or `None` (default). Losses & metrics are always logged. | -| log_preds | whether we want to log prediction samples (default to `True`). | -| log_preds_every_epoch | whether to log predictions every epoch or at the end (default to `False`) | -| log_model | whether we want to log our model (default to False). This also requires `SaveModelCallback` | -| model_name | The name of the `file` to save, overrides `SaveModelCallback` | -| log_dataset |
  • False (default)
  • True will log folder referenced by learn.dls.path.
  • a path can be defined explicitly to reference which folder to log.

Note: subfolder "models" is always ignored.

| -| dataset_name | name of logged dataset (default to `folder name`). | -| valid_dl | `DataLoaders` containing items used for prediction samples (default to random items from `learn.dls.valid`. | -| n_preds | number of logged predictions (default to 36). | -| seed | used for defining random samples. | - -For custom workflows, you can manually log your datasets and models: - -* `log_dataset(path, name=None, metadata={})` -* `log_model(path, name=None, metadata={})` - -_Note: any subfolder "models" will be ignored._ - -## Distributed Training - -`fastai` supports distributed training by using the context manager `distrib_ctx`. W&B supports this automatically and enables you to track your Multi-GPU experiments out of the box. - -Review this minimal example: - -{{< tabpane text=true >}} -{{% tab header="Script" value="script" %}} - -```python -import wandb -from fastai.vision.all import * -from fastai.distributed import * -from fastai.callback.wandb import WandbCallback - -wandb.require(experiment="service") -path = rank0_first(lambda: untar_data(URLs.PETS) / "images") - -def train(): - dls = ImageDataLoaders.from_name_func( - path, - get_image_files(path), - valid_pct=0.2, - label_func=lambda x: x[0].isupper(), - item_tfms=Resize(224), - ) - wandb.init("fastai_ddp", entity="capecape") - cb = WandbCallback() - learn = vision_learner(dls, resnet34, metrics=error_rate, cbs=cb).to_fp16() - with learn.distrib_ctx(sync_bn=False): - learn.fit(1) - -if __name__ == "__main__": - train() -``` - -Then, in your terminal you will execute: - -```shell -$ torchrun --nproc_per_node 2 train.py -``` - -in this case, the machine has 2 GPUs. - -{{% /tab %}} -{{% tab header="Python notebook" value="notebook" %}} - -You can now run distributed training directly inside a notebook. - -```python -import wandb -from fastai.vision.all import * - -from accelerate import notebook_launcher -from fastai.distributed import * -from fastai.callback.wandb import WandbCallback - -wandb.require(experiment="service") -path = untar_data(URLs.PETS) / "images" - -def train(): - dls = ImageDataLoaders.from_name_func( - path, - get_image_files(path), - valid_pct=0.2, - label_func=lambda x: x[0].isupper(), - item_tfms=Resize(224), - ) - wandb.init("fastai_ddp", entity="capecape") - cb = WandbCallback() - learn = vision_learner(dls, resnet34, metrics=error_rate, cbs=cb).to_fp16() - with learn.distrib_ctx(in_notebook=True, sync_bn=False): - learn.fit(1) - -notebook_launcher(train, num_processes=2) -``` - -{{% /tab %}} -{{< /tabpane >}} - -### Log only on the main process - -In the examples above, `wandb` launches one run per process. At the end of the training, you will end up with two runs. This can sometimes be confusing, and you may want to log only on the main process. To do so, you will have to detect in which process you are manually and avoid creating runs (calling `wandb.init` in all other processes) - -{{< tabpane text=true >}} -{{% tab header="Script" value="script" %}} - -```python -import wandb -from fastai.vision.all import * -from fastai.distributed import * -from fastai.callback.wandb import WandbCallback - -wandb.require(experiment="service") -path = rank0_first(lambda: untar_data(URLs.PETS) / "images") - -def train(): - cb = [] - dls = ImageDataLoaders.from_name_func( - path, - get_image_files(path), - valid_pct=0.2, - label_func=lambda x: x[0].isupper(), - item_tfms=Resize(224), - ) - if rank_distrib() == 0: - run = wandb.init("fastai_ddp", entity="capecape") - cb = WandbCallback() - learn = vision_learner(dls, resnet34, metrics=error_rate, cbs=cb).to_fp16() - with learn.distrib_ctx(sync_bn=False): - learn.fit(1) - -if __name__ == "__main__": - train() -``` -in your terminal call: - -``` -$ torchrun --nproc_per_node 2 train.py -``` - -{{% /tab %}} -{{% tab header="Python notebook" value="notebook" %}} - -```python -import wandb -from fastai.vision.all import * - -from accelerate import notebook_launcher -from fastai.distributed import * -from fastai.callback.wandb import WandbCallback - -wandb.require(experiment="service") -path = untar_data(URLs.PETS) / "images" - -def train(): - cb = [] - dls = ImageDataLoaders.from_name_func( - path, - get_image_files(path), - valid_pct=0.2, - label_func=lambda x: x[0].isupper(), - item_tfms=Resize(224), - ) - if rank_distrib() == 0: - run = wandb.init("fastai_ddp", entity="capecape") - cb = WandbCallback() - learn = vision_learner(dls, resnet34, metrics=error_rate, cbs=cb).to_fp16() - with learn.distrib_ctx(in_notebook=True, sync_bn=False): - learn.fit(1) - -notebook_launcher(train, num_processes=2) -``` - -{{% /tab %}} -{{< /tabpane >}} - -## Examples - -* [Visualize, track, and compare Fastai models](https://app.wandb.ai/borisd13/demo_config/reports/Visualize-track-compare-Fastai-models--Vmlldzo4MzAyNA): A thoroughly documented walkthrough. -* [Image Segmentation on CamVid](https://bit.ly/fastai-wandb): A sample use case of the integration. \ No newline at end of file diff --git a/content/en/guides/integrations/fastai/v1.md b/content/en/guides/integrations/fastai/v1.md deleted file mode 100644 index 540d41d47d..0000000000 --- a/content/en/guides/integrations/fastai/v1.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -menu: - default: - identifier: v1 - parent: fastai -title: fastai v1 ---- - -{{% alert %}} -This documentation is for fastai v1. -If you use the current version of fastai, you should refer to [fastai page]({{< relref "../" >}}). -{{% /alert %}} - -For scripts using fastai v1, we have a callback that can automatically log model topology, losses, metrics, weights, gradients, sample predictions and best trained model. - -```python -import wandb -from wandb.fastai import WandbCallback - -wandb.init() - -learn = cnn_learner(data, model, callback_fns=WandbCallback) -learn.fit(epochs) -``` - -Requested logged data is configurable through the callback constructor. - -```python -from functools import partial - -learn = cnn_learner( - data, model, callback_fns=partial(WandbCallback, input_type="images") -) -``` - -It is also possible to use WandbCallback only when starting training. In this case it must be instantiated. - -```python -learn.fit(epochs, callbacks=WandbCallback(learn)) -``` - -Custom parameters can also be given at that stage. - -```python -learn.fit(epochs, callbacks=WandbCallback(learn, input_type="images")) -``` - -## Example Code - -We've created a few examples for you to see how the integration works: - -**Fastai v1** - -* [Classify Simpsons characters](https://github.com/borisdayma/simpsons-fastai)[: ](https://app.wandb.ai/jxmorris12/huggingface-demo/reports/A-Step-by-Step-Guide-to-Tracking-Hugging-Face-Model-Performance--VmlldzoxMDE2MTU)A simple demo to track and compare Fastai models -* [Semantic Segmentation with Fastai](https://github.com/borisdayma/semantic-segmentation): Optimize neural networks on self-driving cars - -## Options - -`WandbCallback()` class supports a number of options: - -| Keyword argument | Default | Description | -| ---------------- | --------- | -------------------------------------------------------------------------------------------------------- | -| learn | N/A | the fast.ai learner to hook. | -| save_model | True | save the model if it's improved at each step. It will also load best model at the end of training. | -| mode | auto | `min`, `max`, or `auto`: How to compare the training metric specified in `monitor` between steps. | -| monitor | None | training metric used to measure performance for saving the best model. None defaults to validation loss. | -| log | gradients | `gradients`, `parameters`, `all`, or None. Losses & metrics are always logged. | -| input_type | None | `images` or `None`. Used to display sample predictions. | -| validation_data | None | data used for sample predictions if `input_type` is set. | -| predictions | 36 | number of predictions to make if `input_type` is set and `validation_data` is `None`. | -| seed | 12345 | initialize random generator for sample predictions if `input_type` is set and `validation_data` is `None`. | \ No newline at end of file diff --git a/content/en/guides/integrations/huggingface.md b/content/en/guides/integrations/huggingface.md deleted file mode 100644 index 944c5a4c49..0000000000 --- a/content/en/guides/integrations/huggingface.md +++ /dev/null @@ -1,578 +0,0 @@ ---- -menu: - default: - identifier: huggingface - parent: integrations -title: Hugging Face Transformers -weight: 110 ---- -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/huggingface/Optimize_Hugging_Face_models_with_Weights_&_Biases.ipynb" >}} - -The [Hugging Face Transformers](https://huggingface.co/transformers/) library makes state-of-the-art NLP models like BERT and training techniques like mixed precision and gradient checkpointing easy to use. The [W&B integration](https://huggingface.co/transformers/main_classes/callback.html#transformers.integrations.WandbCallback) adds rich, flexible experiment tracking and model versioning to interactive centralized dashboards without compromising that ease of use. - -## Next-level logging in few lines - -```python -os.environ["WANDB_PROJECT"] = "" # name your W&B project -os.environ["WANDB_LOG_MODEL"] = "checkpoint" # log all model checkpoints - -from transformers import TrainingArguments, Trainer - -args = TrainingArguments(..., report_to="wandb") # turn on W&B logging -trainer = Trainer(..., args=args) -``` -{{< img src="/images/integrations/huggingface_gif.gif" alt="HuggingFace dashboard" >}} - -{{% alert %}} -If you'd rather dive straight into working code, check out this [Google Colab](https://wandb.me/hf). -{{% /alert %}} - -## Get started: track experiments - -### Sign up and create an API key - -An API key authenticates your machine to W&B. You can generate an API key from your user profile. - -{{% alert %}} -For a more streamlined approach, you can generate an API key by going directly to the [W&B authorization page](https://wandb.ai/authorize). Copy the displayed API key and save it in a secure location such as a password manager. -{{% /alert %}} - -1. Click your user profile icon in the upper right corner. -1. Select **User Settings**, then scroll to the **API Keys** section. -1. Click **Reveal**. Copy the displayed API key. To hide the API key, reload the page. - -### Install the `wandb` library and log in - -To install the `wandb` library locally and log in: - -{{< tabpane text=true >}} -{{% tab header="Command Line" value="cli" %}} - -1. Set the `WANDB_API_KEY` [environment variable]({{< relref "/guides/models/track/environment-variables.md" >}}) to your API key. - - ```bash - export WANDB_API_KEY= - ``` - -1. Install the `wandb` library and log in. - - - - ```shell - pip install wandb - - wandb login - ``` - -{{% /tab %}} - -{{% tab header="Python" value="python" %}} - -```bash -pip install wandb -``` -```python -import wandb -wandb.login() -``` - -{{% /tab %}} - -{{% tab header="Python notebook" value="python" %}} - -```notebook -!pip install wandb - -import wandb -wandb.login() -``` - -{{% /tab %}} -{{< /tabpane >}} - -If you are using W&B for the first time you might want to check out our [quickstart]({{< relref "/guides/quickstart.md" >}}) - - -### Name the project - -A W&B Project is where all of the charts, data, and models logged from related runs are stored. Naming your project helps you organize your work and keep all the information about a single project in one place. - -To add a run to a project simply set the `WANDB_PROJECT` environment variable to the name of your project. The `WandbCallback` will pick up this project name environment variable and use it when setting up your run. - -{{< tabpane text=true >}} -{{% tab header="Command Line" value="cli" %}} - -```bash -WANDB_PROJECT=amazon_sentiment_analysis -``` - -{{% /tab %}} - -{{% tab header="Python" value="python" %}} - -```python -import os -os.environ["WANDB_PROJECT"]="amazon_sentiment_analysis" -``` - -{{% /tab %}} - -{{% tab header="Python notebook" value="notebook" %}} - -```notebook -%env WANDB_PROJECT=amazon_sentiment_analysis -``` - -{{% /tab %}} - -{{< /tabpane >}} - -{{% alert %}} -Make sure you set the project name _before_ you initialize the `Trainer`. -{{% /alert %}} - -If a project name is not specified the project name defaults to `huggingface`. - -### Log your training runs to W&B - -This is **the most important step** when defining your `Trainer` training arguments, either inside your code or from the command line, is to set `report_to` to `"wandb"` in order enable logging with W&B. - -The `logging_steps` argument in `TrainingArguments` will control how often training metrics are pushed to W&B during training. You can also give a name to the training run in W&B using the `run_name` argument. - -That's it. Now your models will log losses, evaluation metrics, model topology, and gradients to W&B while they train. - -{{< tabpane text=true >}} -{{% tab header="Command Line" value="cli" %}} - -```bash -python run_glue.py \ # run your Python script - --report_to wandb \ # enable logging to W&B - --run_name bert-base-high-lr \ # name of the W&B run (optional) - # other command line arguments here -``` - -{{% /tab %}} - -{{% tab header="Python" value="python" %}} - -```python -from transformers import TrainingArguments, Trainer - -args = TrainingArguments( - # other args and kwargs here - report_to="wandb", # enable logging to W&B - run_name="bert-base-high-lr", # name of the W&B run (optional) - logging_steps=1, # how often to log to W&B -) - -trainer = Trainer( - # other args and kwargs here - args=args, # your training args -) - -trainer.train() # start training and logging to W&B -``` - -{{% /tab %}} -{{< /tabpane >}} - -{{% alert %}} -Using TensorFlow? Just swap the PyTorch `Trainer` for the TensorFlow `TFTrainer`. -{{% /alert %}} - -### Turn on model checkpointing - - -Using [Artifacts]({{< relref "/guides/core/artifacts/" >}}), you can store up to 100GB of models and datasets for free and then use the W&B [Registry]({{< relref "/guides/core/registry/" >}}). Using Registry, you can register models to explore and evaluate them, prepare them for staging, or deploy them in your production environment. - -To log your Hugging Face model checkpoints to Artifacts, set the `WANDB_LOG_MODEL` environment variable to _one_ of: - -- **`checkpoint`**: Upload a checkpoint every `args.save_steps` from the [`TrainingArguments`](https://huggingface.co/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments). -- **`end`**: Upload the model at the end of training, if `load_best_model_at_end` is also set. -- **`false`**: Do not upload the model. - - -{{< tabpane text=true >}} - -{{% tab header="Command Line" value="cli" %}} - -```bash -WANDB_LOG_MODEL="checkpoint" -``` - -{{% /tab %}} - -{{% tab header="Python" value="python" %}} - -```python -import os - -os.environ["WANDB_LOG_MODEL"] = "checkpoint" -``` - -{{% /tab %}} - -{{% tab header="Python notebook" value="notebook" %}} - -```notebook -%env WANDB_LOG_MODEL="checkpoint" -``` - -{{% /tab %}} - -{{< /tabpane >}} - -Any Transformers `Trainer` you initialize from now on will upload models to your W&B project. The model checkpoints you log will be viewable through the [Artifacts]({{< relref "/guides/core/artifacts/" >}}) UI, and include the full model lineage (see an example model checkpoint in the UI [here](https://wandb.ai/wandb/arttest/artifacts/model/iv3_trained/5334ab69740f9dda4fed/lineage?_gl=1*yyql5q*_ga*MTQxOTYyNzExOS4xNjg0NDYyNzk1*_ga_JH1SJHJQXJ*MTY5MjMwNzI2Mi4yNjkuMS4xNjkyMzA5NjM2LjM3LjAuMA..)). - - -{{% alert %}} -By default, your model will be saved to W&B Artifacts as `model-{run_id}` when `WANDB_LOG_MODEL` is set to `end` or `checkpoint-{run_id}` when `WANDB_LOG_MODEL` is set to `checkpoint`. -However, If you pass a [`run_name`](https://huggingface.co/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments.run_name) in your `TrainingArguments`, the model will be saved as `model-{run_name}` or `checkpoint-{run_name}`. -{{% /alert %}} - -#### W&B Registry -Once you have logged your checkpoints to Artifacts, you can then register your best model checkpoints and centralize them across your team with [Registry]({{< relref "/guides/core/registry/" >}}). Using Registry, you can organize your best models by task, manage the lifecycles of models, track and audit the entire ML lifecyle, and [automate]({{< relref "/guides/core/automations/" >}}) downstream actions. - -To link a model Artifact, refer to [Registry]({{< relref "/guides/core/registry/" >}}). - -### Visualise evaluation outputs during training - -Visualing your model outputs during training or evaluation is often essential to really understand how your model is training. - -By using the callbacks system in the Transformers Trainer, you can log additional helpful data to W&B such as your models' text generation outputs or other predictions to W&B Tables. - -See the [Custom logging section]({{< relref "#custom-logging-log-and-view-evaluation-samples-during-training" >}}) below for a full guide on how to log evaluation outputs while training to log to a W&B Table like this: - - -{{< img src="/images/integrations/huggingface_eval_tables.png" alt="Shows a W&B Table with evaluation outputs" >}} - -### Finish your W&B Run (Notebook only) - -If your training is encapsulated in a Python script, the W&B run will end when your script finishes. - -If you are using a Jupyter or Google Colab notebook, you'll need to tell us when you're done with training by calling `run.finish()`. - -```python -run = wandb.init() -trainer.train() # start training and logging to W&B - -# post-training analysis, testing, other logged code - -run.finish() -``` - -### Visualize your results - -Once you have logged your training results you can explore your results dynamically in the [W&B Dashboard]({{< relref "/guides/models/track/workspaces.md" >}}). It's easy to compare across dozens of runs at once, zoom in on interesting findings, and coax insights out of complex data with flexible, interactive visualizations. - -## Advanced features and FAQs - -### How do I save the best model? -If you pass `TrainingArguments` with `load_best_model_at_end=True` to your `Trainer`, W&B saves the best performing model checkpoint to Artifacts. - -If you save your model checkpoints as Artifacts, you can promote them to the [Registry]({{< relref "/guides/core/registry/" >}}). In Registry, you can: -- Organize your best model versions by ML task. -- Centralize models and share them with your team. -- Stage models for production or bookmark them for further evaluation. -- Trigger downstream CI/CD processes. - -### How do I load a saved model? - -If you saved your model to W&B Artifacts with `WANDB_LOG_MODEL`, you can download your model weights for additional training or to run inference. You just load them back into the same Hugging Face architecture that you used before. - -```python -# Create a new run -with wandb.init(project="amazon_sentiment_analysis") as run: - # Pass the name and version of Artifact - my_model_name = "model-bert-base-high-lr:latest" - my_model_artifact = run.use_artifact(my_model_name) - - # Download model weights to a folder and return the path - model_dir = my_model_artifact.download() - - # Load your Hugging Face model from that folder - # using the same model class - model = AutoModelForSequenceClassification.from_pretrained( - model_dir, num_labels=num_labels - ) - - # Do additional training, or run inference -``` - -### How do I resume training from a checkpoint? -If you had set `WANDB_LOG_MODEL='checkpoint'` you can also resume training by you can using the `model_dir` as the `model_name_or_path` argument in your `TrainingArguments` and pass `resume_from_checkpoint=True` to `Trainer`. - -```python -last_run_id = "xxxxxxxx" # fetch the run_id from your wandb workspace - -# resume the wandb run from the run_id -with wandb.init( - project=os.environ["WANDB_PROJECT"], - id=last_run_id, - resume="must", -) as run: - # Connect an Artifact to the run - my_checkpoint_name = f"checkpoint-{last_run_id}:latest" - my_checkpoint_artifact = run.use_artifact(my_model_name) - - # Download checkpoint to a folder and return the path - checkpoint_dir = my_checkpoint_artifact.download() - - # reinitialize your model and trainer - model = AutoModelForSequenceClassification.from_pretrained( - "", num_labels=num_labels - ) - # your awesome training arguments here. - training_args = TrainingArguments() - - trainer = Trainer(model=model, args=training_args) - - # make sure use the checkpoint dir to resume training from the checkpoint - trainer.train(resume_from_checkpoint=checkpoint_dir) -``` - -### How do I log and view evaluation samples during training - -Logging to W&B via the Transformers `Trainer` is taken care of by the [`WandbCallback`](https://huggingface.co/transformers/main_classes/callback.html#transformers.integrations.WandbCallback) in the Transformers library. If you need to customize your Hugging Face logging you can modify this callback by subclassing `WandbCallback` and adding additional functionality that leverages additional methods from the Trainer class. - -Below is the general pattern to add this new callback to the HF Trainer, and further down is a code-complete example to log evaluation outputs to a W&B Table: - - -```python -# Instantiate the Trainer as normal -trainer = Trainer() - -# Instantiate the new logging callback, passing it the Trainer object -evals_callback = WandbEvalsCallback(trainer, tokenizer, ...) - -# Add the callback to the Trainer -trainer.add_callback(evals_callback) - -# Begin Trainer training as normal -trainer.train() -``` - -#### View evaluation samples during training - -The following section shows how to customize the `WandbCallback` to run model predictions and log evaluation samples to a W&B Table during training. We will every `eval_steps` using the `on_evaluate` method of the Trainer callback. - -Here, we wrote a `decode_predictions` function to decode the predictions and labels from the model output using the tokenizer. - -Then, we create a pandas DataFrame from the predictions and labels and add an `epoch` column to the DataFrame. - -Finally, we create a `wandb.Table` from the DataFrame and log it to wandb. -Additionally, we can control the frequency of logging by logging the predictions every `freq` epochs. - -**Note**: Unlike the regular `WandbCallback` this custom callback needs to be added to the trainer **after** the `Trainer` is instantiated and not during initialization of the `Trainer`. -This is because the `Trainer` instance is passed to the callback during initialization. - -```python -from transformers.integrations import WandbCallback -import pandas as pd - - -def decode_predictions(tokenizer, predictions): - labels = tokenizer.batch_decode(predictions.label_ids) - logits = predictions.predictions.argmax(axis=-1) - prediction_text = tokenizer.batch_decode(logits) - return {"labels": labels, "predictions": prediction_text} - - -class WandbPredictionProgressCallback(WandbCallback): - """Custom WandbCallback to log model predictions during training. - - This callback logs model predictions and labels to a wandb.Table at each - logging step during training. It allows to visualize the - model predictions as the training progresses. - - Attributes: - trainer (Trainer): The Hugging Face Trainer instance. - tokenizer (AutoTokenizer): The tokenizer associated with the model. - sample_dataset (Dataset): A subset of the validation dataset - for generating predictions. - num_samples (int, optional): Number of samples to select from - the validation dataset for generating predictions. Defaults to 100. - freq (int, optional): Frequency of logging. Defaults to 2. - """ - - def __init__(self, trainer, tokenizer, val_dataset, num_samples=100, freq=2): - """Initializes the WandbPredictionProgressCallback instance. - - Args: - trainer (Trainer): The Hugging Face Trainer instance. - tokenizer (AutoTokenizer): The tokenizer associated - with the model. - val_dataset (Dataset): The validation dataset. - num_samples (int, optional): Number of samples to select from - the validation dataset for generating predictions. - Defaults to 100. - freq (int, optional): Frequency of logging. Defaults to 2. - """ - super().__init__() - self.trainer = trainer - self.tokenizer = tokenizer - self.sample_dataset = val_dataset.select(range(num_samples)) - self.freq = freq - - def on_evaluate(self, args, state, control, **kwargs): - super().on_evaluate(args, state, control, **kwargs) - # control the frequency of logging by logging the predictions - # every `freq` epochs - if state.epoch % self.freq == 0: - # generate predictions - predictions = self.trainer.predict(self.sample_dataset) - # decode predictions and labels - predictions = decode_predictions(self.tokenizer, predictions) - # add predictions to a wandb.Table - predictions_df = pd.DataFrame(predictions) - predictions_df["epoch"] = state.epoch - records_table = self._wandb.Table(dataframe=predictions_df) - # log the table to wandb - self._wandb.log({"sample_predictions": records_table}) - - -# First, instantiate the Trainer -trainer = Trainer( - model=model, - args=training_args, - train_dataset=lm_datasets["train"], - eval_dataset=lm_datasets["validation"], -) - -# Instantiate the WandbPredictionProgressCallback -progress_callback = WandbPredictionProgressCallback( - trainer=trainer, - tokenizer=tokenizer, - val_dataset=lm_dataset["validation"], - num_samples=10, - freq=2, -) - -# Add the callback to the trainer -trainer.add_callback(progress_callback) -``` - -For a more detailed example please refer to this [colab](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/huggingface/Custom_Progress_Callback.ipynb) - - -### What additional W&B settings are available? - -Further configuration of what is logged with `Trainer` is possible by setting environment variables. A full list of W&B environment variables [can be found here]({{< relref "/guides/hosting/env-vars.md" >}}). - -| Environment Variable | Usage | -| -------------------- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `WANDB_PROJECT` | Give your project a name (`huggingface` by default) | -| `WANDB_LOG_MODEL` |

Log the model checkpoint as a W&B Artifact (`false` by default)

  • false (default): No model checkpointing
  • checkpoint: A checkpoint will be uploaded every args.save_steps (set in the Trainer's TrainingArguments).
  • end: The final model checkpoint will be uploaded at the end of training.
| -| `WANDB_WATCH` |

Set whether you'd like to log your models gradients, parameters or neither

  • false (default): No gradient or parameter logging
  • gradients: Log histograms of the gradients
  • all: Log histograms of gradients and parameters
| -| `WANDB_DISABLED` | Set to `true` to turn off logging entirely (`false` by default) | -| `WANDB_QUIET`. | Set to `true` to limit statements logged to standard output to critical statements only (`false` by default) | -| `WANDB_SILENT` | Set to `true` to silence the output printed by wandb (`false` by default) | - -{{< tabpane text=true >}} - -{{% tab header="Command Line" value="cli" %}} - -```bash -WANDB_WATCH=all -WANDB_SILENT=true -``` - -{{% /tab %}} - -{{% tab header="Notebook" value="notebook" %}} - -```notebook -%env WANDB_WATCH=all -%env WANDB_SILENT=true -``` - -{{% /tab %}} - -{{< /tabpane >}} - - -### How do I customize `wandb.init`? - -The `WandbCallback` that `Trainer` uses will call `wandb.init` under the hood when `Trainer` is initialized. You can alternatively set up your runs manually by calling `wandb.init` before the`Trainer` is initialized. This gives you full control over your W&B run configuration. - -An example of what you might want to pass to `init` is below. For `wandb.init()` details, see the [`wandb.init()` reference]({{< relref "/ref/python/functions/init.md" >}}). - -```python -wandb.init( - project="amazon_sentiment_analysis", - name="bert-base-high-lr", - tags=["baseline", "high-lr"], - group="bert", -) -``` - - -## Additional resources - -Below are 6 Transformers and W&B related articles you might enjoy - -
- -Hyperparameter Optimization for Hugging Face Transformers - -* Three strategies for hyperparameter optimization for Hugging Face Transformers are compared: Grid Search, Bayesian Optimization, and Population Based Training. -* We use a standard uncased BERT model from Hugging Face transformers, and we want to fine-tune on the RTE dataset from the SuperGLUE benchmark -* Results show that Population Based Training is the most effective approach to hyperparameter optimization of our Hugging Face transformer model. - -Read the [Hyperparameter Optimization for Hugging Face Transformers report](https://wandb.ai/amogkam/transformers/reports/Hyperparameter-Optimization-for-Hugging-Face-Transformers--VmlldzoyMTc2ODI). -
- -
- -Hugging Tweets: Train a Model to Generate Tweets - -* In the article, the author demonstrates how to fine-tune a pre-trained GPT2 HuggingFace Transformer model on anyone's Tweets in five minutes. -* The model uses the following pipeline: Downloading Tweets, Optimizing the Dataset, Initial Experiments, Comparing Losses Between Users, Fine-Tuning the Model. - -Read the full report [here](https://wandb.ai/wandb/huggingtweets/reports/HuggingTweets-Train-a-Model-to-Generate-Tweets--VmlldzoxMTY5MjI). -
- -
- -Sentence Classification With Hugging Face BERT and WB - -* In this article, we'll build a sentence classifier leveraging the power of recent breakthroughs in Natural Language Processing, focusing on an application of transfer learning to NLP. -* We'll be using The Corpus of Linguistic Acceptability (CoLA) dataset for single sentence classification, which is a set of sentences labeled as grammatically correct or incorrect that was first published in May 2018. -* We'll use Google's BERT to create high performance models with minimal effort on a range of NLP tasks. - -Read the full report [here](https://wandb.ai/cayush/bert-finetuning/reports/Sentence-Classification-With-Huggingface-BERT-and-W-B--Vmlldzo4MDMwNA). -
- -
- -A Step by Step Guide to Tracking Hugging Face Model Performance - -* We use W&B and Hugging Face transformers to train DistilBERT, a Transformer that's 40% smaller than BERT but retains 97% of BERT's accuracy, on the GLUE benchmark -* The GLUE benchmark is a collection of nine datasets and tasks for training NLP models - -Read the full report [here](https://wandb.ai/jxmorris12/huggingface-demo/reports/A-Step-by-Step-Guide-to-Tracking-HuggingFace-Model-Performance--VmlldzoxMDE2MTU). -
- -
- -Examples of Early Stopping in HuggingFace - -* Fine-tuning a Hugging Face Transformer using Early Stopping regularization can be done natively in PyTorch or TensorFlow. -* Using the EarlyStopping callback in TensorFlow is straightforward with the `tf.keras.callbacks.EarlyStopping`callback. -* In PyTorch, there is not an off-the-shelf early stopping method, but there is a working early stopping hook available on GitHub Gist. - -Read the full report [here](https://wandb.ai/ayush-thakur/huggingface/reports/Early-Stopping-in-HuggingFace-Examples--Vmlldzo0MzE2MTM). -
- -
- -How to Fine-Tune Hugging Face Transformers on a Custom Dataset - -We fine tune a DistilBERT transformer for sentiment analysis (binary classification) on a custom IMDB dataset. - -Read the full report [here](https://wandb.ai/ayush-thakur/huggingface/reports/How-to-Fine-Tune-HuggingFace-Transformers-on-a-Custom-Dataset--Vmlldzo0MzQ2MDc). -
- -## Get help or request features - -For any issues, questions, or feature requests for the Hugging Face W&B integration, feel free to post in [this thread on the Hugging Face forums](https://discuss.huggingface.co/t/logging-experiment-tracking-with-w-b/498) or open an issue on the Hugging Face [Transformers GitHub repo](https://github.com/huggingface/transformers). \ No newline at end of file diff --git a/content/en/guides/integrations/hydra.md b/content/en/guides/integrations/hydra.md deleted file mode 100644 index 4e15f445c4..0000000000 --- a/content/en/guides/integrations/hydra.md +++ /dev/null @@ -1,101 +0,0 @@ ---- -description: How to integrate W&B with Hydra. -menu: - default: - identifier: hydra - parent: integrations -title: Hydra -weight: 150 ---- - -> [Hydra](https://hydra.cc) is an open-source Python framework that simplifies the development of research and other complex applications. The key feature is the ability to dynamically create a hierarchical configuration by composition and override it through config files and the command line. - -You can continue to use Hydra for configuration management while taking advantage of the power of W&B. - -## Track metrics - -Track your metrics as normal with `wandb.init()` and `wandb.Run.log()` . Here, `wandb.entity` and `wandb.project` are defined within a hydra configuration file. - -```python -import wandb - - -@hydra.main(config_path="configs/", config_name="defaults") -def run_experiment(cfg): - - with wandb.init(entity=cfg.wandb.entity, project=cfg.wandb.project) as run: - run.log({"loss": loss}) -``` - -## Track Hyperparameters - -Hydra uses [omegaconf](https://omegaconf.readthedocs.io/en/2.1_branch/) as the default way to interface with configuration dictionaries. `OmegaConf`'s dictionary are not a subclass of primitive dictionaries so directly passing Hydra's `Config` to `wandb.Run.config` leads to unexpected results on the dashboard. It's necessary to convert `omegaconf.DictConfig` to the primitive `dict` type before passing to `wandb.Run.config`. - -```python -@hydra.main(config_path="configs/", config_name="defaults") -def run_experiment(cfg): - with wandb.init(entity=cfg.wandb.entity, project=cfg.wandb.project) as run: - run.config = omegaconf.OmegaConf.to_container( - cfg, resolve=True, throw_on_missing=True - ) - run = wandb.init(entity=cfg.wandb.entity, project=cfg.wandb.project) - run.log({"loss": loss}) - model = Model(**run.config.model.configs) -``` - -## Troubleshoot multiprocessing - -If your process hangs when started, this may be caused by [this known issue]({{< relref "/guides/models/track/log/distributed-training.md" >}}). To solve this, try to changing wandb's multiprocessing protocol either by adding an extra settings parameter to `wandb.init()` as: - -```python -wandb.init(settings=wandb.Settings(start_method="thread")) -``` - -or by setting a global environment variable from your shell: - -```bash -$ export WANDB_START_METHOD=thread -``` - -## Optimize Hyperparameters - -[W&B Sweeps]({{< relref "/guides/models/sweeps/" >}}) is a highly scalable hyperparameter search platform, which provides interesting insights and visualization about W&B experiments with minimal requirements code real-estate. Sweeps integrates seamlessly with Hydra projects with no-coding requirements. The only thing needed is a configuration file describing the various parameters to sweep over as normal. - -A simple example `sweep.yaml` file would be: - -```yaml -program: main.py -method: bayes -metric: - goal: maximize - name: test/accuracy -parameters: - dataset: - values: [mnist, cifar10] - -command: - - ${env} - - python - - ${program} - - ${args_no_hyphens} -``` - -Invoke the sweep: - -``` bash -wandb sweep sweep.yaml` \ -``` - -W&B automatically creates a sweep inside your project and returns a `wandb agent` command for you to run on each machine you want to run your sweep. - -### Pass parameters not present in Hydra defaults - - - -Hydra supports passing extra parameters through the command line which aren't present in the default configuration file, by using a `+` before command. For example, you can pass an extra parameter with some value by simply calling: - -```bash -$ python program.py +experiment=some_experiment -``` - -You cannot sweep over such `+` configurations similar to what one does while configuring [Hydra Experiments](https://hydra.cc/docs/patterns/configuring_experiments/). To work around this, you can initialize the experiment parameter with a default empty file and use W&B Sweep to override those empty configs on each call. For more information, read [this W&B Report](https://wandb.me/hydra). diff --git a/content/en/guides/integrations/ignite.md b/content/en/guides/integrations/ignite.md deleted file mode 100644 index 293cdfa39c..0000000000 --- a/content/en/guides/integrations/ignite.md +++ /dev/null @@ -1,192 +0,0 @@ ---- -description: How to integrate W&B with PyTorch Ignite. -menu: - default: - identifier: ignite - parent: integrations -title: PyTorch Ignite -weight: 330 ---- - -* See the resulting visualizations in this [example W&B report →](https://app.wandb.ai/example-team/pytorch-ignite-example/reports/PyTorch-Ignite-with-W%26B--Vmlldzo0NzkwMg) -* Try running the code yourself in this [example hosted notebook →](https://colab.research.google.com/drive/15e-yGOvboTzXU4pe91Jg-Yr7sae3zBOJ#scrollTo=ztVifsYAmnRr) - -Ignite supports W&B handler to log metrics, model/optimizer parameters, gradients during training and validation. It can also be used to log model checkpoints to the W&B cloud. This class is also a wrapper for the wandb module. This means that you can call any wandb function using this wrapper. See examples on how to save model parameters and gradients. - -## Basic setup - -```python -from argparse import ArgumentParser -import wandb -import torch -from torch import nn -from torch.optim import SGD -from torch.utils.data import DataLoader -import torch.nn.functional as F -from torchvision.transforms import Compose, ToTensor, Normalize -from torchvision.datasets import MNIST - -from ignite.engine import Events, create_supervised_trainer, create_supervised_evaluator -from ignite.metrics import Accuracy, Loss - -from tqdm import tqdm - - -class Net(nn.Module): - def __init__(self): - super(Net, self).__init__() - self.conv1 = nn.Conv2d(1, 10, kernel_size=5) - self.conv2 = nn.Conv2d(10, 20, kernel_size=5) - self.conv2_drop = nn.Dropout2d() - self.fc1 = nn.Linear(320, 50) - self.fc2 = nn.Linear(50, 10) - - def forward(self, x): - x = F.relu(F.max_pool2d(self.conv1(x), 2)) - x = F.relu(F.max_pool2d(self.conv2_drop(self.conv2(x)), 2)) - x = x.view(-1, 320) - x = F.relu(self.fc1(x)) - x = F.dropout(x, training=self.training) - x = self.fc2(x) - return F.log_softmax(x, dim=-1) - - -def get_data_loaders(train_batch_size, val_batch_size): - data_transform = Compose([ToTensor(), Normalize((0.1307,), (0.3081,))]) - - train_loader = DataLoader(MNIST(download=True, root=".", transform=data_transform, train=True), - batch_size=train_batch_size, shuffle=True) - - val_loader = DataLoader(MNIST(download=False, root=".", transform=data_transform, train=False), - batch_size=val_batch_size, shuffle=False) - return train_loader, val_loader -``` - -Using `WandBLogger` in ignite is a modular process. First, you create a `WandBLogger` object. Next, you attach it to a trainer or evaluator to automatically log the metrics. This example shows: - -* Logs training loss, attached to the trainer object. -* Logs validation loss, attached to the evaluator. -* Logs optional Parameters, such as learning rate. -* Watches the model. - -```python -from ignite.contrib.handlers.wandb_logger import * -def run(train_batch_size, val_batch_size, epochs, lr, momentum, log_interval): - train_loader, val_loader = get_data_loaders(train_batch_size, val_batch_size) - model = Net() - device = 'cpu' - - if torch.cuda.is_available(): - device = 'cuda' - - optimizer = SGD(model.parameters(), lr=lr, momentum=momentum) - trainer = create_supervised_trainer(model, optimizer, F.nll_loss, device=device) - evaluator = create_supervised_evaluator(model, - metrics={'accuracy': Accuracy(), - 'nll': Loss(F.nll_loss)}, - device=device) - - desc = "ITERATION - loss: {:.2f}" - pbar = tqdm( - initial=0, leave=False, total=len(train_loader), - desc=desc.format(0) - ) - #WandBlogger Object Creation - wandb_logger = WandBLogger( - project="pytorch-ignite-integration", - name="cnn-mnist", - config={"max_epochs": epochs,"batch_size":train_batch_size}, - tags=["pytorch-ignite", "mninst"] - ) - - wandb_logger.attach_output_handler( - trainer, - event_name=Events.ITERATION_COMPLETED, - tag="training", - output_transform=lambda loss: {"loss": loss} - ) - - wandb_logger.attach_output_handler( - evaluator, - event_name=Events.EPOCH_COMPLETED, - tag="training", - metric_names=["nll", "accuracy"], - global_step_transform=lambda *_: trainer.state.iteration, - ) - - wandb_logger.attach_opt_params_handler( - trainer, - event_name=Events.ITERATION_STARTED, - optimizer=optimizer, - param_name='lr' # optional - ) - - wandb_logger.watch(model) -``` - -You can optionally utilize ignite `EVENTS` to log the metrics directly to the terminal - -```python - @trainer.on(Events.ITERATION_COMPLETED(every=log_interval)) - def log_training_loss(engine): - pbar.desc = desc.format(engine.state.output) - pbar.update(log_interval) - - @trainer.on(Events.EPOCH_COMPLETED) - def log_training_results(engine): - pbar.refresh() - evaluator.run(train_loader) - metrics = evaluator.state.metrics - avg_accuracy = metrics['accuracy'] - avg_nll = metrics['nll'] - tqdm.write( - "Training Results - Epoch: {} Avg accuracy: {:.2f} Avg loss: {:.2f}" - .format(engine.state.epoch, avg_accuracy, avg_nll) - ) - - @trainer.on(Events.EPOCH_COMPLETED) - def log_validation_results(engine): - evaluator.run(val_loader) - metrics = evaluator.state.metrics - avg_accuracy = metrics['accuracy'] - avg_nll = metrics['nll'] - tqdm.write( - "Validation Results - Epoch: {} Avg accuracy: {:.2f} Avg loss: {:.2f}" - .format(engine.state.epoch, avg_accuracy, avg_nll)) - - pbar.n = pbar.last_print_n = 0 - - trainer.run(train_loader, max_epochs=epochs) - pbar.close() - - -if __name__ == "__main__": - parser = ArgumentParser() - parser.add_argument('--batch_size', type=int, default=64, - help='input batch size for training (default: 64)') - parser.add_argument('--val_batch_size', type=int, default=1000, - help='input batch size for validation (default: 1000)') - parser.add_argument('--epochs', type=int, default=10, - help='number of epochs to train (default: 10)') - parser.add_argument('--lr', type=float, default=0.01, - help='learning rate (default: 0.01)') - parser.add_argument('--momentum', type=float, default=0.5, - help='SGD momentum (default: 0.5)') - parser.add_argument('--log_interval', type=int, default=10, - help='how many batches to wait before logging training status') - - args = parser.parse_args() - run(args.batch_size, args.val_batch_size, args.epochs, args.lr, args.momentum, args.log_interval) -``` - -This code generates these visualizations:: - -{{< img src="/images/integrations/pytorch-ignite-1.png" alt="PyTorch Ignite training dashboard" >}} - -{{< img src="/images/integrations/pytorch-ignite-2.png" alt="PyTorch Ignite performance" >}} - -{{< img src="/images/integrations/pytorch-ignite-3.png" alt="PyTorch Ignite hyperparameter tuning results" >}} - -{{< img src="/images/integrations/pytorch-ignite-4.png" alt="PyTorch Ignite model comparison dashboard" >}} - -Refer to the [Ignite Docs](https://pytorch.org/ignite/contrib/handlers.html#module-ignite.contrib.handlers.wandb_logger) for more details. \ No newline at end of file diff --git a/content/en/guides/integrations/keras.md b/content/en/guides/integrations/keras.md deleted file mode 100644 index 883e773b7d..0000000000 --- a/content/en/guides/integrations/keras.md +++ /dev/null @@ -1,312 +0,0 @@ ---- -menu: - default: - identifier: keras - parent: integrations -title: Keras -weight: 160 ---- -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/intro/Intro_to_Weights_%26_Biases_keras.ipynb" >}} - -## Keras callbacks - -W&B has three callbacks for Keras, available from `wandb` v0.13.4. For the legacy `WandbCallback` scroll down. - - -- **`WandbMetricsLogger`** : Use this callback for [Experiment Tracking]({{< relref "/guides/models/track" >}}). It logs your training and validation metrics along with system metrics to W&B. - -- **`WandbModelCheckpoint`** : Use this callback to log your model checkpoints to W&B [Artifacts]({{< relref "/guides/core/artifacts/" >}}). - -- **`WandbEvalCallback`**: This base callback logs model predictions to W&B [Tables]({{< relref "/guides/models/tables/" >}}) for interactive visualization. - -These new callbacks: - -* Adhere to Keras design philosophy. -* Reduce the cognitive load of using a single callback (`WandbCallback`) for everything. -* Make it easy for Keras users to modify the callback by subclassing it to support their niche use case. - -## Track experiments with `WandbMetricsLogger` - -{{< cta-button colabLink="https://github.com/wandb/examples/blob/master/colabs/keras/Use_WandbMetricLogger_in_your_Keras_workflow.ipynb" >}} - -`WandbMetricsLogger` automatically logs Keras' `logs` dictionary that callback methods such as `on_epoch_end`, `on_batch_end` etc, take as an argument. - -This tracks: - -* Training and validation metrics defined in `model.compile`. -* System (CPU/GPU/TPU) metrics. -* Learning rate (both for a fixed value or a learning rate scheduler. - -```python -import wandb -from wandb.integration.keras import WandbMetricsLogger - -# Initialize a new W&B Run -wandb.init(config={"bs": 12}) - -# Pass the WandbMetricsLogger to model.fit -model.fit( - X_train, y_train, validation_data=(X_test, y_test), callbacks=[WandbMetricsLogger()] -) -``` - -### `WandbMetricsLogger` reference - - -| Parameter | Description | -| --------------------- | --------------------------------------------------------------------------------------------------------------------------------- | -| `log_freq` | (`epoch`, `batch`, or an `int`): if `epoch`, logs metrics at the end of each epoch. If `batch`, logs metrics at the end of each batch. If an `int`, logs metrics at the end of that many batches. Defaults to `epoch`. | -| `initial_global_step` | (int): Use this argument to correctly log the learning rate when you resume training from some initial_epoch, and a learning rate scheduler is used. This can be computed as step_size * initial_step. Defaults to 0. | - -## Checkpoint a model using `WandbModelCheckpoint` - -{{< cta-button colabLink="https://github.com/wandb/examples/blob/master/colabs/keras/Use_WandbModelCheckpoint_in_your_Keras_workflow.ipynb" >}} - -Use `WandbModelCheckpoint` callback to save the Keras model (`SavedModel` format) or model weights periodically and uploads them to W&B as a `wandb.Artifact` for model versioning. - -This callback is subclassed from [`tf.keras.callbacks.ModelCheckpoint`](https://www.tensorflow.org/api_docs/python/tf/keras/callbacks/ModelCheckpoint) ,thus the checkpointing logic is taken care of by the parent callback. - -This callback saves: - -* The model that has achieved best performance based on the monitor. -* The model at the end of every epoch regardless of the performance. -* The model at the end of the epoch or after a fixed number of training batches. -* Only model weights or the whole model. -* The model either in `SavedModel` format or in `.h5` format. - -Use this callback in conjunction with `WandbMetricsLogger`. - -```python -import wandb -from wandb.integration.keras import WandbMetricsLogger, WandbModelCheckpoint - -# Initialize a new W&B Run -wandb.init(config={"bs": 12}) - -# Pass the WandbModelCheckpoint to model.fit -model.fit( - X_train, - y_train, - validation_data=(X_test, y_test), - callbacks=[ - WandbMetricsLogger(), - WandbModelCheckpoint("models"), - ], -) -``` - -### `WandbModelCheckpoint` reference - -| Parameter | Description | -| ------------------------- | ---- | -| `filepath` | (str): path to save the mode file.| -| `monitor` | (str): The metric name to monitor. | -| `verbose` | (int): Verbosity mode, 0 or 1. Mode 0 is silent, and mode 1 displays messages when the callback takes an action. | -| `save_best_only` | (Boolean): if `save_best_only=True`, it only saves the latest model or the model it considers the best, according to the defined by the `monitor` and `mode` attributes. | -| `save_weights_only` | (Boolean): if True, saves only the model's weights. | -| `mode` | (`auto`, `min`, or `max`): For `val_acc`, set it to `max`, for `val_loss`, set it to `min`, and so on | | -| `save_freq` | ("epoch" or int): When using ‘epoch’, the callback saves the model after each epoch. When using an integer, the callback saves the model at end of this many batches. Note that when monitoring validation metrics such as `val_acc` or `val_loss`, `save_freq` must be set to "epoch" as those metrics are only available at the end of an epoch. | -| `options` | (str): Optional `tf.train.CheckpointOptions` object if `save_weights_only` is true or optional `tf.saved_model.SaveOptions` object if `save_weights_only` is false. | -| `initial_value_threshold` | (float): Floating point initial "best" value of the metric to be monitored. | - -### Log checkpoints after N epochs - -By default (`save_freq="epoch"`), the callback creates a checkpoint and uploads it as an artifact after each epoch. To create a checkpoint after a specific number of batches, set `save_freq` to an integer. To checkpoint after `N` epochs, compute the cardinality of the `train` dataloader and pass it to `save_freq`: - -```python -WandbModelCheckpoint( - filepath="models/", - save_freq=int((trainloader.cardinality()*N).numpy()) -) -``` - -### Efficiently log checkpoints on a TPU architecture - -While checkpointing on TPUs you might encounter `UnimplementedError: File system scheme '[local]' not implemented` error message. This happens because the model directory (`filepath`) must use a cloud storage bucket path (`gs://bucket-name/...`), and this bucket must be accessible from the TPU server. We can however, use the local path for checkpointing which in turn is uploaded as an Artifacts. - -```python -checkpoint_options = tf.saved_model.SaveOptions(experimental_io_device="/job:localhost") - -WandbModelCheckpoint( - filepath="models/, - options=checkpoint_options, -) -``` - -## Visualize model predictions using `WandbEvalCallback` - -{{< cta-button colabLink="https://github.com/wandb/examples/blob/e66f16fbe7ae7a2e636d59350a50059d3f7e5494/colabs/keras/Use_WandbEvalCallback_in_your_Keras_workflow.ipynb" >}} - -The `WandbEvalCallback` is an abstract base class to build Keras callbacks primarily for model prediction and, secondarily, dataset visualization. - -This abstract callback is agnostic with respect to the dataset and the task. To use this, inherit from this base `WandbEvalCallback` callback class and implement the `add_ground_truth` and `add_model_prediction` methods. - -The `WandbEvalCallback` is a utility class that provides methods to: - -* Create data and prediction `wandb.Table` instances. -* Log data and prediction Tables as `wandb.Artifact`. -* Log the data table `on_train_begin`. -* log the prediction table `on_epoch_end`. - -The following example uses `WandbClfEvalCallback` for an image classification task. This example callback logs the validation data (`data_table`) to W&B, performs inference, and logs the prediction (`pred_table`) to W&B at the end of every epoch. - -```python -import wandb -from wandb.integration.keras import WandbMetricsLogger, WandbEvalCallback - - -# Implement your model prediction visualization callback -class WandbClfEvalCallback(WandbEvalCallback): - def __init__( - self, validation_data, data_table_columns, pred_table_columns, num_samples=100 - ): - super().__init__(data_table_columns, pred_table_columns) - - self.x = validation_data[0] - self.y = validation_data[1] - - def add_ground_truth(self, logs=None): - for idx, (image, label) in enumerate(zip(self.x, self.y)): - self.data_table.add_data(idx, wandb.Image(image), label) - - def add_model_predictions(self, epoch, logs=None): - preds = self.model.predict(self.x, verbose=0) - preds = tf.argmax(preds, axis=-1) - - table_idxs = self.data_table_ref.get_index() - - for idx in table_idxs: - pred = preds[idx] - self.pred_table.add_data( - epoch, - self.data_table_ref.data[idx][0], - self.data_table_ref.data[idx][1], - self.data_table_ref.data[idx][2], - pred, - ) - - -# ... - -# Initialize a new W&B Run -wandb.init(config={"hyper": "parameter"}) - -# Add the Callbacks to Model.fit -model.fit( - X_train, - y_train, - validation_data=(X_test, y_test), - callbacks=[ - WandbMetricsLogger(), - WandbClfEvalCallback( - validation_data=(X_test, y_test), - data_table_columns=["idx", "image", "label"], - pred_table_columns=["epoch", "idx", "image", "label", "pred"], - ), - ], -) -``` - -{{% alert %}} -The W&B [Artifact page]({{< relref "/guides/core/artifacts/explore-and-traverse-an-artifact-graph" >}}) includes Table logs by default, rather than the **Workspace** page. -{{% /alert %}} - -### `WandbEvalCallback` reference - -| Parameter | Description | -| -------------------- | ------------------------------------------------ | -| `data_table_columns` | (list) List of column names for the `data_table` | -| `pred_table_columns` | (list) List of column names for the `pred_table` | - -### Memory footprint details - -We log the `data_table` to W&B when the `on_train_begin` method is invoked. Once it's uploaded as a W&B Artifact, we get a reference to this table which can be accessed using `data_table_ref` class variable. The `data_table_ref` is a 2D list that can be indexed like `self.data_table_ref[idx][n]`, where `idx` is the row number while `n` is the column number. Let's see the usage in the example below. - -### Customize the callback - -You can override the `on_train_begin` or `on_epoch_end` methods to have more fine-grained control. If you want to log the samples after `N` batches, you can implement `on_train_batch_end` method. - -{{% alert %}} -If you are implementing a callback for model prediction visualization by inheriting `WandbEvalCallback` and something needs to be clarified or fixed, let us know by opening an [issue](https://github.com/wandb/wandb/issues). -{{% /alert %}} - -## `WandbCallback` [legacy] - -Use the W&B library `WandbCallback` Class to automatically save all the metrics and the loss values tracked in `model.fit`. - -```python -import wandb -from wandb.integration.keras import WandbCallback - -wandb.init(config={"hyper": "parameter"}) - -... # code to set up your model in Keras - -# Pass the callback to model.fit -model.fit( - X_train, y_train, validation_data=(X_test, y_test), callbacks=[WandbCallback()] -) -``` - -You can watch the short video [Get Started with Keras and W&B in Less Than a Minute](https://www.youtube.com/watch?ab_channel=Weights&Biases&v=4FjDIJ-vO_M). - -For a more detailed video, watch [Integrate W&B with Keras](https://www.youtube.com/watch?v=Bsudo7jbMow\&ab_channel=Weights%26Biases). You can review the [Colab Jupyter Notebook](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/keras/Keras_pipeline_with_Weights_and_Biases.ipynb). - -{{% alert %}} -See our [example repo](https://github.com/wandb/examples) for scripts, including a [Fashion MNIST example](https://github.com/wandb/examples/blob/master/examples/keras/keras-cnn-fashion/train.py) and the [W&B Dashboard](https://wandb.ai/wandb/keras-fashion-mnist/runs/5z1d85qs) it generates. -{{% /alert %}} - -The `WandbCallback` class supports a wide variety of logging configuration options: specifying a metric to monitor, tracking of weights and gradients, logging of predictions on training_data and validation_data, and more. - -Check out the reference documentation for the `keras.WandbCallback` for full details. - -The `WandbCallback` - -* Automatically logs history data from any metrics collected by Keras: loss and anything passed into `keras_model.compile()`. -* Sets summary metrics for the run associated with the "best" training step, as defined by the `monitor` and `mode` attributes. This defaults to the epoch with the minimum `val_loss`. `WandbCallback` by default saves the model associated with the best `epoch`. -* Optionally logs gradient and parameter histogram. -* Optionally saves training and validation data for wandb to visualize. - -### `WandbCallback` reference - -| Arguments | | -| -------------------------- | ------------------------------------------- | -| `monitor` | (str) name of metric to monitor. Defaults to `val_loss`. | -| `mode` | (str) one of {`auto`, `min`, `max`}. `min` - save model when monitor is minimized `max` - save model when monitor is maximized `auto` - try to guess when to save the model (default). | -| `save_model` | True - save a model when monitor beats all previous epochs False - don't save models | -| `save_graph` | (boolean) if True save model graph to wandb (default to True). | -| `save_weights_only` | (boolean) if True, saves only the model's weights(`model.save_weights(filepath)`). Otherwise, saves the full model). | -| `log_weights` | (boolean) if True save histograms of the model's layer's weights. | -| `log_gradients` | (boolean) if True log histograms of the training gradients | -| `training_data` | (tuple) Same format `(X,y)` as passed to `model.fit`. This is needed for calculating gradients - this is mandatory if `log_gradients` is `True`. | -| `validation_data` | (tuple) Same format `(X,y)` as passed to `model.fit`. A set of data for wandb to visualize. If you set this field, every epoch, wandb makes a small number of predictions and saves the results for later visualization. | -| `generator` | (generator) a generator that returns validation data for wandb to visualize. This generator should return tuples `(X,y)`. Either `validate_data` or generator should be set for wandb to visualize specific data examples. | -| `validation_steps` | (int) if `validation_data` is a generator, how many steps to run the generator for the full validation set. | -| `labels` | (list) If you are visualizing your data with wandb this list of labels converts numeric output to understandable string if you are building a classifier with multiple classes. For a binary classifier, you can pass in a list of two labels \[`label for false`, `label for true`]. If `validate_data` and `generator` are both false, this does nothing. | -| `predictions` | (int) the number of predictions to make for visualization each epoch, max is 100. | -| `input_type` | (string) type of the model input to help visualization. can be one of: (`image`, `images`, `segmentation_mask`). | -| `output_type` | (string) type of the model output to help visualziation. can be one of: (`image`, `images`, `segmentation_mask`). | -| `log_evaluation` | (boolean) if True, save a Table containing validation data and the model's predictions at each epoch. See `validation_indexes`, `validation_row_processor`, and `output_row_processor` for additional details. | -| `class_colors` | (\[float, float, float]) if the input or output is a segmentation mask, an array containing an rgb tuple (range 0-1) for each class. | -| `log_batch_frequency` | (integer) if None, callback logs every epoch. If set to integer, callback logs training metrics every `log_batch_frequency` batches. | -| `log_best_prefix` | (string) if None, saves no extra summary metrics. If set to a string, prepends the monitored metric and epoch with the prefix and saves the results as summary metrics. | -| `validation_indexes` | (\[wandb.data_types._TableLinkMixin]) an ordered list of index keys to associate with each validation example. If `log_evaluation` is True and you provide `validation_indexes`, does not create a Table of validation data. Instead, associates each prediction with the row represented by the `TableLinkMixin`. To obtain a list of row keys, use `Table.get_index() `. | -| `validation_row_processor` | (Callable) a function to apply to the validation data, commonly used to visualize the data. The function receives an `ndx` (int) and a `row` (dict). If your model has a single input, then `row["input"]` contains the input data for the row. Otherwise, it contains the names of the input slots. If your fit function takes a single target, then `row["target"]` contains the target data for the row. Otherwise, it contains the names of the output slots. For example, if your input data is a single array, to visualize the data as an Image, provide `lambda ndx, row: {"img": wandb.Image(row["input"])}` as the processor. Ignored if `log_evaluation` is False or `validation_indexes` are present. | -| `output_row_processor` | (Callable) same as `validation_row_processor`, but applied to the model's output. `row["output"]` contains the results of the model output. | -| `infer_missing_processors` | (Boolean) Determines whether to infer `validation_row_processor` and `output_row_processor` if they are missing. Defaults to True. If you provide `labels`, W&B attempts to infer classification-type processors where appropriate. | -| `log_evaluation_frequency` | (int) Determines how often to log evaluation results. Defaults to `0` to log only at the end of training. Set to 1 to log every epoch, 2 to log every other epoch, and so on. Has no effect when `log_evaluation` is False. | - -## Frequently Asked Questions - -### How do I use `Keras` multiprocessing with `wandb`? - -When setting `use_multiprocessing=True`, this error may occur: - -```python -Error("You must call wandb.init() before wandb.config.batch_size") -``` - -To work around it: - -1. In the `Sequence` class construction, add: `wandb.init(group='...')`. -2. In `main`, make sure you're using `if __name__ == "__main__":` and put the rest of your script logic inside it. \ No newline at end of file diff --git a/content/en/guides/integrations/kubeflow-pipelines-kfp.md b/content/en/guides/integrations/kubeflow-pipelines-kfp.md deleted file mode 100644 index e32f85d098..0000000000 --- a/content/en/guides/integrations/kubeflow-pipelines-kfp.md +++ /dev/null @@ -1,201 +0,0 @@ ---- -description: How to integrate W&B with Kubeflow Pipelines. -menu: - default: - identifier: kubeflow-pipelines-kfp - parent: integrations -title: Kubeflow Pipelines (kfp) -weight: 170 ---- - - -[Kubeflow Pipelines (kfp) ](https://www.kubeflow.org/docs/components/pipelines/overview/)is a platform for building and deploying portable, scalable machine learning (ML) workflows based on Docker containers. - -This integration lets users apply decorators to kfp python functional components to automatically log parameters and artifacts to W&B. - -This feature was enabled in `wandb==0.12.11` and requires `kfp<2.0.0` - -## Sign up and create an API key - -An API key authenticates your machine to W&B. You can generate an API key from your user profile. - -{{% alert %}} -For a more streamlined approach, you can generate an API key by going directly to the [W&B authorization page](https://wandb.ai/authorize). Copy the displayed API key and save it in a secure location such as a password manager. -{{% /alert %}} - -1. Click your user profile icon in the upper right corner. -1. Select **User Settings**, then scroll to the **API Keys** section. -1. Click **Reveal**. Copy the displayed API key. To hide the API key, reload the page. - -## Install the `wandb` library and log in - -To install the `wandb` library locally and log in: - -{{< tabpane text=true >}} -{{% tab header="Command Line" value="cli" %}} - -1. Set the `WANDB_API_KEY` [environment variable]({{< relref "/guides/models/track/environment-variables.md" >}}) to your API key. - - ```bash - export WANDB_API_KEY= - ``` - -1. Install the `wandb` library and log in. - - - - ```shell - pip install wandb - - wandb login - ``` - -{{% /tab %}} - -{{% tab header="Python" value="python" %}} - -```bash -pip install wandb -``` -```python -import wandb -wandb.login() -``` - -{{% /tab %}} - -{{% tab header="Python notebook" value="notebook" %}} - -```notebook -!pip install wandb - -import wandb -wandb.login() -``` - -{{% /tab %}} -{{< /tabpane >}} - - -## Decorate your components - -Add the `@wandb_log` decorator and create your components as usual. This will automatically log the input/outputs parameters and artifacts to W&B each time you run your pipeline. - -```python -from kfp import components -from wandb.integration.kfp import wandb_log - - -@wandb_log -def add(a: float, b: float) -> float: - return a + b - - -add = components.create_component_from_func(add) -``` - -## Pass environment variables to containers - -You may need to explicitly pass [environment variables]({{< relref "/guides/models/track/environment-variables.md" >}}) to your containers. For two-way linking, you should also set the environment variables `WANDB_KUBEFLOW_URL` to the base URL of your Kubeflow Pipelines instance. For example, `https://kubeflow.mysite.com`. - -```python -import os -from kubernetes.client.models import V1EnvVar - - -def add_wandb_env_variables(op): - env = { - "WANDB_API_KEY": os.getenv("WANDB_API_KEY"), - "WANDB_BASE_URL": os.getenv("WANDB_BASE_URL"), - } - - for name, value in env.items(): - op = op.add_env_variable(V1EnvVar(name, value)) - return op - - -@dsl.pipeline(name="example-pipeline") -def example_pipeline(param1: str, param2: int): - conf = dsl.get_pipeline_conf() - conf.add_op_transformer(add_wandb_env_variables) -``` - -## Access your data programmatically - -### Via the Kubeflow Pipelines UI - -Click on any Run in the Kubeflow Pipelines UI that has been logged with W&B. - -* Find details about inputs and outputs in the `Input/Output` and `ML Metadata` tabs. -* View the W&B web app from the `Visualizations` tab. - -{{< img src="/images/integrations/kubeflow_app_pipelines_ui.png" alt="W&B in Kubeflow UI" >}} - -### Via the web app UI - -The web app UI has the same content as the `Visualizations` tab in Kubeflow Pipelines, but with more space. Learn [more about the web app UI here]({{< relref "/guides/models/app" >}}). - -{{< img src="/images/integrations/kubeflow_pipelines.png" alt="Run details" >}} - -{{< img src="/images/integrations/kubeflow_via_app.png" alt="Pipeline DAG" >}} - -### Via the Public API (for programmatic access) - -* For programmatic access, [see our Public API]({{< relref "/ref/python/public-api/index.md" >}}). - -### Concept mapping from Kubeflow Pipelines to W&B - -Here's a mapping of Kubeflow Pipelines concepts to W&B - -| Kubeflow Pipelines | W&B | Location in W&B | -| ------------------ | --- | --------------- | -| Input Scalar | [`config`]({{< relref "/guides/models/track/config" >}}) | [Overview tab]({{< relref "/guides/models/track/runs/#overview-tab" >}}) | -| Output Scalar | [`summary`]({{< relref "/guides/models/track/log" >}}) | [Overview tab]({{< relref "/guides/models/track/runs/#overview-tab" >}}) | -| Input Artifact | Input Artifact | [Artifacts tab]({{< relref "/guides/models/track/runs/#artifacts-tab" >}}) | -| Output Artifact | Output Artifact | [Artifacts tab]({{< relref "/guides/models/track/runs/#artifacts-tab" >}}) | - -## Fine-grain logging - -If you want finer control of logging, you can sprinkle in `wandb.log` and `wandb.log_artifact` calls in the component. - -### With explicit `wandb.log_artifacts` calls - -In this example below, we are training a model. The `@wandb_log` decorator will automatically track the relevant inputs and outputs. If you want to log the training process, you can explicitly add that logging like so: - -```python -@wandb_log -def train_model( - train_dataloader_path: components.InputPath("dataloader"), - test_dataloader_path: components.InputPath("dataloader"), - model_path: components.OutputPath("pytorch_model"), -): - with wandb.init() as run: - ... - for epoch in epochs: - for batch_idx, (data, target) in enumerate(train_dataloader): - ... - if batch_idx % log_interval == 0: - run.log( - {"epoch": epoch, "step": batch_idx * len(data), "loss": loss.item()} - ) - ... - run.log_artifact(model_artifact) -``` - -### With implicit wandb integrations - -If you're using a [framework integration we support]({{< relref "/guides/integrations/" >}}), you can also pass in the callback directly: - -```python -@wandb_log -def train_model( - train_dataloader_path: components.InputPath("dataloader"), - test_dataloader_path: components.InputPath("dataloader"), - model_path: components.OutputPath("pytorch_model"), -): - from pytorch_lightning.loggers import WandbLogger - from pytorch_lightning import Trainer - - trainer = Trainer(logger=WandbLogger()) - ... # do training -``` \ No newline at end of file diff --git a/content/en/guides/integrations/lightgbm.md b/content/en/guides/integrations/lightgbm.md deleted file mode 100644 index de80857fc5..0000000000 --- a/content/en/guides/integrations/lightgbm.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -description: Track your trees with W&B. -menu: - default: - identifier: lightgbm - parent: integrations -title: LightGBM -weight: 190 ---- - -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/boosting/Simple_LightGBM_Integration.ipynb" >}} - -The `wandb` library includes a special callback for [LightGBM](https://lightgbm.readthedocs.io/en/latest/). It's also easy to use the generic logging features of W&B to track large experiments, like hyperparameter sweeps. - -```python -from wandb.integration.lightgbm import wandb_callback, log_summary -import lightgbm as lgb - -# Log metrics to W&B -gbm = lgb.train(..., callbacks=[wandb_callback()]) - -# Log feature importance plot and upload model checkpoint to W&B -log_summary(gbm, save_model_checkpoint=True) -``` - -{{% alert %}} -Looking for working code examples? Check out [our repository of examples on GitHub](https://github.com/wandb/examples/tree/master/examples/boosting-algorithms). -{{% /alert %}} - -## Tuning your hyperparameters with Sweeps - -Attaining the maximum performance out of models requires tuning hyperparameters, like tree depth and learning rate. W&B [Sweeps]({{< relref "/guides/models/sweeps/" >}}) is a powerful toolkit for configuring, orchestrating, and analyzing large hyperparameter testing experiments. - -To learn more about these tools and see an example of how to use Sweeps with XGBoost, check out this interactive Colab notebook. - -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/boosting/Using_W%26B_Sweeps_with_XGBoost.ipynb" >}} - -{{< img src="/images/integrations/lightgbm_sweeps.png" alt="LightGBM performance comparison" >}} \ No newline at end of file diff --git a/content/en/guides/integrations/lightning.md b/content/en/guides/integrations/lightning.md deleted file mode 100644 index 8a90dabd54..0000000000 --- a/content/en/guides/integrations/lightning.md +++ /dev/null @@ -1,658 +0,0 @@ ---- -menu: - default: - identifier: lightning - parent: integrations -title: PyTorch Lightning -weight: 340 ---- -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/pytorch-lightning/Optimize_PyTorch_Lightning_models_with_Weights_%26_Biases.ipynb" >}} - -PyTorch Lightning provides a lightweight wrapper for organizing your PyTorch code and easily adding advanced features such as distributed training and 16-bit precision. W&B provides a lightweight wrapper for logging your ML experiments. But you don't need to combine the two yourself: W&B is incorporated directly into the PyTorch Lightning library via the [`WandbLogger`](https://lightning.ai/docs/pytorch/stable/api/lightning.pytorch.loggers.wandb.html#module-lightning.pytorch.loggers.wandb). - -## Integrate with Lightning - -{{< tabpane text=true >}} -{{% tab header="PyTorch Logger" value="pytorch" %}} - -```python -from lightning.pytorch.loggers import WandbLogger -from lightning.pytorch import Trainer - -wandb_logger = WandbLogger(log_model="all") -trainer = Trainer(logger=wandb_logger) -``` - -{{% alert %}} -**Using wandb.log():** The `WandbLogger` logs to W&B using the Trainer's `global_step`. If you make additional calls to `wandb.log` directly in your code, **do not** use the `step` argument in `wandb.log()`. - -Instead, log the Trainer's `global_step` like your other metrics: - -```python -wandb.log({"accuracy":0.99, "trainer/global_step": step}) -``` -{{% /alert %}} - -{{% /tab %}} - -{{% tab header="Fabric Logger" value="fabric" %}} - -```python -import lightning as L -from wandb.integration.lightning.fabric import WandbLogger - -wandb_logger = WandbLogger(log_model="all") -fabric = L.Fabric(loggers=[wandb_logger]) -fabric.launch() -fabric.log_dict({"important_metric": important_metric}) -``` - -{{% /tab %}} - -{{< /tabpane >}} - -{{< img src="/images/integrations/n6P7K4M.gif" alt="Interactive dashboards" >}} - -### Sign up and create an API key - -An API key authenticates your machine to W&B. You can generate an API key from your user profile. - -{{% alert %}} -For a more streamlined approach, you can generate an API key by going directly to the [W&B authorization page](https://wandb.ai/authorize). Copy the displayed API key and save it in a secure location such as a password manager. -{{% /alert %}} - -1. Click your user profile icon in the upper right corner. -1. Select **User Settings**, then scroll to the **API Keys** section. -1. Click **Reveal**. Copy the displayed API key. To hide the API key, reload the page. - -### Install the `wandb` library and log in - -To install the `wandb` library locally and log in: - -{{< tabpane text=true >}} -{{% tab header="Command Line" value="cli" %}} - -1. Set the `WANDB_API_KEY` [environment variable]({{< relref "/guides/models/track/environment-variables.md" >}}) to your API key. - - ```bash - export WANDB_API_KEY= - ``` - -1. Install the `wandb` library and log in. - - - - ```shell - pip install wandb - - wandb login - ``` - -{{% /tab %}} - -{{% tab header="Python" value="python" %}} - -```bash -pip install wandb -``` -```python -import wandb -wandb.login() -``` - -{{% /tab %}} - -{{% tab header="Python notebook" value="notebook" %}} - -```notebook -!pip install wandb - -import wandb -wandb.login() -``` - -{{% /tab %}} -{{< /tabpane >}} - - -## Use PyTorch Lightning's `WandbLogger` - -PyTorch Lightning has multiple `WandbLogger` classes to log metrics and model weights, media, and more. - -- [`PyTorch`](https://lightning.ai/docs/pytorch/stable/api/lightning.pytorch.loggers.wandb.html#module-lightning.pytorch.loggers.wandb) -- [`Fabric`](https://lightning.ai/docs/pytorch/stable/api/lightning.pytorch.loggers.wandb.html#module-lightning.pytorch.loggers.wandb) - -To integrate with Lightning, instantiate the `WandbLogger` and pass it to Lightning's `Trainer` or `Fabric`. - -{{< tabpane text=true >}} - -{{% tab header="PyTorch Logger" value="pytorch" %}} - -```python -trainer = Trainer(logger=wandb_logger) -``` - -{{% /tab %}} - -{{% tab header="Fabric Logger" value="fabric" %}} - -```python -fabric = L.Fabric(loggers=[wandb_logger]) -fabric.launch() -fabric.log_dict({ - "important_metric": important_metric -}) -``` - -{{% /tab %}} - -{{< /tabpane >}} - - -### Common logger arguments - -Below are some of the most used parameters in `WandbLogger`. Review the PyTorch Lightning documentation for details about all logger arguments. - -- [`PyTorch`](https://lightning.ai/docs/pytorch/stable/api/lightning.pytorch.loggers.wandb.html#module-lightning.pytorch.loggers.wandb) -- [`Fabric`](https://lightning.ai/docs/pytorch/stable/api/lightning.pytorch.loggers.wandb.html#module-lightning.pytorch.loggers.wandb) - -| Parameter | Description | -| ----------- | ----------------------------------------------------------------------------- | -| `project` | Define what wandb Project to log to | -| `name` | Give a name to your wandb run | -| `log_model` | Log all models if `log_model="all"` or at end of training if `log_model=True` | -| `save_dir` | Path where data is saved | - -## Log your hyperparameters - -{{< tabpane text=true >}} - -{{% tab header="PyTorch Logger" value="pytorch" %}} - -```python -class LitModule(LightningModule): - def __init__(self, *args, **kwarg): - self.save_hyperparameters() -``` - -{{% /tab %}} - -{{% tab header="Fabric Logger" value="fabric" %}} - -```python -wandb_logger.log_hyperparams( - { - "hyperparameter_1": hyperparameter_1, - "hyperparameter_2": hyperparameter_2, - } -) -``` - -{{% /tab %}} - -{{< /tabpane >}} - -## Log additional config parameters - -```python -# add one parameter -wandb_logger.experiment.config["key"] = value - -# add multiple parameters -wandb_logger.experiment.config.update({key1: val1, key2: val2}) - -# use directly wandb module -wandb.config["key"] = value -wandb.config.update() -``` - -## Log gradients, parameter histogram and model topology - -You can pass your model object to `wandblogger.watch()` to monitor your models's gradients and parameters as you train. See the PyTorch Lightning `WandbLogger` documentation - -## Log metrics - -{{< tabpane text=true >}} - -{{% tab header="PyTorch Logger" value="pytorch" %}} - -You can log your metrics to W&B when using the `WandbLogger` by calling `self.log('my_metric_name', metric_vale)` within your `LightningModule`, such as in your `training_step` or `validation_step methods.` - -The code snippet below shows how to define your `LightningModule` to log your metrics and your `LightningModule` hyperparameters. This example uses the [`torchmetrics`](https://github.com/PyTorchLightning/metrics) library to calculate your metrics - -```python -import torch -from torch.nn import Linear, CrossEntropyLoss, functional as F -from torch.optim import Adam -from torchmetrics.functional import accuracy -from lightning.pytorch import LightningModule - - -class My_LitModule(LightningModule): - def __init__(self, n_classes=10, n_layer_1=128, n_layer_2=256, lr=1e-3): - """method used to define the model parameters""" - super().__init__() - - # mnist images are (1, 28, 28) (channels, width, height) - self.layer_1 = Linear(28 * 28, n_layer_1) - self.layer_2 = Linear(n_layer_1, n_layer_2) - self.layer_3 = Linear(n_layer_2, n_classes) - - self.loss = CrossEntropyLoss() - self.lr = lr - - # save hyper-parameters to self.hparams (auto-logged by W&B) - self.save_hyperparameters() - - def forward(self, x): - """method used for inference input -> output""" - - # (b, 1, 28, 28) -> (b, 1*28*28) - batch_size, channels, width, height = x.size() - x = x.view(batch_size, -1) - - # let's do 3 x (linear + relu) - x = F.relu(self.layer_1(x)) - x = F.relu(self.layer_2(x)) - x = self.layer_3(x) - return x - - def training_step(self, batch, batch_idx): - """needs to return a loss from a single batch""" - _, loss, acc = self._get_preds_loss_accuracy(batch) - - # Log loss and metric - self.log("train_loss", loss) - self.log("train_accuracy", acc) - return loss - - def validation_step(self, batch, batch_idx): - """used for logging metrics""" - preds, loss, acc = self._get_preds_loss_accuracy(batch) - - # Log loss and metric - self.log("val_loss", loss) - self.log("val_accuracy", acc) - return preds - - def configure_optimizers(self): - """defines model optimizer""" - return Adam(self.parameters(), lr=self.lr) - - def _get_preds_loss_accuracy(self, batch): - """convenience function since train/valid/test steps are similar""" - x, y = batch - logits = self(x) - preds = torch.argmax(logits, dim=1) - loss = self.loss(logits, y) - acc = accuracy(preds, y) - return preds, loss, acc -``` - -{{% /tab %}} - -{{% tab header="Fabric Logger" value="fabric" %}} - -```python -import lightning as L -import torch -import torchvision as tv -from wandb.integration.lightning.fabric import WandbLogger -import wandb - -fabric = L.Fabric(loggers=[wandb_logger]) -fabric.launch() - -model = tv.models.resnet18() -optimizer = torch.optim.SGD(model.parameters(), lr=lr) -model, optimizer = fabric.setup(model, optimizer) - -train_dataloader = fabric.setup_dataloaders( - torch.utils.data.DataLoader(train_dataset, batch_size=batch_size) -) - -model.train() -for epoch in range(num_epochs): - for batch in train_dataloader: - optimizer.zero_grad() - loss = model(batch) - loss.backward() - optimizer.step() - fabric.log_dict({"loss": loss}) -``` - -{{% /tab %}} - -{{< /tabpane >}} - -## Log the min/max of a metric - -Using wandb's [`define_metric`]({{< relref "/ref/python/experiments/run.md#define_metric" >}}) function you can define whether you'd like your W&B summary metric to display the min, max, mean or best value for that metric. If `define`_`metric` _ isn't used, then the last value logged with appear in your summary metrics. See the `define_metric` [reference docs here]({{< relref "/ref/python/experiments/run.md#define_metric" >}}) and the [guide here]({{< relref "/guides/models/track/log/customize-logging-axes" >}}) for more. - -To tell W&B to keep track of the max validation accuracy in the W&B summary metric, call `wandb.define_metric` only once, at the beginning of training: - -{{< tabpane text=true >}} -{{% tab header="PyTorch Logger" value="pytorch" %}} - -```python -class My_LitModule(LightningModule): - ... - - def validation_step(self, batch, batch_idx): - if trainer.global_step == 0: - wandb.define_metric("val_accuracy", summary="max") - - preds, loss, acc = self._get_preds_loss_accuracy(batch) - - # Log loss and metric - self.log("val_loss", loss) - self.log("val_accuracy", acc) - return preds -``` - -{{% /tab %}} -{{% tab header="Fabric Logger" value="fabric" %}} - -```python -wandb.define_metric("val_accuracy", summary="max") -fabric = L.Fabric(loggers=[wandb_logger]) -fabric.launch() -fabric.log_dict({"val_accuracy": val_accuracy}) -``` - -{{% /tab %}} -{{< /tabpane >}} - -## Checkpoint a model - -To save model checkpoints as W&B [Artifacts]({{< relref "/guides/core/artifacts/" >}}), -use the Lightning [`ModelCheckpoint`](https://pytorch-lightning.readthedocs.io/en/stable/api/pytorch_lightning.callbacks.ModelCheckpoint.html#pytorch_lightning.callbacks.ModelCheckpoint) callback and set the `log_model` argument in the `WandbLogger`. - -{{< tabpane text=true >}} - -{{% tab header="PyTorch Logger" value="pytorch" %}} - -```python -trainer = Trainer(logger=wandb_logger, callbacks=[checkpoint_callback]) -``` - -{{% /tab %}} - -{{% tab header="Fabric Logger" value="fabric" %}} - -```python -fabric = L.Fabric(loggers=[wandb_logger], callbacks=[checkpoint_callback]) -``` - -{{% /tab %}} - -{{< /tabpane >}} - -The _latest_ and _best_ aliases are automatically set to easily retrieve a model checkpoint from a W&B [Artifact]({{< relref "/guides/core/artifacts/" >}}): - -```python -# reference can be retrieved in artifacts panel -# "VERSION" can be a version (ex: "v2") or an alias ("latest or "best") -checkpoint_reference = "USER/PROJECT/MODEL-RUN_ID:VERSION" -``` - -{{< tabpane text=true >}} -{{% tab header="Via Logger" value="logger" %}} - -```python -# download checkpoint locally (if not already cached) -wandb_logger.download_artifact(checkpoint_reference, artifact_type="model") -``` - -{{% /tab %}} - -{{% tab header="Via wandb" value="wandb" %}} - -```python -# download checkpoint locally (if not already cached) -run = wandb.init(project="MNIST") -artifact = run.use_artifact(checkpoint_reference, type="model") -artifact_dir = artifact.download() -``` - -{{% /tab %}} -{{< /tabpane >}} - -{{< tabpane text=true >}} -{{% tab header="PyTorch Logger" value="pytorch" %}} - -```python -# load checkpoint -model = LitModule.load_from_checkpoint(Path(artifact_dir) / "model.ckpt") -``` - -{{% /tab %}} - -{{% tab header="Fabric Logger" value="fabric" %}} - -```python -# Request the raw checkpoint -full_checkpoint = fabric.load(Path(artifact_dir) / "model.ckpt") - -model.load_state_dict(full_checkpoint["model"]) -optimizer.load_state_dict(full_checkpoint["optimizer"]) -``` - -{{% /tab %}} -{{< /tabpane >}} - -The model checkpoints you log are viewable through the [W&B Artifacts]({{< relref "/guides/core/artifacts" >}}) UI, and include the full model lineage (see an example model checkpoint in the UI [here](https://wandb.ai/wandb/arttest/artifacts/model/iv3_trained/5334ab69740f9dda4fed/lineage?_gl=1*yyql5q*_ga*MTQxOTYyNzExOS4xNjg0NDYyNzk1*_ga_JH1SJHJQXJ*MTY5MjMwNzI2Mi4yNjkuMS4xNjkyMzA5NjM2LjM3LjAuMA..)). - -To bookmark your best model checkpoints and centralize them across your team, you can link them to the [W&B Model Registry]({{< relref "/guides/models" >}}). - -Here you can organize your best models by task, manage model lifecycle, facilitate easy tracking and auditing throughout the ML lifecyle, and [automate]({{< relref "/guides/core/automations/" >}}) downstream actions with webhooks or jobs. - -## Log images, text, and more - -The `WandbLogger` has `log_image`, `log_text` and `log_table` methods for logging media. - -You can also directly call `wandb.log` or `trainer.logger.experiment.log` to log other media types such as Audio, Molecules, Point Clouds, 3D Objects and more. - -{{< tabpane text=true >}} - -{{% tab header="Log Images" value="images" %}} - -```python -# using tensors, numpy arrays or PIL images -wandb_logger.log_image(key="samples", images=[img1, img2]) - -# adding captions -wandb_logger.log_image(key="samples", images=[img1, img2], caption=["tree", "person"]) - -# using file path -wandb_logger.log_image(key="samples", images=["img_1.jpg", "img_2.jpg"]) - -# using .log in the trainer -trainer.logger.experiment.log( - {"samples": [wandb.Image(img, caption=caption) for (img, caption) in my_images]}, - step=current_trainer_global_step, -) -``` - -{{% /tab %}} - -{{% tab header="Log Text" value="text" %}} - -```python -# data should be a list of lists -columns = ["input", "label", "prediction"] -my_data = [["cheese", "english", "english"], ["fromage", "french", "spanish"]] - -# using columns and data -wandb_logger.log_text(key="my_samples", columns=columns, data=my_data) - -# using a pandas DataFrame -wandb_logger.log_text(key="my_samples", dataframe=my_dataframe) -``` - -{{% /tab %}} - -{{% tab header="Log Tables" value="tables" %}} - -```python -# log a W&B Table that has a text caption, an image and audio -columns = ["caption", "image", "sound"] - -# data should be a list of lists -my_data = [ - ["cheese", wandb.Image(img_1), wandb.Audio(snd_1)], - ["wine", wandb.Image(img_2), wandb.Audio(snd_2)], -] - -# log the Table -wandb_logger.log_table(key="my_samples", columns=columns, data=data) -``` - -{{% /tab %}} - -{{< /tabpane >}} - -You can use Lightning's Callbacks system to control when you log to W&B via the `WandbLogger`, in this example we log a sample of our validation images and predictions: - - -```python -import torch -import wandb -import lightning.pytorch as pl -from lightning.pytorch.loggers import WandbLogger - -# or -# from wandb.integration.lightning.fabric import WandbLogger - - -class LogPredictionSamplesCallback(Callback): - def on_validation_batch_end( - self, trainer, pl_module, outputs, batch, batch_idx, dataloader_idx - ): - """Called when the validation batch ends.""" - - # `outputs` comes from `LightningModule.validation_step` - # which corresponds to our model predictions in this case - - # Let's log 20 sample image predictions from the first batch - if batch_idx == 0: - n = 20 - x, y = batch - images = [img for img in x[:n]] - captions = [ - f"Ground Truth: {y_i} - Prediction: {y_pred}" - for y_i, y_pred in zip(y[:n], outputs[:n]) - ] - - # Option 1: log images with `WandbLogger.log_image` - wandb_logger.log_image(key="sample_images", images=images, caption=captions) - - # Option 2: log images and predictions as a W&B Table - columns = ["image", "ground truth", "prediction"] - data = [ - [wandb.Image(x_i), y_i, y_pred] or x_i, - y_i, - y_pred in list(zip(x[:n], y[:n], outputs[:n])), - ] - wandb_logger.log_table(key="sample_table", columns=columns, data=data) - - -trainer = pl.Trainer(callbacks=[LogPredictionSamplesCallback()]) -``` - -## Use multiple GPUs with Lightning and W&B - -PyTorch Lightning has Multi-GPU support through their DDP Interface. However, PyTorch Lightning's design requires you to be careful about how you instantiate our GPUs. - -Lightning assumes that each GPU (or Rank) in your training loop must be instantiated in exactly the same way - with the same initial conditions. However, only rank 0 process gets access to the `wandb.run` object, and for non-zero rank processes: `wandb.run = None`. This could cause your non-zero processes to fail. Such a situation can put you in a **deadlock** because rank 0 process will wait for the non-zero rank processes to join, which have already crashed. - -For this reason, be careful about how we set up your training code. The recommended way to set it up would be to have your code be independent of the `wandb.run` object. - -```python -class MNISTClassifier(pl.LightningModule): - def __init__(self): - super(MNISTClassifier, self).__init__() - - self.model = nn.Sequential( - nn.Flatten(), - nn.Linear(28 * 28, 128), - nn.ReLU(), - nn.Linear(128, 10), - ) - - self.loss = nn.CrossEntropyLoss() - - def forward(self, x): - return self.model(x) - - def training_step(self, batch, batch_idx): - x, y = batch - y_hat = self.forward(x) - loss = self.loss(y_hat, y) - - self.log("train/loss", loss) - return {"train_loss": loss} - - def validation_step(self, batch, batch_idx): - x, y = batch - y_hat = self.forward(x) - loss = self.loss(y_hat, y) - - self.log("val/loss", loss) - return {"val_loss": loss} - - def configure_optimizers(self): - return torch.optim.Adam(self.parameters(), lr=0.001) - - -def main(): - # Setting all the random seeds to the same value. - # This is important in a distributed training setting. - # Each rank will get its own set of initial weights. - # If they don't match up, the gradients will not match either, - # leading to training that may not converge. - pl.seed_everything(1) - - train_loader = DataLoader(train_dataset, batch_size=64, shuffle=True, num_workers=4) - val_loader = DataLoader(val_dataset, batch_size=64, shuffle=False, num_workers=4) - - model = MNISTClassifier() - wandb_logger = WandbLogger(project="") - callbacks = [ - ModelCheckpoint( - dirpath="checkpoints", - every_n_train_steps=100, - ), - ] - trainer = pl.Trainer( - max_epochs=3, gpus=2, logger=wandb_logger, strategy="ddp", callbacks=callbacks - ) - trainer.fit(model, train_loader, val_loader) -``` - - - -## Examples - -You can follow along in a [video tutorial with a Colab notebook](https://wandb.me/lit-colab). - -## Frequently Asked Questions - -### How does W&B integrate with Lightning? - -The core integration is based on the [Lightning `loggers` API](https://pytorch-lightning.readthedocs.io/en/stable/extensions/logging.html), which lets you write much of your logging code in a framework-agnostic way. `Logger`s are passed to the [Lightning `Trainer`](https://pytorch-lightning.readthedocs.io/en/stable/common/trainer.html) and are triggered based on that API's rich [hook-and-callback system](https://pytorch-lightning.readthedocs.io/en/stable/extensions/callbacks.html). This keeps your research code well-separated from engineering and logging code. - -### What does the integration log without any additional code? - -We'll save your model checkpoints to W&B, where you can view them or download them for use in future runs. We'll also capture [system metrics]({{< relref "/ref/python/experiments/system-metrics.md" >}}), like GPU usage and network I/O, environment information, like hardware and OS information, [code state]({{< relref "/guides/models/app/features/panels/code.md" >}}) (including git commit and diff patch, notebook contents and session history), and anything printed to the standard out. - -### What if I need to use `wandb.run` in my training setup? - -You need to expand the scope of the variable you need to access yourself. In other words, make sure that the initial conditions are the same on all processes. - -```python -if os.environ.get("LOCAL_RANK", None) is None: - os.environ["WANDB_DIR"] = wandb.run.dir -``` - -If they are, you can use `os.environ["WANDB_DIR"]` to set up the model checkpoints directory. This way, any non-zero rank process can access `wandb.run.dir`. \ No newline at end of file diff --git a/content/en/guides/integrations/metaflow.md b/content/en/guides/integrations/metaflow.md deleted file mode 100644 index b8b56042de..0000000000 --- a/content/en/guides/integrations/metaflow.md +++ /dev/null @@ -1,218 +0,0 @@ ---- -description: How to integrate W&B with Metaflow. -menu: - default: - identifier: metaflow - parent: integrations -title: Metaflow -weight: 200 ---- -## Overview - -[Metaflow](https://docs.metaflow.org) is a framework created by [Netflix](https://netflixtechblog.com) for creating and running ML workflows. - -This integration lets users apply decorators to Metaflow [steps and flows](https://docs.metaflow.org/metaflow/basics) to automatically log parameters and artifacts to W&B. - -* Decorating a step will turn logging off or on for certain types within that step. -* Decorating the flow will turn logging off or on for every step in the flow. - -## Quickstart - -### Sign up and create an API key - -An API key authenticates your machine to W&B. You can generate an API key from your user profile. - -{{% alert %}} -For a more streamlined approach, you can generate an API key by going directly to the [W&B authorization page](https://wandb.ai/authorize). Copy the displayed API key and save it in a secure location such as a password manager. -{{% /alert %}} - -1. Click your user profile icon in the upper right corner. -1. Select **User Settings**, then scroll to the **API Keys** section. -1. Click **Reveal**. Copy the displayed API key. To hide the API key, reload the page. - -### Install the `wandb` library and log in - -To install the `wandb` library locally and log in: - -{{% alert %}} -For `wandb` version 0.19.8 or below, install `fastcore` version 1.8.0 or below (`fastcore<1.8.0`) instead of `plum-dispatch`. -{{% /alert %}} - - -{{< tabpane text=true >}} -{{% tab header="Command Line" value="cli" %}} - -1. Set the `WANDB_API_KEY` [environment variable]({{< relref "/guides/models/track/environment-variables.md" >}}) to your API key. - - ```bash - export WANDB_API_KEY= - ``` - -1. Install the `wandb` library and log in. - - - - ```shell - pip install -Uqqq metaflow "plum-dispatch<3.0.0" wandb - - wandb login - ``` - -{{% /tab %}} - -{{% tab header="Python" value="python" %}} - -```bash -pip install -Uqqq metaflow "plum-dispatch<3.0.0" wandb -``` -```python -import wandb -wandb.login() -``` - -{{% /tab %}} - -{{% tab header="Python notebook" value="notebook" %}} - -```notebook -!pip install -Uqqq metaflow "plum-dispatch<3.0.0" wandb - -import wandb -wandb.login() -``` - -{{% /tab %}} -{{< /tabpane >}} - -### Decorate your flows and steps - -{{< tabpane text=true >}} -{{% tab header="Step" value="step" %}} - -Decorating a step turns logging off or on for certain types within that step. - -In this example, all datasets and models in `start` will be logged - -```python -from wandb.integration.metaflow import wandb_log - -class WandbExampleFlow(FlowSpec): - @wandb_log(datasets=True, models=True, settings=wandb.Settings(...)) - @step - def start(self): - self.raw_df = pd.read_csv(...). # pd.DataFrame -> upload as dataset - self.model_file = torch.load(...) # nn.Module -> upload as model - self.next(self.transform) -``` -{{% /tab %}} - -{{% tab header="Flow" value="flow" %}} - -Decorating a flow is equivalent to decorating all the constituent steps with a default. - -In this case, all steps in `WandbExampleFlow` default to logging datasets and models by default, just like decorating each step with `@wandb_log(datasets=True, models=True)` - -```python -from wandb.integration.metaflow import wandb_log - -@wandb_log(datasets=True, models=True) # decorate all @step -class WandbExampleFlow(FlowSpec): - @step - def start(self): - self.raw_df = pd.read_csv(...). # pd.DataFrame -> upload as dataset - self.model_file = torch.load(...) # nn.Module -> upload as model - self.next(self.transform) -``` -{{% /tab %}} - -{{% tab header="Flow and Steps" value="flow_and_steps" %}} - -Decorating the flow is equivalent to decorating all steps with a default. That means if you later decorate a Step with another `@wandb_log`, it overrides the flow-level decoration. - -In this example: - -* `start` and `mid` log both datasets and models. -* `end` logs neither datasets nor models. - -```python -from wandb.integration.metaflow import wandb_log - -@wandb_log(datasets=True, models=True) # same as decorating start and mid -class WandbExampleFlow(FlowSpec): - # this step will log datasets and models - @step - def start(self): - self.raw_df = pd.read_csv(...). # pd.DataFrame -> upload as dataset - self.model_file = torch.load(...) # nn.Module -> upload as model - self.next(self.mid) - - # this step will also log datasets and models - @step - def mid(self): - self.raw_df = pd.read_csv(...). # pd.DataFrame -> upload as dataset - self.model_file = torch.load(...) # nn.Module -> upload as model - self.next(self.end) - - # this step is overwritten and will NOT log datasets OR models - @wandb_log(datasets=False, models=False) - @step - def end(self): - self.raw_df = pd.read_csv(...). - self.model_file = torch.load(...) -``` -{{% /tab %}} -{{< /tabpane >}} - -## Access your data programmatically - -You can access the information we've captured in three ways: inside the original Python process being logged using the [`wandb` client library]({{< relref "/ref/python/" >}}), with the [web app UI]({{< relref "/guides/models/track/workspaces.md" >}}), or programmatically using [our Public API]({{< relref "/ref/python/public-api/" >}}). `Parameter`s are saved to W&B's [`config`]({{< relref "/guides/models/track/config.md" >}}) and can be found in the [Overview tab]({{< relref "/guides/models/track/runs/#overview-tab" >}}). `datasets`, `models`, and `others` are saved to [W&B Artifacts]({{< relref "/guides/core/artifacts/" >}}) and can be found in the [Artifacts tab]({{< relref "/guides/models/track/runs/#artifacts-tab" >}}). Base python types are saved to W&B's [`summary`]({{< relref "/guides/models/track/log/" >}}) dict and can be found in the Overview tab. See our [guide to the Public API]({{< relref "/guides/models/track/public-api-guide.md" >}}) for details on using the API to get this information programmatically from outside . - -### Quick reference - -| Data | Client library | UI | -| ----------------------------------------------- | ----------------------------------------- | --------------------- | -| `Parameter(...)` | `wandb.Run.config` | Overview tab, Config | -| `datasets`, `models`, `others` | `wandb.Run.use_artifact("{var_name}:latest")` | Artifacts tab | -| Base Python types (`dict`, `list`, `str`, etc.) | `wandb.Run.summary` | Overview tab, Summary | - -### `wandb_log` kwargs - -| kwarg | Options | -| ---------- | ------------------------------------------------------------------------------- | -| `datasets` |
  • True: Log instance variables that are a dataset
  • False
| -| `models` |
  • True: Log instance variables that are a model
  • False
| -| `others` |
  • True: Log anything else that is serializable as a pickle
  • False
| -| `settings` |
  • wandb.Settings(...): Specify your own wandb settings for this step or flow
  • None: Equivalent to passing wandb.Settings()

By default, if:

  • settings.run_group is None, it will be set to \{flow_name\}/\{run_id\}
  • settings.run_job_type is None, it will be set to \{run_job_type\}/\{step_name\}
| - -## Frequently Asked Questions - -### What exactly do you log? Do you log all instance and local variables? - -`wandb_log` only logs instance variables. Local variables are NEVER logged. This is useful to avoid logging unnecessary data. - -### Which data types get logged? - -We currently support these types: - -| Logging Setting | Type | -| ------------------- | --------------------------------------------------------------------------------------------------------------------------- | -| default (always on) |
  • dict, list, set, str, int, float, bool
| -| `datasets` |
  • pd.DataFrame
  • pathlib.Path
| -| `models` |
  • nn.Module
  • sklearn.base.BaseEstimator
| -| `others` | | - -### How can I configure logging behavior? - -| Kind of Variable | behavior | Example | Data Type | -| ---------------- | ------------------------------ | --------------- | -------------- | -| Instance | Auto-logged | `self.accuracy` | `float` | -| Instance | Logged if `datasets=True` | `self.df` | `pd.DataFrame` | -| Instance | Not logged if `datasets=False` | `self.df` | `pd.DataFrame` | -| Local | Never logged | `accuracy` | `float` | -| Local | Never logged | `df` | `pd.DataFrame` | - -### Is artifact lineage tracked? - -Yes. If you have an artifact that is an output of step A and an input to step B, we automatically construct the lineage DAG for you. - -For an example of this behavior, please see this[ notebook](https://colab.research.google.com/drive/1wZG-jYzPelk8Rs2gIM3a71uEoG46u_nG#scrollTo=DQQVaKS0TmDU) and its corresponding [W&B Artifacts page](https://wandb.ai/megatruong/metaflow_integration/artifacts/dataset/raw_df/7d14e6578d3f1cfc72fe/graph) \ No newline at end of file diff --git a/content/en/guides/integrations/mmengine.md b/content/en/guides/integrations/mmengine.md deleted file mode 100644 index 5116f6864e..0000000000 --- a/content/en/guides/integrations/mmengine.md +++ /dev/null @@ -1,125 +0,0 @@ ---- -menu: - default: - identifier: mmengine - parent: integrations -title: MMEngine -weight: 210 ---- -MMEngine by [OpenMMLab](https://github.com/open-mmlab) is a foundational library for training deep learning models based on PyTorch. MMEngine implements a next-generation training architecture for the OpenMMLab algorithm library, providing a unified execution foundation for over 30 algorithm libraries within OpenMMLab. Its core components include the training engine, evaluation engine, and module management. - -[W&B](https://wandb.ai/site) is directly integrated into MMEngine through a dedicated [`WandbVisBackend`](https://mmengine.readthedocs.io/en/latest/api/generated/mmengine.visualization.WandbVisBackend.html#mmengine.visualization.WandbVisBackend) that can be used to -- log training and evaluation metrics. -- log and manage experiment configs. -- log additional records such as graph, images, scalars, etc. - -## Get started - -Install `openmim` and `wandb`. - -{{< tabpane text=true >}} -{{% tab header="Command Line" value="script" %}} - -``` bash -pip install -q -U openmim wandb -``` - -{{% /tab %}} - -{{% tab header="Notebook" value="notebook" %}} - -``` bash -!pip install -q -U openmim wandb -``` - -{{% /tab %}} -{{< /tabpane >}} - -Next, install `mmengine` and `mmcv` using `mim`. - -{{< tabpane text=true >}} -{{% tab header="Command Line" value="script" %}} - -``` bash -mim install -q mmengine mmcv -``` - -{{% /tab %}} - -{{% tab header="Notebook" value="notebook" %}} - -``` bash -!mim install -q mmengine mmcv -``` - -{{% /tab %}} -{{< /tabpane >}} - -## Use the `WandbVisBackend` with MMEngine Runner - -This section demonstrates a typical workflow using `WandbVisBackend` using [`mmengine.runner.Runner`](https://mmengine.readthedocs.io/en/latest/api/generated/mmengine.runner.Runner.html#mmengine.runner.Runner). - -1. Define a `visualizer` from a visualization config. - - ```python - from mmengine.visualization import Visualizer - - # define the visualization configs - visualization_cfg = dict( - name="wandb_visualizer", - vis_backends=[ - dict( - type='WandbVisBackend', - init_kwargs=dict(project="mmengine"), - ) - ], - save_dir="runs/wandb" - ) - - # get the visualizer from the visualization configs - visualizer = Visualizer.get_instance(**visualization_cfg) - ``` - - {{% alert %}} - You pass a dictionary of arguments for [W&B run initialization]({{< relref "/ref/python/functions/init.md" >}}) input parameters to `init_kwargs`. - {{% /alert %}} - -2. Initialize a `runner` with the `visualizer`, and call `runner.train()`. - - ```python - from mmengine.runner import Runner - - # build the mmengine Runner which is a training helper for PyTorch - runner = Runner( - model, - work_dir='runs/gan/', - train_dataloader=train_dataloader, - train_cfg=train_cfg, - optim_wrapper=opt_wrapper_dict, - visualizer=visualizer, # pass the visualizer - ) - - # start training - runner.train() - ``` - -## Use the `WandbVisBackend` with OpenMMLab computer vision libraries - -The `WandbVisBackend` can also be used easily to track experiments with OpenMMLab computer vision libraries such as [MMDetection](https://mmdetection.readthedocs.io/). - -```python -# inherit base configs from the default runtime configs -_base_ = ["../_base_/default_runtime.py"] - -# Assign the `WandbVisBackend` config dictionary to the -# `vis_backends` of the `visualizer` from the base configs -_base_.visualizer.vis_backends = [ - dict( - type='WandbVisBackend', - init_kwargs={ - 'project': 'mmdet', - 'entity': 'geekyrakshit' - }, - ), -] -``` \ No newline at end of file diff --git a/content/en/guides/integrations/mmf.md b/content/en/guides/integrations/mmf.md deleted file mode 100644 index a397f25f3d..0000000000 --- a/content/en/guides/integrations/mmf.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -description: How to integrate W&B with Meta AI's MMF. -menu: - default: - identifier: mmf - parent: integrations -title: MMF -weight: 220 ---- - -The `WandbLogger` class in [Meta AI's MMF](https://github.com/facebookresearch/mmf) library will enable W&B to log the training/validation metrics, system (GPU and CPU) metrics, model checkpoints and configuration parameters. - -## Current features - -The following features are currently supported by the `WandbLogger` in MMF: - -* Training & Validation metrics -* Learning Rate over time -* Model Checkpoint saving to W&B Artifacts -* GPU and CPU system metrics -* Training configuration parameters - -## Config parameters - -The following options are available in MMF config to enable and customize the wandb logging: - -``` -training: - wandb: - enabled: true - - # An entity is a username or team name where you're sending runs. - # By default it will log the run to your user account. - entity: null - - # Project name to be used while logging the experiment with wandb - project: mmf - - # Experiment/ run name to be used while logging the experiment - # under the project with wandb. The default experiment name - # is: ${training.experiment_name} - name: ${training.experiment_name} - - # Turn on model checkpointing, saving checkpoints to W&B Artifacts - log_model_checkpoint: true - - # Additional argument values that you want to pass to wandb.init() such as: - # job_type: 'train' - # tags: ['tag1', 'tag2'] - -env: - # To change the path to the directory where wandb metadata would be - # stored (Default: env.log_dir): - wandb_logdir: ${env:MMF_WANDB_LOGDIR,} -``` \ No newline at end of file diff --git a/content/en/guides/integrations/openai-api.md b/content/en/guides/integrations/openai-api.md deleted file mode 100644 index 5fef255010..0000000000 --- a/content/en/guides/integrations/openai-api.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -description: How to use W&B with the OpenAI API. -menu: - default: - identifier: openai-api - parent: integrations -title: OpenAI API -weight: 240 ---- -{{< cta-button colabLink="https://github.com/wandb/examples/blob/master/colabs/openai/OpenAI_API_Autologger_Quickstart.ipynb" >}} - -Use the W&B OpenAI API integration to log requests, responses, token counts and model metadata for all OpenAI models, including fine-tuned models. - - -{{% alert %}} -See the [OpenAI fine-tuning integration]({{< relref "./openai-fine-tuning.md" >}}) to learn how to use W&B to track your fine-tuning experiments, models, and datasets and share your results with your colleagues. -{{% /alert %}} - -Log your API inputs and outputs you can quickly evaluate the performance of difference prompts, compare different model settings (such as temperature), and track other usage metrics such as token usage. - - - - -{{< img src="/images/integrations/open_ai_autolog.png" alt="OpenAI API automatic logging" >}} - - -## Install OpenAI Python API library - -The W&B autolog integration works with OpenAI version 0.28.1 and below. - -To install OpenAI Python API version 0.28.1, run: -```python -pip install openai==0.28.1 -``` - -## Use the OpenAI Python API - -### 1. Import autolog and initialise it -First, import `autolog` from `wandb.integration.openai` and initialise it. - -```python -import os -import openai -from wandb.integration.openai import autolog - -autolog({"project": "gpt5"}) -``` - -You can optionally pass a dictionary with argument that `wandb.init()` accepts to `autolog`. This includes a project name, team name, entity, and more. For more information about [`wandb.init()`]({{< relref "/ref/python/functions/init.md" >}}), see the API Reference Guide. - -### 2. Call the OpenAI API -Each call you make to the OpenAI API is now logged to W&B automatically. - -```python -os.environ["OPENAI_API_KEY"] = "XXX" - -chat_request_kwargs = dict( - model="gpt-3.5-turbo", - messages=[ - {"role": "system", "content": "You are a helpful assistant."}, - {"role": "user", "content": "Who won the world series in 2020?"}, - {"role": "assistant", "content": "The Los Angeles Dodgers"}, - {"role": "user", "content": "Where was it played?"}, - ], -) -response = openai.ChatCompletion.create(**chat_request_kwargs) -``` - -### 3. View your OpenAI API inputs and responses - -Click on the W&B [run]({{< relref "/guides/models/track/runs/" >}}) link generated by `autolog` in **step 1**. This redirects you to your project workspace in the W&B App. - -Select a run you created to view the trace table, trace timeline and the model architecture of the OpenAI LLM used. - -## Turn off autolog -W&B recommends that you call `disable()` to close all W&B processes when you are finished using the OpenAI API. - -```python -autolog.disable() -``` - -Now your inputs and completions will be logged to W&B, ready for analysis or to be shared with colleagues. \ No newline at end of file diff --git a/content/en/guides/integrations/openai-fine-tuning.md b/content/en/guides/integrations/openai-fine-tuning.md deleted file mode 100644 index 0cab4ce77e..0000000000 --- a/content/en/guides/integrations/openai-fine-tuning.md +++ /dev/null @@ -1,176 +0,0 @@ ---- -description: How to Fine-Tune OpenAI models using W&B. -menu: - default: - identifier: openai-fine-tuning - parent: integrations -title: OpenAI Fine-Tuning -weight: 250 ---- -{{< cta-button colabLink="https://wandb.me/openai-colab" >}} - -Log your OpenAI GPT-3.5 or GPT-4 model's fine-tuning metrics and configuration to W&B. Utilize the W&B ecosystem to track your fine-tuning experiments, models, and datasets and share your results with your colleagues. - -{{% alert %}} -See the [OpenAI documentation](https://platform.openai.com/docs/guides/fine-tuning/which-models-can-be-fine-tuned) for a list of models that you can fine tune. -{{% /alert %}} - -See the [W&B Integration](https://platform.openai.com/docs/guides/fine-tuning/weights-and-biases-integration) section in the OpenAI documentation for supplemental information on how to integrate W&B with OpenAI for fine-tuning. - - -## Install or update OpenAI Python API - -The W&B OpenAI fine-tuning integration works with OpenAI version 1.0 and above. See the PyPI documentation for the latest version of the [OpenAI Python API](https://pypi.org/project/openai/) library. - - -To install OpenAI Python API, run: -```python -pip install openai -``` - -If you already have OpenAI Python API installed, you can update it with: -```python -pip install -U openai -``` - - -## Sync your OpenAI fine-tuning results - -Integrate W&B with OpenAI's fine-tuning API to log your fine-tuning metrics and configuration to W&B. To do this, use the `WandbLogger` class from the `wandb.integration.openai.fine_tuning` module. - - -```python -from wandb.integration.openai.fine_tuning import WandbLogger - -# Finetuning logic - -WandbLogger.sync(fine_tune_job_id=FINETUNE_JOB_ID) -``` - -{{< img src="/images/integrations/open_ai_auto_scan.png" alt="OpenAI auto-scan feature" >}} - -### Sync your fine-tunes - -Sync your results from your script - - -```python -from wandb.integration.openai.fine_tuning import WandbLogger - -# one line command -WandbLogger.sync() - -# passing optional parameters -WandbLogger.sync( - fine_tune_job_id=None, - num_fine_tunes=None, - project="OpenAI-Fine-Tune", - entity=None, - overwrite=False, - model_artifact_name="model-metadata", - model_artifact_type="model", - **kwargs_wandb_init -) -``` - -### Reference - -| Argument | Description | -| ------------------------ | ------------------------------------------------------------------------------------------------------------------------- | -| fine_tune_job_id | This is the OpenAI Fine-Tune ID which you get when you create your fine-tune job using `client.fine_tuning.jobs.create`. If this argument is None (default), all the OpenAI fine-tune jobs that haven't already been synced will be synced to W&B. | -| openai_client | Pass an initialized OpenAI client to `sync`. If no client is provided, one is initialized by the logger itself. By default it is None. | -| num_fine_tunes | If no ID is provided, then all the unsynced fine-tunes will be logged to W&B. This argument allows you to select the number of recent fine-tunes to sync. If num_fine_tunes is 5, it selects the 5 most recent fine-tunes. | -| project | W&B project name where your fine-tune metrics, models, data, etc. will be logged. By default, the project name is "OpenAI-Fine-Tune." | -| entity | W&B Username or team name where you're sending runs. By default, your default entity is used, which is usually your username. | -| overwrite | Forces logging and overwrite existing wandb run of the same fine-tune job. By default this is False. | -| wait_for_job_success | Once an OpenAI fine-tuning job is started it usually takes a bit of time. To ensure that your metrics are logged to W&B as soon as the fine-tune job is finished, this setting will check every 60 seconds for the status of the fine-tune job to change to `succeeded`. Once the fine-tune job is detected as being successful, the metrics will be synced automatically to W&B. Set to True by default. | -| model_artifact_name | The name of the model artifact that is logged. Defaults to `"model-metadata"`. | -| model_artifact_type | The type of the model artifact that is logged. Defaults to `"model"`. | -| \*\*kwargs_wandb_init | Aany additional argument passed directly to [`wandb.init()`]({{< relref "/ref/python/functions/init.md" >}}) | - -## Dataset Versioning and Visualization - -### Versioning - -The training and validation data that you upload to OpenAI for fine-tuning are automatically logged as W&B Artifacts for easier version control. Below is an view of the training file in Artifacts. Here you can see the W&B run that logged this file, when it was logged, what version of the dataset this is, the metadata, and DAG lineage from the training data to the trained model. - -{{< img src="/images/integrations/openai_data_artifacts.png" alt="W&B Artifacts with training datasets" >}} - -### Visualization - -The datasets are visualized as W&B Tables, which allows you to explore, search, and interact with the dataset. Check out the training samples visualized using W&B Tables below. - -{{< img src="/images/integrations/openai_data_visualization.png" alt="OpenAI data" >}} - - -## The fine-tuned model and model versioning - -OpenAI gives you an id of the fine-tuned model. Since we don't have access to the model weights, the `WandbLogger` creates a `model_metadata.json` file with all the details (hyperparameters, data file ids, etc.) of the model along with the `fine_tuned_model`` id and is logged as a W&B Artifact. - -This model (metadata) artifact can further be linked to a model in the [W&B Registry]({{< relref "/guides/core/registry/" >}}). - -{{< img src="/images/integrations/openai_model_metadata.png" alt="OpenAI model metadata" >}} - - -## Frequently Asked Questions - -### How do I share my fine-tune results with my team in W&B? - -Log your fine-tune jobs to your team account with: - -```python -WandbLogger.sync(entity="YOUR_TEAM_NAME") -``` - -### How can I organize my runs? - -Your W&B runs are automatically organized and can be filtered/sorted based on any configuration parameter such as job type, base model, learning rate, training filename and any other hyper-parameter. - -In addition, you can rename your runs, add notes or create tags to group them. - -Once you’re satisfied, you can save your workspace and use it to create report, importing data from your runs and saved artifacts (training/validation files). - -### How can I access my fine-tuned model? - -Fine-tuned model ID is logged to W&B as artifacts (`model_metadata.json`) as well config. - -```python -import wandb - -with wandb.init(project="OpenAI-Fine-Tune", entity="YOUR_TEAM_NAME") as run: - ft_artifact = run.use_artifact("ENTITY/PROJECT/model_metadata:VERSION") - artifact_dir = ft_artifact.download() -``` - -where `VERSION` is either: - -* a version number such as `v2` -* the fine-tune id such as `ft-xxxxxxxxx` -* an alias added automatically such as `latest` or manually - -You can then access `fine_tuned_model` id by reading the downloaded `model_metadata.json` file. - -### What if a fine-tune was not synced successfully? - -If a fine-tune was not logged to W&B successfully, you can use the `overwrite=True` and pass the fine-tune job id: - -```python -WandbLogger.sync( - fine_tune_job_id="FINE_TUNE_JOB_ID", - overwrite=True, -) -``` - -### Can I track my datasets and models with W&B? - -The training and validation data are logged automatically to W&B as artifacts. The metadata including the ID for the fine-tuned model is also logged as artifacts. - -You can always control the pipeline using low level wandb APIs like `wandb.Artifact`, `wandb.Run.log`, etc. This will allow complete traceability of your data and models. - -{{< img src="/images/integrations/open_ai_faq_can_track.png" alt="OpenAI tracking FAQ" >}} - -## Resources - -* [OpenAI Fine-tuning Documentation](https://platform.openai.com/docs/guides/fine-tuning/) is very thorough and contains many useful tips -* [Demo Colab](https://wandb.me/openai-colab) -* [How to Fine-Tune Your OpenAI GPT-3.5 and GPT-4 Models with W&B](https://wandb.me/openai-report) report \ No newline at end of file diff --git a/content/en/guides/integrations/openai-gym.md b/content/en/guides/integrations/openai-gym.md deleted file mode 100644 index 650ccb263d..0000000000 --- a/content/en/guides/integrations/openai-gym.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -description: How to integrate W&B with OpenAI Gym. -menu: - default: - identifier: openai-gym - parent: integrations -title: OpenAI Gym -weight: 260 ---- - -{{% alert %}} -"The team that has been maintaining Gym since 2021 has moved all future development to [Gymnasium](https://github.com/Farama-Foundation/Gymnasium), a drop in replacement for Gym (import gymnasium as gym), and Gym will not be receiving any future updates." ([Source](https://github.com/openai/gym#the-team-that-has-been-maintaining-gym-since-2021-has-moved-all-future-development-to-gymnasium-a-drop-in-replacement-for-gym-import-gymnasium-as-gym-and-gym-will-not-be-receiving-any-future-updates-please-switch-over-to-gymnasium-as-soon-as-youre-able-to-do-so-if-youd-like-to-read-more-about-the-story-behind-this-switch-please-check-out-this-blog-post)) - -Since Gym is no longer an actively maintained project, try out our integration with Gymnasium. -{{% /alert %}} - -If you're using [OpenAI Gym](https://github.com/openai/gym), W&B automatically logs videos of your environment generated by `gym.wrappers.Monitor`. Just set the `monitor_gym` keyword argument to [`wandb.init`]({{< relref "/ref/python/functions/init.md" >}}) to `True` or call `wandb.gym.monitor()`. - -Our gym integration is very light. We simply [look at the name of the video file](https://github.com/wandb/wandb/blob/master/wandb/integration/gym/__init__.py#L15) being logged from `gym` and name it after that or fall back to `"videos"` if we don't find a match. If you want more control, you can always just manually [log a video]({{< relref "/guides/models/track/log/media.md" >}}). - -The [OpenRL Benchmark](https://wandb.me/openrl-benchmark-report) by[ CleanRL](https://github.com/vwxyzjn/cleanrl) uses this integration for its OpenAI Gym examples. You can find source code (including [the specific code used for specific runs](https://wandb.ai/cleanrl/cleanrl.benchmark/runs/2jrqfugg/code?workspace=user-costa-huang)) that demonstrates how to use gym with - -{{< img src="/images/integrations/open_ai_report_example.png" alt="OpenAI Gym dashboard" >}} \ No newline at end of file diff --git a/content/en/guides/integrations/paddledetection.md b/content/en/guides/integrations/paddledetection.md deleted file mode 100644 index 7ac2961f30..0000000000 --- a/content/en/guides/integrations/paddledetection.md +++ /dev/null @@ -1,120 +0,0 @@ ---- -description: How to integrate W&B with PaddleDetection. -menu: - default: - identifier: paddledetection - parent: integrations -title: PaddleDetection -weight: 270 ---- - -{{< cta-button colabLink="https://colab.research.google.com/drive/1ywdzcZKPmynih1GuGyCWB4Brf5Jj7xRY?usp=sharing" >}} - -[PaddleDetection](https://github.com/PaddlePaddle/PaddleDetection) is an end-to-end object-detection development kit based on [PaddlePaddle](https://github.com/PaddlePaddle/Paddle). It detects various mainstream objects, segments instances, and tracks and detects keypoints using configurable modules such as network components, data augmentations, and losses. - -PaddleDetection now includes a built-in W&B integration which logs all your training and validation metrics, as well as your model checkpoints and their corresponding metadata. - -The PaddleDetection `WandbLogger` logs your training and evaluation metrics to W&B as well as your model checkpoints while training. - -[Read a W&B blog post](https://wandb.ai/manan-goel/PaddleDetectionYOLOX/reports/Object-Detection-with-PaddleDetection-and-W-B--VmlldzoyMDU4MjY0) which illustrates how to integrate a YOLOX model with PaddleDetection on a subset of the `COCO2017` dataset. - -## Sign up and create an API key - -An API key authenticates your machine to W&B. You can generate an API key from your user profile. - -{{% alert %}} -For a more streamlined approach, you can generate an API key by going directly to the [W&B authorization page](https://wandb.ai/authorize). Copy the displayed API key and save it in a secure location such as a password manager. -{{% /alert %}} - -1. Click your user profile icon in the upper right corner. -1. Select **User Settings**, then scroll to the **API Keys** section. -1. Click **Reveal**. Copy the displayed API key. To hide the API key, reload the page. - -## Install the `wandb` library and log in - -To install the `wandb` library locally and log in: - -{{< tabpane text=true >}} -{{% tab header="Command Line" value="cli" %}} - -1. Set the `WANDB_API_KEY` [environment variable]({{< relref "/guides/models/track/environment-variables.md" >}}) to your API key. - - ```bash - export WANDB_API_KEY= - ``` - -1. Install the `wandb` library and log in. - - - - ```shell - pip install wandb - - wandb login - ``` - -{{% /tab %}} - -{{% tab header="Python" value="python" %}} - -```bash -pip install wandb -``` -```python -import wandb -wandb.login() -``` - -{{% /tab %}} - -{{% tab header="Python notebook" value="python" %}} - -```notebook -!pip install wandb - -import wandb -wandb.login() -``` - -{{% /tab %}} -{{< /tabpane >}} - -## Activate the `WandbLogger` in your training script - -{{< tabpane text=true >}} -{{% tab header="Command Line" value="cli" %}} -To use wandb via arguments to `train.py` in [PaddleDetection](https://github.com/PaddlePaddle/PaddleDetection/): - -* Add the `--use_wandb` flag -* The first wandb arguments must be preceded by `-o` (you only need to pass this once) -* Each individual argument must contain the prefix `"wandb-"` . For example any argument to be passed to [`wandb.init()`]({{< relref "/ref/python/functions/init.md" >}}) would get the `wandb-` prefix - -```shell -python tools/train.py - -c config.yml \ - --use_wandb \ - -o \ - wandb-project=MyDetector \ - wandb-entity=MyTeam \ - wandb-save_dir=./logs -``` -{{% /tab %}} -{{% tab header="`config.yml`" value="config" %}} -Add the wandb arguments to the config.yml file under the `wandb` key: - -``` -wandb: - project: MyProject - entity: MyTeam - save_dir: ./logs -``` - -When you run your `train.py` file, it generates a link to your W&B Dashboard. - -{{< img src="/images/integrations/paddledetection_wb_dashboard.png" alt="A W&B Dashboard" >}} -{{% /tab %}} -{{< /tabpane >}} - -## Feedback or issues - -If you have any feedback or issues about the W&B integration, open an issue on the [PaddleDetection GitHub](https://github.com/PaddlePaddle/PaddleDetection) or email support@wandb.com. \ No newline at end of file diff --git a/content/en/guides/integrations/paddleocr.md b/content/en/guides/integrations/paddleocr.md deleted file mode 100644 index d8653b5d72..0000000000 --- a/content/en/guides/integrations/paddleocr.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -description: How to integrate W&B with PaddleOCR. -menu: - default: - identifier: paddleocr - parent: integrations -title: PaddleOCR -weight: 280 ---- -[PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR) aims to create multilingual, awesome, leading, and practical OCR tools that help users train better models and apply them into practice implemented in PaddlePaddle. PaddleOCR support a variety of cutting-edge algorithms related to OCR, and developed industrial solution. PaddleOCR now comes with a W&B integration for logging training and evaluation metrics along with model checkpoints with corresponding metadata. - -## Example Blog & Colab - -[Read here](https://wandb.ai/manan-goel/text_detection/reports/Train-and-Debug-Your-OCR-Models-with-PaddleOCR-and-W-B--VmlldzoyMDUwMDIw) to see how to train a model with PaddleOCR on the ICDAR2015 dataset. This also comes with a [Google Colab](https://colab.research.google.com/drive/1id2VTIQ5-M1TElAkzjzobUCdGeJeW-nV?usp=sharing) and the corresponding live W&B dashboard is available [here](https://wandb.ai/manan-goel/text_detection). There is also a Chinese version of this blog here: [W&B对您的OCR模型进行训练和调试](https://wandb.ai/wandb_fc/chinese/reports/W-B-OCR---VmlldzoyMDk1NzE4) - -## Sign up and create an API key - -An API key authenticates your machine to W&B. You can generate an API key from your user profile. - -{{% alert %}} -For a more streamlined approach, you can generate an API key by going directly to the [W&B authorization page](https://wandb.ai/authorize). Copy the displayed API key and save it in a secure location such as a password manager. -{{% /alert %}} - -1. Click your user profile icon in the upper right corner. -1. Select **User Settings**, then scroll to the **API Keys** section. -1. Click **Reveal**. Copy the displayed API key. To hide the API key, reload the page. - -## Install the `wandb` library and log in - -To install the `wandb` library locally and log in: - -{{< tabpane text=true >}} -{{% tab header="Command Line" value="cli" %}} - -1. Set the `WANDB_API_KEY` [environment variable]({{< relref "/guides/models/track/environment-variables.md" >}}) to your API key. - - ```bash - export WANDB_API_KEY= - ``` - -1. Install the `wandb` library and log in. - - - - ```shell - pip install wandb - - wandb login - ``` - -{{% /tab %}} - -{{% tab header="Python" value="python" %}} - -```bash -pip install wandb -``` -```python -import wandb -wandb.login() -``` - -{{% /tab %}} - -{{% tab header="Python notebook" value="notebook" %}} - -```notebook -!pip install wandb - -import wandb -wandb.login() -``` - -{{% /tab %}} -{{< /tabpane >}} - -## Add wandb to your `config.yml` file - -PaddleOCR requires configuration variables to be provided using a yaml file. Adding the following snippet at the end of the configuration yaml file will automatically log all training and validation metrics to a W&B dashboard along with model checkpoints: - -```python -Global: - use_wandb: True -``` - -Any additional, optional arguments that you might like to pass to [`wandb.init()`]({{< relref "/ref/python/functions/init.md" >}}) can also be added under the `wandb` header in the yaml file: - -``` -wandb: - project: CoolOCR # (optional) this is the wandb project name - entity: my_team # (optional) if you're using a wandb team, you can pass the team name here - name: MyOCRModel # (optional) this is the name of the wandb run -``` - -## Pass the `config.yml` file to `train.py` - -The yaml file is then provided as an argument to the [training script](https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.5/tools/train.py) available in the PaddleOCR repository. - -```bash -python tools/train.py -c config.yml -``` - -Once you run your `train.py` file with W&B turned on, a link will be generated to bring you to your W&B dashboard: - -{{< img src="/images/integrations/paddleocr_wb_dashboard1.png" alt="PaddleOCR training dashboard" >}} - -{{< img src="/images/integrations/paddleocr_wb_dashboard2.png" alt="PaddleOCR validation dashboard" >}} - -{{< img src="/images/integrations/paddleocr_wb_dashboard3.png" alt="Text Detection Model dashboard" >}} - -## Feedback or issues - -If you have any feedback or issues about the W&B integration, open an issue on the [PaddleOCR GitHub](https://github.com/PaddlePaddle/PaddleOCR) or email support@wandb.com. \ No newline at end of file diff --git a/content/en/guides/integrations/prodigy.md b/content/en/guides/integrations/prodigy.md deleted file mode 100644 index 6f36af1002..0000000000 --- a/content/en/guides/integrations/prodigy.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -description: How to integrate W&B with Prodigy. -menu: - default: - identifier: prodigy - parent: integrations -title: Prodigy -weight: 290 ---- - -[Prodigy](https://prodi.gy/) is an annotation tool for creating training and evaluation data for machine learning models, error analysis, data inspection & cleaning. [W&B Tables]({{< relref "/guides/models/tables/tables-walkthrough.md" >}}) allow you to log, visualize, analyze, and share datasets (and more!) inside W&B. - -The [W&B integration with Prodigy](https://github.com/wandb/wandb/blob/master/wandb/integration/prodigy/prodigy.py) adds simple and easy-to-use functionality to upload your Prodigy-annotated dataset directly to W&B for use with Tables. - -Run a few lines of code, like these: - -```python -import wandb -from wandb.integration.prodigy import upload_dataset - -with wandb.init(project="prodigy"): - upload_dataset("news_headlines_ner") -``` - -and get visual, interactive, shareable tables like this one: - -{{< img src="/images/integrations/prodigy_interactive_visual.png" alt="Prodigy annotation table" >}} - -## Quickstart - -Use `wandb.integration.prodigy.upload_dataset` to upload your annotated prodigy dataset directly from the local Prodigy database to W&B in our [Table]({{< relref "/ref/python/data-types/table.md" >}}) format. For more information on Prodigy, including installation & setup, please refer to the [Prodigy documentation](https://prodi.gy/docs/). - -W&B will automatically try to convert images and named entity fields to [`wandb.Image`]({{< relref "/ref/python/data-types/image.md" >}}) and [`wandb.Html`]({{< relref "/ref/python/data-types/html.md" >}})respectively. Extra columns may be added to the resulting table to include these visualizations. - -## Read through a detailed example - -Explore the [Visualizing Prodigy Datasets Using W&B Tables](https://wandb.ai/kshen/prodigy/reports/Visualizing-Prodigy-Datasets-Using-W-B-Tables--Vmlldzo5NDE2MTc) for example visualizations generated with W&B Prodigy integration. - -## Also using spaCy? - -W&B also has an integration with spaCy, see the [docs here]({{< relref "/guides/integrations/spacy" >}}). \ No newline at end of file diff --git a/content/en/guides/integrations/pytorch-geometric.md b/content/en/guides/integrations/pytorch-geometric.md deleted file mode 100644 index b6531e9631..0000000000 --- a/content/en/guides/integrations/pytorch-geometric.md +++ /dev/null @@ -1,179 +0,0 @@ ---- -menu: - default: - identifier: pytorch-geometric - parent: integrations -title: PyTorch Geometric -weight: 310 ---- -[PyTorch Geometric](https://github.com/pyg-team/pytorch_geometric) or PyG is one of the most popular libraries for geometric deep learning and W&B works extremely well with it for visualizing graphs and tracking experiments. - -After you have installed Pytorch Geometric, follow these steps to get started. - -## Sign up and create an API key - -An API key authenticates your machine to W&B. You can generate an API key from your user profile. - -{{% alert %}} -For a more streamlined approach, you can generate an API key by going directly to the [W&B authorization page](https://wandb.ai/authorize). Copy the displayed API key and save it in a secure location such as a password manager. -{{% /alert %}} - -1. Click your user profile icon in the upper right corner. -1. Select **User Settings**, then scroll to the **API Keys** section. -1. Click **Reveal**. Copy the displayed API key. To hide the API key, reload the page. - -## Install the `wandb` library and log in - -To install the `wandb` library locally and log in: - -{{< tabpane text=true >}} -{{% tab header="Command Line" value="cli" %}} - -1. Set the `WANDB_API_KEY` [environment variable]({{< relref "/guides/models/track/environment-variables.md" >}}) to your API key. - - ```bash - export WANDB_API_KEY= - ``` - -1. Install the `wandb` library and log in. - - - - ```shell - pip install wandb - - wandb login - ``` - -{{% /tab %}} - -{{% tab header="Python" value="python" %}} - -```bash -pip install wandb -``` -```python -import wandb -wandb.login() -``` - -{{% /tab %}} - -{{% tab header="Python notebook" value="notebook" %}} - -```notebook -!pip install wandb - -import wandb -wandb.login() -``` - -{{% /tab %}} -{{< /tabpane >}} - -## Visualize the graphs - -You can save details about the input graphs including number of edges, number of nodes and more. W&B supports logging plotly charts and HTML panels so any visualizations you create for your graph can then also be logged to W&B. - -### Use PyVis - -The following snippet shows how you could do that with PyVis and HTML. - -```python -from pyvis.network import Network -import wandb - -with wandb.init(project=’graph_vis’) as run: - net = Network(height="750px", width="100%", bgcolor="#222222", font_color="white") - - # Add the edges from the PyG graph to the PyVis network - for e in tqdm(g.edge_index.T): - src = e[0].item() - dst = e[1].item() - - net.add_node(dst) - net.add_node(src) - - net.add_edge(src, dst, value=0.1) - - # Save the PyVis visualisation to a HTML file - net.show("graph.html") - run.log({"eda/graph": wandb.Html("graph.html")}) -``` - -{{< img src="/images/integrations/pyg_graph_wandb.png" alt="Interactive graph visualization" >}} - -### Use Plotly - -To use plotly to create a graph visualization, first you need to convert the PyG graph to a networkx object. Following this you will need to create Plotly scatter plots for both nodes and edges. The snippet below can be used for this task. - -```python -def create_vis(graph): - G = to_networkx(graph) - pos = nx.spring_layout(G) - - edge_x = [] - edge_y = [] - for edge in G.edges(): - x0, y0 = pos[edge[0]] - x1, y1 = pos[edge[1]] - edge_x.append(x0) - edge_x.append(x1) - edge_x.append(None) - edge_y.append(y0) - edge_y.append(y1) - edge_y.append(None) - - edge_trace = go.Scatter( - x=edge_x, y=edge_y, - line=dict(width=0.5, color='#888'), - hoverinfo='none', - mode='lines' - ) - - node_x = [] - node_y = [] - for node in G.nodes(): - x, y = pos[node] - node_x.append(x) - node_y.append(y) - - node_trace = go.Scatter( - x=node_x, y=node_y, - mode='markers', - hoverinfo='text', - line_width=2 - ) - - fig = go.Figure(data=[edge_trace, node_trace], layout=go.Layout()) - - return fig - - -with wandb.init(project=’visualize_graph’) as run: - run.log({‘graph’: wandb.Plotly(create_vis(graph))}) -``` - -{{< img src="/images/integrations/pyg_graph_plotly.png" alt="A visualization created using the example function and logged inside a W&B Table." >}} - -## Log metrics - -You can use W&B to track your experiments and related metrics, such as loss functions, accuracy, and more. Add the following line to your training loop: - -```python -with wandb.init(project="my_project", entity="my_entity") as run: - run.log({ - 'train/loss': training_loss, - 'train/acc': training_acc, - 'val/loss': validation_loss, - 'val/acc': validation_acc - }) -``` - -{{< img src="/images/integrations/pyg_metrics.png" alt="hits@K metrics over epochs" >}} - -## More resources - -- [Recommending Amazon Products using Graph Neural Networks in PyTorch Geometric](https://wandb.ai/manan-goel/gnn-recommender/reports/Recommending-Amazon-Products-using-Graph-Neural-Networks-in-PyTorch-Geometric--VmlldzozMTA3MzYw#what-does-the-data-look-like?) -- [Point Cloud Classification using PyTorch Geometric](https://wandb.ai/geekyrakshit/pyg-point-cloud/reports/Point-Cloud-Classification-using-PyTorch-Geometric--VmlldzozMTExMTE3) -- [Point Cloud Segmentation using PyTorch Geometric](https://wandb.ai/wandb/point-cloud-segmentation/reports/Point-Cloud-Segmentation-using-Dynamic-Graph-CNN--VmlldzozMTk5MDcy) \ No newline at end of file diff --git a/content/en/guides/integrations/pytorch.md b/content/en/guides/integrations/pytorch.md deleted file mode 100644 index 8f73f04eb7..0000000000 --- a/content/en/guides/integrations/pytorch.md +++ /dev/null @@ -1,109 +0,0 @@ ---- -menu: - default: - identifier: pytorch - parent: integrations -title: PyTorch -weight: 300 ---- -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/intro/Intro_to_Weights_%26_Biases.ipynb" >}} - -PyTorch is one of the most popular frameworks for deep learning in Python, especially among researchers. W&B provides first class support for PyTorch, from logging gradients to profiling your code on the CPU and GPU. - -Try our integration out in a Colab notebook. - -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/pytorch/Simple_PyTorch_Integration.ipynb" >}} - -You can also see our [example repo](https://github.com/wandb/examples) for scripts, including one on hyperparameter optimization using [Hyperband](https://arxiv.org/abs/1603.06560) on [Fashion MNIST](https://github.com/wandb/examples/tree/master/examples/pytorch/pytorch-cnn-fashion), plus the [W&B Dashboard](https://wandb.ai/wandb/keras-fashion-mnist/runs/5z1d85qs) it generates. - -## Log gradients with `run.watch` - -To automatically log gradients, you can call [`wandb.Run.watch()`]({{< relref "/ref/python/experiments/run.md/#method-runwatch" >}}) and pass in your PyTorch model. - -```python -import wandb - -with wandb.init(config=args) as run: - - model = ... # set up your model - - # Magic - run.watch(model, log_freq=100) - - model.train() - for batch_idx, (data, target) in enumerate(train_loader): - output = model(data) - loss = F.nll_loss(output, target) - loss.backward() - optimizer.step() - if batch_idx % args.log_interval == 0: - run.log({"loss": loss}) -``` - -If you need to track multiple models in the same script, you can call [`wandb.Run.watch()`]({{< relref "/ref/python/experiments/run/#method-runwatch" >}}) on each model separately. - -{{% alert color="secondary" %}} -Gradients, metrics, and the graph won't be logged until `wandb.Run.log()` is called after a forward _and_ backward pass. -{{% /alert %}} - -## Log images and media - -You can pass PyTorch `Tensors` with image data into [`wandb.Image`]({{< relref "/ref/python/data-types/image.md" >}}) and utilities from [`torchvision`](https://pytorch.org/vision/stable/index.html) will be used to convert them to images automatically: - -```python -with wandb.init(project="my_project", entity="my_entity") as run: - images_t = ... # generate or load images as PyTorch Tensors - run.log({"examples": [wandb.Image(im) for im in images_t]}) -``` - -For more on logging rich media to W&B in PyTorch and other frameworks, check out our [media logging guide]({{< relref "/guides/models/track/log/media.md" >}}). - -If you also want to include information alongside media, like your model's predictions or derived metrics, use a `wandb.Table`. - -```python -with wandb.init() as run: - my_table = wandb.Table() - - my_table.add_column("image", images_t) - my_table.add_column("label", labels) - my_table.add_column("class_prediction", predictions_t) - - # Log your Table to W&B - run.log({"mnist_predictions": my_table}) -``` - -{{< img src="/images/integrations/pytorch_example_table.png" alt="PyTorch model results" >}} - -For more on logging and visualizing datasets and models, check out our [guide to W&B Tables]({{< relref "/guides/models/tables/" >}}). - -## Profile PyTorch code - -{{< img src="/images/integrations/pytorch_example_dashboard.png" alt="PyTorch execution traces" >}} - -W&B integrates directly with [PyTorch Kineto](https://github.com/pytorch/kineto)'s [Tensorboard plugin](https://github.com/pytorch/kineto/blob/master/tb_plugin/README.md) to provide tools for profiling PyTorch code, inspecting the details of CPU and GPU communication, and identifying bottlenecks and optimizations. - -```python -profile_dir = "path/to/run/tbprofile/" -profiler = torch.profiler.profile( - schedule=schedule, # see the profiler docs for details on scheduling - on_trace_ready=torch.profiler.tensorboard_trace_handler(profile_dir), - with_stack=True, -) - -with profiler: - ... # run the code you want to profile here - # see the profiler docs for detailed usage information - -# create a wandb Artifact -profile_art = wandb.Artifact("trace", type="profile") -# add the pt.trace.json files to the Artifact -profile_art.add_file(glob.glob(profile_dir + ".pt.trace.json")) -# log the artifact -profile_art.save() -``` - -See and run working example code in [this Colab](https://wandb.me/trace-colab). - -{{% alert color="secondary" %}} -The interactive trace viewing tool is based on the Chrome Trace Viewer, which works best with the Chrome browser. -{{% /alert %}} \ No newline at end of file diff --git a/content/en/guides/integrations/ray-tune.md b/content/en/guides/integrations/ray-tune.md deleted file mode 100644 index 5d662dfec2..0000000000 --- a/content/en/guides/integrations/ray-tune.md +++ /dev/null @@ -1,115 +0,0 @@ ---- -description: How to integrate W&B with Ray Tune. -menu: - default: - identifier: ray-tune - parent: integrations -title: Ray Tune -weight: 360 ---- - -W&B integrates with [Ray](https://github.com/ray-project/ray) by offering two lightweight integrations. - -- The`WandbLoggerCallback` function automatically logs metrics reported to Tune to the Wandb API. -- The `setup_wandb()` function, which can be used with the function API, automatically initializes the Wandb API with Tune's training information. You can use the Wandb API as usual. such as by using `run.log()` to log your training process. - -## Configure the integration - -```python -from ray.air.integrations.wandb import WandbLoggerCallback -``` - -Wandb configuration is done by passing a wandb key to the config parameter of `tune.run()` (see example below). - -The content of the wandb config entry is passed to `wandb.init()` as keyword arguments. The exception are the following settings, which are used to configure the `WandbLoggerCallback` itself: - -### Parameters - -`project (str)`: Name of the Wandb project. Mandatory. - -`api_key_file (str)`: Path to file containing the Wandb API KEY. - -`api_key (str)`: Wandb API Key. Alternative to setting `api_key_file`. - -`excludes (list)`: List of metrics to exclude from the log. - -`log_config (bool)`: Whether to log the config parameter of the results dictionary. Defaults to False. - -`upload_checkpoints (bool)`: If True, model checkpoints are uploaded as artifacts. Defaults to False. - -### Example - -```python -from ray import tune, train -from ray.air.integrations.wandb import WandbLoggerCallback - - -def train_fc(config): - for i in range(10): - train.report({"mean_accuracy": (i + config["alpha"]) / 10}) - - -tuner = tune.Tuner( - train_fc, - param_space={ - "alpha": tune.grid_search([0.1, 0.2, 0.3]), - "beta": tune.uniform(0.5, 1.0), - }, - run_config=train.RunConfig( - callbacks=[ - WandbLoggerCallback( - project="", api_key="", log_config=True - ) - ] - ), -) - -results = tuner.fit() -``` - -## setup_wandb - -```python -from ray.air.integrations.wandb import setup_wandb -``` - -This utility function helps initialize Wandb for use with Ray Tune. For basic usage, call `setup_wandb()` in your training function: - -```python -from ray.air.integrations.wandb import setup_wandb - - -def train_fn(config): - # Initialize wandb - wandb = setup_wandb(config) - run = wandb.init( - project=config["wandb"]["project"], - api_key_file=config["wandb"]["api_key_file"], - ) - - for i in range(10): - loss = config["a"] + config["b"] - run.log({"loss": loss}) - tune.report(loss=loss) - run.finish() - - -tuner = tune.Tuner( - train_fn, - param_space={ - # define search space here - "a": tune.choice([1, 2, 3]), - "b": tune.choice([4, 5, 6]), - # wandb configuration - "wandb": {"project": "Optimization_Project", "api_key_file": "/path/to/file"}, - }, -) -results = tuner.fit() -``` - -## Example Code - -We've created a few examples for you to see how the integration works: - -* [Colab](https://wandb.me/raytune-colab): A simple demo to try the integration. -* [Dashboard](https://wandb.ai/anmolmann/ray_tune): View dashboard generated from the example. \ No newline at end of file diff --git a/content/en/guides/integrations/sagemaker.md b/content/en/guides/integrations/sagemaker.md deleted file mode 100644 index e0143cf06f..0000000000 --- a/content/en/guides/integrations/sagemaker.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -description: How to integrate W&B with Amazon SageMaker. -menu: - default: - identifier: sagemaker - parent: integrations -title: SageMaker -weight: 370 ---- - - -W&B integrates with [Amazon SageMaker](https://aws.amazon.com/sagemaker/), automatically reading hyperparameters, grouping distributed runs, and resuming runs from checkpoints. - -## Authentication - -W&B looks for a file named `secrets.env` relative to the training script and loads them into the environment when `wandb.init()` is called. You can generate a `secrets.env` file by calling `wandb.sagemaker_auth(path="source_dir")` in the script you use to launch your experiments. Be sure to add this file to your `.gitignore`! - -## Existing estimators - -If you're using one of SageMakers preconfigured estimators you need to add a `requirements.txt` to your source directory that includes wandb - -```text -wandb -``` - -If you're using an estimator that's running Python 2, you'll need to install `psutil` directly from this [wheel](https://pythonwheels.com) before installing wandb: - -```text -https://wheels.galaxyproject.org/packages/psutil-5.4.8-cp27-cp27mu-manylinux1_x86_64.whl -wandb -``` - -Review a complete example on [GitHub](https://github.com/wandb/examples/tree/master/examples/pytorch/pytorch-cifar10-sagemaker), and read more on our [blog](https://wandb.ai/site/articles/running-sweeps-with-sagemaker). - -You can also read the [Deploy Sentiment Analyzer Using SageMaker and W&B tutorial](https://wandb.ai/authors/sagemaker/reports/Deploy-Sentiment-Analyzer-Using-SageMaker-and-W-B--VmlldzoxODA1ODE) on deploying a sentiment analyzer using SageMaker and W&B. - -{{% alert color="secondary" %}} -The W&B sweep agent behaves as expected in a SageMaker job only if your SageMaker integration is turned off. Turn off the SageMaker integration by modifying your invocation of `wandb.init`: - -```python -wandb.init(..., settings=wandb.Settings(sagemaker_disable=True)) -``` -{{% /alert %}} diff --git a/content/en/guides/integrations/scikit.md b/content/en/guides/integrations/scikit.md deleted file mode 100644 index 4d99722921..0000000000 --- a/content/en/guides/integrations/scikit.md +++ /dev/null @@ -1,329 +0,0 @@ ---- -menu: - default: - identifier: scikit - parent: integrations -title: Scikit-Learn -weight: 380 ---- -You can use wandb to visualize and compare your scikit-learn models' performance with just a few lines of code. [Try an example →](https://wandb.me/scikit-colab) - -## Get started - -### Sign up and create an API key - -An API key authenticates your machine to W&B. You can generate an API key from your user profile. - -{{% alert %}} -For a more streamlined approach, you can generate an API key by going directly to the [W&B authorization page](https://wandb.ai/authorize). Copy the displayed API key and save it in a secure location such as a password manager. -{{% /alert %}} - -1. Click your user profile icon in the upper right corner. -1. Select **User Settings**, then scroll to the **API Keys** section. -1. Click **Reveal**. Copy the displayed API key. To hide the API key, reload the page. - -### Install the `wandb` library and log in - -To install the `wandb` library locally and log in: - -{{< tabpane text=true >}} -{{% tab header="Command Line" value="cli" %}} - -1. Set the `WANDB_API_KEY` [environment variable]({{< relref "/guides/models/track/environment-variables.md" >}}) to your API key. - - ```bash - export WANDB_API_KEY= - ``` - -1. Install the `wandb` library and log in. - - - - ```shell - pip install wandb - - wandb login - ``` - -{{% /tab %}} - -{{% tab header="Python" value="python" %}} - -```bash -pip install wandb -``` -```python -import wandb -wandb.login() -``` - -{{% /tab %}} - -{{% tab header="Python notebook" value="notebook" %}} - -```notebook -!pip install wandb - -import wandb -wandb.login() -``` - -{{% /tab %}} -{{< /tabpane >}} - -### Log metrics - -```python -import wandb - -wandb.init(project="visualize-sklearn") as run: - - y_pred = clf.predict(X_test) - accuracy = sklearn.metrics.accuracy_score(y_true, y_pred) - - # If logging metrics over time, then use run.log - run.log({"accuracy": accuracy}) - - # OR to log a final metric at the end of training you can also use run.summary - run.summary["accuracy"] = accuracy -``` - -### Make plots - -#### Step 1: Import wandb and initialize a new run - -```python -import wandb - -run = wandb.init(project="visualize-sklearn") -``` - -#### Step 2: Visualize plots - -#### Individual plots - -After training a model and making predictions you can then generate plots in wandb to analyze your predictions. See the **Supported Plots** section below for a full list of supported charts. - -```python -# Visualize single plot -wandb.sklearn.plot_confusion_matrix(y_true, y_pred, labels) -``` - -#### All plots - -W&B has functions such as `plot_classifier` that will plot several relevant plots: - -```python -# Visualize all classifier plots -wandb.sklearn.plot_classifier( - clf, - X_train, - X_test, - y_train, - y_test, - y_pred, - y_probas, - labels, - model_name="SVC", - feature_names=None, -) - -# All regression plots -wandb.sklearn.plot_regressor(reg, X_train, X_test, y_train, y_test, model_name="Ridge") - -# All clustering plots -wandb.sklearn.plot_clusterer( - kmeans, X_train, cluster_labels, labels=None, model_name="KMeans" -) - -run.finish() -``` - -#### Existing Matplotlib plots - -Plots created on Matplotlib can also be logged on W&B Dashboard. To do that, it is first required to install `plotly`. - -```bash -pip install plotly -``` - -Finally, the plots can be logged on W&B's dashboard as follows: - -```python -import matplotlib.pyplot as plt -import wandb - -with wandb.init(project="visualize-sklearn") as run: - - # do all the plt.plot(), plt.scatter(), etc. here. - # ... - - # instead of doing plt.show() do: - run.log({"plot": plt}) -``` - -## Supported plots - -### Learning curve - -{{< img src="/images/integrations/scikit_learning_curve.png" alt="Scikit-learn learning curve" >}} - -Trains model on datasets of varying lengths and generates a plot of cross validated scores vs dataset size, for both training and test sets. - -`wandb.sklearn.plot_learning_curve(model, X, y)` - -* model (clf or reg): Takes in a fitted regressor or classifier. -* X (arr): Dataset features. -* y (arr): Dataset labels. - -### ROC - -{{< img src="/images/integrations/scikit_roc.png" alt="Scikit-learn ROC curve" >}} - -ROC curves plot true positive rate (y-axis) vs false positive rate (x-axis). The ideal score is a TPR = 1 and FPR = 0, which is the point on the top left. Typically we calculate the area under the ROC curve (AUC-ROC), and the greater the AUC-ROC the better. - -`wandb.sklearn.plot_roc(y_true, y_probas, labels)` - -* y_true (arr): Test set labels. -* y_probas (arr): Test set predicted probabilities. -* labels (list): Named labels for target variable (y). - -### Class proportions - -{{< img src="/images/integrations/scikic_class_props.png" alt="Scikit-learn classification properties" >}} - -Plots the distribution of target classes in training and test sets. Useful for detecting imbalanced classes and ensuring that one class doesn't have a disproportionate influence on the model. - -`wandb.sklearn.plot_class_proportions(y_train, y_test, ['dog', 'cat', 'owl'])` - -* y_train (arr): Training set labels. -* y_test (arr): Test set labels. -* labels (list): Named labels for target variable (y). - -### Precision recall curve - -{{< img src="/images/integrations/scikit_precision_recall.png" alt="Scikit-learn precision-recall curve" >}} - -Computes the tradeoff between precision and recall for different thresholds. A high area under the curve represents both high recall and high precision, where high precision relates to a low false positive rate, and high recall relates to a low false negative rate. - -High scores for both show that the classifier is returning accurate results (high precision), as well as returning a majority of all positive results (high recall). PR curve is useful when the classes are very imbalanced. - -`wandb.sklearn.plot_precision_recall(y_true, y_probas, labels)` - -* y_true (arr): Test set labels. -* y_probas (arr): Test set predicted probabilities. -* labels (list): Named labels for target variable (y). - -### Feature importances - -{{< img src="/images/integrations/scikit_feature_importances.png" alt="Scikit-learn feature importance chart" >}} - -Evaluates and plots the importance of each feature for the classification task. Only works with classifiers that have a `feature_importances_` attribute, like trees. - -`wandb.sklearn.plot_feature_importances(model, ['width', 'height, 'length'])` - -* model (clf): Takes in a fitted classifier. -* feature_names (list): Names for features. Makes plots easier to read by replacing feature indexes with corresponding names. - -### Calibration curve - -{{< img src="/images/integrations/scikit_calibration_curve.png" alt="Scikit-learn calibration curve" >}} - -Plots how well calibrated the predicted probabilities of a classifier are and how to calibrate an uncalibrated classifier. Compares estimated predicted probabilities by a baseline logistic regression model, the model passed as an argument, and by both its isotonic calibration and sigmoid calibrations. - -The closer the calibration curves are to a diagonal the better. A transposed sigmoid like curve represents an overfitted classifier, while a sigmoid like curve represents an underfitted classifier. By training isotonic and sigmoid calibrations of the model and comparing their curves we can figure out whether the model is over or underfitting and if so which calibration (sigmoid or isotonic) might help fix this. - -For more details, check out [sklearn's docs](https://scikit-learn.org/stable/auto_examples/calibration/plot_calibration_curve.html). - -`wandb.sklearn.plot_calibration_curve(clf, X, y, 'RandomForestClassifier')` - -* model (clf): Takes in a fitted classifier. -* X (arr): Training set features. -* y (arr): Training set labels. -* model_name (str): Model name. Defaults to 'Classifier' - -### Confusion matrix - -{{< img src="/images/integrations/scikit_confusion_matrix.png" alt="Scikit-learn confusion matrix" >}} - -Computes the confusion matrix to evaluate the accuracy of a classification. It's useful for assessing the quality of model predictions and finding patterns in the predictions the model gets wrong. The diagonal represents the predictions the model got right, such as where the actual label is equal to the predicted label. - -`wandb.sklearn.plot_confusion_matrix(y_true, y_pred, labels)` - -* y_true (arr): Test set labels. -* y_pred (arr): Test set predicted labels. -* labels (list): Named labels for target variable (y). - -### Summary metrics - -{{< img src="/images/integrations/scikit_summary_metrics.png" alt="Scikit-learn summary metrics" >}} - -- Calculates summary metrics for classification, such as `mse`, `mae`, and `r2` score. -- Calculates summary metrics for regression, such as `f1`, accuracy, precision, and recall. - -`wandb.sklearn.plot_summary_metrics(model, X_train, y_train, X_test, y_test)` - -* model (clf or reg): Takes in a fitted regressor or classifier. -* X (arr): Training set features. -* y (arr): Training set labels. - * X_test (arr): Test set features. -* y_test (arr): Test set labels. - -### Elbow plot - -{{< img src="/images/integrations/scikit_elbow_plot.png" alt="Scikit-learn elbow plot" >}} - -Measures and plots the percentage of variance explained as a function of the number of clusters, along with training times. Useful in picking the optimal number of clusters. - -`wandb.sklearn.plot_elbow_curve(model, X_train)` - -* model (clusterer): Takes in a fitted clusterer. -* X (arr): Training set features. - -### Silhouette plot - -{{< img src="/images/integrations/scikit_silhouette_plot.png" alt="Scikit-learn silhouette plot" >}} - -Measures & plots how close each point in one cluster is to points in the neighboring clusters. The thickness of the clusters corresponds to the cluster size. The vertical line represents the average silhouette score of all the points. - -Silhouette coefficients near +1 indicate that the sample is far away from the neighboring clusters. A value of 0 indicates that the sample is on or very close to the decision boundary between two neighboring clusters and negative values indicate that those samples might have been assigned to the wrong cluster. - -In general we want all silhouette cluster scores to be above average (past the red line) and as close to 1 as possible. We also prefer cluster sizes that reflect the underlying patterns in the data. - -`wandb.sklearn.plot_silhouette(model, X_train, ['spam', 'not spam'])` - -* model (clusterer): Takes in a fitted clusterer. -* X (arr): Training set features. - * cluster_labels (list): Names for cluster labels. Makes plots easier to read by replacing cluster indexes with corresponding names. - -### Outlier candidates plot - -{{< img src="/images/integrations/scikit_outlier_plot.png" alt="Scikit-learn outlier plot" >}} - -Measures a datapoint's influence on regression model via cook's distance. Instances with heavily skewed influences could potentially be outliers. Useful for outlier detection. - -`wandb.sklearn.plot_outlier_candidates(model, X, y)` - -* model (regressor): Takes in a fitted classifier. -* X (arr): Training set features. -* y (arr): Training set labels. - -### Residuals plot - -{{< img src="/images/integrations/scikit_residuals_plot.png" alt="Scikit-learn residuals plot" >}} - -Measures and plots the predicted target values (y-axis) vs the difference between actual and predicted target values (x-axis), as well as the distribution of the residual error. - -Generally, the residuals of a well-fit model should be randomly distributed because good models will account for most phenomena in a data set, except for random error. - -`wandb.sklearn.plot_residuals(model, X, y)` - -* model (regressor): Takes in a fitted classifier. -* X (arr): Training set features. -* y (arr): Training set labels. - - If you have any questions, we'd love to answer them in our [slack community](https://wandb.me/slack). - -## Example - -* [Run in colab](https://wandb.me/scikit-colab): A simple notebook to get you started. \ No newline at end of file diff --git a/content/en/guides/integrations/simpletransformers.md b/content/en/guides/integrations/simpletransformers.md deleted file mode 100644 index af67056f6f..0000000000 --- a/content/en/guides/integrations/simpletransformers.md +++ /dev/null @@ -1,128 +0,0 @@ ---- -description: How to integrate W&B with the Transformers library by Hugging Face. -menu: - default: - identifier: simpletransformers - parent: integrations -title: Simple Transformers -weight: 390 ---- - -This library is based on the Transformers library by Hugging Face. Simple Transformers lets you quickly train and evaluate Transformer models. Only 3 lines of code are needed to initialize a model, train the model, and evaluate a model. It supports Sequence Classification, Token Classification \(NER\),Question Answering,Language Model Fine-Tuning, Language Model Training, Language Generation, T5 Model, Seq2Seq Tasks , Multi-Modal Classification and Conversational AI. - -To use W&B for visualizing model training. To use this, set a project name for W&B in the `wandb_project` attribute of the `args` dictionary. This logs all hyperparameter values, training losses, and evaluation metrics to the given project. - -```python -model = ClassificationModel('roberta', 'roberta-base', args={'wandb_project': 'project-name'}) -``` - -Any additional arguments that go into `wandb.init` can be passed as `wandb_kwargs`. - -## Structure - -The library is designed to have a separate class for every NLP task. The classes that provide similar functionality are grouped together. - -* `simpletransformers.classification` - Includes all Classification models. - * `ClassificationModel` - * `MultiLabelClassificationModel` -* `simpletransformers.ner` - Includes all Named Entity Recognition models. - * `NERModel` -* `simpletransformers.question_answering` - Includes all Question Answering models. - * `QuestionAnsweringModel` - -Here are some minimal examples - -## MultiLabel Classification - -```text - model = MultiLabelClassificationModel("distilbert","distilbert-base-uncased",num_labels=6, - args={"reprocess_input_data": True, "overwrite_output_dir": True, "num_train_epochs":epochs,'learning_rate':learning_rate, - 'wandb_project': "simpletransformers"}, - ) - # Train the model - model.train_model(train_df) - - # Evaluate the model - result, model_outputs, wrong_predictions = model.eval_model(eval_df) -``` - -## Question Answering - -```text - train_args = { - 'learning_rate': wandb.config.learning_rate, - 'num_train_epochs': 2, - 'max_seq_length': 128, - 'doc_stride': 64, - 'overwrite_output_dir': True, - 'reprocess_input_data': False, - 'train_batch_size': 2, - 'fp16': False, - 'wandb_project': "simpletransformers" -} - -model = QuestionAnsweringModel('distilbert', 'distilbert-base-cased', args=train_args) -model.train_model(train_data) -``` - - -SimpleTransformers provides classes as well as training scripts for all common natural language tasks. Here is the complete list of global arguments that are supported by the library, with their default arguments. - -```text -global_args = { - "adam_epsilon": 1e-8, - "best_model_dir": "outputs/best_model", - "cache_dir": "cache_dir/", - "config": {}, - "do_lower_case": False, - "early_stopping_consider_epochs": False, - "early_stopping_delta": 0, - "early_stopping_metric": "eval_loss", - "early_stopping_metric_minimize": True, - "early_stopping_patience": 3, - "encoding": None, - "eval_batch_size": 8, - "evaluate_during_training": False, - "evaluate_during_training_silent": True, - "evaluate_during_training_steps": 2000, - "evaluate_during_training_verbose": False, - "fp16": True, - "fp16_opt_level": "O1", - "gradient_accumulation_steps": 1, - "learning_rate": 4e-5, - "local_rank": -1, - "logging_steps": 50, - "manual_seed": None, - "max_grad_norm": 1.0, - "max_seq_length": 128, - "multiprocessing_chunksize": 500, - "n_gpu": 1, - "no_cache": False, - "no_save": False, - "num_train_epochs": 1, - "output_dir": "outputs/", - "overwrite_output_dir": False, - "process_count": cpu_count() - 2 if cpu_count() > 2 else 1, - "reprocess_input_data": True, - "save_best_model": True, - "save_eval_checkpoints": True, - "save_model_every_epoch": True, - "save_steps": 2000, - "save_optimizer_and_scheduler": True, - "silent": False, - "tensorboard_dir": None, - "train_batch_size": 8, - "use_cached_eval_features": False, - "use_early_stopping": False, - "use_multiprocessing": True, - "wandb_kwargs": {}, - "wandb_project": None, - "warmup_ratio": 0.06, - "warmup_steps": 0, - "weight_decay": 0, -} -``` - -Refer to [simpletransformers on github](https://github.com/ThilinaRajapakse/simpletransformers) for more detailed documentation. - -Checkout [this W&B report](https://app.wandb.ai/cayush/simpletransformers/reports/Using-simpleTransformer-on-common-NLP-applications---Vmlldzo4Njk2NA) that covers training transformers on some the most popular GLUE benchmark datasets. [Try it out yourself on colab](https://colab.research.google.com/drive/1oXROllqMqVvBFcPgTKJRboTq96uWuqSz?usp=sharing). \ No newline at end of file diff --git a/content/en/guides/integrations/skorch.md b/content/en/guides/integrations/skorch.md deleted file mode 100644 index fc6eac6c28..0000000000 --- a/content/en/guides/integrations/skorch.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -description: How to integrate W&B with Skorch. -menu: - default: - identifier: skorch - parent: integrations -title: Skorch -weight: 400 ---- - -You can use W&B with Skorch to automatically log the model with the best performance, along with all model performance metrics, the model topology and compute resources after each epoch. Every file saved in `wandb_run.dir` is automatically logged to W&B. - -See [example run](https://app.wandb.ai/borisd13/skorch/runs/s20or4ct?workspace=user-borisd13). - -## Parameters - -| Parameter | Type | Description | -| :--- | :--- | :--- | -| `wandb_run` | `wandb.wandb_run`. Run | wandb run used to log data. | -|`save_model` | bool (default=True)| Whether to save a checkpoint of the best model and upload it to your Run on W&B.| -|`keys_ignored`| str or list of str (default=None) | Key or list of keys that should not be logged to tensorboard. Note that in addition to the keys provided by the user, keys such as those starting with `event_` or ending on `_best` are ignored by default.| - -## Example Code - -We've created a few examples for you to see how the integration works: - -* [Colab](https://colab.research.google.com/drive/1Bo8SqN1wNPMKv5Bn9NjwGecBxzFlaNZn?usp=sharing): A simple demo to try the integration -* [A step by step guide](https://app.wandb.ai/cayush/uncategorized/reports/Automate-Kaggle-model-training-with-Skorch-and-W%26B--Vmlldzo4NTQ1NQ): to tracking your Skorch model performance - -```python -# Install wandb -... pip install wandb - -import wandb -from skorch.callbacks import WandbLogger - -# Create a wandb Run -wandb_run = wandb.init() -# Alternative: Create a wandb Run without a W&B account -wandb_run = wandb.init(anonymous="allow") - -# Log hyper-parameters (optional) -wandb_run.config.update({"learning rate": 1e-3, "batch size": 32}) - -net = NeuralNet(..., callbacks=[WandbLogger(wandb_run)]) -net.fit(X, y) -``` - -## Method reference - -| Method | Description | -| :--- | :--- | -| `initialize`\(\) | \(Re-\)Set the initial state of the callback. | -| `on_batch_begin`\(net\[, X, y, training\]\) | Called at the beginning of each batch. | -| `on_batch_end`\(net\[, X, y, training\]\) | Called at the end of each batch. | -| `on_epoch_begin`\(net\[, dataset_train, …\]\) | Called at the beginning of each epoch. | -| `on_epoch_end`\(net, \*\*kwargs\) | Log values from the last history step and save best model | -| `on_grad_computed`\(net, named_parameters\[, X, …\]\) | Called once per batch after gradients have been computed but before an update step was performed. | -| `on_train_begin`\(net, \*\*kwargs\) | Log model topology and add a hook for gradients | -| `on_train_end`\(net\[, X, y\]\) | Called at the end of training. | \ No newline at end of file diff --git a/content/en/guides/integrations/spacy.md b/content/en/guides/integrations/spacy.md deleted file mode 100644 index 066a608d36..0000000000 --- a/content/en/guides/integrations/spacy.md +++ /dev/null @@ -1,141 +0,0 @@ ---- -menu: - default: - identifier: spacy - parent: integrations -title: spaCy -weight: 410 ---- -[spaCy](https://spacy.io) is a popular "industrial-strength" NLP library: fast, accurate models with a minimum of fuss. As of spaCy v3, W&B can now be used with [`spacy train`](https://spacy.io/api/cli#train) to track your spaCy model's training metrics as well as to save and version your models and datasets. And all it takes is a few added lines in your configuration. - -## Sign up and create an API key - -An API key authenticates your machine to W&B. You can generate an API key from your user profile. - -{{% alert %}} -For a more streamlined approach, you can generate an API key by going directly to the [W&B authorization page](https://wandb.ai/authorize). Copy the displayed API key and save it in a secure location such as a password manager. -{{% /alert %}} - -1. Click your user profile icon in the upper right corner. -1. Select **User Settings**, then scroll to the **API Keys** section. -1. Click **Reveal**. Copy the displayed API key. To hide the API key, reload the page. - -## Install the `wandb` library and log in - -To install the `wandb` library locally and log in: - -{{< tabpane text=true >}} -{{% tab header="Command Line" value="cli" %}} - -1. Set the `WANDB_API_KEY` [environment variable]({{< relref "/guides/models/track/environment-variables.md" >}}) to your API key. - - ```bash - export WANDB_API_KEY= - ``` - -1. Install the `wandb` library and log in. - - - - ```shell - pip install wandb - - wandb login - ``` - -{{% /tab %}} - -{{% tab header="Python" value="python" %}} - -```bash -pip install wandb -``` -```python -import wandb -wandb.login() -``` - -{{% /tab %}} - -{{% tab header="Python notebook" value="notebook" %}} - -```notebook -!pip install wandb - -import wandb -wandb.login() -``` - -{{% /tab %}} -{{< /tabpane >}} - -## Add the `WandbLogger` to your spaCy config file - -spaCy config files are used to specify all aspects of training, not just logging -- GPU allocation, optimizer choice, dataset paths, and more. Minimally, under `[training.logger]` you need to provide the key `@loggers` with the value `"spacy.WandbLogger.v3"`, plus a `project_name`. - -{{% alert %}} -For more on how spaCy training config files work and on other options you can pass in to customize training, check out [spaCy's documentation](https://spacy.io/usage/training). -{{% /alert %}} - -```python -[training.logger] -@loggers = "spacy.WandbLogger.v3" -project_name = "my_spacy_project" -remove_config_values = ["paths.train", "paths.dev", "corpora.train.path", "corpora.dev.path"] -log_dataset_dir = "./corpus" -model_log_interval = 1000 -``` - -| Name | Description | -| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `project_name` | `str`. The name of the W&B Project. The project will be created automatically if it doesn’t exist yet. | -| `remove_config_values` | `List[str]` . A list of values to exclude from the config before it is uploaded to W&B. `[]` by default. | -| `model_log_interval` | `Optional int`. `None` by default. If set, enables [model versioning]({{< relref "/guides/core/registry/" >}}) with [Artifacts]({{< relref "/guides/core/artifacts/" >}}). Pass in the number of steps to wait between logging model checkpoints. `None` by default. | -| `log_dataset_dir` | `Optional str`. If passed a path, the dataset will be uploaded as an Artifact at the beginning of training. `None` by default. | -| `entity` | `Optional str` . If passed, the run will be created in the specified entity | -| `run_name` | `Optional str` . If specified, the run will be created with the specified name. | - -## Start training - -Once you have added the `WandbLogger` to your spaCy training config you can run `spacy train` as usual. - -{{< tabpane text=true >}} - -{{% tab header="Command Line" value="cli" %}} - -```python -python -m spacy train \ - config.cfg \ - --output ./output \ - --paths.train ./train \ - --paths.dev ./dev -``` - -{{% /tab %}} - -{{% tab header="Python" value="python" %}} - -```python -python -m spacy train \ - config.cfg \ - --output ./output \ - --paths.train ./train \ - --paths.dev ./dev -``` - -{{% /tab %}} - -{{% tab header="Python notebook" value="notebook" %}} - -```notebook -!python -m spacy train \ - config.cfg \ - --output ./output \ - --paths.train ./train \ - --paths.dev ./dev -``` - -{{% /tab %}} -{{< /tabpane >}} - -When training begins, a link to your training run's [W&B page]({{< relref "/guides/models/track/runs/" >}}) will be output which will take you to this run's experiment tracking [dashboard]({{< relref "/guides/models/track/workspaces.md" >}}) in the W&B web UI. \ No newline at end of file diff --git a/content/en/guides/integrations/stable-baselines-3.md b/content/en/guides/integrations/stable-baselines-3.md deleted file mode 100644 index 4ed99a0841..0000000000 --- a/content/en/guides/integrations/stable-baselines-3.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -description: How to integrate W&B with Stable Baseline 3. -menu: - default: - identifier: stable-baselines-3 - parent: integrations -title: Stable Baselines 3 -weight: 420 ---- - -[Stable Baselines 3](https://github.com/DLR-RM/stable-baselines3) \(SB3\) is a set of reliable implementations of reinforcement learning algorithms in PyTorch. W&B's SB3 integration: - -* Records metrics such as losses and episodic returns. -* Uploads videos of agents playing the games. -* Saves the trained model. -* Logs the model's hyperparameters. -* Logs the model gradient histograms. - -Review an [example SB3 training run](https://wandb.ai/wandb/sb3/runs/1jyr6z10). - -## Log your SB3 experiments - -```python -from wandb.integration.sb3 import WandbCallback - -model.learn(..., callback=WandbCallback()) -``` - -{{< img src="/images/integrations/stable_baselines_demo.gif" alt="Stable Baselines 3 training with W&B" >}} - -## WandbCallback Arguments - -| Argument | Usage | -| :--- | :--- | -| `verbose` | The verbosity of sb3 output | -| `model_save_path` | Path to the folder where the model will be saved, The default value is \`None\` so the model is not logged | -| `model_save_freq` | Frequency to save the model | -| `gradient_save_freq` | Frequency to log gradient. The default value is 0 so the gradients are not logged | - -## Basic Example - -The W&B SB3 integration uses the logs output from TensorBoard to log your metrics - -```python -import gym -from stable_baselines3 import PPO -from stable_baselines3.common.monitor import Monitor -from stable_baselines3.common.vec_env import DummyVecEnv, VecVideoRecorder -import wandb -from wandb.integration.sb3 import WandbCallback - - -config = { - "policy_type": "MlpPolicy", - "total_timesteps": 25000, - "env_name": "CartPole-v1", -} -run = wandb.init( - project="sb3", - config=config, - sync_tensorboard=True, # auto-upload sb3's tensorboard metrics - monitor_gym=True, # auto-upload the videos of agents playing the game - save_code=True, # optional -) - - -def make_env(): - env = gym.make(config["env_name"]) - env = Monitor(env) # record stats such as returns - return env - - -env = DummyVecEnv([make_env]) -env = VecVideoRecorder( - env, - f"videos/{run.id}", - record_video_trigger=lambda x: x % 2000 == 0, - video_length=200, -) -model = PPO(config["policy_type"], env, verbose=1, tensorboard_log=f"runs/{run.id}") -model.learn( - total_timesteps=config["total_timesteps"], - callback=WandbCallback( - gradient_save_freq=100, - model_save_path=f"models/{run.id}", - verbose=2, - ), -) -run.finish() -``` \ No newline at end of file diff --git a/content/en/guides/integrations/tensorboard.md b/content/en/guides/integrations/tensorboard.md deleted file mode 100644 index 263622154f..0000000000 --- a/content/en/guides/integrations/tensorboard.md +++ /dev/null @@ -1,110 +0,0 @@ ---- -menu: - default: - identifier: tensorboard - parent: integrations -title: TensorBoard -weight: 430 ---- -{{< cta-button colabLink="https://github.com/wandb/examples/blob/master/colabs/tensorboard/TensorBoard_and_Weights_and_Biases.ipynb" >}} - -{{% alert %}} -W&B support embedded TensorBoard for W&B Multi-tenant SaaS. -{{% /alert %}} - -Upload your TensorBoard logs to the cloud, quickly share your results among colleagues and classmates and keep your analysis in one centralized location. - -{{< img src="/images/integrations/tensorboard_oneline_code.webp" alt="TensorBoard integration code" >}} - -## Get started - -```python -import wandb - -# Start a wandb run with `sync_tensorboard=True` -wandb.init(project="my-project", sync_tensorboard=True) as run: - # Your training code using TensorBoard - ... - -``` - -Review an [example TensorBoard integration run](https://wandb.ai/rymc/simple-tensorboard-example/runs/oab614zf/tensorboard). - -Once your run finishes, you can access your TensorBoard event files in W&B and you can visualize your metrics in native W&B charts, together with additional useful information like the system's CPU or GPU utilization, the `git` state, the terminal command the run used, and more. - -{{% alert %}} -W&B supports TensorBoard with all versions of TensorFlow. W&B also supports TensorBoard 1.14 and higher with PyTorch as well as TensorBoardX. -{{% /alert %}} - -## Frequently asked questions - -### How can I log metrics to W&B that aren't logged to TensorBoard? - -If you need to log additional custom metrics that aren't being logged to TensorBoard, you can call `wandb.Run.log()` in your code `run.log({"custom": 0.8})` - -Setting the step argument in `run.log()` is turned off when syncing Tensorboard. If you'd like to set a different step count, you can log the metrics with a step metric as: - -`run.log({"custom": 0.8, "global_step": global_step})` - -### How do I configure Tensorboard when I'm using it with `wandb`? - -If you want more control over how TensorBoard is patched you can call `wandb.tensorboard.patch` instead of passing `sync_tensorboard=True` to `wandb.init`. - -```python -import wandb - -wandb.tensorboard.patch(root_logdir="") -run = wandb.init() - -# Finish the wandb run to upload the tensorboard logs to W&B (if running in Notebook) -run.finish() -``` - -You can pass `tensorboard_x=False` to this method to ensure vanilla TensorBoard is patched, if you're using TensorBoard > 1.14 with PyTorch you can pass `pytorch=True` to ensure it's patched. Both of these options have smart defaults depending on what versions of these libraries have been imported. - -By default, we also sync the `tfevents` files and any `.pbtxt` files. This enables us to launch a TensorBoard instance on your behalf. You will see a [TensorBoard tab](https://www.wandb.com/articles/hosted-tensorboard) on the run page. This behavior can be turned off by passing `save=False` to `wandb.tensorboard.patch` - -```python -import wandb - -run = wandb.init() -wandb.tensorboard.patch(save=False, tensorboard_x=True) - -# If running in a notebook, finish the wandb run to upload the tensorboard logs to W&B -run.finish() -``` - -{{% alert color="secondary" %}} -You must call either `wandb.init()` or `wandb.tensorboard.patch` **before** calling `tf.summary.create_file_writer` or constructing a `SummaryWriter` via `torch.utils.tensorboard`. -{{% /alert %}} - -### How do I sync historical TensorBoard runs? - -If you have existing `tfevents` files stored locally and you would like to import them into W&B, you can run `wandb sync log_dir`, where `log_dir` is a local directory containing the `tfevents` files. - -### How do I use Google Colab or Jupyter with TensorBoard? - -If running your code in a Jupyter or Colab notebook, make sure to call `wandb.Run.finish()` and the end of your training. This will finish the wandb run and upload the tensorboard logs to W&B so they can be visualized. This is not necessary when running a `.py` script as wandb finishes automatically when a script finishes. - -To run shell commands in a notebook environment, you must prepend a `!`, as in `!wandb sync directoryname`. - -### How do I use PyTorch with TensorBoard? - -If you use PyTorch's TensorBoard integration, you may need to manually upload the PyTorch Profiler JSON file. - -```python -with wandb.init(project="my-project", sync_tensorboard=True) as run: - run.save(glob.glob(f"runs/*.pt.trace.json")[0], base_path=f"runs") -``` - -### Can I sync tfevents files stored in the cloud? - -`wandb` 0.20.0 and above supports syncing `tfevents` files stored in S3, GCS or Azure. `wandb` uses the default credentials for each cloud provider, corresponding to the commands in the following table: - -| Cloud provider | Credentials | Logging directory format | -| -------------- | --------------------------------------- | ------------------------------------- | -| S3 | `aws configure` | `s3://bucket/path/to/logs` | -| GCS | `gcloud auth application-default login` | `gs://bucket/path/to/logs` | -| Azure | `az login`[^1] | `az://account/container/path/to/logs` | - -[^1]: You must also set the `AZURE_STORAGE_ACCOUNT` and `AZURE_STORAGE_KEY` environment variables. diff --git a/content/en/guides/integrations/tensorflow.md b/content/en/guides/integrations/tensorflow.md deleted file mode 100644 index 18cbf03d50..0000000000 --- a/content/en/guides/integrations/tensorflow.md +++ /dev/null @@ -1,97 +0,0 @@ ---- -menu: - default: - identifier: tensorflow - parent: integrations -title: TensorFlow -weight: 440 ---- - -{{< cta-button colabLink="https://colab.research.google.com/drive/1JCpAbjkCFhYMT7LCQ399y35TS3jlMpvM" >}} - -## Get started - -If you're already using TensorBoard, it's easy to integrate with wandb. - -```python -import tensorflow as tf -import wandb -``` - -## Log custom metrics - -If you need to log additional custom metrics that aren't being logged to TensorBoard, you can call `run.log()` in your code `run.log({"custom": 0.8}) ` - -Setting the step argument in `run.log()` is turned off when syncing Tensorboard. If you'd like to set a different step count, you can log the metrics with a step metric as: - -``` python -with wandb.init(config=tf.flags.FLAGS, sync_tensorboard=True) as run: - run.log({"custom": 0.8, "global_step":global_step}, step=global_step) -``` - -## TensorFlow estimators hook - -If you want more control over what gets logged, wandb also provides a hook for TensorFlow estimators. It will log all `tf.summary` values in the graph. - -```python -import tensorflow as tf -import wandb - -run = wandb.init(config=tf.FLAGS) - -estimator.train(hooks=[wandb.tensorflow.WandbHook(steps_per_log=1000)]) -run.finish() -``` - -## Log manually - -The simplest way to log metrics in TensorFlow is by logging `tf.summary` with the TensorFlow logger: - -```python -import wandb -run = wandb.init(config=tf.flags.FLAGS, sync_tensorboard=True) -with tf.Session() as sess: - # ... - wandb.tensorflow.log(tf.summary.merge_all()) -``` - -With TensorFlow 2, the recommended way of training a model with a custom loop is via using `tf.GradientTape`. You can read more in the [TensorFlow custom training walkthrough](https://www.tensorflow.org/tutorials/customization/custom_training_walkthrough). If you want to incorporate `wandb` to log metrics in your custom TensorFlow training loops you can follow this snippet: - -```python - with tf.GradientTape() as tape: - # Get the probabilities - predictions = model(features) - # Calculate the loss - loss = loss_func(labels, predictions) - - # Log your metrics - run.log("loss": loss.numpy()) - # Get the gradients - gradients = tape.gradient(loss, model.trainable_variables) - # Update the weights - optimizer.apply_gradients(zip(gradients, model.trainable_variables)) -``` - -A [full example of customizing training loops in TensorFlow 2](https://www.wandb.com/articles/wandb-customizing-training-loops-in-tensorflow-2) is available. - -## How is W&B different from TensorBoard? - -When the cofounders started working on W&B, they were inspired to build a tool for the frustrated TensorBoard users at OpenAI. Here are a few things we've focused on improving: - -1. **Reproduce models**: W&B is good for experimentation, exploration, and reproducing models later. We capture not just the metrics, but also the hyperparameters and version of the code, and we can save your version-control status and model checkpoints for you so your project is reproducible. -2. **Automatic organization**: Whether you're picking up a project from a collaborator, coming back from a vacation, or dusting off an old project, W&B makes it easy to see all the models that have been tried so no one wastes hours, GPU cycles, or carbon re-running experiments. -3. **Fast, flexible integration**: Add W&B to your project in 5 minutes. Install our free open-source Python package and add a couple of lines to your code, and every time you run your model you'll have nice logged metrics and records. -4. **Persistent, centralized dashboard**: No matter where you train your models, whether on your local machine, in a shared lab cluster, or on spot instances in the cloud, your results are shared to the same centralized dashboard. You don't need to spend your time copying and organizing TensorBoard files from different machines. -5. **Powerful tables**: Search, filter, sort, and group results from different models. It's easy to look over thousands of model versions and find the best performing models for different tasks. TensorBoard isn't built to work well on large projects. -6. **Tools for collaboration**: Use W&B to organize complex machine learning projects. It's easy to share a link to W&B, and you can use private teams to have everyone sending results to a shared project. We also support collaboration via reports— add interactive visualizations and describe your work in markdown. This is a great way to keep a work log, share findings with your supervisor, or present findings to your lab or team. - -Get started with a [free account](https://wandb.ai) - -## Examples - -We've created a few examples for you to see how the integration works: - -* [Example on Github](https://github.com/wandb/examples/blob/master/examples/tensorflow/tf-estimator-mnist/mnist.py): MNIST example Using TensorFlow Estimators -* [Example on Github](https://github.com/wandb/examples/blob/master/examples/tensorflow/tf-cnn-fashion/train.py): Fashion MNIST example Using Raw TensorFlow -* [Wandb Dashboard](https://app.wandb.ai/l2k2/examples-tf-estimator-mnist/runs/p0ifowcb): View result on W&B -* Customizing Training Loops in TensorFlow 2 - [Article](https://www.wandb.com/articles/wandb-customizing-training-loops-in-tensorflow-2) | [Dashboard](https://app.wandb.ai/sayakpaul/custom_training_loops_tf) \ No newline at end of file diff --git a/content/en/guides/integrations/torchtune.md b/content/en/guides/integrations/torchtune.md deleted file mode 100644 index aa14a4f443..0000000000 --- a/content/en/guides/integrations/torchtune.md +++ /dev/null @@ -1,154 +0,0 @@ ---- -menu: - default: - identifier: torchtune - parent: integrations -title: Pytorch torchtune -weight: 320 ---- -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/torchtune/torchtune_and_wandb.ipynb" >}} - -[torchtune](https://pytorch.org/torchtune/stable/index.html) is a PyTorch-based library designed to streamline the authoring, fine-tuning, and experimentation processes for large language models (LLMs). Additionally, torchtune has built-in support for [logging with W&B](https://pytorch.org/torchtune/stable/deep_dives/wandb_logging.html), enhancing tracking and visualization of training processes. - -{{< img src="/images/integrations/torchtune_dashboard.png" alt="TorchTune training dashboard" >}} - -Check the W&B blog post on [Fine-tuning Mistral 7B using torchtune](https://wandb.ai/capecape/torchtune-mistral/reports/torchtune-The-new-PyTorch-LLM-fine-tuning-library---Vmlldzo3NTUwNjM0). - -## W&B logging at your fingertips - -{{< tabpane text=true >}} -{{% tab header="Command line" value="cli" %}} - -Override command line arguments at launch: - -```bash -tune run lora_finetune_single_device --config llama3/8B_lora_single_device \ - metric_logger._component_=torchtune.utils.metric_logging.WandBLogger \ - metric_logger.project="llama3_lora" \ - log_every_n_steps=5 -``` - -{{% /tab %}} -{{% tab header="Recipe's config" value="config" %}} - -Enable W&B logging on the recipe's config: - -```yaml -# inside llama3/8B_lora_single_device.yaml -metric_logger: - _component_: torchtune.utils.metric_logging.WandBLogger - project: llama3_lora -log_every_n_steps: 5 -``` - -{{% /tab %}} -{{< /tabpane >}} - -## Use the W&B metric logger - -Enable W&B logging on the recipe's config file by modifying the `metric_logger` section. Change the `_component_` to `torchtune.utils.metric_logging.WandBLogger` class. You can also pass a `project` name and `log_every_n_steps` to customize the logging behavior. - -You can also pass any other `kwargs` as you would to the [wandb.init()]({{< relref "/ref/python/functions/init.md" >}}) method. For example, if you are working on a team, you can pass the `entity` argument to the `WandBLogger` class to specify the team name. - -{{< tabpane text=true >}} -{{% tab header="Recipe's Config" value="config" %}} - -```yaml -# inside llama3/8B_lora_single_device.yaml -metric_logger: - _component_: torchtune.utils.metric_logging.WandBLogger - project: llama3_lora - entity: my_project - job_type: lora_finetune_single_device - group: my_awesome_experiments -log_every_n_steps: 5 -``` - -{{% /tab %}} - -{{% tab header="Command Line" value="cli" %}} - -```shell -tune run lora_finetune_single_device --config llama3/8B_lora_single_device \ - metric_logger._component_=torchtune.utils.metric_logging.WandBLogger \ - metric_logger.project="llama3_lora" \ - metric_logger.entity="my_project" \ - metric_logger.job_type="lora_finetune_single_device" \ - metric_logger.group="my_awesome_experiments" \ - log_every_n_steps=5 -``` - -{{% /tab %}} -{{< /tabpane >}} - -## What is logged? - -You can explore the W&B dashboard to see the logged metrics. By default W&B logs all of the hyperparameters from the config file and the launch overrides. - -W&B captures the resolved config on the **Overview** tab. W&B also stores the config in YAML format on the [Files tab](https://wandb.ai/capecape/torchtune/runs/joyknwwa/files). - -{{< img src="/images/integrations/torchtune_config.png" alt="TorchTune configuration" >}} - -### Logged Metrics - -Each recipe has its own training loop. Check each individual recipe to see its logged metrics, which include these by default: - -| Metric | Description | -| --- | --- | -| `loss` | The loss of the model | -| `lr` | The learning rate | -| `tokens_per_second` | The tokens per second of the model | -| `grad_norm` | The gradient norm of the model | -| `global_step` | Corresponds to the current step in the training loop. Takes into account gradient accumulation, basically every time an optimizer step is taken, the model is updated, the gradients are accumulated and the model is updated once every `gradient_accumulation_steps` | - -{{% alert %}} -`global_step` is not the same as the number of training steps. It corresponds to the current step in the training loop. Takes into account gradient accumulation, basically every time an optimizer step is taken the `global_step` is incremented by 1. For example, if the dataloader has 10 batches, gradient accumulation steps is 2 and run for 3 epochs, the optimizer will step 15 times, in this case `global_step` will range from 1 to 15. -{{% /alert %}} - -The streamlined design of torchtune allows to easily add custom metrics or modify the existing ones. It suffices to modify the corresponding [recipe file](https://github.com/pytorch/torchtune/tree/main/recipes), for example, computing one could log `current_epoch` as a percentage of the total number of epochs as following: - -```python -# inside `train.py` function in the recipe file -self._metric_logger.log_dict( - {"current_epoch": self.epochs * self.global_step / self._steps_per_epoch}, - step=self.global_step, -) -``` - -{{% alert %}} -This is a fast evolving library, the current metrics are subject to change. If you want to add a custom metric, you should modify the recipe and call the corresponding `self._metric_logger.*` function. -{{% /alert %}} - -## Save and load checkpoints - -The torchtune library supports various [checkpoint formats](https://pytorch.org/torchtune/stable/deep_dives/checkpointer.html). Depending on the origin of the model you are using, you should switch to the appropriate [checkpointer class](https://pytorch.org/torchtune/stable/deep_dives/checkpointer.html). - -If you want to save the model checkpoints to [W&B Artifacts]({{< relref "/guides/core/artifacts/" >}}), the simplest solution is to override the `save_checkpoint` functions inside the corresponding recipe. - -Here is an example of how you can override the `save_checkpoint` function to save the model checkpoints to W&B Artifacts. - -```python -def save_checkpoint(self, epoch: int) -> None: - ... - ## Let's save the checkpoint to W&B - ## depending on the Checkpointer Class the file will be named differently - ## Here is an example for the full_finetune case - checkpoint_file = Path.joinpath( - self._checkpointer._output_dir, f"torchtune_model_{epoch}" - ).with_suffix(".pt") - wandb_artifact = wandb.Artifact( - name=f"torchtune_model_{epoch}", - type="model", - # description of the model checkpoint - description="Model checkpoint", - # you can add whatever metadata you want as a dict - metadata={ - utils.SEED_KEY: self.seed, - utils.EPOCHS_KEY: self.epochs_run, - utils.TOTAL_EPOCHS_KEY: self.total_epochs, - utils.MAX_STEPS_KEY: self.max_steps_per_epoch, - }, - ) - wandb_artifact.add_file(checkpoint_file) - wandb.log_artifact(wandb_artifact) -``` \ No newline at end of file diff --git a/content/en/guides/integrations/ultralytics.md b/content/en/guides/integrations/ultralytics.md deleted file mode 100644 index f9c34f8232..0000000000 --- a/content/en/guides/integrations/ultralytics.md +++ /dev/null @@ -1,144 +0,0 @@ ---- -menu: - default: - identifier: ultralytics - parent: integrations -title: Ultralytics -weight: 480 ---- -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/ultralytics/01_train_val.ipynb" >}} - -[Ultralytics](https://github.com/ultralytics/ultralytics) is the home for cutting-edge, state-of-the-art computer vision models for tasks like image classification, object detection, image segmentation, and pose estimation. Not only it hosts [YOLOv8](https://docs.ultralytics.com/models/yolov8/), the latest iteration in the YOLO series of real-time object detection models, but other powerful computer vision models such as [SAM (Segment Anything Model)](https://docs.ultralytics.com/models/sam/#introduction-to-sam-the-segment-anything-model), [RT-DETR](https://docs.ultralytics.com/models/rtdetr/), [YOLO-NAS](https://docs.ultralytics.com/models/yolo-nas/), etc. Besides providing implementations of these models, Ultralytics also provides us with out-of-the-box workflows for training, fine-tuning, and applying these models using an easy-to-use API. - -## Get started - -1. Install `ultralytics` and `wandb`. - - {{< tabpane text=true >}} - {{% tab header="Command Line" value="script" %}} - - ```shell - pip install --upgrade ultralytics==8.0.238 wandb - - # or - # conda install ultralytics - ``` - - {{% /tab %}} - {{% tab header="Notebook" value="notebook" %}} - - ```bash - !pip install --upgrade ultralytics==8.0.238 wandb - ``` - - {{% /tab %}} - {{< /tabpane >}} - - The development team has tested the integration with `ultralyticsv8.0.238` and below. To report any issues with the integration, create a [GitHub issue](https://github.com/wandb/wandb/issues/new?template=sdk-bug.yml) with the tag `yolov8`. - -## Track experiments and visualize validation results - -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/ultralytics/01_train_val.ipynb" >}} - -This section demonstrates a typical workflow of using an [Ultralytics](https://docs.ultralytics.com/modes/predict/) model for training, fine-tuning, and validation and performing experiment tracking, model-checkpointing, and visualization of the model's performance using [W&B](https://wandb.ai/site). - -You can also check out about the integration in this report: [Supercharging Ultralytics with W&B](https://wandb.ai/geekyrakshit/ultralytics/reports/Supercharging-Ultralytics-with-Weights-Biases--Vmlldzo0OTMyMDI4) - -To use the W&B integration with Ultralytics, import the `wandb.integration.ultralytics.add_wandb_callback` function. - -```python -import wandb -from wandb.integration.ultralytics import add_wandb_callback - -from ultralytics import YOLO -``` - -Initialize the `YOLO` model of your choice, and invoke the `add_wandb_callback` function on it before performing inference with the model. This ensures that when you perform training, fine-tuning, validation, or inference, it automatically saves the experiment logs and the images, overlaid with both ground-truth and the respective prediction results using the [interactive overlays for computer vision tasks]({{< relref "/guides/models/track/log/media#image-overlays-in-tables" >}}) on W&B along with additional insights in a [`wandb.Table`]({{< relref "/guides/models/tables/" >}}). - -```python -with wandb.init(project="ultralytics", job_type="train") as run: - - # Initialize YOLO Model - model = YOLO("yolov8n.pt") - - # Add W&B callback for Ultralytics - add_wandb_callback(model, enable_model_checkpointing=True) - - # Train/fine-tune your model - # At the end of each epoch, predictions on validation batches are logged - # to a W&B table with insightful and interactive overlays for - # computer vision tasks - model.train(project="ultralytics", data="coco128.yaml", epochs=5, imgsz=640) -``` - -Here's how experiments tracked using W&B for an Ultralytics training or fine-tuning workflow looks like: - -
YOLO Fine-tuning Experiments
- -Here's how epoch-wise validation results are visualized using a [W&B Table]({{< relref "/guides/models/tables/" >}}): - -
WandB Validation Visualization Table
- -## Visualize prediction results - -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/ultralytics/00_inference.ipynb" >}} - -This section demonstrates a typical workflow of using an [Ultralytics](https://docs.ultralytics.com/modes/predict/) model for inference and visualizing the results using [W&B](https://wandb.ai/site). - -You can try out the code in Google Colab: [Open in Colab](https://wandb.me/ultralytics-inference). - -You can also check out about the integration in this report: [Supercharging Ultralytics with W&B](https://wandb.ai/geekyrakshit/ultralytics/reports/Supercharging-Ultralytics-with-Weights-Biases--Vmlldzo0OTMyMDI4) - -In order to use the W&B integration with Ultralytics, we need to import the `wandb.integration.ultralytics.add_wandb_callback` function. - -```python -import wandb -from wandb.integration.ultralytics import add_wandb_callback - -from ultralytics.engine.model import YOLO -``` - -Download a few images to test the integration on. You can use still images, videos, or camera sources. For more information on inference sources, check out the [Ultralytics docs](https://docs.ultralytics.com/modes/predict/). - -```bash -!wget https://raw.githubusercontent.com/wandb/examples/ultralytics/colabs/ultralytics/assets/img1.png -!wget https://raw.githubusercontent.com/wandb/examples/ultralytics/colabs/ultralytics/assets/img2.png -!wget https://raw.githubusercontent.com/wandb/examples/ultralytics/colabs/ultralytics/assets/img4.png -!wget https://raw.githubusercontent.com/wandb/examples/ultralytics/colabs/ultralytics/assets/img5.png -``` - -Initialize a W&B [run]({{< relref "/guides/models/track/runs/" >}}) using `wandb.init()`. Next, Initialize your desired `YOLO` model and invoke the `add_wandb_callback` function on it before you perform inference with the model. This ensures that when you perform inference, it automatically logs the images overlaid with your [interactive overlays for computer vision tasks]({{< relref "/guides/models/track/log/media#image-overlays-in-tables" >}}) along with additional insights in a [`wandb.Table`]({{< relref "/guides/models/tables/" >}}). - -```python -# Initialize W&B Run -with wandb.init(project="ultralytics", job_type="inference") as run: - # Initialize YOLO Model - model = YOLO("yolov8n.pt") - - # Add W&B callback for Ultralytics - add_wandb_callback(model, enable_model_checkpointing=True) - - # Perform prediction which automatically logs to a W&B Table - # with interactive overlays for bounding boxes, segmentation masks - model( - [ - "./assets/img1.jpeg", - "./assets/img3.png", - "./assets/img4.jpeg", - "./assets/img5.jpeg", - ] - ) -``` - -You do not need to explicitly initialize a run using `wandb.init()` in case of a training or fine-tuning workflow. However, if the code involves only prediction, you must explicitly create a run. - -Here's how the interactive bbox overlay looks: - -
WandB Image Overlay
- -For more details, see the [W&B image overlays guide]({{< relref "/guides/models/track/log/media.md#image-overlays" >}}). - -## More resources - -* [Supercharging Ultralytics with W&B](https://wandb.ai/geekyrakshit/ultralytics/reports/Supercharging-Ultralytics-with-Weights-Biases--Vmlldzo0OTMyMDI4) -* [Object Detection using YOLOv8: An End-to-End Workflow](https://wandb.ai/reviewco/object-detection-bdd/reports/Object-Detection-using-YOLOv8-An-End-to-End-Workflow--Vmlldzo1NTAyMDQ1) \ No newline at end of file diff --git a/content/en/guides/integrations/w-and-b-for-julia.md b/content/en/guides/integrations/w-and-b-for-julia.md deleted file mode 100644 index 73318ef33a..0000000000 --- a/content/en/guides/integrations/w-and-b-for-julia.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -description: How to integrate W&B with Julia. -menu: - default: - identifier: w-and-b-for-julia - parent: integrations -title: W&B for Julia -weight: 450 ---- - -For those running machine learning experiments in the Julia programming language, a community contributor has created an unofficial set of Julia bindings called [wandb.jl](https://github.com/avik-pal/Wandb.jl) that you can use. - -You can find examples [in the documentation](https://github.com/avik-pal/Wandb.jl/tree/main/docs/src/examples) on the wandb.jl repository. Their "Getting Started" example is here: - -```julia -using Wandb, Dates, Logging - -# Start a new run, tracking hyperparameters in config -lg = WandbLogger(project = "Wandb.jl", - name = "wandbjl-demo-$(now())", - config = Dict("learning_rate" => 0.01, - "dropout" => 0.2, - "architecture" => "CNN", - "dataset" => "CIFAR-100")) - -# Use LoggingExtras.jl to log to multiple loggers together -global_logger(lg) - -# Simulating the training or evaluation loop -for x ∈ 1:50 - acc = log(1 + x + rand() * get_config(lg, "learning_rate") + rand() + get_config(lg, "dropout")) - loss = 10 - log(1 + x + rand() + x * get_config(lg, "learning_rate") + rand() + get_config(lg, "dropout")) - # Log metrics from your script to W&B - @info "metrics" accuracy=acc loss=loss -end - -# Finish the run -close(lg) -``` \ No newline at end of file diff --git a/content/en/guides/integrations/xgboost.md b/content/en/guides/integrations/xgboost.md deleted file mode 100644 index 515a97d8c6..0000000000 --- a/content/en/guides/integrations/xgboost.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -description: Track your trees with W&B. -menu: - default: - identifier: xgboost - parent: integrations -title: XGBoost -weight: 460 ---- -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/boosting/Credit_Scorecards_with_XGBoost_and_W%26B.ipynb" >}} - -The `wandb` library has a `WandbCallback` callback for logging metrics, configs and saved boosters from training with XGBoost. Here you can see a [live W&B Dashboard](https://wandb.ai/morg/credit_scorecard) with outputs from the XGBoost `WandbCallback`. - -{{< img src="/images/integrations/xgb_dashboard.png" alt="W&B Dashboard using XGBoost" >}} - -## Get started - -Logging XGBoost metrics, configs and booster models to W&B is as easy as passing the `WandbCallback` to XGBoost: - -```python -from wandb.integration.xgboost import WandbCallback -import xgboost as XGBClassifier - -... -# Start a wandb run -with wandb.init() as run: - # Pass WandbCallback to the model - bst = XGBClassifier() - bst.fit(X_train, y_train, callbacks=[WandbCallback(log_model=True)]) -``` - -You can open [this notebook](https://wandb.me/xgboost) for a comprehensive look at logging with XGBoost and W&B - -## `WandbCallback` reference - -### Functionality -Passing `WandbCallback` to a XGBoost model will: -- log the booster model configuration to W&B -- log evaluation metrics collected by XGBoost, such as rmse, accuracy etc to W&B -- log training metrics collected by XGBoost (if you provide data to eval_set) -- log the best score and the best iteration -- save and upload your trained model to W&B Artifacts (when `log_model = True`) -- log feature importance plot when `log_feature_importance=True` (default). -- Capture the best eval metric in `wandb.Run.summary` when `define_metric=True` (default). - -### Arguments -- `log_model`: (boolean) if True save and upload the model to W&B Artifacts - -- `log_feature_importance`: (boolean) if True log a feature importance bar plot - -- `importance_type`: (str) one of `{weight, gain, cover, total_gain, total_cover}` for tree model. weight for linear model. - -- `define_metric`: (boolean) if True (default) capture model performance at the best step, instead of the last step, of training in your `run.summary`. - - -You can review the [source code for WandbCallback](https://github.com/wandb/wandb/blob/main/wandb/integration/xgboost/xgboost.py). - -For additional examples, check out the [repository of examples on GitHub](https://github.com/wandb/examples/tree/master/examples/boosting-algorithms). - -## Tune your hyperparameters with Sweeps - -Attaining the maximum performance out of models requires tuning hyperparameters, like tree depth and learning rate. W&B [Sweeps]({{< relref "/guides/models/sweeps/" >}}) is a powerful toolkit for configuring, orchestrating, and analyzing large hyperparameter testing experiments. - -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/boosting/Using_W%26B_Sweeps_with_XGBoost.ipynb" >}} - -You can also try this [XGBoost & Sweeps Python script](https://github.com/wandb/examples/blob/master/examples/wandb-sweeps/sweeps-xgboost/xgboost_tune.py). - -{{< img src="/images/integrations/xgboost_sweeps_example.png" alt="XGBoost performance comparison" >}} \ No newline at end of file diff --git a/content/en/guides/integrations/yolov5.md b/content/en/guides/integrations/yolov5.md deleted file mode 100644 index e7a4d8a7a7..0000000000 --- a/content/en/guides/integrations/yolov5.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -menu: - default: - identifier: yolov5 - parent: integrations -title: YOLOv5 -weight: 470 ---- - -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/yolo/Train_and_Debug_YOLOv5_Models_with_Weights_%26_Biases_.ipynb" >}} - -[Ultralytics' YOLOv5](https://ultralytics.com/yolo) ("You Only Look Once") model family enables real-time object detection with convolutional neural networks without all the agonizing pain. - -[W&B](https://wandb.com) is directly integrated into YOLOv5, providing experiment metric tracking, model and dataset versioning, rich model prediction visualization, and more. **It's as easy as running a single `pip install` before you run your YOLO experiments.** - -{{% alert %}} -All W&B logging features are compatible with data-parallel multi-GPU training, such as with [PyTorch DDP](https://pytorch.org/tutorials/intermediate/ddp_tutorial.html). -{{% /alert %}} - -## Track core experiments -Simply by installing `wandb`, you'll activate the built-in W&B [logging features]({{< relref "/guides/models/track/log/" >}}): system metrics, model metrics, and media logged to interactive [Dashboards]({{< relref "/guides/models/track/workspaces.md" >}}). - -```python -pip install wandb -git clone https://github.com/ultralytics/yolov5.git -python yolov5/train.py # train a small network on a small dataset -``` - -Just follow the links printed to the standard out by wandb. - -{{< img src="/images/integrations/yolov5_experiment_tracking.png" alt="All these charts and more." >}} - -## Customize the integration - -By passing a few simple command line arguments to YOLO, you can take advantage of even more W&B features. - -* If you pass a number to `--save_period`, W&B saves a [model version]({{< relref "/guides/core/registry/" >}}) at the end of every `save_period` epochs. The model version includes the model weights and tags the best-performing model in the validation set. -* Turning on the `--upload_dataset` flag will also upload the dataset for data versioning. -* Passing a number to `--bbox_interval` will turn on [data visualization]({{< relref "../" >}}). At the end of every `bbox_interval` epochs, the outputs of the model on the validation set will be uploaded to W&B. - -{{< tabpane text=true >}} -{{% tab header="Model Versioning Only" value="modelversioning" %}} - -```python -python yolov5/train.py --epochs 20 --save_period 1 -``` - -{{% /tab %}} -{{% tab header="Model Versioning and Data Visualization" value="bothversioning" %}} - -```python -python yolov5/train.py --epochs 20 --save_period 1 \ - --upload_dataset --bbox_interval 1 -``` - -{{% /tab %}} -{{< /tabpane >}} - -{{% alert %}} -Every W&B account comes with 100 GB of free storage for datasets and models. -{{% /alert %}} - -Here's what that looks like. - -{{< img src="/images/integrations/yolov5_model_versioning.png" alt="Model versioning" >}} - -{{< img src="/images/integrations/yolov5_data_visualization.png" alt="Data visualization" >}} - -{{% alert %}} -With data and model versioning, you can resume paused or crashed experiments from any device, no setup necessary. Check out [the Colab ](https://wandb.me/yolo-colab) for details. -{{% /alert %}} \ No newline at end of file diff --git a/content/en/guides/integrations/yolox.md b/content/en/guides/integrations/yolox.md deleted file mode 100644 index 0fb2dd8388..0000000000 --- a/content/en/guides/integrations/yolox.md +++ /dev/null @@ -1,101 +0,0 @@ ---- -description: How to integrate W&B with YOLOX. -menu: - default: - identifier: yolox - parent: integrations -title: YOLOX -weight: 490 ---- - -[YOLOX](https://github.com/Megvii-BaseDetection/YOLOX) is an anchor-free version of YOLO with strong performance for object detection. You can use the YOLOX W&B integration to turn on logging of metrics related to training, validation, and the system, and you can interactively validate predictions with a single command-line argument. - -## Sign up and create an API key - -An API key authenticates your machine to W&B. You can generate an API key from your user profile. - -{{% alert %}} -For a more streamlined approach, you can generate an API key by going directly to the [W&B authorization page](https://wandb.ai/authorize). Copy the displayed API key and save it in a secure location such as a password manager. -{{% /alert %}} - -1. Click your user profile icon in the upper right corner. -1. Select **User Settings**, then scroll to the **API Keys** section. -1. Click **Reveal**. Copy the displayed API key. To hide the API key, reload the page. - -## Install the `wandb` library and log in - -To install the `wandb` library locally and log in: - -{{< tabpane text=true >}} -{{% tab header="Command Line" value="cli" %}} - -1. Set the `WANDB_API_KEY` [environment variable]({{< relref "/guides/models/track/environment-variables.md" >}}) to your API key. - - ```bash - export WANDB_API_KEY= - ``` - -1. Install the `wandb` library and log in. - - - - ```shell - pip install wandb - - wandb login - ``` - -{{% /tab %}} - -{{% tab header="Python" value="python" %}} - -```bash -pip install wandb -``` -```python -import wandb -wandb.login() -``` - -{{% /tab %}} - -{{% tab header="Python notebook" value="python" %}} - -```notebook -!pip install wandb - -import wandb -wandb.login() -``` - -{{% /tab %}} -{{< /tabpane >}} - -## Log metrics - -Use the `--logger wandb` command line argument to turn on logging with wandb. Optionally you can also pass all of the arguments that [`wandb.init()`]({{< relref "/ref/python/functions/init.md" >}}) expects; prepend each argument with `wandb-`. - -`num_eval_imges` controls the number of validation set images and predictions that are logged to W&B tables for model evaluation. - -```shell -# login to wandb -wandb login - -# call your yolox training script with the `wandb` logger argument -python tools/train.py .... --logger wandb \ - wandb-project \ - wandb-entity - wandb-name \ - wandb-id \ - wandb-save_dir \ - wandb-num_eval_imges \ - wandb-log_checkpoints -``` - -## Example - -[Example dashboard with YOLOX training and validation metrics ->](https://wandb.ai/manan-goel/yolox-nano/runs/3pzfeom) - -{{< img src="/images/integrations/yolox_example_dashboard.png" alt="YOLOX training dashboard" >}} - -Any questions or issues about this W&B integration? Open an issue in the [YOLOX repository](https://github.com/Megvii-BaseDetection/YOLOX). \ No newline at end of file diff --git a/content/en/guides/models/_index.md b/content/en/guides/models/_index.md deleted file mode 100644 index 806dcd90fb..0000000000 --- a/content/en/guides/models/_index.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -menu: - default: - identifier: models -title: W&B Models -weight: 30 -no_list: true ---- - -W&B Models is the system of record for ML Practitioners who want to organize their models, boost productivity and collaboration, and deliver production ML at scale. - -{{< img src="/images/general/architecture.png" alt="W&B Models architecture diagram" >}} - -With W&B Models, you can: - -- Track and visualize all [ML experiments]({{< relref "/guides/models/track/" >}}). -- Optimize and fine-tune models at scale with [hyperparameter sweeps]({{< relref "/guides/models/sweeps/" >}}). -- [Maintain a centralized hub of all models]({{< relref "/guides/core/registry/" >}}), with a seamless handoff point to devops and deployment -- Configure custom automations that trigger key workflows for [model CI/CD]({{< relref "/guides/core/automations/" >}}). - -Machine learning practitioners rely on W&B Models as their ML system of record to track and visualize experiments, manage model versions and lineage, and optimize hyperparameters. \ No newline at end of file diff --git a/content/en/guides/models/app/_index.md b/content/en/guides/models/app/_index.md deleted file mode 100644 index b23541a57e..0000000000 --- a/content/en/guides/models/app/_index.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -menu: - default: - identifier: w-b-app-ui-reference - parent: models -title: W&B App UI -url: guides/app -cascade: -- url: guides/app/:filename ---- - -This section provides details to help you use the W&B App UI. Manage workspaces, teams, and registries, visualize and observe experiments, create panels and reports, configure automations, and more. - -Access the W&B App in a web browser. - -- A W&B Multi-tenant deployment is accessible on the public web at https://wandb.ai/. -- A W&B Dedicated Cloud deployment is accessible at the domain you configured when you signed up for W&B Dedicated Cloud. An admin user can update the domain in the W&B Management Console. Click on the icon in the top right corner and then click **System console**. -- A W&B Self-Managed deployment is accessible at the hostname you configured when you deployed W&B. For example, if you deploy using Helm, the hostname is configured in `values.global.host`. An admin user can update the domain in the W&B Management Console. Click on the icon in the top right corner and then click **System console**. - -Learn more: - -- [Track experiments]({{< relref "/guides/models/track/" >}}) using runs or sweeps. -- [Configure deployment settings]({{< relref "settings-page/" >}}) and [defaults]({{< relref "features/cascade-settings.md" >}}). -- [Add panels]({{< relref "/guides/models/app/features/panels/" >}}) to visualize your experiments, such as line plots, bar plots, media panels, query panels, and tables. -- [Add custom charts]({{< relref "/guides/models/app/features/custom-charts/" >}}). -- [Create and share reports]({{< relref "/guides/core/reports/" >}}). - diff --git a/content/en/guides/models/app/console-logs.md b/content/en/guides/models/app/console-logs.md deleted file mode 100644 index 9bdcf1aa52..0000000000 --- a/content/en/guides/models/app/console-logs.md +++ /dev/null @@ -1,154 +0,0 @@ ---- -title: Console logs -url: guides/app/console-logs ---- - - -When you run an experiment, you may notice various messages printed to your console. W&B captures console logs and displays them in the W&B App. Use these messages to debug and monitor the behavior of your experiment. - -## View console logs - -Access console logs for a run in the W&B App: - -1. Navigate to your project in the W&B App. -2. Select a run within the **Runs** table. -3. Click the **Logs** tab in the project sidebar. - -{{% alert %}} -Only 10,000 lines of your logs are shown due to storage limitations -{{% /alert %}} - - - -## Types of console logs - -W&B captures several types of console logs: informational messages, warnings, and errors, with a prefix to indicate the log's severity. - -### Informational messages -Informational messages provide updates about the run's progress and status. They are typically prefixed with `wandb:`. - -```text -wandb: Starting Run: abc123 -wandb: Run data is saved locally in ./wandb/run-20240125_120000-abc123 -``` - -### Warning messages -Warnings about potential issues that don't stop execution are prefixed with `WARNING:` - -```text -WARNING Found .wandb file, not streaming tensorboard metrics. -WARNING These runs were logged with a previous version of wandb. -``` - -### Error messages -Error messages for serious issues are prefixed with `ERROR:`. These indicate problems that may prevent the run from completing successfully. - -```text -ERROR Unable to save notebook session history. -ERROR Failed to save notebook. -``` - -## Console log settings - -Within your code, pass the `wandb.Settings` object to `wandb.init()` to configure how W&B handles console logs. Within `wandb.Settings`, you can set the following parameters to control console log behavior: - -- `show_errors`: If set to `True`, error messages are displayed in the W&B App. If set to `False`, error messages are not shown. -- `silent`: If set to `True`, all W&B console output will be suppressed. This is useful for production environments where you want to minimize console noise. -- `show_warnings`: If set to `True`, warning messages are displayed in the W&B App. If set to `False`, warning messages are not shown. -- `show_info`: If set to `True`, informational messages are displayed in the W&B App. If set to `False`, informational messages are not shown. - -The following example shows how to configure these settings: - -```python -import wandb - -settings = wandb.Settings( - show_errors=True, # Show error messages in the W&B App - silent=False, # Disable all W&B console output - show_warnings=True # Show warning messages in the W&B App -) - -with wandb.init(settings=settings) as run: - # Your training code here - run.log({"accuracy": 0.95}) -``` - -## Custom logging - -W&B captures console logs from your application, but it does not interfere with your own logging setup. You can use Python's built-in `print()` function or the `logging` module to log messages. - -```python -import wandb - -with wandb.init(project="my-project") as run: - for i in range(100, 1000, 100): - # This will log to W&B and print to console - run.log({"epoch": i, "loss": 0.1 * i}) - print(f"epoch: {i} loss: {0.1 * i}") -``` - -The console logs will look similar to the following: - -```text -1 epoch: 100 loss: 1.3191105127334595 -2 epoch: 200 loss: 0.8664389848709106 -3 epoch: 300 loss: 0.6157898902893066 -4 epoch: 400 loss: 0.4961796700954437 -5 epoch: 500 loss: 0.42592573165893555 -6 epoch: 600 loss: 0.3771176040172577 -7 epoch: 700 loss: 0.3393910825252533 -8 epoch: 800 loss: 0.3082585036754608 -9 epoch: 900 loss: 0.28154927492141724 -``` - -## Time stamps - -Time stamps are automatically added to each console log entry. This allows you to track when each log message was generated. - -You can toggle the time stamps in the console logs on or off. Within the console page select the **Timestamp visible** dropdown in the top left corner. You can choose to show or hide the time stamps. - -## Search console logs - -Use the search bar at the top of the console logs page to filter logs by keywords. You can search for specific terms, labels, or error messages. - -## Filter with custom labels - -{{% alert color="secondary" %}} -Parameters prefixed by `x_` (such as `x_label`) are in public preview. Create a [GitHub issue in the W&B repository](https://github.com/wandb/wandb) to provide feedback. -{{% /alert %}} - -You can filter console logs based on the labels you pass as arguments for `x_label` in `wandb.Settings` in the UI search bar located at the top of the console log page. - -```python -import wandb - -# Initialize a run in the primary node -run = wandb.init( - entity="entity", - project="project", - settings=wandb.Settings( - x_label="custom_label" # (Optional) Custom label for filtering logs - ) -) -``` - -## Download console logs - -Download console logs for a run in the W&B App: - -1. Navigate to your project in the W&B App. -2. Select a run within the **Runs** table. -3. Click the **Logs** tab in the project sidebar. -4. Click the download button in the top right corner of the console logs page. - - -## Copy console logs - -Copy console logs for a run in the W&B App: - -1. Navigate to your project in the W&B App. -2. Select a run within the **Runs** table. -3. Click the **Logs** tab in the project sidebar. -4. Click the copy button in the top right corner of the console logs page. \ No newline at end of file diff --git a/content/en/guides/models/app/features/cascade-settings.md b/content/en/guides/models/app/features/cascade-settings.md deleted file mode 100644 index b3e936f288..0000000000 --- a/content/en/guides/models/app/features/cascade-settings.md +++ /dev/null @@ -1,127 +0,0 @@ ---- -menu: - default: - identifier: cascade-settings - parent: w-b-app-ui-reference -title: Manage workspace, section, and panel settings -url: guides/app/features/cascade-settings ---- - -Within a given workspace page there are three different setting levels: workspaces, sections, and panels. [Workspace settings]({{< relref "#workspace-settings" >}}) apply to the entire workspace. [Section settings]({{< relref "#section-settings" >}}) apply to all panels within a section. [Panel settings]({{< relref "#panel-settings" >}}) apply to individual panels. - -## Workspace settings - -Workspace settings apply to all sections and all panels within those sections. You can edit two types of workspace settings: [Workspace layout]({{< relref "#workspace-layout-options" >}}) and [Line plots]({{< relref "#line-plots-options" >}}). **Workspace layouts** determine the structure of the workspace, while **Line plots** settings control the default settings for line plots in the workspace.ne plots** settings control the default settings for line plots in the workspace. - -To edit settings that apply to the overall structure of this workspace: - -1. Navigate to your project workspace. -2. Click the gear icon next to the **New report** button to view the workspace settings. -3. Choose **Workspace layout** to change the workspace's layout, or choose **Line plots** to configure default settings for line plots in the workspace. -{{< img src="/images/app_ui/workspace_settings.png" alt="Workspace settings gear icon" >}} - -{{% alert %}} -After customizing your workspace, you can use _workspace templates_ to quickly create new workspaces with the same settings. Refer to [Workspace templates]({{< relref "/guides/models/track/workspaces.md#workspace-templates" >}}). -{{% /alert %}} - -### Workspace layout options - -Configure a workspaces layout to define the overall structure of the workspace. This includes sectioning logic and panel organization. - -{{< img src="/images/app_ui/workspace_layout_settings.png" alt="Workspace layout options" >}} - -The workspace layout options page shows whether the workspace generates panels automatically or manually. To adjust a workspace's panel generation mode, refer to [Panels]({{< relref "panels/" >}}). - -This table describes each workspace layout option. - -| Workspace setting | Description | -| ----- | ----- | -| **Hide empty sections during search** | Hide sections that do not contain any panels when searching for a panel.| -| **Sort panels alphabetically** | Sort panels in your workspaces alphabetically. | -| **Section organization** | Remove all existing sections and panels and repopulate them with new section names. Groups the newly populated sections either by first or last prefix. | - -{{% alert %}} -W&B suggests that you organize sections by grouping the first prefix rather than grouping by the last prefix. Grouping by the first prefix can result in fewer sections and better performance. -{{% /alert %}} - -### Line plots options -Set global defaults and custom rules for line plots in a workspace by modifying the **Line plots** workspace settings. - -{{< img src="/images/app_ui/workspace_settings_line_plots.png" alt="Line plot settings" >}} - -You can edit two main settings within **Line plots** settings: **Data** and **Display preferences**. The **Data** tab contains the following settings: - - -| Line plot setting | Description | -| ----- | ----- | -| **X axis** | The scale of the x-axis in line plots. The x-axis is set to **Step** by default. See the proceeding table for the list of x-axis options. | -| **Range** | Minimum and maximum settings to display for x axis. | -| **Smoothing** | Change the smoothing on the line plot. For more information about smoothing, see [Smooth line plots]({{< relref "/guides/models/app/features/panels/line-plot/smoothing.md" >}}). | -| **Outliers** | Rescale to exclude outliers from the default plot min and max scale. | -| **Point aggregation method** | Improve data visualization accuracy and performance. See [Point aggregation]({{< relref "/guides/models/app/features/panels/line-plot/sampling.md" >}}) for more information. | -| **Max number of runs or groups** | Limit the number of runs or groups displayed on the line plot. | - -In addition to **Step**, there are other options for the x-axis: - -| X axis option | Description | -| ------------- | ----------- | -| **Relative Time (Wall)**| Timestamp since the process starts. For example, suppose start a run and resume that run the next day. If you then log something, the recorded point is 24 hours.| -| **Relative Time (Process)** | Timestamp inside the running process. For example, suppose you start a run and let it continue for 10 seconds. The next day you resume that run. The point is recorded as 10 seconds. | -| **Wall Time** | Minutes elapsed since the start of the first run on the graph. | -| **Step** | Increments each time you call `wandb.Run.log()`.| - - - -{{% alert %}} -For information on how to edit an individual line plot, see [Edit line panel settings]({{< relref "/guides/models/app/features/panels/line-plot/#edit-line-panel-settings" >}}) in Line plots. -{{% /alert %}} - - -Within the **Display preferences** tab, you can toggle the proceeding settings: - -| Display preference | Description | -| ----- | ----- | -| **Remove legends from all panels** | Remove the panel's legend | -| **Display colored run names in tooltips** | Show the runs as colored text within the tooltip | -| **Only show highlighted run in companion chart tooltip** | Display only highlighted runs in chart tooltip | -| **Number of runs shown in tooltips** | Display the number of runs in the tooltip | -| **Display full run names on the primary chart tooltip**| Display the full name of the run in the chart tooltip | - - - - -## Section settings - -Section settings apply to all panels within that section. Within a workspace section you can sort panels, rearrange panels, and rename the section name. - -Modify section settings by selecting the three horizontal dots (**...**) in the upper right corner of a section. - -{{< img src="/images/app_ui/section_settings.png" alt="Section settings menu" >}} - -From the dropdown, you can edit the following settings that apply to the entire section: - -| Section setting | Description | -| ----- | ----- | -| **Rename a section** | Rename the name of the section | -| **Sort panels A-Z** | Sort panels within a section alphabetically | -| **Rearrange panels** | Select and drag a panel within a section to manually order your panels | - -The proceeding animation demonstrates how to rearrange panels within a section: - -{{< img src="/images/app_ui/rearrange_panels.gif" alt="Rearranging panels" >}} - -{{% alert %}} -In addition to the settings described in the preceding table, you can also edit how sections appear in your workspaces such as **Add section below**, **Add section above**, **Delete section**, and **Add section to report**. -{{% /alert %}} - -## Panel settings - -Customize an individual panel's settings to compare multiple lines on the same plot, calculate custom axes, rename labels, and more. To edit a panel's settings: - -1. Hover your mouse over the panel you want to edit. -2. Select the pencil icon that appears. -{{< img src="/images/app_ui/panel_settings.png" alt="Panel edit icon" >}} -3. Within the modal that appears, you can edit settings related to the panel's data, display preferences, and more. -{{< img src="/images/app_ui/panel_settings_modal.png" alt="Panel settings modal" >}} - -For a complete list of settings you can apply to a panel, see [Edit line panel settings]({{< relref "/guides/models/app/features/panels/line-plot/#edit-line-panel-settings" >}}). \ No newline at end of file diff --git a/content/en/guides/models/app/features/custom-charts/_index.md b/content/en/guides/models/app/features/custom-charts/_index.md deleted file mode 100644 index fecd90971c..0000000000 --- a/content/en/guides/models/app/features/custom-charts/_index.md +++ /dev/null @@ -1,347 +0,0 @@ ---- -menu: - default: - identifier: intro - parent: w-b-app-ui-reference -title: Custom charts -weight: 3 -url: guides/app/features/custom-charts -cascade: -- url: guides/app/features/custom-charts/:filename ---- - -Custom charts are visualizations you create explicitly. Use custom charts to visualize complex data relationships and have greater control over the appearance and behavior of the chart. - -To create a custom chart, you can either: - -* [Build a chart in the W&B App](#create-a-custom-chart-in-the-wb-app) by pulling in data from your runs using a [GraphQL](https://graphql.org) query. -* Log a `wandb.Table` and call the `wandb.plot()` function from your script. - -{{% alert title="Default charts" %}} -Default charts are generated visualizations based on the data logged from your script with `wandb.Run.log()`. For example, consider the following code snippet: - -```python -import wandb -import math - -with wandb.init() as run: - offset = random.random() - for run_step in range(20): - run.log({ - "acc": math.log(1 + random.random() + run_step) + offset, - "val_acc": math.log(1 + random.random() + run_step) + offset * random.random(), - }) -``` - -This code logs two metrics `acc` and `val_acc` at each training step (each `wandb.Run.log()` call). Within the W&B App, the line plots for `acc` and `val_acc` are automatically generated and appear in the `Charts` panel of the **Workspace** tab. -{{% /alert %}} - - -## Create a custom chart in the W&B App - -To create a custom chart in the W&B App, you must first log data to one or more runs. This data can come from key-value pairs logged with `wandb.Run.log()`, or more complex data structures like `wandb.Table`. Once you log data, you can create a custom chart by pulling in the data using a [GraphQL](https://graphql.org) query. - - -Suppose you want to create a line plot that shows the accuracy as a function of training step. To do this, you first log accuracy values to a run using the following code snippet: - -```python -import wandb -import math - -with wandb.init() as run: - offset = random.random() - for run_step in range(20): - run.log({ - "acc": math.log(1 + random.random() + run_step) + offset, - "val_acc": math.log(1 + random.random() + run_step) + offset * random.random(), - }) -``` - -Each call to `wandb.Run.log()` creates a new entry in the run's history. The `step` value is automatically tracked by W&B and increments with each log call. - -Once the code snippet completes, navigate to your project's workspace: - - - - - -1. Click the **Add panels** button in the top right corner, then select **Custom chart**. -2. Select **Line plot** from the list of chart types. -3. Within the [query editor](#query-editor), select `history` as the [data source](#query-data-sources). Next, select `acc` and type in `_step` as keys. -4. Within the chart editor, select `_step` for the **X** field and `acc` for the **Y** field. Optionally, set a title for the chart. Your settings should look similar to the following: -{{< img src="/images/app_ui/custom-charts-query-example.png" alt="Custom line plot settings" max-width="90%" >}} - - -{{% alert %}} -Note that only the keys you specify in the query editor are available in the chart editor (below the query editor). If you do not see the expected keys, go back to the query editor and ensure you have selected the correct data source and specified the correct keys. -{{% /alert %}} - -Your custom line plot should now appear in the panel, showing the accuracy values over training steps. - -{{< img src="/images/app_ui/manual-line-plot.png" alt="Custom line plot example" max-width="90%" >}} - -### Query data sources - -When you create a custom chart, you can pull in data from your runs using a [GraphQL](https://graphql.org) query. The data you can query comes from: - -* `config`: Initial settings of your experiment (your independent variables). This includes any named fields you’ve logged as keys to `wandb.Run.config` at the start of your training. For example: wandb.Run.config.learning_rate = 0.0001 -* `summary`: A single-value metrics that summarize a run. It's populated by the final value of metrics logged with `wandb.Run.log()` or by directly updating the run.summary object. Think of it as a key-value store for your run's final results. -* `history`: Time series data logged with `wandb.Run.log()`. Each call to `log()` creates a new row in the history table. This is ideal for tracking metrics that change over time, like training and validation loss. -* `summaryTable`: A table of summary metrics. It's populated by logging a `wandb.Table` to the `summary` field. This is useful for logging metrics that are best represented in a tabular format, like confusion matrices or classification reports. -* `historyTable`: A table of time series data. It's populated by logging a `wandb.Table` to the `history` field. This is useful for logging complex metrics that change over time, like per-epoch evaluation metrics. - -To recap, `summary` and `history` are the general locations for your run data, while `summaryTable` and `historyTable` are the specific query types needed to access tabular data stored in those respective locations. - - -### Query editor - -Within the query editor, you can define a [GraphQL](https://graphql.org) query to pull in the data from available [data sources](#query-data-sources). The query editor consists of dropdowns and text fields that allow you to construct the query without needing to write raw GraphQL. You can include any combination of available data sources, depending on the data you want to visualize. - -{{% alert %}} -Pay close attention to the data sources. For example, if you want to visualize time series data logged with `wandb.Run.log()`, you must select the `history` data source. If you select `summary`, you will not see the expected data because `summary` contains only single-value metrics that summarize a run, not time series data. -{{% /alert %}} - -The `keys` argument acts as a filter to specify exactly which pieces of data you want to retrieve from a larger data object such as `summary`. The sub-fields are dictionary-like or key-value pairs. - - -The general structure of the query is as follows: - -```graphql -query { - runSets: (runSets: "${runSets}", limit: 500 ) { - id: - name: - summary: - (keys: [""]) - history: - (keys: [""]) - summaryTable: - (keys: [""]) - historyTable: - (keys: [""]) - } -} -``` - -Here's a breakdown of the components: - -* `runSets`: Top-level object, representing the set of runs you are currently viewing or have filtered in the UI. -* `summary(...)`, `history(...)`, `summaryTable(...)`, `historyTable(...)`: This tells the query to fetch data from the respective objects of each run. -* `keys: [""]`: An array of strings where each string is the name (or key) of the metric or object you want to retrieve. - -## Log charts from a script - -You can programmatically create a custom chart from your script by logging a `wandb.Table` of the data you want to visualize, then calling `wandb.plot.*` to create the chart. - -For example, consider the following code snippet: - -```python -import wandb -import math - -with wandb.init() as run: - offset = random.random() - - # Set up data to log in custom charts - data = [] - for i in range(100): - data.append([i, random.random() + math.log(1 + i) + offset + random.random()]) - - # Create a table with the columns to plot - table = wandb.Table(data=data, columns=["step", "height"]) - - # Use the table to populate various custom charts - line_plot = wandb.plot.line(table, x='step', y='height', title='Line Plot') - histogram = wandb.plot.histogram(table, value='height', title='Histogram') - scatter = wandb.plot.scatter(table, x='step', y='height', title='Scatter Plot') - - # Log custom tables, which will show up in customizable charts in the UI - run.log({'line_1': line_plot, - 'histogram_1': histogram, - 'scatter_1': scatter}) -``` - -Within the W&B app, navigate to the **Workspace** tab. Within the `Custom Charts` panel, there are three charts with the following titles: **Scatter Plot**, **Histogram**, and **Line Plot**. These correspond to the three charts created in the script above. The x-axis and y-axis are set to the columns specified in the `wandb.plot.*` function calls (`height` and `step`). - -The following image shows the three custom charts created from the script: - -{{< img src="/images/app_ui/custom-charts-script-plots.png" alt="Custom charts from script" max-width="90%" >}} - -### Built-in chart types - -W&B has a number of built-in chart presets that you can log directly from your script. These include line plots, scatter plots, bar charts, histograms, PR curves, and ROC curves. The following tabs show how to log each type of chart. - -{{< tabpane text=true >}} -{{% tab header="Line plot" value="line-plot" %}} - - `wandb.plot.line()` - - Log a custom line plot—a list of connected and ordered points (x,y) on arbitrary axes x and y. - - ```python - with wandb.init() as run: - data = [[x, y] for (x, y) in zip(x_values, y_values)] - table = wandb.Table(data=data, columns=["x", "y"]) - run.log( - { - "my_custom_plot_id": wandb.plot.line( - table, "x", "y", title="Custom Y vs X Line Plot" - ) - } - ) - ``` - - A line plot logs curves on any two dimensions. If you plot two lists of values against each other, the number of values in the lists must match exactly (for example, each point must have an x and a y). - - {{< img src="/images/app_ui/line_plot.png" alt="Custom line plot" >}} - - [See an example report](https://wandb.ai/wandb/plots/reports/Custom-Line-Plots--VmlldzoyNjk5NTA) or [try an example Google Colab notebook](https://tiny.cc/custom-charts). - -{{% /tab %}} - -{{% tab header="Scatter plot" value="scatter-plot" %}} - - `wandb.plot.scatter()` - - Log a custom scatter plot—a list of points (x, y) on a pair of arbitrary axes x and y. - - ```python - with wandb.init() as run: - data = [[x, y] for (x, y) in zip(class_x_prediction_scores, class_y_prediction_scores)] - table = wandb.Table(data=data, columns=["class_x", "class_y"]) - run.log({"my_custom_id": wandb.plot.scatter(table, "class_x", "class_y")}) - ``` - - You can use this to log scatter points on any two dimensions. Note that if you're plotting two lists of values against each other, the number of values in the lists must match exactly (for example, each point must have an x and a y). - - {{< img src="/images/app_ui/demo_scatter_plot.png" alt="Scatter plot" >}} - - [See an example report](https://wandb.ai/wandb/plots/reports/Custom-Scatter-Plots--VmlldzoyNjk5NDQ) or [try an example Google Colab notebook](https://tiny.cc/custom-charts). - -{{% /tab %}} - -{{% tab header="Bar chart" value="bar-chart" %}} - - `wandb.plot.bar()` - - Log a custom bar chart—a list of labeled values as bars—natively in a few lines: - - ```python - with wandb.init() as run: - data = [[label, val] for (label, val) in zip(labels, values)] - table = wandb.Table(data=data, columns=["label", "value"]) - run.log( - { - "my_bar_chart_id": wandb.plot.bar( - table, "label", "value", title="Custom Bar Chart" - ) - } - ) - ``` - - You can use this to log arbitrary bar charts. Note that the number of labels and values in the lists must match exactly (for example, each data point must have both). - -{{< img src="/images/app_ui/demo_bar_plot.png" alt="Demo bar plot" >}} - - [See an example report](https://wandb.ai/wandb/plots/reports/Custom-Bar-Charts--VmlldzoyNzExNzk) or [try an example Google Colab notebook](https://tiny.cc/custom-charts). -{{% /tab %}} - -{{% tab header="Histogram" value="histogram" %}} - - `wandb.plot.histogram()` - - Log a custom histogram—sort list of values into bins by count/frequency of occurrence—natively in a few lines. Let's say I have a list of prediction confidence scores (`scores`) and want to visualize their distribution: - - ```python - with wandb.init() as run: - data = [[s] for s in scores] - table = wandb.Table(data=data, columns=["scores"]) - run.log({"my_histogram": wandb.plot.histogram(table, "scores", title=None)}) - ``` - - You can use this to log arbitrary histograms. Note that `data` is a list of lists, intended to support a 2D array of rows and columns. - - {{< img src="/images/app_ui/demo_custom_chart_histogram.png" alt="Custom histogram" >}} - - [See an example report](https://wandb.ai/wandb/plots/reports/Custom-Histograms--VmlldzoyNzE0NzM) or [try an example Google Colab notebook](https://tiny.cc/custom-charts). - -{{% /tab %}} - -{{% tab header="PR curve" value="pr-curve" %}} - - `wandb.plot.pr_curve()` - - Create a [Precision-Recall curve](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.precision_recall_curve.html#sklearn.metrics.precision_recall_curve) in one line: - - ```python - with wandb.init() as run: - plot = wandb.plot.pr_curve(ground_truth, predictions, labels=None, classes_to_plot=None) - - run.log({"pr": plot}) - ``` - - You can log this whenever your code has access to: - - * a model's predicted scores (`predictions`) on a set of examples - * the corresponding ground truth labels (`ground_truth`) for those examples - * (optionally) a list of the labels/class names (`labels=["cat", "dog", "bird"...]` if label index 0 means cat, 1 = dog, 2 = bird, etc.) - * (optionally) a subset (still in list format) of the labels to visualize in the plot - - {{< img src="/images/app_ui/demo_average_precision_lines.png" alt="Precision-recall curves" >}} - - - [See an example report](https://wandb.ai/wandb/plots/reports/Plot-Precision-Recall-Curves--VmlldzoyNjk1ODY) or [try an example Google Colab notebook](https://colab.research.google.com/drive/1mS8ogA3LcZWOXchfJoMrboW3opY1A8BY?usp=sharing). - -{{% /tab %}} - -{{% tab header="ROC curve" value="roc-curve" %}} - - `wandb.plot.roc_curve()` - - Create an [ROC curve](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.roc_curve.html#sklearn.metrics.roc_curve) in one line: - - ```python - with wandb.init() as run: - # ground_truth is a list of true labels, predictions is a list of predicted scores - ground_truth = [0, 1, 0, 1, 0, 1] - predictions = [0.1, 0.4, 0.35, 0.8, 0.7, 0.9] - - # Create the ROC curve plot - # labels is an optional list of class names, classes_to_plot is an optional subset of those labels to visualize - plot = wandb.plot.roc_curve( - ground_truth, predictions, labels=None, classes_to_plot=None - ) - - run.log({"roc": plot}) - ``` - - You can log this whenever your code has access to: - - * a model's predicted scores (`predictions`) on a set of examples - * the corresponding ground truth labels (`ground_truth`) for those examples - * (optionally) a list of the labels/ class names (`labels=["cat", "dog", "bird"...]` if label index 0 means cat, 1 = dog, 2 = bird, etc.) - * (optionally) a subset (still in list format) of these labels to visualize on the plot - - {{< img src="/images/app_ui/demo_custom_chart_roc_curve.png" alt="ROC curve" >}} - - [See an example report](https://wandb.ai/wandb/plots/reports/Plot-ROC-Curves--VmlldzoyNjk3MDE) or [try an example Google Colab notebook](https://colab.research.google.com/drive/1_RMppCqsA8XInV_jhJz32NCZG6Z5t1RO?usp=sharing). - -{{% /tab %}} -{{< /tabpane >}} - - - - - - -## Additional resources - - -* Log your first custom chart with this [Colab notebook](https://tiny.cc/custom-charts) or read its companion [W&B Machine Learning Visualization IDE](https://wandb.ai/wandb/posts/reports/The-W-B-Machine-Learning-Visualization-IDE--VmlldzoyNjk3Nzg) report. -* Try the [Logging custom visualizations with W&B using Keras and Sklearn Colab](https://colab.research.google.com/drive/1g-gNGokPWM2Qbc8p1Gofud0_5AoZdoSD?usp=sharing) notebook. -* Read the [Visualizing NLP Attention Based Models](https://wandb.ai/kylegoyette/gradientsandtranslation2/reports/Visualizing-NLP-Attention-Based-Models-Using-Custom-Charts--VmlldzoyNjg2MjM) report. -* Explore the [Visualizing The Effect of Attention on Gradient Flow](https://wandb.ai/kylegoyette/gradientsandtranslation/reports/Visualizing-The-Effect-of-Attention-on-Gradient-Flow-Using-Custom-Charts--VmlldzoyNjg1NDg) report. -* Read the [Logging arbitrary curves](https://wandb.ai/stacey/presets/reports/Logging-Arbitrary-Curves--VmlldzoyNzQyMzA) report. \ No newline at end of file diff --git a/content/en/guides/models/app/features/custom-charts/walkthrough.md b/content/en/guides/models/app/features/custom-charts/walkthrough.md deleted file mode 100644 index 245e278c33..0000000000 --- a/content/en/guides/models/app/features/custom-charts/walkthrough.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -description: Tutorial of using the custom charts feature in the W&B UI -menu: - default: - identifier: walkthrough - parent: custom-charts -title: 'Tutorial: Use custom charts' ---- - -Use custom charts to control the data you're loading in to a panel and its visualization. - - -## 1. Log data to W&B - -First, log data in your script. Use [wandb.Run.config]({{< relref "/guides/models/track/config.md" >}}) for single points set at the beginning of training, like hyperparameters. Use [wandb.Run.log()]({{< relref "/guides/models/track/log/" >}}) for multiple points over time, and log custom 2D arrays with `wandb.Table()`. We recommend logging up to 10,000 data points per logged key. - -```python -with wandb.init() as run: - - # Logging a custom table of data - my_custom_data = [[x1, y1, z1], [x2, y2, z2]] - run.log( - {"custom_data_table": wandb.Table(data=my_custom_data, columns=["x", "y", "z"])} - ) -``` - -[Try a quick example notebook](https://bit.ly/custom-charts-colab) to log the data tables, and in the next step we'll set up custom charts. See what the resulting charts look like in the [live report](https://app.wandb.ai/demo-team/custom-charts/reports/Custom-Charts--VmlldzoyMTk5MDc). - -## 2. Create a query - -Once you've logged data to visualize, go to your project page and click the **`+`** button to add a new panel, then select **Custom Chart**. You can follow along in the [custom charts demo workspace](https://app.wandb.ai/demo-team/custom-charts). - -{{< img src="/images/app_ui/create_a_query.png" alt="Blank custom chart" >}} - -### Add a query - -1. Click `summary` and select `historyTable` to set up a new query pulling data from the run history. -2. Type in the key where you logged the `wandb.Table()`. In the code snippet above, it was `my_custom_table` . In the [example notebook](https://bit.ly/custom-charts-colab), the keys are `pr_curve` and `roc_curve`. - -### Set Vega fields - -Now that the query is loading in these columns, they're available as options to select in the Vega fields dropdown menus: - -{{< img src="/images/app_ui/set_vega_fields.png" alt="Pulling in columns from the query results to set Vega fields" >}} - -* **x-axis:** runSets_historyTable_r (recall) -* **y-axis:** runSets_historyTable_p (precision) -* **color:** runSets_historyTable_c (class label) - -## 3. Customize the chart - -Now that looks pretty good, but I'd like to switch from a scatter plot to a line plot. Click **Edit** to change the Vega spec for this built in chart. Follow along in the [custom charts demo workspace](https://app.wandb.ai/demo-team/custom-charts). - -{{< img src="/images/general/custom-charts-1.png" alt="Custom chart selection" >}} - -I updated the Vega spec to customize the visualization: - -* add titles for the plot, legend, x-axis, and y-axis (set “title” for each field) -* change the value of “mark” from “point” to “line” -* remove the unused “size” field - -{{< img src="/images/app_ui/customize_vega_spec_for_pr_curve.png" alt="PR curve Vega spec" >}} - -To save this as a preset that you can use elsewhere in this project, click **Save as** at the top of the page. Here's what the result looks like, along with an ROC curve: - -{{< img src="/images/general/custom-charts-2.png" alt="PR curve chart" >}} - -## Bonus: Composite Histograms - -Histograms can visualize numerical distributions to help us understand larger datasets. Composite histograms show multiple distributions across the same bins, letting us compare two or more metrics across different models or across different classes within our model. For a semantic segmentation model detecting objects in driving scenes, we might compare the effectiveness of optimizing for accuracy versus intersection over union (IOU), or we might want to know how well different models detect cars (large, common regions in the data) versus traffic signs (much smaller, less common regions). In the[ demo Colab](https://bit.ly/custom-charts-colab), you can compare the confidence scores for two of the ten classes of living things. - -{{< img src="/images/app_ui/composite_histograms.png" alt="Composite histogram" >}} - -To create your own version of the custom composite histogram panel: - -1. Create a new Custom Chart panel in your Workspace or Report (by adding a “Custom Chart” visualization). Hit the “Edit” button in the top right to modify the Vega spec starting from any built-in panel type. -2. Replace that built-in Vega spec with my [MVP code for a composite histogram in Vega](https://gist.github.com/staceysv/9bed36a2c0c2a427365991403611ce21). You can modify the main title, axis titles, input domain, and any other details directly in this Vega spec [using Vega syntax](https://vega.github.io/) (you could change the colors or even add a third histogram :) -3. Modify the query in the right hand side to load the correct data from your wandb logs. Add the field `summaryTable` and set the corresponding `tableKey` to `class_scores` to fetch the `wandb.Table` logged by your run. This will let you populate the two histogram bin sets (`red_bins` and `blue_bins`) via the dropdown menus with the columns of the `wandb.Table` logged as `class_scores`. For my example, I chose the `animal` class prediction scores for the red bins and `plant` for the blue bins. -4. You can keep making changes to the Vega spec and query until you’re happy with the plot you see in the preview rendering. Once you’re done, click **Save as** in the top and give your custom plot a name so you can reuse it. Then click **Apply from panel library** to finish your plot. - -Here’s what my results look like from a very brief experiment: training on only 1000 examples for one epoch yields a model that’s very confident that most images are not plants and very uncertain about which images might be animals. - -{{< img src="/images/general/custom-charts-3.png" alt="Chart configuration" >}} - -{{< img src="/images/general/custom-charts-4.png" alt="Chart result" >}} \ No newline at end of file diff --git a/content/en/guides/models/app/features/panels/_index.md b/content/en/guides/models/app/features/panels/_index.md deleted file mode 100644 index 6da99aeedc..0000000000 --- a/content/en/guides/models/app/features/panels/_index.md +++ /dev/null @@ -1,216 +0,0 @@ ---- -menu: - default: - identifier: intro_panels - parent: w-b-app-ui-reference -title: Panels -weight: 2 -url: guides/app/features/panels -cascade: -- url: guides/app/features/panels/:filename ---- - -Use workspace panel visualizations to explore your [logged data]({{< relref "/ref/python/experiments/run.md/#method-runlog" >}}) by key, visualize the relationships between hyperparameters and output metrics, and more. - -## Workspace modes - -W&B projects support two different workspace modes. The icon next to the workspace name shows its mode. - -| Icon | Workspace mode | -| --- | --- | -| {{< img src="/images/app_ui/automated_workspace.svg" alt="automated workspace icon" width="32px" >}} | **Automated workspaces** automatically generate panels for all keys logged in the project. Choose an automatic workspace:
  • To get started quickly by visualizing all available data for the project.
  • For a smaller projects that log fewer keys.
  • For more broad analysis.
If you delete a panel from an automatic workspace, you can use [Quick add]({{< relref "#quick-add" >}}) to recreate it. | -| {{manual workspace icon}} | **Manual workspaces** start as blank slates and display only those panels intentionally added by users. Choose a manual workspace:
  • When you care mainly about a fraction of the keys logged in the project.
  • For more focused analysis.
  • To improve the performance of a workspace, avoiding loading panels that are less useful to you.
Use [Quick add]({{< relref "#quick-add" >}}) to easily populate a manual workspace and its sections with useful visualizations rapidly. | - -To change how a workspace generates panels, [reset the workspace]({{< relref "#reset-a-workspace" >}}). - -{{% alert title="Undo changes to your workspace" %}} -To undo changes to your workspace, click the Undo button (arrow that points left) or type **CMD + Z** (macOS) or **CTRL + Z** (Windows / Linux). -{{% /alert %}} - -## Reset a workspace - -To reset a workspace: - -1. At the top of the workspace, click the action menu `...`. -1. Click **Reset workspace**. - -## Configure the workspace layout {#configure-workspace-layout} - -To configure the workspace layout, click **Settings** near the top of the workspace, then click **Workspace layout**. - -- **Hide empty sections during search** (turned on by default) -- **Sort panels alphabetically** (turned off by default) -- **Section organization** (grouped by first prefix by default). To modify this setting: - 1. Click the padlock icon. - 1. Choose how to group panels within a section. - -To configure defaults for the workspace's line plots, refer to [Line plots]({{< relref "line-plot/#all-line-plots-in-a-workspace" >}}). - -### Configure a section's layout {#configure-section-layout} - -To configure the layout of a section, click its gear icon, then click **Display preferences**. -- **Turn on or off colored run names in tooltips** (turned on by default) -- **Only show highlighted run in companion chart tooltips** (turned off by default) -- **Number of runs shown in tooltips** (a single run, all runs, or **Default**) -- **Display full run names on the primary chart tooltip** (turned off by default) - -## View a panel in full-screen mode - -In full-screen mode, the run selector displays and panels use full-fidelity sampling mode plots with 10,000 buckets, rather than 1000 buckets otherwise. - -To view a panel in full-screen mode: - -1. Hover over the panel. -1. Click the panel's action menu `...`, then click the full-screen button, which looks like a viewfinder or an outline showing the four corners of a square. - {{< img src="/images/app_ui/panel_fullscreen.png" alt="Full-screen panel" >}} -1. When you [share the panel]({{< relref "#share-a-panel" >}}) while viewing it in full-screen mode, the resulting link opens in full-screen mode automatically. - -To get back to a panel's workspace from full-screen mode, click the left-pointing arrow at the top of the page. To navigate through a section's panels without exiting full-screen mode, use either the **Previous** and **Next** buttons below the panel or the left and right arrow keys. - -## Add panels - -This section shows various ways to add panels to your workspace. - -### Add a panel manually - -Add panels to your workspace one at a time, either globally or at the section level. - -1. To add a panel globally, click **Add panels** in the control bar near the panel search field. -1. To add a panel directly to a section instead, click the section's action `...` menu, then click **+ Add panels**. -1. Select the type of panel to add, such as a chart. The panel's configuration details appear, with defaults selected. -1. Optionally, customize the panel and its display preferences. Configuration options depend on the type of panel you select. To learn more about the options for each type of panel, refer to the relevant section below, such as [Line plots]({{< relref "line-plot/" >}}) or [Bar plots]({{< relref "bar-plot.md" >}}). -1. Click **Apply**. - -{{< img src="/images/app_ui/add_single_panel.gif" alt="Demo of adding a panel" >}} - -### Quick add panels {#quick-add} - -Use **Quick add** to add a panel automatically for each key you select, either globally or at the section level. - -{{% alert %}} -For an automated workspace with no deleted panels, the **Quick add** option is not visible because the workspace already includes panels for all logged keys. You can use **Quick add** to re-add a panel that you deleted. -{{% /alert %}} - -1. To use **Quick add** to add a panel globally, click **Add panels** in the control bar near the panel search field, then click **Quick add**. -1. To use **Quick add** to add a panel directly to a section, click the section's action `...` menu, click **Add panels**, then click **Quick add**. -1. A list of panels appears. Each panel with a checkmark is already included in the workspace. - - To add all available panels, click the **Add panels** button at the top of the list. The **Quick Add** list closes and the new panels display in the workspace. - - To add an individual panel from the list, hover over the panel's row, then click **Add**. Repeat this step for each panel you want to add, then click the **X** at the top right to close the **Quick Add** list. The new panels display in the workspace. -1. Optionally, customize the panel's settings. - -## Share a panel - -This section shows how to share a panel using a link. - -To share a panel using a link, you can either: - -- While viewing the panel in full-screen mode, copy the URL from the browser. -- Click the action menu `...` and select **Copy panel URL**. - -Share the link with the user or team. When they access the link, the panel opens in [full-screen mode]({{< relref "#view-a-panel-in-full-screen-mode" >}}). - -To return to a panel's workspace from full-screen mode, click the left-pointing arrow at the top of the page. - -### Compose a panel's full-screen link programmatically -In certain situations, such as when [creating an automation]({{< relref "/guides/core/automations/" >}}), it can be useful to include the panel's full-screen URL. This section shows the format for a panel's full-screen URL. In the proceeding example, replace the entity, project, panel, and section names in brackets. - -```text -https://wandb.ai//?panelDisplayName=&panelSectionName= -``` - -If multiple panels in the same section have the same name, this URL opens the first panel with the name. - -### Embed or share a panel on social media -To embed a panel in a website or share it on social media, the panel must be viewable by anyone with the link. If a project is private, only members of the project can view the panel. If the project is public, anyone with the link can view the panel. - -To get the code to embed or share a panel on social media: - -1. From the workspace, hover over the panel, then click its action menu `...`. -1. Click the **Share** tab. -1. Change **Only those who are invited have access** to **Anyone with the link can view**. Otherwise, the choices in the next step are not available. -1. Choose **Share on Twitter**, **Share on Reddit**, **Share on LinkedIn**, or **Copy embed link**. - -### Email a panel report -To email a single panel as a stand-alone report: -1. Hover over the panel, then click the panel's action menu `...`. -1. Click **Share panel in report**. -1. Select the **Invite** tab. -1. Enter an email address or username. -1. Optionally, change **can view** to **can edit**. -1. Click **Invite**. W&B sends an email to the user with a clickable link to the report that contains only the panel you are sharing. - -Unlike when you [share a panel]({{< relref "#share-a-panel" >}}), the recipient cannot get to the workspace from this report. - -## Manage panels - -### Edit a panel - -To edit a panel: - -1. Click its pencil icon. -1. Modify the panel's settings. -1. To change the panel to a different type, select the type and then configure the settings. -1. Click **Apply**. - -### Move a panel - -To move a panel to a different section, you can use the drag handle on the panel. To select the new section from a list instead: - -1. If necessary, create a new section by clicking **Add section** after the last section. -1. Click the action `...` menu for the panel. -1. Click **Move**, then select a new section. - -You can also use the drag handle to rearrange panels within a section. - -### Duplicate a panel - -To duplicate a panel: - -1. At the top of the panel, click the action `...` menu. -1. Click **Duplicate**. - -If desired, you can [customize]({{< relref "#edit-a-panel" >}}) or [move]({{< relref "#move-a-panel" >}}) the duplicated panel. - -### Remove panels - -To remove a panel: - -1. Hover your mouse over the panel. -1. Select the action `...` menu. -1. Click **Delete**. - -To remove all panels from a manual workspace, click its action `...` menu, then click **Clear all panels**. - -To remove all panels from an automatic or manual workspace, you can [reset the workspace]({{< relref "#reset-a-workspace" >}}). Select **Automatic** to start with the default set of panels, or select **Manual** to start with an empty workspace with no panels. - -## Manage sections - -By default, sections in a workspace reflect the logging hierarchy of your keys. However, in a manual workspace, sections appear only after you start adding panels. - -### Add a section - -To add a section, click **Add section** after the last section. - -To add a new section before or after an existing section, you can instead click the section's action `...` menu, then click **New section below** or **New section above**. - - -### Manage a section's panels -Sections with a large number of panels are paginated by default. The default number of panels on a page depend on the panel's configuration and on the sizes of the panels in the section. - -1. To resize a panel, hover over it, click the drag handle, and drag it to adjust the panel's size. Resizing one panel resizes all panels in the section. -1. If a section is paginated, you can customize the number of panels to show on a page: - 1. At the top of the section, click **1 to of **, where `` is the number of visible panels and `` is the total number of panels. - 1. Choose how many panels to show per page, up to 100. -1. To delete a panel from a section: - 1. Hover over the panel, then click its action `...` menu. - 1. Click **Delete**. - -If you reset a workspace to an automated workspace, all deleted panels appear again. - -### Rename a section - -To rename a section, click its action `...` menu, then click **Rename section**. - -### Delete a section - -To delete a section, click its `...` menu, then click **Delete section**. This removes the section and its panels. diff --git a/content/en/guides/models/app/features/panels/bar-plot.md b/content/en/guides/models/app/features/panels/bar-plot.md deleted file mode 100644 index c3faa86f91..0000000000 --- a/content/en/guides/models/app/features/panels/bar-plot.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -description: Visualize metrics, customize axes, and compare categorical data as bars. -menu: - default: - identifier: bar-plot - parent: panels -title: Bar plots -weight: 20 ---- - -A bar plot presents categorical data with rectangular bars which can be plotted vertically or horizontally. Bar plots show up by default with `wandb.Run.log()` when all logged values are of length one. - -{{< img src="/images/app_ui/bar_plot.png" alt="Plotting Box and horizontal Bar plots in W&B" >}} - -Customize with chart settings to limit max runs to show, group runs by any config and rename labels. - -{{< img src="/images/app_ui/bar_plot_custom.png" alt="Customized bar plot" >}} - -## Customize bar plots - -You can also create **Box** or **Violin** Plots to combine many summary statistics into one chart type**.** - -1. Group runs via runs table. -2. Click 'Add panel' in the workspace. -3. Add a standard 'Bar Chart' and select the metric to plot. -4. Under the 'Grouping' tab, pick 'box plot' or 'Violin', etc. to plot either of these styles. - -{{< img src="/images/app_ui/bar_plots.gif" alt="Customize Bar Plots" >}} \ No newline at end of file diff --git a/content/en/guides/models/app/features/panels/code.md b/content/en/guides/models/app/features/panels/code.md deleted file mode 100644 index dfbb9301c7..0000000000 --- a/content/en/guides/models/app/features/panels/code.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -menu: - default: - identifier: code - parent: panels -title: Save and diff code -weight: 50 ---- - -By default, W&B only saves the latest git commit hash. You can turn on more code features to compare the code between your experiments dynamically in the UI. - -Starting with `wandb` version 0.8.28, W&B can save the code from your main training file where you call `wandb.init()`. - -## Save library code - -When you enable code saving, W&B saves the code from the file that called `wandb.init()`. To save additional library code, you have three options: - -### Call `wandb.Run.log_code(".")` after calling `wandb.init()` - -```python -import wandb - -with wandb.init() as run: - run.log_code(".") -``` - -### Pass a settings object to `wandb.init()` with `code_dir` set - -```python -import wandb - -wandb.init(settings=wandb.Settings(code_dir=".")) -``` - -This captures all python source code files in the current directory and all subdirectories as an [artifact]({{< relref "/ref/python/experiments/artifact.md" >}}). For more control over the types and locations of source code files that are saved, see the [reference docs]({{< relref "/ref/python/experiments/run.md#log_code" >}}). - -### Set code saving in the UI - -In addition to setting code saving programmatically, you can also toggle this feature in your W&B account Settings. Note that this will enable code saving for all teams associated with your account. - -> By default, W&B disables code saving for all teams. - -1. Log in to your W&B account. -2. Go to **Settings** > **Privacy**. -3. Under **Project and content security**, toggle **Disable default code saving** on. - -## Code comparer -Compare code used in different W&B runs: - -1. Select the **Add panels** button in the top right corner of the page. -2. Expand **TEXT AND CODE** dropdown and select **Code**. - - -{{< img src="/images/app_ui/code_comparer.png" alt="Code comparer panel" >}} - -## Jupyter session history - -W&B saves the history of code executed in your Jupyter notebook session. When you call **wandb.init()** inside of Jupyter, W&B adds a hook to automatically save a Jupyter notebook containing the history of code executed in your current session. - - -1. Navigate to your project workspaces that contains your code. -2. Select the **Artifacts** tab in the left navigation bar. -3. Expand the **code** artifact. -4. Select the **Files** tab. - -{{< img src="/images/app_ui/jupyter_session_history.gif" alt="Jupyter session history" >}} - -This displays the cells that were run in your session along with any outputs created by calling iPython’s display method. This enables you to see exactly what code was run within Jupyter in a given run. When possible W&B also saves the most recent version of the notebook which you would find in the code directory as well. - -{{< img src="/images/app_ui/jupyter_session_history_display.png" alt="Jupyter session output" >}} \ No newline at end of file diff --git a/content/en/guides/models/app/features/panels/line-plot/_index.md b/content/en/guides/models/app/features/panels/line-plot/_index.md deleted file mode 100644 index 018a3b32d0..0000000000 --- a/content/en/guides/models/app/features/panels/line-plot/_index.md +++ /dev/null @@ -1,228 +0,0 @@ ---- -description: Visualize metrics, customize axes, and compare multiple lines on a plot -url: guides/app/features/panels/line-plot -menu: - default: - identifier: intro_line_plot - parent: panels -cascade: -- url: guides/app/features/panels/line-plot/:filename -title: Line plots -weight: 10 ---- - -Line plots show up by default when you plot metrics over time with `wandb.Run.log()`. Customize with chart settings to compare multiple lines on the same plot, calculate custom axes, and rename labels. - -{{< img src="/images/app_ui/line_plot_example.png" alt="Line plot example" >}} - -## Edit line plot settings - -This section shows how to edit the settings for an individual line plot panel, all line plot panels in a section, or all line plot panels in a workspace. - -{{% alert %}} -If you'd like to use a custom x-axis, make sure it's logged in the same call to `wandb.Run.log()` that you use to log the y-axis. -{{% /alert %}} - -### Individual line plot -A line plot's individual settings override the line plot settings for the section or the workspace. To customize a line plot: - -1. Hover your mouse over the panel, then click the gear icon. -1. Within the drawer that appears, select a tab to edit its [settings]({{< relref "#line-plot-settings" >}}). -1. Click **Apply**. - -#### Line plot settings -You can configure these settings for a line plot: - -**Date**: Configure the plot's data-display details. -* **X axis**: Select the value to use for the X axis (defaults to **Step**). You can change the x-axis to **Relative Time** or select a custom axis based on values you log with W&B. You can also configure the X axis scale and range. - * **Relative Time (Wall)** is clock time since the process started, so if you started a run and resumed it a day later and logged something that would be plotted a 24hrs. - * **Relative Time (Process)** is time inside the running process, so if you started a run and ran for 10 seconds and resumed a day later that point would be plotted at 10s. - * **Wall Time** is minutes elapsed since the start of the first run on the graph. - * **Step** increments by default each time `wandb.Run.log()` is called, and is supposed to reflect the number of training steps you've logged from your model. -* **Y axis**: Select one or more y-axes from the logged values, including metrics and hyperparameters that change over time. You can also configure the X axis scale and range. -* **Point aggregation method**. Either **Random sampling** (the default) or **Full fidelity**. Refer to [Sampling]({{< relref "sampling.md" >}}). -* **Smoothing**: Change the smoothing on the line plot. Defaults to **Time weighted EMA**. Other values include **No smoothing**, **Running average**, and **Gaussian**. -* **Outliers**: Rescale to exclude outliers from the default plot min and max scale. -* **Max number of runs or groups**: Show more lines on the line plot at once by increasing this number, which defaults to 10 runs. You'll see the message "Showing first 10 runs" on the top of the chart if there are more than 10 runs available but the chart is constraining the number visible. -* **Chart type**: Change between a line plot, an area plot, and a percentage area plot. - -**Grouping**: Configure whether and how to group and aggregate runs in the plot. -* **Group by**: Select a column, and all the runs with the same value in that column will be grouped together. -* **Agg**: Aggregation— the value of the line on the graph. The options are mean, median, min, and max of the group. - -**Chart**: Specify titles for the panel, the X axis, and the Y axis, and the -axis, hide or show the legend, and configure its position. - -**Legend**: Customize the appearance of the panel's legend, if it is enabled. -* **Legend**: The field in the legend for each line in the plot in the legend of the plot for each line. -* **Legend template**: Define a fully customizable template for the legend, specifying exactly what text and variables you want to show up in the template at the top of the line plot as well as the legend that appears when you hover your mouse over the plot. - -**Expressions**: Add custom calculated expressions to the panel. -* **Y Axis Expressions**: Add calculated metrics to your graph. You can use any of the logged metrics as well as configuration values like hyperparameters to calculate custom lines. -* **X Axis Expressions**: Rescale the x-axis to use calculated values using custom expressions. Useful variables include\*\*_step\*\* for the default x-axis, and the syntax for referencing summary values is `${summary:value}` - -### All line plots in a section - -To customize the default settings for all line plots in a section, overriding workspace settings for line plots: -1. Click the section's gear icon to open its settings. -1. Within the drawer that appears, select the **Data** or **Display preferences** tabs to configure the default settings for the section. For details about each **Data** setting, refer to the preceding section, [Individual line plot]({{< relref "#line-plot-settings" >}}). For details about each display preference, refer to [Configure section layout]({{< relref "../#configure-section-layout" >}}). - -### All line plots in a workspace -To customize the default settings for all line plots in a workspace: -1. Click the workspace's settings, which has a gear with the label **Settings**. -1. Click **Line plots**. -1. Within the drawer that appears, select the **Data** or **Display preferences** tabs to configure the default settings for the workspace. - - For details about each **Data** setting, refer to the preceding section, [Individual line plot]({{< relref "#line-plot-settings" >}}). - - - For details about each **Display preferences** section, refer to [Workspace display preferences]({{< relref "../#configure-workspace-layout" >}}). At the workspace level, you can configure the default **Zooming** behavior for line plots. This setting controls whether to synchronize zooming across line plots with a matching x-axis key. Disabled by default. - - - -## Visualize average values on a plot - -If you have several different experiments and you'd like to see the average of their values on a plot, you can use the Grouping feature in the table. Click "Group" above the run table and select "All" to show averaged values in your graphs. - -Here is what the graph looks like before averaging: - -{{< img src="/images/app_ui/demo_precision_lines.png" alt="Individual precision lines" >}} - -The proceeding image shows a graph that represents average values across runs using grouped lines. - -{{< img src="/images/app_ui/demo_average_precision_lines.png" alt="Averaged precision lines" >}} - -## Visualize NaN value on a plot - -You can also plot `NaN` values including PyTorch tensors on a line plot with `wandb.Run.log()`. For example: - -```python -with wandb.init() as run: - # Log a NaN value - run.log({"test": float("nan")}) -``` - -{{< img src="/images/app_ui/visualize_nan.png" alt="NaN value handling" >}} - -## Compare two metrics on one chart - -{{< img src="/images/app_ui/visualization_add.gif" alt="Adding visualization panels" >}} - -1. Select the **Add panels** button in the top right corner of the page. -2. From the left panel that appears, expand the Evaluation dropdown. -3. Select **Run comparer** - - -## Change the color of the line plots - -Sometimes the default color of runs is not helpful for comparison. To help overcome this, wandb provides two instances with which one can manually change the colors. - -{{< tabpane text=true >}} -{{% tab header="From the run table" value="run_table" %}} - - Each run is given a random color by default upon initialization. - - {{< img src="/images/app_ui/line_plots_run_table_random_colors.png" alt="Random colors given to runs" >}} - - Upon clicking any of the colors, a color palette appears from which we can manually choose the color we want. - - {{< img src="/images/app_ui/line_plots_run_table_color_palette.png" alt="The color palette" >}} - -{{% /tab %}} - -{{% tab header="From the chart legend settings" value="legend_settings" %}} - -1. Hover your mouse over the panel you want to edit its settings for. -2. Select the pencil icon that appears. -3. Choose the **Legend** tab. - -{{< img src="/images/app_ui/plot_style_line_plot_legend.png" alt="Line plot legend settings" >}} - -{{% /tab %}} -{{< /tabpane >}} - -## Visualize on different x axes - -If you'd like to see the absolute time that an experiment has taken, or see what day an experiment ran, you can switch the x axis. Here's an example of switching from steps to relative time and then to wall time. - -{{< img src="/images/app_ui/howto_use_relative_time_or_wall_time.gif" alt="X-axis time options" >}} - -## Area plots - -In the line plot settings, in the advanced tab, click on different plot styles to get an area plot or a percentage area plot. - -{{< img src="/images/app_ui/line_plots_area_plots.gif" alt="Area plot styles" >}} - -## Zoom - -Click and drag a rectangle to zoom vertically and horizontally at the same time. This changes the x-axis and y-axis zoom. - -{{< img src="/images/app_ui/line_plots_zoom.gif" alt="Plot zoom functionality" >}} - -## Hide chart legend - -Turn off the legend in the line plot with this simple toggle: - -{{< img src="/images/app_ui/demo_hide_legend.gif" alt="Hide legend toggle" >}} - -## Create a run metrics notification -Use [Automations]({{< relref "/guides/core/automations" >}}) to notify your team when a run metric meets a condition you specify. An automation can post to a Slack channel or run a webhook. - -From a line plot, you can quickly create a [run metrics notification]({{< relref "/guides/core/automations/automation-events.md#run-events" >}}) for the metric it shows: - -1. Hover over the panel, then click the bell icon. -1. Configure the automation using the basic or advanced configuration controls. For example, apply a run filter to limit the scope of the automation, or configure an absolute threshold. - -Learn more about [Automations]({{< relref "/guides/core/automations" >}}). - -## Visualize CoreWeave infrastructure alerts - -Observe infrastructure alerts such as GPU failures, thermal violations, and more during machine learning experiments you log to W&B. During a [W&B run]({{< relref "/guides/models/track/runs/_index" >}}), [CoreWeave Mission Control](https://www.coreweave.com/mission-control) monitors your compute infrastructure. - -{{< alert>}} -This feature is in Preview and only available when training on a CoreWeave cluster. Contact your W&B representative for access. -{{< /alert >}} - -If an error occurs, CoreWeave sends that information to W&B. W&B populates infrastructure information onto your run's plots in your project's workspace. CoreWeave attempts to automatically resolve some issues, and W&B surfaces that information in the run's page. - -### Find infrastructure issues in a run - -W&B surfaces both SLURM job issues and cluster node issues. View infrastructure errors in a run: - -1. Navigate to your project on the W&B App. -2. Select the **Workspace** tab to view your project's workspace. -3. Search and select the name of the run that contains an infrastructure issue. If CoreWeave detected an infrastructure issue, one or more red vertical lines with an exclamation mark overlay the run's plots. -4. Select an issue on a plot or select the **Issues** button in the top right of the page. A drawer appears that lists each issue reported by CoreWeave. - -{{< alert title="Tip" >}} -To views runs with infrastructure issues at a glance, pin the **Issues** column to your W&B Workspace to view runs that logged an issue at a glance. For more information about how to pin a column, see [Customize how runs are displayed]({{< relref "/guides/models/track/runs/#customize-how-runs-are-displayed" >}}). -{{< /alert >}} - -The **Overall Grafana view** at the top of the drawer redirects you to the SLURM job's Grafana dashboard, which contains system-level details about the run. The **Issues summary** describes the root error that the SLURM job reported to CoreWeave Mission Control. The summary section also describes any attempts to automatically resolve the error made by CoreWeave. - -{{< img src="/images/app_ui/cw_wb_observability.png" >}} - -The **All Issues** list all issues that occurs during the run in chronological order, with the most recent issue at the top. The list contains the job issue and node issue alerts. Within each issue alert is the name of the issue, the timestamp when the issue occurred, a link to the Grafana dashboard for that issue, and a brief summary that describes the issue. - -The following table shows example alerts for each category of infrastructure issues: - -| Category | Example alerts | -| -------- | ------------- | -| Node Availability & Readiness | `KubeNodeNotReadyHGX`, `NodeExtendedDownTime` | -| GPU/Accelerator Errors | `GPUFallenOffBusHGX`, `GPUFaultHGX`, `NodeTooFewGPUs` | -| Hardware Errors | `HardwareErrorFatal`, `NodeRAIDMemberDegraded` | -| Networking & DNS | `NodeDNSFailureHGX`, `NodeEthFlappingLegacyNonGPU` | -| Power, Cooling, and Management | `NodeCPUHZThrottle`, `RedfishDown` | -| DPU & NVSwitch | `DPUNcoreVersionBelowDesired`, `NVSwitchFaultHGX` | -| Miscellaneous | `NodePCISpeedRootGBT`, `NodePCIWidthRootSMC` | - -For detailed information on error types, see the [SLURM Job Metrics on the CoreWeave Docs](https://docs.coreweave.com/docs/observability/managed-grafana/sunk/slurm-job-metrics#job-info-alerts#job-info-alerts). - -### Debug infrastructure issues - -Each run that you create in W&B corresponds to a single SLURM job in CoreWeave. You can view a failed job's [Grafana](https://grafana.com/) dashboard or discover more information about a single node. The link within the **Overview** section of the **Issues** drawer links to the SLURM job Grafana dashboard. Expand the **All Issues** dropdown to view both job and node issues and their respective Grafana dashboards. - -{{< alert title="Note" >}} -The Grafana dashboard is only available for W&B users with a CoreWeave account. Contact W&B to configure Grafana with your W&B organization. -{{< /alert >}} - -Depending on the issue, you may need to adjust the SLURM job configuration, investigate the node's status, restart the job, or take other actions as needed. - -For more information about CoreWeave SLURM jobs in Grafana, see Slurm/Job Metrics on the [CoreWeave Docs](https://docs.coreweave.com/docs/observability/managed-grafana/sunk/slurm-job-metrics#job-info-alerts). See [Job info: alerts](https://docs.coreweave.com/docs/observability/managed-grafana/sunk/slurm-job-metrics#job-info-alerts#job-info-alerts) for detailed information about job alerts. diff --git a/content/en/guides/models/app/features/panels/line-plot/reference.md b/content/en/guides/models/app/features/panels/line-plot/reference.md deleted file mode 100644 index 771898e032..0000000000 --- a/content/en/guides/models/app/features/panels/line-plot/reference.md +++ /dev/null @@ -1,97 +0,0 @@ ---- -menu: - default: - identifier: reference - parent: line-plot -title: Line plot reference -weight: 10 ---- - -## X-Axis - -{{< img src="/images/app_ui/reference_x_axis.png" alt="Selecting X-Axis" >}} - -You can set the x-axis of a line plot to any value that you have logged with W&B.log as long as it's always logged as a number. - -## Y-Axis variables - -You can set the y-axis variables to any value you have logged with wandb.log as long as you were logging numbers, arrays of numbers or a histogram of numbers. If you logged more than 1500 points for a variable, W&B samples down to 1500 points. - -{{% alert %}} -You can change the color of your y axis lines by changing the color of the run in the runs table. -{{% /alert %}} - -## X range and Y range - -You can change the maximum and minimum values of X and Y for the plot. - -X range default is from the smallest value of your x-axis to the largest. - -Y range default is from the smallest value of your metrics and zero to the largest value of your metrics. - -## Max runs/groups - -By default you will only plot 10 runs or groups of runs. The runs will be taken from the top of your runs table or run set, so if you sort your runs table or run set you can change the runs that are shown. - -{{% alert %}} -A workspace is limited to displaying a maximum of 1000 runs, regardless of its configuration. -{{% /alert %}} - -## Legend - -You can control the legend of your chart to show for any run any config value that you logged and meta data from the runs such as the created at time or the user who created the run. - -Example: - -`${run:displayName} - ${config:dropout}` will make the legend name for each run something like `royal-sweep - 0.5` where `royal-sweep` is the run name and `0.5` is the config parameter named `dropout`. - -You can set value inside`[[ ]]` to display point specific values in the crosshair when hovering over a chart. For example `\[\[ $x: $y ($original) ]]` would display something like "2: 3 (2.9)" - -Supported values inside `[[ ]]` are as follows: - -| Value | Meaning | -| ------------ | ------------------------------------------ | -| `${x}` | X value | -| `${y}` | Y value (Including smoothing adjustment) | -| `${original}` | Y value not including smoothing adjustment | -| `${mean}` | Mean of grouped runs | -| `${stddev}` | Standard Deviation of grouped runs | -| `${min}` | Min of grouped runs | -| `${max}` | Max of grouped runs | -| `${percent}` | Percent of total (for stacked area charts) | - -## Grouping - -You can aggregate all of the runs by turning on grouping, or group over an individual variable. You can also turn on grouping by grouping inside the table and the groups will automatically populate into the graph. - -## Smoothing - -You can set the [smoothing coefficient]({{< relref "/support/kb-articles/formula_smoothing_algorithm.md" >}}) to be between 0 and 1 where 0 is no smoothing and 1 is maximum smoothing. - - -## Ignore outliers - -Rescale the plot to exclude outliers from the default plot min and max scale. The setting's impact on the plot depends on the plot's sampling mode. - -- For plots that use [random sampling mode]({{< relref "sampling.md#random-sampling" >}}), when you enable **Ignore outliers**, only points from 5% to 95% are shown. When outliers are shown, they are not formatted differently from other points. -- For plots that use [full fidelity mode]({{< relref "sampling.md#full-fidelity" >}}), all points are always shown, condensed down to the last value in each bucket. When **Ignore outliers** is enabled, the minimum and maximum bounds of each bucket are shaded. Otherwise, no area is shaded. - -## Expression - -Expression lets you plot values derived from metrics like 1-accuracy. It currently only works if you are plotting a single metric. You can do simple arithmetic expressions, +, -, \*, / and % as well as \*\* for powers. - -## Plot style - -Select a style for your line plot. - -**Line plot:** - -{{< img src="/images/app_ui/plot_style_line_plot.png" alt="Line plot style" >}} - -**Area plot:** - -{{< img src="/images/app_ui/plot_style_area_plot.png" alt="Area plot style" >}} - -**Percentage area plot:** - -{{< img src="/images/app_ui/plot_style_percentage_plot.png" alt="Percentage plot style" >}} diff --git a/content/en/guides/models/app/features/panels/line-plot/sampling.md b/content/en/guides/models/app/features/panels/line-plot/sampling.md deleted file mode 100644 index dc3776e73c..0000000000 --- a/content/en/guides/models/app/features/panels/line-plot/sampling.md +++ /dev/null @@ -1,135 +0,0 @@ ---- -menu: - default: - identifier: sampling - parent: line-plot -title: Point aggregation -weight: 20 ---- - - -Use point aggregation methods within your line plots for improved data visualization accuracy and performance. There are two types of point aggregation modes: [full fidelity]({{< relref "#full-fidelity" >}}) and [random sampling]({{< relref "#random-sampling" >}}). W&B uses full fidelity mode by default. - -## Full fidelity - -When you use full fidelity mode, W&B breaks the x-axis into dynamic buckets based on the number of data points. It then calculates the minimum, maximum, and average values within each bucket while rendering a point aggregation for the line plot. - -There are three main advantages to using full fidelity mode for point aggregation: - -* Preserve extreme values and spikes: retain extreme values and spikes in your data -* Configure how minimum and maximum points render: use the W&B App to interactively decide whether you want to show extreme (min/max) values as a shaded area. -* Explore your data without losing data fidelity: W&B recalculates x-axis bucket sizes when you zoom into specific data points. This helps ensure that you can explore your data without losing accuracy. Caching is used to store previously computed aggregations to help reduce loading times which is particularly useful if you are navigating through large datasets. - -### Configure how minimum and maximum points render - -Show or hide minimum and maximum values with shaded areas around your line plots. - -The proceeding image shows a blue line plot. The light blue shaded area represents the minimum and maximum values for each bucket. - -{{< img src="/images/app_ui/shaded-areas.png" alt="Shaded confidence areas" >}} - -There are three ways to render minimum and maximum values in your line plots: - -* **Never**: The min/max values are not displayed as a shaded area. Only show the aggregated line across the x-axis bucket. -* **On hover**: The shaded area for min/max values appears dynamically when you hover over the chart. This option keeps the view uncluttered while allowing you to inspect ranges interactively. -* **Always**: The min/max shaded area is consistently displayed for every bucket in the chart, helping you visualize the full range of values at all times. This can introduce visual noise if there are many runs visualized in the chart. - -By default, the minimum and maximum values are not displayed as shaded areas. To view one of the shaded area options, follow these steps: - -{{< tabpane text=true >}} -{{% tab header="All charts in a workspace" value="all_charts" %}} -1. Navigate to your W&B project -2. Select on the **Workspace** icon on the left tab -3. Select the gear icon on the top right corner of the screen next to the left of the **Add panels** button. -4. From the UI slider that appears, select **Line plots** -5. Within the **Point aggregation** section, choose **On over** or **Always** from the **Show min/max values as a shaded area** dropdown menu. -{{% /tab %}} - -{{% tab header="Individual chart in a workspace" value="single_chart"%}} -1. Navigate to your W&B project -2. Select on the **Workspace** icon on the left tab -3. Select the line plot panel you want to enable full fidelity mode for -4. Within the modal that appears, select **On hover** or **Always** from the **Show min/max values as a shaded area** dropdown menu. -{{% /tab %}} -{{< /tabpane >}} - - -### Explore your data without losing data fidelity - -Analyze specific regions of the dataset without missing critical points like extreme values or spikes. When you zoom in on a line plot, W&B adjusts the buckets sizes used to calculate the minimum, maximum, and average values within each bucket. - - -{{< img src="/images/app_ui/zoom_in.gif" alt="Plot zoom functionality" >}} - - -W&B divides the x-axis is dynamically into 1000 buckets by default. For each bucket, W&B calculates the following values: - -- **Minimum**: The lowest value in that bucket. -- **Maximum**: The highest value in that bucket. -- **Average**: The mean value of all points in that bucket. - -W&B plots values in buckets in a way that preserves full data representation and includes extreme values in every plot. When zoomed in to 1,000 points or fewer, full fidelity mode renders every data point without additional aggregation. - - -To zoom in on a line plot, follow these steps: - -1. Navigate to your W&B project -2. Select on the **Workspace** icon on the left tab -3. Optionally add a line plot panel to your workspace or navigate to an existing line plot panel. -4. Click and drag to select a specific region to zoom in on. - -{{% alert title="Line plot grouping and expressions" %}} -When you use Line Plot Grouping, W&B applies the following based on the mode selected: - -- **Non-windowed sampling (grouping)**: Aligns points across runs on the x-axis. The average is taken if multiple points share the same x-value; otherwise, they appear as discrete points. -- **Windowed sampling (grouping and expressions)**: Divides the x-axis either into 250 buckets or the number of points in the longest line (whichever is smaller). W&B takes an average of points within each bucket. -- **Full fidelity (grouping and expressions)**: Similar to non-windowed sampling, but fetches up to 500 points per run to balance performance and detail. -{{% /alert %}} - - -## Random sampling - -Random sampling uses 1500 randomly sampled points to render line plots. Random sampling is useful for performance reasons when you have a large number of data points. - -{{% alert color="warning" %}} -Random sampling samples non-deterministically. This means that random sampling sometimes excludes important outliers or spikes in the data and therefore reduces data accuracy. -{{% /alert %}} - - -### Enable random sampling -By default, W&B uses full fidelity mode. To enable random sampling, follow these steps: - -{{< tabpane text=true >}} -{{% tab header="All charts in a workspace" value="all_charts" %}} -1. Navigate to your W&B project -2. Select on the **Workspace** icon on the left tab -3. Select the gear icon on the top right corner of the screen next to the left of the **Add panels** button. -4. From the UI slider that appears, select **Line plots** -5. Choose **Random sampling** from the **Point aggregation** section -{{% /tab %}} - -{{% tab header="Individual chart in a workspace" value="single_chart"%}} -1. Navigate to your W&B project -2. Select on the **Workspace** icon on the left tab -3. Select the line plot panel you want to enable random sampling for -4. Within the modal that appears, select **Random sampling** from the **Point aggregation method** section -{{% /tab %}} -{{< /tabpane >}} - - - -### Access non sampled data - -You can access the complete history of metrics logged during a run using the [W&B Run API]({{< relref "/ref/python/public-api/runs.md" >}}). The following example demonstrates how to retrieve and process the loss values from a specific run: - - -```python -# Initialize the W&B API -run = api.run("l2k2/examples-numpy-boston/i0wt6xua") - -# Retrieve the history of the 'Loss' metric -history = run.scan_history(keys=["Loss"]) - -# Extract the loss values from the history -losses = [row["Loss"] for row in history] -``` diff --git a/content/en/guides/models/app/features/panels/line-plot/smoothing.md b/content/en/guides/models/app/features/panels/line-plot/smoothing.md deleted file mode 100644 index 9d43b012ce..0000000000 --- a/content/en/guides/models/app/features/panels/line-plot/smoothing.md +++ /dev/null @@ -1,102 +0,0 @@ ---- -description: In line plots, use smoothing to see trends in noisy data. -menu: - default: - identifier: smoothing - parent: line-plot -title: Smooth line plots -weight: 30 ---- - -W&B supports several types of smoothing: - -- [Time weighted exponential moving average (TWEMA) smoothing]({{< relref "#time-weighted-exponential-moving-average-twema-smoothing-default" >}}) -- [Gaussian smoothing]({{< relref "#gaussian-smoothing" >}}) -- [Running average]({{< relref "#running-average-smoothing" >}}) -- [Exponential moving average (EMA) smoothing]({{< relref "#exponential-moving-average-ema-smoothing" >}}) - -See these live in an [interactive W&B report](https://wandb.ai/carey/smoothing-example/reports/W-B-Smoothing-Features--Vmlldzo1MzY3OTc). - -{{< img src="/images/app_ui/beamer_smoothing.gif" alt="Demo of various smoothing algorithms" >}} - -## Time Weighted Exponential Moving Average (TWEMA) smoothing (Default) - -The Time Weighted Exponential Moving Average (TWEMA) smoothing algorithm is a technique for smoothing time series data by exponentially decaying the weight of previous points. For details about the technique, see [Exponential Smoothing](https://www.wikiwand.com/en/Exponential_smoothing). The range is 0 to 1. There is a de-bias term added so that early values in the time series are not biased towards zero. - -The TWEMA algorithm takes the density of points on the line (the number of `y` values per unit of range on x-axis) into account. This allows consistent smoothing when displaying multiple lines with different characteristics simultaneously. - -Here is sample code for how this works under the hood: - -```javascript -const smoothingWeight = Math.min(Math.sqrt(smoothingParam || 0), 0.999); -let lastY = yValues.length > 0 ? 0 : NaN; -let debiasWeight = 0; - -return yValues.map((yPoint, index) => { - const prevX = index > 0 ? index - 1 : 0; - // VIEWPORT_SCALE scales the result to the chart's x-axis range - const changeInX = - ((xValues[index] - xValues[prevX]) / rangeOfX) * VIEWPORT_SCALE; - const smoothingWeightAdj = Math.pow(smoothingWeight, changeInX); - - lastY = lastY * smoothingWeightAdj + yPoint; - debiasWeight = debiasWeight * smoothingWeightAdj + 1; - return lastY / debiasWeight; -}); -``` - -Here's what this looks like [in the app](https://wandb.ai/carey/smoothing-example/reports/W-B-Smoothing-Features--Vmlldzo1MzY3OTc): - -{{< img src="/images/app_ui/weighted_exponential_moving_average.png" alt="Demo of TWEMA smoothing" >}} - -## Gaussian smoothing - -Gaussian smoothing (or Gaussian kernel smoothing) computes a weighted average of the points, where the weights correspond to a gaussian distribution with the standard deviation specified as the smoothing parameter. The smoothed value is calculated for every input x value, based on the points occurring both before and after it. - -Here's what this looks like [in the app](https://wandb.ai/carey/smoothing-example/reports/W-B-Smoothing-Features--Vmlldzo1MzY3OTc#3.-gaussian-smoothing): - -{{< img src="/images/app_ui/gaussian_smoothing.png" alt="Demo of gaussian smoothing" >}} - -## Running average smoothing - -Running average is a smoothing algorithm that replaces a point with the average of points in a window before and after the given x value. See ["Boxcar Filter" on Wikipedia](https://en.wikipedia.org/wiki/Moving_average). The selected parameter for running average tells Weights and Biases the number of points to consider in the moving average. - -Consider using Gaussian Smoothing instead if your points are spaced unevenly on the x-axis. - -Here's what this looks like [in the app](https://wandb.ai/carey/smoothing-example/reports/W-B-Smoothing-Features--Vmlldzo1MzY3OTc#4.-running-average): - -{{< img src="/images/app_ui/running_average.png" alt="Demo of running average smoothing" >}} - -## Exponential Moving Average (EMA) smoothing - -The Exponential Moving Average (EMA) smoothing algorithm is a rule of thumb technique for smoothing time series data using the exponential window function. For details about the technique, see [Exponential Smoothing](https://www.wikiwand.com/en/Exponential_smoothing). The range is 0 to 1. A debias term is added so that early values in the time series are not biases towards zero. - -In many situations, EMA smoothing is applied to a full scan of history, rather than bucketing first before smoothing. This often produces more accurate smoothing. - -In the following situations, EMA smoothing is after bucketing instead: -- Sampling -- Grouping -- Expressions -- Non-monotonic x-axes -- Time-based x-axes - -Here is sample code for how this works under the hood: - -```javascript - data.forEach(d => { - const nextVal = d; - last = last * smoothingWeight + (1 - smoothingWeight) * nextVal; - numAccum++; - debiasWeight = 1.0 - Math.pow(smoothingWeight, numAccum); - smoothedData.push(last / debiasWeight); -``` - -Here's what this looks like [in the app](https://wandb.ai/carey/smoothing-example/reports/W-B-Smoothing-Features--Vmlldzo1MzY3OTc): - -{{< img src="/images/app_ui/exponential_moving_average.png" alt="Demo of EMA smoothing" >}} - -## Hide original data - -By default, the original unsmoothed data displays in the plot as a faint line in the background. Click **Show Original** to turn this off. - -{{< img src="/images/app_ui/demo_wandb_smoothing_turn_on_and_off_original_data.gif" alt="Turn on or off original data" >}} \ No newline at end of file diff --git a/content/en/guides/models/app/features/panels/media.md b/content/en/guides/models/app/features/panels/media.md deleted file mode 100644 index fa7c426e26..0000000000 --- a/content/en/guides/models/app/features/panels/media.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -menu: - default: - identifier: media-panels - parent: panels -title: Media panels -weight: 50 ---- - -A media panel visualizes [logged keys for media objects]({{< relref "/guides/models/track/log/media.md" >}}), including 3D objects, audio, images, video, or point clouds. This page shows how to add and manage media panels in a workspace. - -{{< img src="/images/app_ui/demo-media-panel.png" alt="Demo of a media panel" >}} - -## Add a media panel -To add a media panel for a logged key using the default configuration, use Quick Add. You can add a media panel globally or to a specific section. - -1. **Global**: Click **Add panels** in the control bar near the panel search field. -1. **Section**: Click the section's action `...` menu, then click **Add panels**. -1. In the list of available panels, find the key for the panel, then click **Add**. Repeat this step for each media panel you want to add, then click the **X** at the top right to close the **Quick Add** list. -1. Optionally, [configure the panel]({{< relref "#configure-a-media-panel" >}}). - -You can add a media panel globally or to a specific section: -1. **Global**: Click **Add panels** in the control bar near the panel search field. -1. **Section**: Click the section's action `...` menu, then click **Add panels**. -1. Click the **Media** section to expand it. -1. Select the type of media the panel visualizes, 3d objects, images, video, or audio. The panel configuration screen displays. Configure the panel, then click **Apply**. Refer to [Configure a media panel]({{< relref "#configure-a-media-panel" >}}). - -## Configure a media panel -Panels for all media types have the same options. - -When you add a media panel manually, its configuration page opens after you select the type of media. To update the configuration for an existing panel, hover over the panel, then click the gear icon that appears at the top right. This section describes the settings available in each tab. - -### Overlays -This tab appears for images and point clouds logged with segmentation masks or bounding boxes. -- Search and filter overlays by name. -- Customize overlay colors. - -### Display -Customize the panel's overall appearance and behavior. -- Configure the panel's title. -- Select the media keys to visualize. -- Customize the panel's slider and playback behavior. - - Configure the slider key, which defaults to **Step**. - - Set **Stride length** to the number of steps to advance for each click of the slider. - - Turn on or off **Snap to existing step**. If it is turned on, the stepper advances to the next existing step after **Stride length**. Otherwise, it advances by **Stride length** even if that does not align with an existing step. -- **Images**: Turn on or off smoothing. -- **3d objects**: Configure the background color and point color. - -### Layout -Customize the display of the panel's individual items. -- Turn on or off **Grid mode**. - - When it is turned on, you can choose a custom X and Y axis to plot on top of each item. More than one item displays in each row, and you limit how many rows to show. - - When it is turned off, you can customize the number of columns to use for the panel's content, and you can configure the panel's content, which defaults to **Run**. -- Optionally limit the **Max runs to include** in the panel. -- Optionally specify a **Media display limit** to limit the number of media items to include per run. -- **Images and videos**: Turn on or off display of full-size media. -- **Images**: When **Fit media** is turned on, resize the panel's media to fit the panel's size. -- **Point clouds**: Optionally turn on the right-handed system for plotting points, rather than the default left-handed system. - -### All media panels in a section -To customize the default settings for all media panels in a section, overriding workspace settings for media panels: -1. Click the section's gear icon to open its settings. -1. Click **Media settings**. -1. Within the drawer that appears, click the **Display**, **Layout**, or **Sync** tab to configure the default media settings for the section. You can configure settings for images, videos, audio, and 3d objects. The settings that appear depend on the section's current media panels. - -Refer to [Configure a media panel]({{< relref "#configure-a-media-panel" >}}) for details about a specific setting for **Display** or **Layout** media setting. The **Sync** tab is available only at the section or workspace level, not for individual media panels. - -When **Step slider syncing** is turned on, the section's media panels with the same step slider are kept in sync. To turn on step slider syncing: - - 1. Click the **Sync** tab. - 1. Turn on **Sync slider by key (Step)**. - -### All media panels in a workspace -To customize the default settings for all media panels in a workspace: -1. Click the workspace's settings, which has a gear with the label **Settings**. -1. Click **Media settings**. -1. Within the drawer that appears, click the **Display** or **Layout** tab to configure the default media settings for the workspace. You can configure settings for images, videos, audio, and 3d objects. The settings that appear depend on the workspace's current media panels. - -With the exception of the **Sync** tab, refer to [Configure a media panel]({{< relref "#configure-a-media-panel" >}}) for details about a setting. The **Sync** tab is available only at the section or workspace level, not for individual media panels. - -When **Step slider syncing** is turned on, the section's media panels with the same step slider are kept in sync. To turn on step slider syncing: - -1. Click the **Sync** tab. -1. Turn on **Sync slider by key (Step)**. - -For details about each setting, refer to [Configure a media panel]({{< relref "#configure-a-media-panel" >}}). - -## Interact with a media panel -- Click a media panel to view it in full-screen mode. Click the arrow button at the top of the panel to exit full-screen mode. -- To navigate through a section's panels without exiting full-screen mode, use either the **Previous** and **Next** buttons below the panel or the left and right arrow keys. -- To move a media panel's step slider, use **CMD + left or right arrow key** (macOS) or **Ctrl + left or right arrow key** (Windows / Linux). If **Sync slider by key (Step)** is turned on for the section or workspace, moving the step slider in one media panel also moves the step slider in other media panels with the same step slider key. -- Use the stepper at the top of a media panel to step through media runs. To move the step slider, use the UI controls or -- To configure a media panel, hover over it and click the gear icon at the top. -- For an image that was logged with segmentation masks, you can customize their appearance or turn each one on or off. Hover over the panel, then click the lower gear icon. -- For an image or point cloud that was logged with bounding boxes, you can customize their appearance or turn each one on or off. Hover over the panel, then click the lower gear icon. diff --git a/content/en/guides/models/app/features/panels/parallel-coordinates.md b/content/en/guides/models/app/features/panels/parallel-coordinates.md deleted file mode 100644 index c8a2134846..0000000000 --- a/content/en/guides/models/app/features/panels/parallel-coordinates.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -description: Compare results across machine learning experiments -menu: - default: - identifier: parallel-coordinates - parent: panels -title: Parallel coordinates -weight: 30 ---- - -Parallel coordinates charts summarize the relationship between large numbers of hyperparameters and model metrics at a glance. - -{{< img src="/images/app_ui/parallel_coordinates.gif" alt="Parallel coordinates plot" >}} - -* **Axes**: Different hyperparameters from [`wandb.Run.config`]({{< relref "/guides/models/track/config.md" >}}) and metrics from [`wandb.Run.log()`]({{< relref "/guides/models/track/log/" >}}). -* **Lines**: Each line represents a single run. Mouse over a line to see a tooltip with details about the run. All lines that match the current filters will be shown, but if you turn off the eye, lines will be grayed out. - -## Create a parallel coordinates panel - -1. Go to the landing page for your workspace -2. Click **Add Panels** -3. Select **Parallel coordinates** - -## Panel Settings - -To configure the panel, click the edit button in the upper right corner of the panel. - -* **Tooltip**: On hover, a legend shows up with info on each run -* **Titles**: Edit the axis titles to be more readable -* **Gradient**: Customize the gradient to be any color range you like -* **Log scale**: Each axis can be set to view on a log scale independently -* **Flip axis**: Switch the axis direction— this is useful when you have both accuracy and loss as columns - -[Interact with a live parallel coordinates panel](https://app.wandb.ai/example-team/sweep-demo/reports/Zoom-in-on-Parallel-Coordinates-Charts--Vmlldzo5MTQ4Nw) diff --git a/content/en/guides/models/app/features/panels/parameter-importance.md b/content/en/guides/models/app/features/panels/parameter-importance.md deleted file mode 100644 index 991af6a827..0000000000 --- a/content/en/guides/models/app/features/panels/parameter-importance.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -description: Visualize the relationships between your model's hyperparameters and - output metrics -menu: - default: - identifier: parameter-importance - parent: panels -title: Parameter importance -weight: 60 ---- - -Discover which of your hyperparameters were the best predictors of, and highly correlated to desirable values of your metrics. - - -{{< img src="/images/general/parameter-importance-1.png" alt="Parameter importance panel" >}} - -**Correlation** is the linear correlation between the hyperparameter and the chosen metric (in this case val_loss). So a high correlation means that when the hyperparameter has a higher value, the metric also has higher values and vice versa. Correlation is a great metric to look at but it can't capture second order interactions between inputs and it can get messy to compare inputs with wildly different ranges. - -Therefore W&B also calculates an **importance** metric. W&B trains a random forest with the hyperparameters as inputs and the metric as the target output and report the feature importance values for the random forest. - -The idea for this technique was inspired by a conversation with [Jeremy Howard](https://twitter.com/jeremyphoward) who has pioneered the use of random forest feature importances to explore hyperparameter spaces at [Fast.ai](https://fast.ai). W&B highly recommends you check out this [lecture](https://course18.fast.ai/lessonsml1/lesson4.html) (and these [notes](https://forums.fast.ai/t/wiki-lesson-thread-lesson-4/7540)) to learn more about the motivation behind this analysis. - -Hyperparameter importance panel untangles the complicated interactions between highly correlated hyperparameters. In doing so, it helps you fine tune your hyperparameter searches by showing you which of your hyperparameters matter the most in terms of predicting model performance. - -## Creating a hyperparameter importance panel - -1. Navigate to your W&B project. -2. Select **Add panels** button. -3. Expand the **CHARTS** dropdown, choose **Parallel coordinates** from the dropdown. - - -{{% alert %}} -If an empty panel appears, make sure that your runs are ungrouped -{{% /alert %}} - - -{{< img src="/images/app_ui/hyperparameter_importance_panel.gif" alt="Automatic parameter visualization" >}} - -With the parameter manager, we can manually set the visible and hidden parameters. - -{{< img src="/images/app_ui/hyperparameter_importance_panel_manual.gif" alt="Manually setting the visible and hidden fields" >}} - -## Interpreting a hyperparameter importance panel - -{{< img src="/images/general/parameter-importance-4.png" alt="Feature importance analysis" >}} - -This panel shows you all the parameters passed to the [wandb.Run.config]({{< relref "/guides/models/track/config/" >}}) object in your training script. Next, it shows the feature importances and correlations of these config parameters with respect to the model metric you select (`val_loss` in this case). - -### Importance - -The importance column shows you the degree to which each hyperparameter was useful in predicting the chosen metric. Imagine a scenario were you start tuning a plethora of hyperparameters and using this plot to hone in on which ones merit further exploration. The subsequent sweeps can then be limited to the most important hyperparameters, thereby finding a better model faster and cheaper. - -{{% alert %}} -W&B calculate importances using a tree based model rather than a linear model as the former are more tolerant of both categorical data and data that's not normalized. -{{% /alert %}} - -In the preceding image, you can see that `epochs, learning_rate, batch_size` and `weight_decay` were fairly important. - -### Correlations - -Correlations capture linear relationships between individual hyperparameters and metric values. They answer the question of whether there a significant relationship between using a hyperparameter, such as the SGD optimizer, and the `val_loss` (the answer in this case is yes). Correlation values range from -1 to 1, where positive values represent positive linear correlation, negative values represent negative linear correlation and a value of 0 represents no correlation. Generally a value greater than 0.7 in either direction represents strong correlation. - -You might use this graph to further explore the values that are have a higher correlation to our metric (in this case you might pick stochastic gradient descent or adam over rmsprop or nadam) or train for more epochs. - - -{{% alert %}} -* correlations show evidence of association, not necessarily causation. -* correlations are sensitive to outliers, which might turn a strong relationship to a moderate one, specially if the sample size of hyperparameters tried is small. -* and finally, correlations only capture linear relationships between hyperparameters and metrics. If there is a strong polynomial relationship, it won't be captured by correlations. -{{% /alert %}} - -The disparities between importance and correlations result from the fact that importance accounts for interactions between hyperparameters, whereas correlation only measures the affects of individual hyperparameters on metric values. Secondly, correlations capture only the linear relationships, whereas importances can capture more complex ones. - -As you can see both importance and correlations are powerful tools for understanding how your hyperparameters influence model performance. \ No newline at end of file diff --git a/content/en/guides/models/app/features/panels/query-panels/_index.md b/content/en/guides/models/app/features/panels/query-panels/_index.md deleted file mode 100644 index e69253cc2f..0000000000 --- a/content/en/guides/models/app/features/panels/query-panels/_index.md +++ /dev/null @@ -1,164 +0,0 @@ ---- -description: Some features on this page are in beta, hidden behind a feature flag. - Add `weave-plot` to your bio on your profile page to unlock all related features. -url: guides/app/features/panels/query-panels -menu: - default: - identifier: intro_query_panel - parent: panels -cascade: -- url: guides/app/features/panels/query-panels/:filename -title: Query panels ---- - - -{{% alert %}} -Looking for W&B Weave? W&B's suite of tools for Generative AI application building? Find the docs for weave here: [wandb.me/weave](https://wandb.github.io/weave/?utm_source=wandb_docs&utm_medium=docs&utm_campaign=weave-nudge). -{{% /alert %}} - -Use query panels to query and interactively visualize your data. - -{{< img src="/images/weave/pretty_panel.png" alt="Query panel" >}} - - - -## Create a query panel - -Add a query to your workspace or within a report. - -{{< tabpane text=true >}} -{{% tab header="Project workspace" value="workspace" %}} - - 1. Navigate to your project's workspace. - 2. In the upper right hand corner, click `Add panel`. - 3. From the dropdown, select `Query panel`. - {{< img src="/images/weave/add_weave_panel_workspace.png" alt="Add panel dropdown" >}} - -{{% /tab %}} - -{{% tab header="W&B Report" value="report" %}} - -Type and select `/Query panel`. - -{{< img src="/images/weave/add_weave_panel_report_1.png" alt="Query panel option" >}} - -Alternatively, you can associate a query with a set of runs: -1. Within your report, type and select `/Panel grid`. -2. Click the `Add panel` button. -3. From the dropdown, select `Query panel`. - -{{% /tab %}} -{{< /tabpane >}} - - -## Query components - -### Expressions - -Use query expressions to query your data stored in W&B such as runs, artifacts, models, tables, and more. - -#### Example: Query a table -Suppose you want to query a W&B Table. In your training code you log a table called `"cifar10_sample_table"`: - -```python -import wandb -with wandb.init() as run: - run.log({"cifar10_sample_table":}) -``` - -Within the query panel you can query your table with: -```python -runs.summary["cifar10_sample_table"] -``` -{{< img src="/images/weave/basic_weave_expression.png" alt="Table query expression" >}} - -Breaking this down: - -* `runs` is a variable automatically injected in Query Panel Expressions when the Query Panel is in a Workspace. Its "value" is the list of runs which are visible for that particular Workspace. [Read about the different attributes available within a run here]({{< relref "../../../../track/public-api-guide.md#understanding-the-different-attributes" >}}). -* `summary` is an op which returns the Summary object for a Run. Ops are _mapped_, meaning this op is applied to each Run in the list, resulting in a list of Summary objects. -* `["cifar10_sample_table"]` is a Pick op (denoted with brackets), with a parameter of `predictions`. Since Summary objects act like dictionaries or maps, this operation picks the `predictions` field off of each Summary object. - -To learn how to write your own queries interactively, see the [Query panel demo](https://wandb.ai/luis_team_test/weave_example_queries/reports/Weave-queries---Vmlldzo1NzIxOTY2?accessToken=bvzq5hwooare9zy790yfl3oitutbvno2i6c2s81gk91750m53m2hdclj0jvryhcr). - -### Configurations - -Select the gear icon on the upper left corner of the panel to expand the query configuration. This allows the user to configure the type of panel and the parameters for the result panel. - -{{< img src="/images/weave/weave_panel_config.png" alt="Panel configuration menu" >}} - -### Result panels - -Finally, the query result panel renders the result of the query expression, using the selected query panel, configured by the configuration to display the data in an interactive form. The following images shows a Table and a Plot of the same data. - -{{< img src="/images/weave/result_panel_table.png" alt="Table result panel" >}} - -{{< img src="/images/weave/result_panel_plot.png" alt="Plot result panel" >}} - -## Basic operations -The following common operations you can make within your query panels. -### Sort -Sort from the column options: -{{< img src="/images/weave/weave_sort.png" alt="Column sort options" >}} - -### Filter -You can either filter directly in the query or using the filter button in the top left corner (second image) -{{< img src="/images/weave/weave_filter_1.png" alt="Query filter syntax" >}} -{{< img src="/images/weave/weave_filter_2.png" alt="Filter button" >}} - -### Map -Map operations iterate over lists and apply a function to each element in the data. You can do this directly with a panel query or by inserting a new column from the column options. -{{< img src="/images/weave/weave_map.png" alt="Map operation query" >}} -{{< img src="/images/weave/weave_map.gif" alt="Map column insertion" >}} - -### Groupby -You can groupby using a query or from the column options. -{{< img src="/images/weave/weave_groupby.png" alt="Group by query" >}} -{{< img src="/images/weave/weave_groupby.gif" alt="Group by column options" >}} - -### Concat -The concat operation allows you to concatenate 2 tables and concatenate or join from the panel settings -{{< img src="/images/weave/weave_concat.gif" alt="Table concatenation" >}} - -### Join -It is also possible to join tables directly in the query. Consider the following query expression: -```python -project("luis_team_test", "weave_example_queries").runs.summary["short_table_0"].table.rows.concat.join(\ -project("luis_team_test", "weave_example_queries").runs.summary["short_table_1"].table.rows.concat,\ -(row) => row["Label"],(row) => row["Label"], "Table1", "Table2",\ -"false", "false") -``` -{{< img src="/images/weave/weave_join.png" alt="Table join operation" >}} - -The table on the left is generated from: -```python -project("luis_team_test", "weave_example_queries").\ -runs.summary["short_table_0"].table.rows.concat.join -``` -The table in the right is generated from: -```python -project("luis_team_test", "weave_example_queries").\ -runs.summary["short_table_1"].table.rows.concat -``` -Where: -* `(row) => row["Label"]` are selectors for each table, determining which column to join on -* `"Table1"` and `"Table2"` are the names of each table when joined -* `true` and `false` are for left and right inner/outer join settings - - -## Runs object -Use query panels to access the `runs` object. Run objects store records of your experiments. You can find more details in [Accessing runs object](https://wandb.ai/luis_team_test/weave_example_queries/reports/Weave-queries---Vmlldzo1NzIxOTY2?accessToken=bvzq5hwooare9zy790yfl3oitutbvno2i6c2s81gk91750m53m2hdclj0jvryhcr#3.-accessing-runs-object) but, as quick overview, `runs` object has available: -* `summary`: A dictionary of information that summarizes the run's results. This can be scalars like accuracy and loss, or large files. By default, `wandb.Run.log()` sets the summary to the final value of a logged time series. You can set the contents of the summary directly. Think of the summary as the run's outputs. -* `history`: A list of dictionaries meant to store values that change while the model is training such as loss. The command `wandb.Run.log()` appends to this object. -* `config`: A dictionary of the run's configuration information, such as the hyperparameters for a training run or the preprocessing methods for a run that creates a dataset Artifact. Think of these as the run's "inputs" -{{< img src="/images/weave/weave_runs_object.png" alt="Runs object structure" >}} - -## Access Artifacts - -Artifacts are a core concept in W&B. They are a versioned, named collection of files and directories. Use Artifacts to track model weights, datasets, and any other file or directory. Artifacts are stored in W&B and can be downloaded or used in other runs. You can find more details and examples in [Accessing artifacts](https://wandb.ai/luis_team_test/weave_example_queries/reports/Weave-queries---Vmlldzo1NzIxOTY2?accessToken=bvzq5hwooare9zy790yfl3oitutbvno2i6c2s81gk91750m53m2hdclj0jvryhcr#4.-accessing-artifacts). Artifacts are normally accessed from the `project` object: -* `project.artifactVersion()`: returns the specific artifact version for a given name and version within a project -* `project.artifact("")`: returns the artifact for a given name within a project. You can then use `.versions` to get a list of all versions of this artifact -* `project.artifactType()`: returns the `artifactType` for a given name within a project. You can then use `.artifacts` to get a list of all artifacts with this type -* `project.artifactTypes`: returns a list of all artifact types under the project -{{< img src="/images/weave/weave_artifacts.png" alt="Artifact access methods" >}} \ No newline at end of file diff --git a/content/en/guides/models/app/features/panels/query-panels/embedding-projector.md b/content/en/guides/models/app/features/panels/query-panels/embedding-projector.md deleted file mode 100644 index 8f86c2f0f9..0000000000 --- a/content/en/guides/models/app/features/panels/query-panels/embedding-projector.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -description: W&B's Embedding Projector allows users to plot multi-dimensional embeddings - on a 2D plane using common dimension reduction algorithms like PCA, UMAP, and t-SNE. -menu: - default: - identifier: embedding-projector - parent: query-panels -title: Embed objects ---- - -{{< img src="/images/weave/embedding_projector.png" alt="Embedding projector" >}} - -[Embeddings](https://developers.google.com/machine-learning/crash-course/embeddings/video-lecture) are used to represent objects (people, images, posts, words, etc...) with a list of numbers - sometimes referred to as a _vector_. In machine learning and data science use cases, embeddings can be generated using a variety of approaches across a range of applications. This page assumes the reader is familiar with embeddings and is interested in visually analyzing them inside of W&B. - -## Embedding Examples - -- [Live Interactive Demo Report](https://wandb.ai/timssweeney/toy_datasets/reports/Feature-Report-W-B-Embeddings-Projector--VmlldzoxMjg2MjY4?accessToken=bo36zrgl0gref1th5nj59nrft9rc4r71s53zr2qvqlz68jwn8d8yyjdz73cqfyhq) -- [Example Colab](https://colab.research.google.com/drive/1DaKL4lZVh3ETyYEM1oJ46ffjpGs8glXA#scrollTo=D--9i6-gXBm_). - -### Hello World - -W&B allows you to log embeddings using the `wandb.Table` class. Consider the following example of 3 embeddings, each consisting of 5 dimensions: - -```python -import wandb - -with wandb.init(project="embedding_tutorial") as run: - embeddings = [ - # D1 D2 D3 D4 D5 - [0.2, 0.4, 0.1, 0.7, 0.5], # embedding 1 - [0.3, 0.1, 0.9, 0.2, 0.7], # embedding 2 - [0.4, 0.5, 0.2, 0.2, 0.1], # embedding 3 - ] - run.log( - {"embeddings": wandb.Table(columns=["D1", "D2", "D3", "D4", "D5"], data=embeddings)} - ) - run.finish() -``` - -After running the above code, the W&B dashboard will have a new Table containing your data. You can select `2D Projection` from the upper right panel selector to plot the embeddings in 2 dimensions. Smart default will be automatically selected, which can be easily overridden in the configuration menu accessed by clicking the gear icon. In this example, we automatically use all 5 available numeric dimensions. - -{{< img src="/images/app_ui/weave_hello_world.png" alt="2D projection example" >}} - -### Digits MNIST - -While the above example shows the basic mechanics of logging embeddings, typically you are working with many more dimensions and samples. Let's consider the MNIST Digits dataset ([UCI ML hand-written digits dataset](https://archive.ics.uci.edu/ml/datasets/Optical+Recognition+of+Handwritten+Digits)[s](https://archive.ics.uci.edu/ml/datasets/Optical+Recognition+of+Handwritten+Digits)) made available via [SciKit-Learn](https://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_digits.html). This dataset has 1797 records, each with 64 dimensions. The problem is a 10 class classification use case. We can convert the input data to an image for visualization as well. - -```python -import wandb -from sklearn.datasets import load_digits - -with wandb.init(project="embedding_tutorial") as run: - - # Load the dataset - ds = load_digits(as_frame=True) - df = ds.data - - # Create a "target" column - df["target"] = ds.target.astype(str) - cols = df.columns.tolist() - df = df[cols[-1:] + cols[:-1]] - - # Create an "image" column - df["image"] = df.apply( - lambda row: wandb.Image(row[1:].values.reshape(8, 8) / 16.0), axis=1 - ) - cols = df.columns.tolist() - df = df[cols[-1:] + cols[:-1]] - - run.log({"digits": df}) -``` - -After running the above code, again we are presented with a Table in the UI. By selecting `2D Projection` we can configure the definition of the embedding, coloring, algorithm (PCA, UMAP, t-SNE), algorithm parameters, and even overlay (in this case we show the image when hovering over a point). In this particular case, these are all "smart defaults" and you should see something very similar with a single click on `2D Projection`. ([Interact with this embedding tutorial example](https://wandb.ai/timssweeney/embedding_tutorial/runs/k6guxhum?workspace=user-timssweeney)). - -{{< img src="/images/weave/embedding_projector.png" alt="MNIST digits projection" >}} - -## Logging Options - -You can log embeddings in a number of different formats: - -1. **Single Embedding Column:** Often your data is already in a "matrix"-like format. In this case, you can create a single embedding column - where the data type of the cell values can be `list[int]`, `list[float]`, or `np.ndarray`. -2. **Multiple Numeric Columns:** In the above two examples, we use this approach and create a column for each dimension. We currently accept python `int` or `float` for the cells. - -{{< img src="/images/weave/logging_options.png" alt="Single embedding column" >}} -{{< img src="/images/weave/logging_option_image_right.png" alt="Multiple numeric columns" >}} - -Furthermore, just like all tables, you have many options regarding how to construct the table: - -1. Directly from a **dataframe** using `wandb.Table(dataframe=df)` -2. Directly from a **list of data** using `wandb.Table(data=[...], columns=[...])` -3. Build the table **incrementally row-by-row** (great if you have a loop in your code). Add rows to your table using `table.add_data(...)` -4. Add an **embedding column** to your table (great if you have a list of predictions in the form of embeddings): `table.add_col("col_name", ...)` -5. Add a **computed column** (great if you have a function or model you want to map over your table): `table.add_computed_columns(lambda row, ndx: {"embedding": model.predict(row)})` - -## Plotting Options - -After selecting `2D Projection`, you can click the gear icon to edit the rendering settings. In addition to selecting the intended columns (see above), you can select an algorithm of interest (along with the desired parameters). Below you can see the parameters for UMAP and t-SNE respectively. - -{{< img src="/images/weave/plotting_options_left.png" alt="UMAP parameters" >}} -{{< img src="/images/weave/plotting_options_right.png" alt="t-SNE parameters" >}} - -{{% alert %}} -Note: we currently downsample to a random subset of 1000 rows and 50 dimensions for all three algorithms. -{{% /alert %}} \ No newline at end of file diff --git a/content/en/guides/models/app/features/panels/run-comparer.md b/content/en/guides/models/app/features/panels/run-comparer.md deleted file mode 100644 index 6c0ba00ada..0000000000 --- a/content/en/guides/models/app/features/panels/run-comparer.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -description: Compare metrics across multiple runs -menu: - default: - identifier: run-comparer - parent: panels -title: Compare run metrics -weight: 70 ---- - -Use the Run Comparer to see differences and similarities across runs in your project. - -## Add a Run Comparer panel - -1. Select the **Add panels** button in the top right corner of the page. -1. From the **Evaluation** section, select **Run comparer**. - -## Use Run Comparer -Run Comparer shows the configuration and logged metrics for the 10 first visible runs in the project, one column per run. - -- To change the runs to compare, you can search, filter, group, or sort the list of runs on the left-hand side. The Run Comparer updates automatically. -- Use the search field at the top of the Run Comparer to filter or search for a configuration key or a metadata key such as the Python version or the run's creation time. -- To quickly see differences and hide identical values, toggle **Diff only** at the top of the panel. -- To adjust the column width or row height, use the formatting buttons at the top of the panel. -- To copy any configuration or metric's value, hover your mouse over the value, then click the copy button. The entire value is copied, even if it is too long to display on the screen. - -{{% alert %}} -By default, Run Comparer does not differentiate runs with different values for [`job_type`]({{< relref "/ref/python/functions/init.md" >}}). This means that it is possible to compare runs that are not comparable within a project. For example, you could compare a training run to a model evaluation run. A training run could contain run logs, hyperparameters, training loss metrics, and the model itself. An evaluation run could use the model to check the model's performance on new training data. - -When you search, filter, group, or sort the list of runs in the Runs Table, the Run Comparer automatically updates to compare the first 10 runs. Filter or search within the Runs Table to compare similar runs, such as by filtering or sorting the list by `job_type`. Learn more about [filtering runs]({{< relref "/guides/models/track/runs/filter-runs.md" >}}). -{{% /alert %}} diff --git a/content/en/guides/models/app/features/panels/scatter-plot.md b/content/en/guides/models/app/features/panels/scatter-plot.md deleted file mode 100644 index b5848585e8..0000000000 --- a/content/en/guides/models/app/features/panels/scatter-plot.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -menu: - default: - identifier: scatter-plot - parent: panels -title: Scatter plots -weight: 40 ---- - -This page shows how to use scatter plots in W&B. - -## Use case - -Use scatter plots to compare multiple runs and visualize the performance of an experiment: - -- Plot lines for minimum, maximum, and average values. -- Customize metadata tooltips. -- Control point colors. -- Adjust axis ranges. -- Use a log scale for the axes. - -## Example - -The following example shows a scatter plot displaying validation accuracy for different models over several weeks of experimentation. The tooltip includes batch size, dropout, and axis values. A line also shows the running average of validation accuracy. - -[See a live example →](https://app.wandb.ai/l2k2/l2k/reports?view=carey%2FScatter%20Plot) - -{{< img src="/images/general/scatter-plots-1.png" alt="Validation accuracy scatter plot" >}} - -## Create a scatter plot - -To create a scatter plot in the W&B UI: - -1. Navigate to the **Workspaces** tab. -2. In the **Charts** panel, click the action menu `...`. -3. From the pop-up menu, select **Add panels**. -4. In the **Add panels** menu, select **Scatter plot**. -5. Set the `x` and `y` axes to plot the data you want to view. Optionally, set maximum and minimum ranges for your axes or add a `z` axis. -6. Click **Apply** to create the scatter plot. -7. View the new scatter plot in the Charts panel. diff --git a/content/en/guides/models/app/keyboard-shortcuts.md b/content/en/guides/models/app/keyboard-shortcuts.md deleted file mode 100644 index 8f75e9ac25..0000000000 --- a/content/en/guides/models/app/keyboard-shortcuts.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -description: Learn about the keyboard shortcuts available in the W&B App. -menu: - default: - identifier: keyboard-shortcuts - parent: app -title: Keyboard shortcuts -weight: 1 ---- - -The W&B App supports keyboard shortcuts to help you navigate and interact with experiments, workspaces, and data more efficiently. This reference guide covers all available keyboard shortcuts organized by functional area. - -## Workspace Management - -| Shortcut | Description | -|----------|-------------| -| **Cmd+Z** (macOS) / **Ctrl+Z** (Windows/Linux) | Undo a change you've made in the UI, such as a modification to the workspace or a panel. | -| **Cmd+Shift+Z** (macOS) / **Ctrl+Y** (Windows/Linux) | Redo a change you previously undid in the workspace. | - -## Navigation - -| Shortcut | Description | -|----------|-------------| -| **Tab** | Navigate between interactive elements. | -| **Cmd+J** (macOS) / **Ctrl+J** (Windows/Linux) | Switch between the Workspaces and Runs tabs in the sidebar. | -| **Cmd+K** (macOS) / **Ctrl+K** (Windows/Linux) | Open the quick search dialog to search across projects, runs, and other resources. | -| **Esc** | Throughout the W&B App, exit full-screen panel views, close settings drawers, dismiss the quick search dialog, close an editor, or dismiss other overlays. | - -## Panel Navigation - -| Shortcut | Description | -|----------|-------------| -| **Left Arrow / Right Arrow** | Step through panels in a section when in full screen mode. | -| **Esc** | Exit full-screen panel view and return to the workspace. | -| **Cmd+Left Arrow / Cmd+Right Arrow** (macOS)
**Ctrl+Left Arrow / Ctrl+Right Arrow** (Windows/Linux) | When viewing a media panel in full screen mode,move the step slider. | - -## Reports - -| Shortcut | Description | -|----------|-------------| -| **Delete / Backspace** | Remove the selected panel grid from the report. | -| **Enter** | Insert a Markdown block after typing "/mark" in a report. | -| **Esc** | Exit the report editor. | -| **Tab** | Navigate between interactive elements in a report. | - -## Notes - -- Most keyboard shortcuts use **Cmd** on macOS and **Ctrl** on Windows/Linux -- The W&B App implements custom handling for some browser default shortcuts. -- Some shortcuts are context-sensitive and only work in specific areas of the application \ No newline at end of file diff --git a/content/en/guides/models/app/settings-page/_index.md b/content/en/guides/models/app/settings-page/_index.md deleted file mode 100644 index e19c534e21..0000000000 --- a/content/en/guides/models/app/settings-page/_index.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -description: Use the Weights and Biases Settings Page to customize your individual - user profile or team settings. -menu: - default: - identifier: settings - parent: w-b-app-ui-reference -title: Settings -weight: 4 -cascade: -- url: guides/app/settings-page/:filename ---- - -Within your individual user account you can edit: your profile picture, display name, geography location, biography information, emails associated to your account, and manage alerts for runs. You can also use the settings page to link your GitHub repository and delete your account. For more information, see [User settings]({{< relref "./user-settings.md" >}}). - -Use the team settings page to invite or remove new members to a team, manage alerts for team runs, change privacy settings, and view and manage storage usage. For more information about team settings, see [Team settings]({{< relref "./teams.md" >}}). \ No newline at end of file diff --git a/content/en/guides/models/app/settings-page/anon.md b/content/en/guides/models/app/settings-page/anon.md deleted file mode 100644 index 777d1c33ab..0000000000 --- a/content/en/guides/models/app/settings-page/anon.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -description: Log and visualize data without a W&B account -menu: - default: - identifier: anon - parent: settings -title: Anonymous mode -weight: 80 ---- - -Are you publishing code that you want anyone to be able to run easily? Use anonymous mode to let someone run your code, see a W&B dashboard, and visualize results without needing to create a W&B account first. - -Allow results to be logged in anonymous mode with: - -```python -import wandb - -wandb.init(anonymous="allow") -``` - -For example, the proceeding code snippet shows how to create and log an artifact with W&B: - -```python -import wandb - -run = wandb.init(anonymous="allow") - -artifact = wandb.Artifact(name="art1", type="foo") -artifact.add_file(local_path="path/to/file") -run.log_artifact(artifact) - -run.finish() -``` - -[Try the example notebook](https://colab.research.google.com/drive/1nQ3n8GD6pO-ySdLlQXgbz4wA3yXoSI7i) to see how anonymous mode works. \ No newline at end of file diff --git a/content/en/guides/models/app/settings-page/billing-settings.md b/content/en/guides/models/app/settings-page/billing-settings.md deleted file mode 100644 index aee64aee19..0000000000 --- a/content/en/guides/models/app/settings-page/billing-settings.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -description: Manage your organization's billing settings -menu: - default: - parent: settings -title: Manage billing settings -weight: 20 ---- - -Navigate to your user profile page and select your user icon on the top right corner. From the dropdown, choose **Billing**, or choose **Settings** and then select the **Billing** tab. - -## Plan details - -The **Plan details** section summarizes your organization's current plan, charges, limits, and usage. - -- For details and a list of users, click **Manage users**. -- For details about usage, click **View usage**. -- Amount of storage your organization uses, both free and paid. From here, you can purchase additional storage and manage storage that is currently in use. Learn more about [storage settings]({{< relref "storage.md" >}}). - -From here, you can compare plans or talk to Sales. - -## Plan usage -This section visually summarizes current usage and displays upcoming usage charges. For detailed insights into usage by month, click **View usage** on an individual tile. To export usage by calendar month, team, or project, click **Export CSV**. - -### Usage alerts - -{{% alert %}} -Usage alerts are not available on the [Enterprise plan](https://wandb.ai/site/pricing/). -{{% /alert %}} - -For organizations on paid plans, admins receive alerts via email **once per billing period** when certain thresholds are met, along with details about how to increase your organization's limits if you are a [billing admin]({{< relref "#billing-admin" >}}) and how to contact a billing admin otherwise. On the [Pro plan](https://wandb.ai/site/pricing/), only the billing admin receives usage alerts. - -These alerts are not configurable, and are sent when: - -- Your organization is approaching a monthly limit of a category of usage (85% of hours used) and when it reaches 100% of the limit, according to your plan. -- Your organization's accumulated average charges for a billing period exceed these thresholds: $200, $450, $700, and $1000. These overage charges are incurred when your organization accumulates more usage than your plan includes for tracked hours, storage, or W&B Weave data ingestion. - -For questions about usage or billing, contact your account team or Support. - -## Payment methods -This section shows the payment methods on file for your organization. If you have not added a payment method, you will be prompted to do so when you upgrade your plan or add paid storage. - -## Billing admin -This section shows the current billing admin. The billing admin is an organization admin, receives all billing-related emails, and can view and manage payment methods. - -{{% alert %}} -In W&B Dedicated Cloud, multiple users can be billing admins. In W&B Multi-tenant Cloud, only one user at a time can be the billing admin. -{{% /alert %}} - -To change the billing admin or assign the role to additional users: - -1. Click **Manage roles**. -1. Search for a user. -1. Click the **Billing admin** field in that user's row. -1. Read the summary, then click **Change billing user**. - -## Invoices -If you pay using a credit card, this section allows you to view monthly invoices. -- For Enterprise accounts that pay via wire transfer, this section is blank. For questions, contact your account team. -- If your organization incurs no charges, no invoice is generated. \ No newline at end of file diff --git a/content/en/guides/models/app/settings-page/emails.md b/content/en/guides/models/app/settings-page/emails.md deleted file mode 100644 index 997e90503a..0000000000 --- a/content/en/guides/models/app/settings-page/emails.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -description: Manage emails from the Settings page. -menu: - default: - identifier: emails - parent: settings -title: Manage email settings -weight: 40 ---- - - -Add, delete, manage email types and primary email addresses in your W&B Profile Settings page. Select your profile icon in the upper right corner of the W&B dashboard. From the dropdown, select **Settings**. Within the Settings page, scroll down to the Emails dashboard: - -{{< img src="/images/app_ui/manage_emails.png" alt="Email management dashboard" >}} - -## Manage primary email - -The primary email is marked with a 😎 emoji. The primary email is automatically defined with the email you provided when you created a W&B account. - -Select the kebab dropdown to change the primary email associated with your Weights And Biases account: - -{{% alert %}} -Only verified emails can be set as primary -{{% /alert %}} - -{{< img src="/images/app_ui/primary_email.png" alt="Primary email dropdown" >}} - -## Add emails - -Select **+ Add Email** to add an email. This will take you to an Auth0 page. You can enter in the credentials for the new email or connect using single sign-on (SSO). - -## Delete emails - -Select the kebab dropdown and choose **Delete Emails** to delete an email that is registered to your W&B account - -{{% alert %}} -Primary emails cannot be deleted. You need to set a different email as a primary email before deleting. -{{% /alert %}} - -## Log in methods - -The Log in Methods column displays the log in methods that are associated with your account. - -A verification email is sent to your email account when you create a W&B account. Your email account is considered unverified until you verify your email address. Unverified emails are displayed in red. - -Attempt to log in with your email address again to retrieve a second verification email if you no longer have the original verification email that was sent to your email account. - -Contact support@wandb.com for account log in issues. \ No newline at end of file diff --git a/content/en/guides/models/app/settings-page/storage.md b/content/en/guides/models/app/settings-page/storage.md deleted file mode 100644 index 66189d96f6..0000000000 --- a/content/en/guides/models/app/settings-page/storage.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -description: Ways to manage W&B data storage. -menu: - default: - identifier: app_storage - parent: settings -title: Manage storage -weight: 60 ---- - -If you are approaching or exceeding your storage limit, there are multiple paths forward to manage your data. The path that's best for you will depend on your account type and your current project setup. - -## Manage storage consumption -W&B offers different methods of optimizing your storage consumption: - -- Use [reference artifacts]({{< relref "/guides/core/artifacts/track-external-files.md" >}}) to track files saved outside the W&B system, instead of uploading them to W&B storage. -- Use an [external cloud storage bucket]({{< relref "teams.md" >}}) for storage. *(Enterprise only)* - -## Delete data -You can also choose to delete data to remain under your storage limit. There are several ways to do this: - -- Delete data interactively with the app UI. -- [Set a TTL policy]({{< relref "/guides/core/artifacts/manage-data/ttl.md" >}}) on Artifacts so they are automatically deleted. \ No newline at end of file diff --git a/content/en/guides/models/app/settings-page/teams.md b/content/en/guides/models/app/settings-page/teams.md deleted file mode 100644 index 5970e70ac1..0000000000 --- a/content/en/guides/models/app/settings-page/teams.md +++ /dev/null @@ -1,199 +0,0 @@ ---- -description: Collaborate with your colleagues, share results, and track all the experiments across your team. Manage team settings including members, alerts, and privacy. -menu: - default: - identifier: teams - parent: settings -title: Team settings -weight: 30 ---- - -Use W&B Teams as a central workspace for your ML team to build better models faster. Organization admins and team admins can view and edit a team's settings. - -* **Track all the experiments** your team has tried so you never duplicate work. -* **Save and reproduce** previously trained models. -* **Share progress** and results with your boss and collaborators. -* **Catch regressions** and immediately get alerted when performance drops. -* **Benchmark model performance** and compare model versions. - -{{< img src="/images/app_ui/teams_overview.webp" alt="Teams workspace overview" >}} - -{{% alert %}} -Only Administration account types can change team settings or remove a member from a team. -{{% /alert %}} - -## Create a collaborative team - -1. [Sign up or log in](https://app.wandb.ai/login?signup=true) to your free W&B account. -2. Click **Invite Team** in the navigation bar. -3. Create your team and invite collaborators. -4. Configure your team using the settings described below. - -{{% alert %}} -**Note**: Only the admin of an organization can create a new team. -{{% /alert %}} - -## Team configuration -You can configure various settings for your team, including its membership, alerts, and privacy settings. - -To manage your team's settings, navigate to the **Teams** section in the left-menu and click the team you want to change settings for. You can update the following settings: -### Members - -The Members section shows a list of all pending invitations and the members who have accepted the invitation to join the team. The list displays each member's name, username, email, team role, and access privileges to Models and W&B Weave, which are inherited from the organization. You can choose from the standard team roles **Admin**, **Member**, and **View-only**. If your organization has created [custom roles]({{< relref "/guides/hosting/iam/access-management/manage-organization.md#create-custom-roles" >}}), you can assign a custom role instead. - -See [Add and Manage teams]({{< relref "/guides/hosting/iam/access-management/manage-organization.md#add-and-manage-teams" >}}) for information on how to create a team, manage teams, and manage team membership and roles. To configure who can invite new members and configure other privacy settings for the team, refer to [Privacy]({{< relref "#privacy" >}}). - -To remove a team member, admins can open the team settings page and click the delete button next to the departing member's name. Any runs logged to the team remain after a user leaves. - -### Avatar - -To set an avatar for your team: - -1. Navigate to the **Teams** section in the left-menu and click the team you want to add an avatar for. This opens the team's overview page. -2. Hover over the team's default avatar image in the upper-left corner of the page and click the **Upload photo** button. This opens a file prompt. -3. From the file prompt, select the image you want to use and then click **Open**. This uploads the photo to your team and sets it as your team's avatar. - -### Alerts - -You can set up alerts to notify your team when runs crash and finish. Alerts can be sent through either email or Slack, and you can customize them to meet your needs. - -In the **Team alerts** section, toggle the switch next to the event type you want to receive alerts from. Weights and Biases provides the following event type options: - -* **Runs finished**: whether a Weights and Biases run successfully finished. -* **Run crashed**: if a run has failed to finish. -* **wandb.alert()**: A custom scriptable alert. See [Send alerts with `wandb.Run.alert()`]({{< relref "/guides/models/track/runs/alert.md" >}}) for more information. - - -### Slack notifications - -Configure Slack destinations where your team's [automations]({{< relref "/guides/core/automations/" >}}) can send notifications when an event occurs in a registry or a project, such as when a new artifact is created or when a run metric meets a defined threshold. Refer to [Create a Slack automation]({{< relref "/guides/core/automations/create-automations/slack.md" >}}). - -{{% pageinfo color="info" %}} -{{< readfile file="/_includes/enterprise-only.md" >}} -{{% /pageinfo %}} - -### Webhooks - -Configure webhooks that your team's [automations]({{< relref "/guides/core/automations/" >}}) can run when an event occurs in a registry or a project, such as when a new artifact is created or when a run metric meets a defined threshold. Refer to [Create a webhook automation]({{< relref "/guides/core/automations/create-automations/webhook.md" >}}). - -{{% pageinfo color="info" %}} -{{< readfile file="/_includes/enterprise-only.md" >}} -{{% /pageinfo %}} - -### Privacy - -Team privacy settings allow you to manage visibility and sharing abilities on your team. Only organization admins can modify privacy settings. - -You can change the following privacy settings: - -- Hide this team from all non-members. -- Make all future team projects private (public sharing not allowed). -- Allow any team member to invite other team members (not just admins). -- Disable public sharing to outside of team for reports in private projects. This disables existing magic links. -- Automatically recommend new users with matching email domains join this team upon signup. -- Enable code saving by default. - -You can see the privacy settings of all team projects on the team settings page: `app.wandb.ai/teams/your-team-name` - -### Usage - -The **Usage** section describes the total memory usage the team has consumed on the Weights and Biases servers. The default storage plan is 100GB. For more information about storage and pricing, see the [Pricing](https://wandb.ai/site/pricing) page. - -### Storage - -The **Storage** section describes the cloud storage bucket configuration that is being used for the team's data. For more information, see [Secure Storage Connector]({{< relref "#secure-storage-connector" >}}) or check out our [W&B Server]({{< relref "/guides/hosting/data-security/secure-storage-connector.md" >}}) docs if you are self-hosting. - -## Create a team profile - -You can customize your team's profile page to show an introduction and showcase reports and projects that are visible to the public or team members. Present reports, projects, and external links. - -* **Highlight your best research** to visitors by showcasing your best public reports -* **Showcase the most active projects** to make it easier for teammates to find them -* **Find collaborators** by adding external links to your company or research lab's website and any papers you've published - - - -## Team roles and permissions -Select a team role when you invite colleagues to join a team. There are following team role options: - -- **Admin**: Team admins can add and remove other admins or team members. They have permissions to modify all projects and full deletion permissions. This includes, but is not limited to, deleting runs, projects, artifacts, and sweeps. -- **Member**: A regular member of the team. By default, only an admin can invite a team member. To change this behavior, refer to [Privacy settings]({{< relref "#privacy" >}}). -- **View-Only (Enterprise-only feature)**: View-Only members can view assets within the team such as runs, reports, and workspaces. They can follow and comment on reports, but they can not create, edit, or delete project overview, reports, or runs. -- **Custom roles (Enterprise-only feature)**: Custom roles allow organization admins to compose new roles based on either of the **View-Only** or **Member** roles, together with additional permissions to achieve fine-grained access control. Team admins can then assign any of those custom roles to users in their respective teams. Refer to [Introducing Custom Roles for W&B Teams](https://wandb.ai/wandb_fc/announcements/reports/Introducing-Custom-Roles-for-W-B-Teams--Vmlldzo2MTMxMjQ3) for details. - -A team member can delete only runs they created. Suppose you have two members A and B. Member B moves a run from team B's project to a different project owned by Member A. Member A cannot delete the run Member B moved to Member A's project. An admin can manage runs and sweep runs created by any team member. - -### Service accounts - -In addition to user roles, teams can also use **service accounts** for automation. Service accounts are not users, but rather non-human identities used for automated workflows. Refer to [Use service accounts to automate workflows]({{< relref "/guides/hosting/iam/authentication/service-accounts.md" >}}) for detailed information. - -{{% alert %}} -W&B recommends assigning more than one admin in a team to ensure that admin operations can continue when the primary admin is not available. -{{% /alert %}} - -### Team settings -Team settings allow you to manage the settings for your team and its members. With these privileges, you can effectively oversee and organize your team within W&B. - -| Permissions | View-Only | Team Member | Team Admin | -| ------------------- | --------- | ----------- | ---------- | -| Add team members | | | X | -| Remove team members | | | X | -| Manage team settings| | | X | - -### Reports -Report permissions grant access to create, view, and edit reports. The proceeding table lists permissions that apply to all reports across a given team. - -| Permissions | View-Only | Team Member | Team Admin | -| ----------- | --------- | ----------------------------------------------- | ---------- | -|View reports | X | X | X | -|Create reports | | X | X | -|Edit reports | | X (team members can only edit their own reports)| X | -|Delete reports | | X (team members can only edit their own reports)| X | - -### Experiments -The proceeding table lists permissions that apply to all experiments across a given team. - -| Permissions | View-Only | Team Member | Team Admin | -| ------------------------------------------------------------------------------------ | --------- | ----------- | ---------- | -| View experiment metadata (includes history metrics, system metrics, files, and logs) | X | X | X | -| Edit experiment panels and workspaces | | X | X | -| Log experiments | | X | X | -| Delete experiments | | X (team members can only delete experiments they created) | X | -|Stop experiments | | X (team members can only stop experiments they created) | X | - -### Artifacts -The proceeding table lists permissions that apply to all artifacts across a given team. - -| Permissions | View-Only | Team Member | Team Admin | -| ---------------- | --------- | ----------- | ---------- | -| View artifacts | X | X | X | -| Create artifacts | | X | X | -| Delete artifacts | | X | X | -| Edit metadata | | X | X | -| Edit aliases | | X | X | -| Delete aliases | | X | X | -| Download artifact| | X | X | - -### System settings (W&B Server only) -Use system permissions to create and manage teams and their members and to adjust system settings. These privileges enable you to effectively administer and maintain the W&B instance. - -| Permissions | View-Only | Team Member | Team Admin | System Admin | -| ------------------------ | --------- | ----------- | ---------- | ------------ | -| Configure system settings| | | | X | -| Create/delete teams | | | | X | - -### Team service account behavior - -* When you configure a team in your training environment, you can use a service account from that team to log runs in either of private or public projects within that team. Additionally, you can attribute those runs to a user if **WANDB_USERNAME** or **WANDB_USER_EMAIL** variable exists in your environment and the referenced user is part of that team. -* When you **do not** configure a team in your training environment and use a service account, the runs log to the named project within that service account's parent team. In this case as well, you can attribute the runs to a user if **WANDB_USERNAME** or **WANDB_USER_EMAIL** variable exists in your environment and the referenced user is part of the service account's parent team. -* A service account can not log runs to a private project in a team different from its parent team. A service account can log to runs to project only if the project is set to `Open` project visibility. - -## Team trials - -See the [pricing page](https://wandb.ai/site/pricing) for more information on W&B plans. You can download all your data at any time, either using the dashboard UI or the [Export API]({{< relref "/ref/python/public-api/index.md" >}}). - -## Advanced configuration - -### Secure storage connector - -The team-level secure storage connector allows teams to use their own cloud storage bucket with W&B. This provides greater data access control and data isolation for teams with highly sensitive data or strict compliance requirements. Refer to [Secure Storage Connector]({{< relref "/guides/hosting/data-security/secure-storage-connector.md" >}}) for more information. diff --git a/content/en/guides/models/app/settings-page/user-settings.md b/content/en/guides/models/app/settings-page/user-settings.md deleted file mode 100644 index 10a1680bae..0000000000 --- a/content/en/guides/models/app/settings-page/user-settings.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -description: Manage your profile information, account defaults, alerts, participation - in beta products, GitHub integration, storage usage, account activation, and create - teams in your user settings. -menu: - default: - identifier: user-settings - parent: settings -title: Manage user settings -weight: 10 ---- - -Navigate to your user profile page and select your user icon on the top right corner. From the dropdown, choose **Settings**. - -## Profile - -Within the **Profile** section you can manage and modify your account name and institution. You can optionally add a biography, location, link to a personal or your institution’s website, and upload a profile image. - -## Edit your intro - -To edit your intro, click **Edit** at the top of your profile. The WYSIWYG editor that opens supports Markdown. -1. To edit a line, click it. To save time, you can type `/` and choose Markdown from the list. -1. Use an item's drag handles to move it. -1. To delete a block, click the drag handle, then click **Delete**. -1. To save your changes, click **Save**. - -### Add social badges - -To add a follow badge for the `@weights_biases` account on X, you could add a Markdown-style link with an HTML `` tag that points to the badge image: - -```markdown -[![X: @weights_biases](https://img.shields.io/twitter/follow/weights_biases?style=social)](https://x.com/intent/follow?screen_name=weights_biases) -``` -In an `` tag, you can specify `width`, `height`, or both. If you specify only one of them, the image's proportions are maintained. - -## Default team -If you are a member of more than one team, the **Default team** section allows you to configure the default team to use when a run or a Weave trace does not specify a team. If you are a member of only one team, that team is the default and this section does not appear. - -Select a tab to continue. - -{{< tabpane text=true >}} -{{% tab header="Multi-tenant Cloud" %}} -Next to **Default location to create new projects in**, click thew drop-down, then select your default team. -{{% /tab %}} -{{% tab header="Dedicated Cloud / Self-Managed" %}} -1. Next to **Default location to create new projects in**, click thew drop-down, then select your default team or your personal entity. -1. (**Optional**) If an admin has turned on public projects in in **Account** > **Settings** > **Privacy**, configure the default visibility for your new projects. Click the button next to **Default project privacy in your personal account**, then select **Private** (the default) or **Public**. -1. (**Optional**) If an admin has turned on [default saving and diffing code]({{< relref "/guides/models/app/features/panels/code.md" >}}) in **Account** > **Settings** > **Privacy**, to turn it on for your runs, click **Enable code saving in your personal account**. -{{% /tab %}} -{{< /tabpane >}} - -{{% alert %}} -To specify the default team when you’re running a script in an automated environment, you can specify the default location using the `WANDB_ENTITY` [environment variable]({{< relref "https://docs.wandb.ai/guides/models/track/environment-variables.md" >}}). -{{% /alert %}} - -## Teams -The **Teams** section lists all of your teams. - -1. Click a team name to go to the team page. -1. If you have permission to join additional teams, click **View teams** next to **We found teams for you to join**. -1. Optionally, turn on **Hide teams in public profile**. - -{{% alert %}} -To create or manage a team, see [Manage teams]({{< relref "/guides/models/app/settings-page/teams/" >}}). -{{% /alert %}} - -## Beta features - -Within the **Beta Features** section you can optionally enable fun add-ons and sneak previews of new products in development. Select the toggle switch next to the beta feature you want to enable. - -## Alerts - -Get notified when your runs crash, finish, or set custom alerts with [wandb.Run.alert()]({{< relref "/guides/models/track/runs/alert.md" >}}). Receive notifications either through Email or Slack. Toggle the switch next to the event type you want to receive alerts from. - -* **Runs finished**: whether a Weights and Biases run successfully finished. -* **Run crashed**: notification if a run has failed to finish. - -For more information about how to set up and manage alerts, see [Send alerts with wandb.Run.alert()]({{< relref "/guides/models/track/runs/alert.md" >}}). - -## Personal GitHub integration - -Connect a personal Github account. To connect a Github account: - -1. Select the **Connect Github** button. This will redirect you to an open authorization (OAuth) page. -2. Select the organization to grant access in the **Organization access** section. -3. Select **Authorize** **wandb**. - -## Delete your account - -Select the **Delete Account** button to delete your account. - -{{% alert color="secondary" %}} -Account deletion can not be reversed. -{{% /alert %}} - -## Storage - -The **Storage** section describes the total memory usage the your account has consumed on the Weights and Biases servers. The default storage plan is 100GB. For more information about storage and pricing, see the [Pricing](https://wandb.ai/site/pricing) page. \ No newline at end of file diff --git a/content/en/guides/models/evaluate-models.md b/content/en/guides/models/evaluate-models.md deleted file mode 100644 index b1ecdf53dd..0000000000 --- a/content/en/guides/models/evaluate-models.md +++ /dev/null @@ -1,241 +0,0 @@ ---- -title: Evaluate models -description: -menu: - default: - identifier: eval-weave - parent: w-b-models ---- - -## Evaluate models with Weave - -[W&B Weave](https://weave-docs.wandb.ai/) is a purpose-built toolkit for evaluating LLMs and GenAI applications. It provides comprehensive evaluation capabilities including scorers, judges, and detailed tracing to help you understand and improve model performance. Weave integrates with W&B Models, allowing you to evaluate models stored in your Model Registry. - -{{< img src="/images/weave/evals.png" alt="Weave evaluation dashboard showing model performance metrics and traces" >}} - -### Key features for model evaluation - -* **Scorers and judges**: Pre-built and custom evaluation metrics for accuracy, relevance, coherence, and more -* **Evaluation datasets**: Structured test sets with ground truth for systematic evaluation -* **Model versioning**: Track and compare different versions of your models -* **Detailed tracing**: Debug model behavior with complete input/output traces -* **Cost tracking**: Monitor API costs and token usage across evaluations - -### Getting started: Evaluate a model from W&B Registry - -Download a model from W&B Models Registry and evaluate it using Weave: - -```python -import weave -import wandb -from typing import Any - -# Initialize Weave -weave.init("your-entity/your-project") - -# Define a ChatModel that loads from W&B Registry -class ChatModel(weave.Model): - model_name: str - - def model_post_init(self, __context): - # Download model from W&B Models Registry - run = wandb.init(project="your-project", job_type="model_download") - artifact = run.use_artifact(self.model_name) - self.model_path = artifact.download() - # Initialize your model here - - @weave.op() - async def predict(self, query: str) -> str: - # Your model inference logic - return self.model.generate(query) - -# Create evaluation dataset -dataset = weave.Dataset(name="eval_dataset", rows=[ - {"input": "What is the capital of France?", "expected": "Paris"}, - {"input": "What is 2+2?", "expected": "4"}, -]) - -# Define scorers -@weave.op() -def exact_match_scorer(expected: str, output: str) -> dict: - return {"correct": expected.lower() == output.lower()} - -# Run evaluation -model = ChatModel(model_name="wandb-entity/registry-name/model:version") -evaluation = weave.Evaluation( - dataset=dataset, - scorers=[exact_match_scorer] -) -results = await evaluation.evaluate(model) -``` - -### Integrate Weave evaluations with W&B Models - -The [Models and Weave Integration Demo](https://weave-docs.wandb.ai/reference/gen_notebooks/Models_and_Weave_Integration_Demo) shows the complete workflow for: - -1. **Load models from Registry**: Download fine-tuned models stored in W&B Models Registry -2. **Create evaluation pipelines**: Build comprehensive evaluations with custom scorers -3. **Log results back to W&B**: Connect evaluation metrics to your model runs -4. **Version evaluated models**: Save improved models back to the Registry - -Log evaluation results to both Weave and W&B Models: - -```python -# Run evaluation with W&B tracking -with weave.attributes({"wandb-run-id": wandb.run.id}): - summary, call = await evaluation.evaluate.call(evaluation, model) - -# Log metrics to W&B Models -wandb.run.log(summary) -wandb.run.config.update({ - "weave_eval_url": f"https://wandb.ai/{entity}/{project}/r/call/{call.id}" -}) -``` - -### Advanced Weave features - -#### Custom scorers and judges -Create sophisticated evaluation metrics tailored to your use case: - -```python -@weave.op() -def llm_judge_scorer(expected: str, output: str, judge_model) -> dict: - prompt = f"Is this answer correct? Expected: {expected}, Got: {output}" - judgment = await judge_model.predict(prompt) - return {"judge_score": judgment} -``` - -#### Batch evaluations -Evaluate multiple model versions or configurations: - -```python -models = [ - ChatModel(model_name="model:v1"), - ChatModel(model_name="model:v2"), -] - -for model in models: - results = await evaluation.evaluate(model) - print(f"{model.model_name}: {results}") -``` - -### Next steps - -* [Complete Weave evaluation tutorial](https://weave-docs.wandb.ai/tutorial-eval/) -* [Models and Weave integration example](https://weave-docs.wandb.ai/reference/gen_notebooks/Models_and_Weave_Integration_Demo) - - - -## Evaluate models with tables - -Use W&B Tables to: -* **Compare model predictions**: View side-by-side comparisons of how different models perform on the same test set -* **Track prediction changes**: Monitor how predictions evolve across training epochs or model versions -* **Analyze errors**: Filter and query to find commonly misclassified examples and error patterns -* **Visualize rich media**: Display images, audio, text, and other media types alongside predictions and metrics - -![Example of predictions table showing model outputs alongside ground truth labels](/images/data_vis/tables_sample_predictions.png) - -### Basic example: Log evaluation results - -```python -import wandb - -# Initialize a run -run = wandb.init(project="model-evaluation") - -# Create a table with evaluation results -columns = ["id", "input", "ground_truth", "prediction", "confidence", "correct"] -eval_table = wandb.Table(columns=columns) - -# Add evaluation data -for idx, (input_data, label) in enumerate(test_dataset): - prediction = model(input_data) - confidence = prediction.max() - predicted_class = prediction.argmax() - - eval_table.add_data( - idx, - wandb.Image(input_data), # Log images or other media - label, - predicted_class, - confidence, - label == predicted_class - ) - -# Log the table -run.log({"evaluation_results": eval_table}) -``` - -### Advanced table workflows - -#### Compare multiple models -Log evaluation tables from different models to the same key for direct comparison: - -```python -# Model A evaluation -with wandb.init(project="model-comparison", name="model_a") as run: - eval_table_a = create_eval_table(model_a, test_data) - run.log({"test_predictions": eval_table_a}) - -# Model B evaluation -with wandb.init(project="model-comparison", name="model_b") as run: - eval_table_b = create_eval_table(model_b, test_data) - run.log({"test_predictions": eval_table_b}) -``` - -![Side-by-side comparison of model predictions across training epochs](/images/data_vis/table_comparison.png) - -#### Track predictions over time -Log tables at different training epochs to visualize improvement: - -```python -for epoch in range(num_epochs): - train_model(model, train_data) - - # Evaluate and log predictions for this epoch - eval_table = wandb.Table(columns=["image", "truth", "prediction"]) - for image, label in test_subset: - pred = model(image) - eval_table.add_data(wandb.Image(image), label, pred.argmax()) - - wandb.log({f"predictions_epoch_{epoch}": eval_table}) -``` - -### Interactive analysis in the W&B UI - -Once logged, you can: -1. **Filter results**: Click on column headers to filter by prediction accuracy, confidence thresholds, or specific classes -2. **Compare tables**: Select multiple table versions to see side-by-side comparisons -3. **Query data**: Use the query bar to find specific patterns (for example, `"correct" = false AND "confidence" > 0.8`) -4. **Group and aggregate**: Group by predicted class to see per-class accuracy metrics - -![Interactive filtering and querying of evaluation results in W&B Tables](/images/data_vis/wandb_demo_filter_on_a_table.png) - -### Example: Error analysis with enriched tables - -```python -# Create a mutable table to add analysis columns -eval_table = wandb.Table( - columns=["id", "image", "label", "prediction"], - log_mode="MUTABLE" # Allows adding columns later -) - -# Initial predictions -for idx, (img, label) in enumerate(test_data): - pred = model(img) - eval_table.add_data(idx, wandb.Image(img), label, pred.argmax()) - -run.log({"eval_analysis": eval_table}) - -# Add confidence scores for error analysis -confidences = [model(img).max() for img, _ in test_data] -eval_table.add_column("confidence", confidences) - -# Add error types -error_types = classify_errors(eval_table.get_column("label"), - eval_table.get_column("prediction")) -eval_table.add_column("error_type", error_types) - -run.log({"eval_analysis": eval_table}) -``` diff --git a/content/en/guides/models/sweeps/_index.md b/content/en/guides/models/sweeps/_index.md deleted file mode 100644 index 6f8f9e29bf..0000000000 --- a/content/en/guides/models/sweeps/_index.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -description: Hyperparameter search and model optimization with W&B Sweeps -menu: - default: - identifier: sweeps - parent: w-b-models -title: Sweeps -url: guides/sweeps -weight: 2 -cascade: -- url: guides/sweeps/:filename ---- -{{< cta-button productLink="https://wandb.ai/stacey/deep-drive/workspace?workspace=user-lavanyashukla" colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/pytorch/Organizing_Hyperparameter_Sweeps_in_PyTorch_with_W%26B.ipynb" >}} - - -Use W&B Sweeps to automate hyperparameter search and visualize rich, interactive experiment tracking. Pick from popular search methods such as Bayesian, grid search, and random to search the hyperparameter space. Scale and parallelize sweep across one or more machines. - -{{< img src="/images/sweeps/intro_what_it_is.png" alt="Hyperparameter tuning insights" >}} - -### How it works -Create a sweep with two [W&B CLI]({{< relref "/ref/cli/" >}}) commands: - - -1. Initialize a sweep - -```bash -wandb sweep --project -``` - -2. Start the sweep agent - -```bash -wandb agent -``` - -{{% alert %}} -The preceding code snippet, and the colab linked on this page, show how to initialize and create a sweep with wht W&B CLI. See the [Sweeps walkthrough]({{< relref "./walkthrough.md" >}}) for a step-by-step outline of the W&B Python SDK commands to use to define a sweep configuration, initialize a sweep, and start a sweep. -{{% /alert %}} - - - -### How to get started - -Depending on your use case, explore the following resources to get started with W&B Sweeps: - -* Read through the [sweeps walkthrough]({{< relref "./walkthrough.md" >}}) for a step-by-step outline of the W&B Python SDK commands to use to define a sweep configuration, initialize a sweep, and start a sweep. -* Explore this chapter to learn how to: - * [Add W&B to your code]({{< relref "./add-w-and-b-to-your-code.md" >}}) - * [Define sweep configuration]({{< relref "/guides/models/sweeps/define-sweep-configuration/" >}}) - * [Initialize sweeps]({{< relref "./initialize-sweeps.md" >}}) - * [Start sweep agents]({{< relref "./start-sweep-agents.md" >}}) - * [Visualize sweep results]({{< relref "./visualize-sweep-results.md" >}}) -* Explore a [curated list of Sweep experiments]({{< relref "./useful-resources.md" >}}) that explore hyperparameter optimization with W&B Sweeps. Results are stored in W&B Reports. - -For a step-by-step video, see: [Tune Hyperparameters Easily with W&B Sweeps](https://www.youtube.com/watch?v=9zrmUIlScdY\&ab_channel=Weights%26Biases). - - \ No newline at end of file diff --git a/content/en/guides/models/sweeps/add-w-and-b-to-your-code.md b/content/en/guides/models/sweeps/add-w-and-b-to-your-code.md deleted file mode 100644 index fc8dbe03ad..0000000000 --- a/content/en/guides/models/sweeps/add-w-and-b-to-your-code.md +++ /dev/null @@ -1,297 +0,0 @@ ---- -description: Add W&B to your Python code script or Jupyter Notebook. -menu: - default: - identifier: add-w-and-b-to-your-code - parent: sweeps -title: Add W&B (wandb) to your code -weight: 2 ---- - -This guide provides recommendations on how to integrate W&B into your Python training script or notebook. - -## Original training script - -Suppose you have a Python script that trains a model (see below). Your goal is to find the hyperparameters that maxmimizes the validation accuracy(`val_acc`). - -In your Python script, you define two functions: `train_one_epoch` and `evaluate_one_epoch`. The `train_one_epoch` function simulates training for one epoch and returns the training accuracy and loss. The `evaluate_one_epoch` function simulates evaluating the model on the validation data set and returns the validation accuracy and loss. - -You define a configuration dictionary (`config`) that contains hyperparameter values such as the learning rate (`lr`), batch size (`batch_size`), and number of epochs (`epochs`). The values in the configuration dictionary control the training process. - -Next you define a function called `main` that mimics a typical training loop. For each epoch, the accuracy and loss is computed on the training and validation data sets. - -{{< alert >}} -This code is a mock training script. It does not train a model, but simulates the training process by generating random accuracy and loss values. The purpose of this code is to demonstrate how to integrate W&B into your training script. -{{< /alert >}} - -```python -import random -import numpy as np - -def train_one_epoch(epoch, lr, batch_size): - acc = 0.25 + ((epoch / 30) + (random.random() / 10)) - loss = 0.2 + (1 - ((epoch - 1) / 10 + random.random() / 5)) - return acc, loss - -def evaluate_one_epoch(epoch): - acc = 0.1 + ((epoch / 20) + (random.random() / 10)) - loss = 0.25 + (1 - ((epoch - 1) / 10 + random.random() / 6)) - return acc, loss - -# config variable with hyperparameter values -config = {"lr": 0.0001, "batch_size": 16, "epochs": 5} - -def main(): - lr = config["lr"] - batch_size = config["batch_size"] - epochs = config["epochs"] - - for epoch in np.arange(1, epochs): - train_acc, train_loss = train_one_epoch(epoch, lr, batch_size) - val_acc, val_loss = evaluate_one_epoch(epoch) - - print("epoch: ", epoch) - print("training accuracy:", train_acc, "training loss:", train_loss) - print("validation accuracy:", val_acc, "validation loss:", val_loss) - -if __name__ == "__main__": - main() -``` - -In the next section, you will add W&B to your Python script to track hyperparameters and metrics during training. You want to use W&B to find the best hyperparameters that maximize the validation accuracy (`val_acc`). - - -## Training script with W&B Python SDK - -How you integrate W&B to your Python script or notebook depends on how you manage sweeps. You can start a sweep job within a Python notebook or script or from the command line. - -{{< tabpane text=true >}} -{{% tab header="Python script or notebook" %}} - -Add the following to your Python script: - -1. Create a dictionary object where the key-value pairs define a [sweep configuration]({{< relref "/guides/models/sweeps/define-sweep-configuration/" >}}). The sweep configuration defines the hyperparameters you want W&B to explore on your behalf along with the metric you want to optimize. Continuing from the previous example, the batch size (`batch_size`), epochs (`epochs`), and the learning rate (`lr`) are the hyperparameters to vary during each sweep. You want to maximize the accuracy of the validation score so you set `"goal": "maximize"` and the name of the variable you want to optimize for, in this case `val_acc` (`"name": "val_acc"`). -2. Pass the sweep configuration dictionary to [`wandb.sweep()`]({{< relref "/ref/python/functions/sweep.md" >}}). This initializes the sweep and returns a sweep ID (`sweep_id`). For more information, see [Initialize sweeps]({{< relref "./initialize-sweeps.md" >}}). -3. At the top of your script, import the W&B Python SDK (`wandb`). -4. Within your `main` function, use the [`wandb.init()`]({{< relref "/ref/python/functions/init.md" >}}) API to generate a background process to sync and log data as a [W&B Run]({{< relref "/ref/python/experiments/run.md" >}}). Pass the project name as a parameter to the `wandb.init()` method. If you do not pass a project name, W&B uses the default project name. -5. Fetch the hyperparameter values from the `wandb.Run.config` object. This allows you to use the hyperparameter values defined in the sweep configuration dictionary instead of hard coded values. -6. Log the metric you are optimizing for to W&B using [`wandb.Run.log()`]({{< relref "/ref/python/experiments/run.md/#method-runlog" >}}). You must log the metric defined in your configuration. For example, if you define the metric to optimize as `val_acc`, you must log `val_acc`. If you do not log the metric, W&B does not know what to optimize for. Within the configuration dictionary (`sweep_configuration` in this example), you define the sweep to maximize the `val_acc` value. -7. Start the sweep with [`wandb.agent()`]({{< relref "/ref/python/functions/agent.md" >}}). Provide the sweep ID and the name of the function the sweep will execute (`function=main`), and specify the maximum number of runs to try to four (`count=4`). - - -Putting this all together, your script might look similar to the following: - -```python -import wandb # Import the W&B Python SDK -import numpy as np -import random -import argparse - -def train_one_epoch(epoch, lr, batch_size): - acc = 0.25 + ((epoch / 30) + (random.random() / 10)) - loss = 0.2 + (1 - ((epoch - 1) / 10 + random.random() / 5)) - return acc, loss - -def evaluate_one_epoch(epoch): - acc = 0.1 + ((epoch / 20) + (random.random() / 10)) - loss = 0.25 + (1 - ((epoch - 1) / 10 + random.random() / 6)) - return acc, loss - -def main(args=None): - # When called by sweep agent, args will be None, - # so we use the project from sweep config - project = args.project if args else None - - with wandb.init(project=project) as run: - # Fetches the hyperparameter values from `wandb.Run.config` object - lr = run.config["lr"] - batch_size = run.config["batch_size"] - epochs = run.config["epochs"] - - # Execute the training loop and log the performance values to W&B - for epoch in np.arange(1, epochs): - train_acc, train_loss = train_one_epoch(epoch, lr, batch_size) - val_acc, val_loss = evaluate_one_epoch(epoch) - run.log( - { - "epoch": epoch, - "train_acc": train_acc, - "train_loss": train_loss, - "val_acc": val_acc, # Metric optimized - "val_loss": val_loss, - } - ) - -if __name__ == "__main__": - parser = argparse.ArgumentParser() - parser.add_argument("--project", type=str, default="sweep-example", help="W&B project name") - args = parser.parse_args() - - # Define a sweep config dictionary - sweep_configuration = { - "method": "random", - "name": "sweep", - # Metric that you want to optimize - # For example, if you want to maximize validation - # accuracy set "goal": "maximize" and the name of the variable - # you want to optimize for, in this case "val_acc" - "metric": { - "goal": "maximize", - "name": "val_acc" - }, - "parameters": { - "batch_size": {"values": [16, 32, 64]}, - "epochs": {"values": [5, 10, 15]}, - "lr": {"max": 0.1, "min": 0.0001}, - }, - } - - # Initialize the sweep by passing in the config dictionary - sweep_id = wandb.sweep(sweep=sweep_configuration, project=args.project) - - # Start the sweep job - wandb.agent(sweep_id, function=main, count=4) -``` - - - -{{% /tab %}} {{% tab header="CLI" %}} - -Create a YAML configuration file with your sweep configuration. The -configuration file contains the hyperparameters you want the sweep to explore. In -the following example, the batch size (`batch_size`), epochs (`epochs`), and -the learning rate (`lr`) hyperparameters are varied during each sweep. - -```yaml -# config.yaml -program: train.py -method: random -name: sweep -metric: - goal: maximize - name: val_acc -parameters: - batch_size: - values: [16, 32, 64] - lr: - min: 0.0001 - max: 0.1 - epochs: - values: [5, 10, 15] -``` - -For more information on how to create a W&B Sweep configuration, see [Define sweep configuration]({{< relref "/guides/models/sweeps/define-sweep-configuration/" >}}). - -You must provide the name of your Python script for the `program` key -in your YAML file. - -Next, add the following to the code example: - -1. Import the W&B Python SDK (`wandb`) and PyYAML (`yaml`). PyYAML is used to read in our YAML configuration file. -2. Read in the configuration file. -3. Use the [`wandb.init()`]({{< relref "/ref/python/functions/init.md" >}}) API to generate a background process to sync and log data as a [W&B Run]({{< relref "/ref/python/experiments/run.md" >}}). Pass the config object to the config parameter. -4. Define hyperparameter values from `wandb.Run.config` instead of using hard coded values. -5. Log the metric you want to optimize with [`wandb.Run.log()`]({{< relref "/ref/python/experiments/run.md/#method-runlog" >}}). You must log the metric defined in your configuration. Within the configuration dictionary (`sweep_configuration` in this example) you define the sweep to maximize the `val_acc` value. - -```python -import wandb -import yaml -import random -import numpy as np - - -def train_one_epoch(epoch, lr, batch_size): - acc = 0.25 + ((epoch / 30) + (random.random() / 10)) - loss = 0.2 + (1 - ((epoch - 1) / 10 + random.random() / 5)) - return acc, loss - - -def evaluate_one_epoch(epoch): - acc = 0.1 + ((epoch / 20) + (random.random() / 10)) - loss = 0.25 + (1 - ((epoch - 1) / 10 + random.random() / 6)) - return acc, loss - - -def main(): - # Set up your default hyperparameters - with open("./config.yaml") as file: - config = yaml.load(file, Loader=yaml.FullLoader) - - with wandb.init(config=config) as run: - for epoch in np.arange(1, run.config['epochs']): - train_acc, train_loss = train_one_epoch(epoch, run.config['lr'], run.config['batch_size']) - val_acc, val_loss = evaluate_one_epoch(epoch) - run.log( - { - "epoch": epoch, - "train_acc": train_acc, - "train_loss": train_loss, - "val_acc": val_acc, - "val_loss": val_loss, - } - ) - -# Call the main function. -main() -``` - -In your CLI, set a maximum number of runs for the sweep -agent to try. This is optional. This example we set the -maximum number to 5. - -```bash -NUM=5 -``` - -Next, initialize the sweep with the [`wandb sweep`]({{< relref "/ref/cli/wandb-sweep.md" >}}) command. Provide the name of the YAML file. Optionally provide the name of the project for the project flag (`--project`): - -```bash -wandb sweep --project sweep-demo-cli config.yaml -``` - -This returns a sweep ID. For more information on how to initialize sweeps, see -[Initialize sweeps]({{< relref "./initialize-sweeps.md" >}}). - -Copy the sweep ID and replace `sweepID` in the following code snippet to start -the sweep job with the [`wandb agent`]({{< relref "/ref/cli/wandb-agent.md" >}}) -command: - -```bash -wandb agent --count $NUM your-entity/sweep-demo-cli/sweepID -``` - -For more information, see [Start sweep jobs]({{< relref "./start-sweep-agents.md" >}}). - -{{% /tab %}} {{< /tabpane >}} - - -{{% alert title="Logging metrics to W&B in a sweep" %}} -You must log the metric you define and are optimizing for in both your sweep configuration and with `wandb.Run.log()`. For example, if you define the metric to optimize as `val_acc` within your sweep configuration, you must also log `val_acc` to W&B. If you do not log the metric, W&B does not know what to optimize for. - -```python -with wandb.init() as run: - val_loss, val_acc = train() - run.log( - { - "val_loss": val_loss, - "val_acc": val_acc - } - ) -``` - -The following is an incorrect example of logging the metric to W&B. The metric that is optimized for in the sweep configuration is `val_acc`, but the code logs `val_acc` within a nested dictionary under the key `validation`. You must log the metric directly, not within a nested dictionary. - -```python -with wandb.init() as run: - val_loss, val_acc = train() - run.log( - { - "validation": { - "val_loss": val_loss, - "val_acc": val_acc - } - } - ) -``` - -{{% /alert %}} \ No newline at end of file diff --git a/content/en/guides/models/sweeps/define-sweep-configuration/_index.md b/content/en/guides/models/sweeps/define-sweep-configuration/_index.md deleted file mode 100644 index 8f1c37cf9d..0000000000 --- a/content/en/guides/models/sweeps/define-sweep-configuration/_index.md +++ /dev/null @@ -1,369 +0,0 @@ ---- -description: Learn how to create configuration files for sweeps. -menu: - default: - identifier: define-sweep-configuration - parent: sweeps -url: guides/sweeps/define-sweep-configuration -title: Define a sweep configuration -weight: 3 ---- - - -A W&B Sweep combines a strategy for exploring hyperparameter values with the code that evaluates them. The strategy can be as simple as trying every option or as complex as Bayesian Optimization and Hyperband ([BOHB](https://arxiv.org/abs/1807.01774)). - -Define a sweep configuration either in a [Python dictionary](https://docs.python.org/3/tutorial/datastructures.html#dictionaries) or a [YAML](https://yaml.org/) file. How you define your sweep configuration depends on how you want to manage your sweep. - -{{% alert %}} -Define your sweep configuration in a YAML file if you want to initialize a sweep and start a sweep agent from the command line. Define your sweep in a Python dictionary if you initialize a sweep and start a sweep entirely within a Python script or notebook. -{{% /alert %}} - -The following guide describes how to format your sweep configuration. See [Sweep configuration options]({{< relref "./sweep-config-keys.md" >}}) for a comprehensive list of top-level sweep configuration keys. - -## Basic structure - -Both sweep configuration format options (YAML and Python dictionary) utilize key-value pairs and nested structures. - -Use top-level keys within your sweep configuration to define qualities of your sweep search such as the name of the sweep ([`name`]({{< relref "./sweep-config-keys.md" >}}) key), the parameters to search through ([`parameters`]({{< relref "./sweep-config-keys.md#parameters" >}}) key), the methodology to search the parameter space ([`method`]({{< relref "./sweep-config-keys.md#method" >}}) key), and more. - - -For example, the proceeding code snippets show the same sweep configuration defined within a YAML file and within a Python dictionary. Within the sweep configuration there are five top level keys specified: `program`, `name`, `method`, `metric` and `parameters`. - - -{{< tabpane text=true >}} - {{% tab header="CLI" %}} -Define a sweep configuration in a YAML file if you want to manage sweeps interactively from the command line (CLI) - -```yaml title="config.yaml" -program: train.py -name: sweepdemo -method: bayes -metric: - goal: minimize - name: validation_loss -parameters: - learning_rate: - min: 0.0001 - max: 0.1 - batch_size: - values: [16, 32, 64] - epochs: - values: [5, 10, 15] - optimizer: - values: ["adam", "sgd"] -``` - {{% /tab %}} - {{% tab header="Python script or notebook" %}} -Define a sweep in a Python dictionary data structure if you define training algorithm in a Python script or notebook. - -The proceeding code snippet stores a sweep configuration in a variable named `sweep_configuration`: - -```python title="train.py" -sweep_configuration = { - "name": "sweepdemo", - "method": "bayes", - "metric": {"goal": "minimize", "name": "validation_loss"}, - "parameters": { - "learning_rate": {"min": 0.0001, "max": 0.1}, - "batch_size": {"values": [16, 32, 64]}, - "epochs": {"values": [5, 10, 15]}, - "optimizer": {"values": ["adam", "sgd"]}, - }, -} -``` - {{% /tab %}} -{{< /tabpane >}} - - -Within the top level `parameters` key, the following keys are nested: `learning_rate`, `batch_size`, `epoch`, and `optimizer`. For each of the nested keys you specify, you can provide one or more values, a distribution, a probability, and more. For more information, see the [parameters]({{< relref "./sweep-config-keys.md#parameters" >}}) section in [Sweep configuration options]({{< relref "./sweep-config-keys.md" >}}). - - -## Double nested parameters - -Sweep configurations support nested parameters. To delineate a nested parameter, use an additional `parameters` key under the top level parameter name. Sweep configs support multi-level nesting. - -Specify a probability distribution for your random variables if you use a Bayesian or random hyperparameter search. For each hyperparameter: - -1. Create a top level `parameters` key in your sweep config. -2. Within the `parameters`key, nest the following: - 1. Specify the name of hyperparameter you want to optimize. - 2. Specify the distribution you want to use for the `distribution` key. Nest the `distribution` key-value pair underneath the hyperparameter name. - 3. Specify one or more values to explore. The value (or values) should be inline with the distribution key. - 1. (Optional) Use an additional parameters key under the top level parameter name to delineate a nested parameter. - - - - - - - - -{{% alert color="secondary" %}} -Nested parameters defined in sweep configuration overwrite keys specified in a W&B run configuration. - -For example, suppose you initialize a W&B run with the following configuration in a `train.py` Python script (see Lines 1-2). Next, you define a sweep configuration in a dictionary called `sweep_configuration` (see Lines 4-13). You then pass the sweep config dictionary to `wandb.sweep` to initialize a sweep config (see Line 16). - - -```python title="train.py" -def main(): - run = wandb.init(config={"nested_param": {"manual_key": 1}}) - - -sweep_configuration = { - "top_level_param": 0, - "nested_param": { - "learning_rate": 0.01, - "double_nested_param": {"x": 0.9, "y": 0.8}, - }, -} - -# Initialize sweep by passing in config. -sweep_id = wandb.sweep(sweep=sweep_configuration, project="") - -# Start sweep job. -wandb.agent(sweep_id, function=main, count=4) -``` -The `nested_param.manual_key` that is passed when the W&B run is initialized is not accessible. The `wandb.Run.config` only possess the key-value pairs that are defined in the sweep configuration dictionary. -{{% /alert %}} - - -## Sweep configuration template - - -The following template shows how you can configure parameters and specify search constraints. Replace `hyperparameter_name` with the name of your hyperparameter and any values enclosed in `<>`. - -```yaml title="config.yaml" -program: -method: -parameter: - hyperparameter_name0: - value: 0 - hyperparameter_name1: - values: [0, 0, 0] - hyperparameter_name: - distribution: - value: - hyperparameter_name2: - distribution: - min: - max: - q: - hyperparameter_name3: - distribution: - values: - - - - - - -early_terminate: - type: hyperband - s: 0 - eta: 0 - max_iter: 0 -command: -- ${Command macro} -- ${Command macro} -- ${Command macro} -- ${Command macro} -``` - -To express a numeric value using scientific notation, add the YAML `!!float` operator, which casts the value to a floating point number. For example, `min: !!float 1e-5`. See [Command example]({{< relref "#command-example" >}}). - -## Sweep configuration examples - -{{< tabpane text=true >}} - {{% tab header="CLI" %}} - -```yaml title="config.yaml" -program: train.py -method: random -metric: - goal: minimize - name: loss -parameters: - batch_size: - distribution: q_log_uniform_values - max: 256 - min: 32 - q: 8 - dropout: - values: [0.3, 0.4, 0.5] - epochs: - value: 1 - fc_layer_size: - values: [128, 256, 512] - learning_rate: - distribution: uniform - max: 0.1 - min: 0 - optimizer: - values: ["adam", "sgd"] -``` - - {{% /tab %}} - {{% tab header="Python script or notebook" %}} - -```python title="train.py" -sweep_config = { - "method": "random", - "metric": {"goal": "minimize", "name": "loss"}, - "parameters": { - "batch_size": { - "distribution": "q_log_uniform_values", - "max": 256, - "min": 32, - "q": 8, - }, - "dropout": {"values": [0.3, 0.4, 0.5]}, - "epochs": {"value": 1}, - "fc_layer_size": {"values": [128, 256, 512]}, - "learning_rate": {"distribution": "uniform", "max": 0.1, "min": 0}, - "optimizer": {"values": ["adam", "sgd"]}, - }, -} -``` - - {{% /tab %}} -{{< /tabpane >}} - - - -### Bayes hyperband example - -```yaml -program: train.py -method: bayes -metric: - goal: minimize - name: val_loss -parameters: - dropout: - values: [0.15, 0.2, 0.25, 0.3, 0.4] - hidden_layer_size: - values: [96, 128, 148] - layer_1_size: - values: [10, 12, 14, 16, 18, 20] - layer_2_size: - values: [24, 28, 32, 36, 40, 44] - learn_rate: - values: [0.001, 0.01, 0.003] - decay: - values: [1e-5, 1e-6, 1e-7] - momentum: - values: [0.8, 0.9, 0.95] - epochs: - value: 27 -early_terminate: - type: hyperband - s: 2 - eta: 3 - max_iter: 27 -``` - -The proceeding tabs show how to specify either a minimum or maximum number of iterations for `early_terminate`: - -{{< tabpane text=true >}} - {{% tab header="Maximum number of iterations" %}} - -The brackets for this example are: `[3, 3*eta, 3*eta*eta, 3*eta*eta*eta]`, which equals `[3, 9, 27, 81]`. - -```yaml -early_terminate: - type: hyperband - min_iter: 3 -``` - - {{% /tab %}} - {{% tab header="Minimum number of iterations" %}} - -The brackets for this example are `[27/eta, 27/eta/eta]`, which equals `[9, 3]`. - -```yaml -early_terminate: - type: hyperband - max_iter: 27 - s: 2 -``` - - {{% /tab %}} -{{< /tabpane >}} - - - -### Macro and custom command arguments example - -For more complex command line arguments, you can use macros to pass environment variables, the Python interpreter, and additional arguments. [W&B supports pre defined macros]({{< relref "./sweep-config-keys.md#command-macros" >}}) and custom command line arguments that you can specify in your sweep configuration. - -For example, the following sweep configuration (`sweep.yaml`) defines a command that runs a Python script (`run.py`) with the `${env}`, `${interpreter}`, and `${program}` macros replaced with the appropriate values when the sweep runs. - -The `--batch_size=${batch_size}`, `--test=True`, and `--optimizer=${optimizer}` arguments use custom macros to pass the values of the `batch_size`, `test`, and `optimizer` parameters defined in the sweep configuration. - -```yaml title="sweep.yaml" -program: run.py -method: random -metric: - name: validation_loss -parameters: - learning_rate: - min: 0.0001 - max: 0.1 -command: - - ${env} - - ${interpreter} - - ${program} - - "--batch_size=${batch_size}" - - "--optimizer=${optimizer}" - - "--test=True" -``` -The associated Python script (`run.py`) can then parse these command line arguments using the `argparse` module. - -```python title="run.py" -# run.py -import wandb -import argparse - -parser = argparse.ArgumentParser() -parser.add_argument('--batch_size', type=int) -parser.add_argument('--optimizer', type=str, choices=['adam', 'sgd'], required=True) -parser.add_argument('--test', type=str2bool, default=False) -args = parser.parse_args() - -# Initialize a W&B Run -with wandb.init('test-project') as run: - run.log({'validation_loss':1}) -``` - -See the [Command macros]({{< relref "./sweep-config-keys.md#command-macros" >}}) section in [Sweep configuration options]({{< relref "./sweep-config-keys.md" >}}) for a list of pre-defined macros you can use in your sweep configuration. - -#### Boolean arguments - -The `argparse` module does not support boolean arguments by default. To define a boolean argument, you can use the [`action`](https://docs.python.org/3/library/argparse.html#action) parameter or use a custom function to convert the string representation of the boolean value to a boolean type. - -As an example, you can use the following code snippet to define a boolean argument. Pass `store_true` or `store_false` as an argument to `ArgumentParser`. - -```python -import wandb -import argparse - -parser = argparse.ArgumentParser() -parser.add_argument('--test', action='store_true') -args = parser.parse_args() - -args.test # This will be True if --test is passed, otherwise False -``` - -You can also define a custom function to convert the string representation of the boolean value to a boolean type. For example, the following code snippet defines the `str2bool` function, which converts a string to a boolean value. - -```python -def str2bool(v: str) -> bool: - """Convert a string to a boolean. This is required because - argparse does not support boolean arguments by default. - """ - if isinstance(v, bool): - return v - return v.lower() in ('yes', 'true', 't', '1') -``` - - - - - diff --git a/content/en/guides/models/sweeps/define-sweep-configuration/sweep-config-keys.md b/content/en/guides/models/sweeps/define-sweep-configuration/sweep-config-keys.md deleted file mode 100644 index 74ee93c43a..0000000000 --- a/content/en/guides/models/sweeps/define-sweep-configuration/sweep-config-keys.md +++ /dev/null @@ -1,187 +0,0 @@ ---- -menu: - default: - identifier: sweep-config-keys - parent: define-a-sweep-configuration -title: Sweep configuration options ---- - - -A sweep configuration consists of nested key-value pairs. Use top-level keys within your sweep configuration to define qualities of your sweep search such as the parameters to search through ([`parameter`]({{< relref "./sweep-config-keys.md#parameters" >}}) key), the methodology to search the parameter space ([`method`]({{< relref "./sweep-config-keys.md#method" >}}) key), and more. - -The proceeding table lists top-level sweep configuration keys and a brief description. See the respective sections for more information about each key. - - -| Top-level keys | Description | -| -------------- | ----------- | -| `program` | (required) Training script to run | -| `entity` | The entity for this sweep | -| `project` | The project for this sweep | -| `description` | Text description of the sweep | -| `name` | The name of the sweep, displayed in the W&B UI. | -| [`method`]({{< relref "#method" >}}) | (required) The search strategy | -| [`metric`]({{< relref "#metric" >}}) | The metric to optimize (only used by certain search strategies and stopping criteria) | -| [`parameters`]({{< relref "#parameters" >}}) | (required) Parameter bounds to search | -| [`early_terminate`]({{< relref "#early_terminate" >}}) | Any early stopping criteria | -| [`command`]({{< relref "#command" >}}) | Command structure for invoking and passing arguments to the training script | -| `run_cap` | Maximum number of runs for this sweep | - -See the [Sweep configuration]({{< relref "./sweep-config-keys.md" >}}) structure for more information on how to structure your sweep configuration. - - - -## `metric` - -Use the `metric` top-level sweep configuration key to specify the name, the goal, and the target metric to optimize. - -|Key | Description | -| -------- | --------------------------------------------------------- | -| `name` | Name of the metric to optimize. | -| `goal` | Either `minimize` or `maximize` (Default is `minimize`). | -| `target` | Goal value for the metric you are optimizing. The sweep does not create new runs when if or when a run reaches a target value that you specify. Active agents that have a run executing (when the run reaches the target) wait until the run completes before the agent stops creating new runs. | - - - - -## `parameters` -In your YAML file or Python script, specify `parameters` as a top level key. Within the `parameters` key, provide the name of a hyperparameter you want to optimize. Common hyperparameters include: learning rate, batch size, epochs, optimizers, and more. For each hyperparameter you define in your sweep configuration, specify one or more search constraints. - -The proceeding table shows supported hyperparameter search constraints. Based on your hyperparameter and use case, use one of the search constraints below to tell your sweep agent where (in the case of a distribution) or what (`value`, `values`, and so forth) to search or use. - - -| Search constraint | Description | -| --------------- | ------------------------------------------------------------------------------ | -| `values` | Specifies all valid values for this hyperparameter. Compatible with `grid`. | -| `value` | Specifies the single valid value for this hyperparameter. Compatible with `grid`. | -| `distribution` | Specify a probability [distribution]({{< relref "#distribution-options-for-random-and-bayesian-search" >}}). See the note following this table for information on default values. | -| `probabilities` | Specify the probability of selecting each element of `values` when using `random`. | -| `min`, `max` | (`int`or `float`) Maximum and minimum values. If `int`, for `int_uniform` -distributed hyperparameters. If `float`, for `uniform` -distributed hyperparameters. | -| `mu` | (`float`) Mean parameter for `normal` - or `lognormal` -distributed hyperparameters. | -| `sigma` | (`float`) Standard deviation parameter for `normal` - or `lognormal` -distributed hyperparameters. | -| `q` | (`float`) Quantization step size for quantized hyperparameters. | -| `parameters` | Nest other parameters inside a root level parameter. | - - -{{% alert %}} -W&B sets the following distributions based on the following conditions if a [distribution]({{< relref "#distribution-options-for-random-and-bayesian-search" >}}) is not specified: -* `categorical` if you specify `values` -* `int_uniform` if you specify `max` and `min` as integers -* `uniform` if you specify `max` and `min` as floats -* `constant` if you provide a set to `value` -{{% /alert %}} - -## `method` -Specify the hyperparameter search strategy with the `method` key. There are three hyperparameter search strategies to choose from: grid, random, and Bayesian search. -#### Grid search -Iterate over every combination of hyperparameter values. Grid search makes uninformed decisions on the set of hyperparameter values to use on each iteration. Grid search can be computationally costly. - -Grid search executes forever if it is searching within in a continuous search space. - -#### Random search -Choose a random, uninformed, set of hyperparameter values on each iteration based on a distribution. Random search runs forever unless you stop the process from the command line, within your python script, or [the W&B App]({{< relref "../sweeps-ui.md" >}}). - -Specify the distribution space with the metric key if you choose random (`method: random`) search. - -#### Bayesian search -In contrast to [random]({{< relref "#random-search" >}}) and [grid]({{< relref "#grid-search" >}}) search, Bayesian models make informed decisions. Bayesian optimization uses a probabilistic model to decide which values to use through an iterative process of testing values on a surrogate function before evaluating the objective function. Bayesian search works well for small numbers of continuous parameters but scales poorly. For more information about Bayesian search, see the [Bayesian Optimization Primer paper](https://web.archive.org/web/20240209053347/https://static.sigopt.com/b/20a144d208ef255d3b981ce419667ec25d8412e2/static/pdf/SigOpt_Bayesian_Optimization_Primer.pdf). - - - -Bayesian search runs forever unless you stop the process from the command line, within your python script, or [the W&B App]({{< relref "../sweeps-ui.md" >}}). - -### Distribution options for random and Bayesian search -Within the `parameter` key, nest the name of the hyperparameter. Next, specify the `distribution` key and specify a distribution for the value. - -The proceeding tables lists distributions W&B supports. - -| Value for `distribution` key | Description | -| ------------------------ | ------------------------------------ | -| `constant` | Constant distribution. Must specify the constant value (`value`) to use. | -| `categorical` | Categorical distribution. Must specify all valid values (`values`) for this hyperparameter. | -| `int_uniform` | Discrete uniform distribution on integers. Must specify `max` and `min` as integers. | -| `uniform` | Continuous uniform distribution. Must specify `max` and `min` as floats. | -| `q_uniform` | Quantized uniform distribution. Returns `round(X / q) * q` where X is uniform. `q` defaults to `1`.| -| `log_uniform` | Log-uniform distribution. Returns a value `X` between `exp(min)` and `exp(max)`such that the natural logarithm is uniformly distributed between `min` and `max`. | -| `log_uniform_values` | Log-uniform distribution. Returns a value `X` between `min` and `max` such that `log(`X`)` is uniformly distributed between `log(min)` and `log(max)`. | -| `q_log_uniform` | Quantized log uniform. Returns `round(X / q) * q` where `X` is `log_uniform`. `q` defaults to `1`. | -| `q_log_uniform_values` | Quantized log uniform. Returns `round(X / q) * q` where `X` is `log_uniform_values`. `q` defaults to `1`. | -| `inv_log_uniform` | Inverse log uniform distribution. Returns `X`, where `log(1/X)` is uniformly distributed between `min` and `max`. | -| `inv_log_uniform_values` | Inverse log uniform distribution. Returns `X`, where `log(1/X)` is uniformly distributed between `log(1/max)` and `log(1/min)`. | -| `normal` | Normal distribution. Return value is normally distributed with mean `mu` (default `0`) and standard deviation `sigma` (default `1`).| -| `q_normal` | Quantized normal distribution. Returns `round(X / q) * q` where `X` is `normal`. Q defaults to 1. | -| `log_normal` | Log normal distribution. Returns a value `X` such that the natural logarithm `log(X)` is normally distributed with mean `mu` (default `0`) and standard deviation `sigma` (default `1`). | -| `q_log_normal` | Quantized log normal distribution. Returns `round(X / q) * q` where `X` is `log_normal`. `q` defaults to `1`. | - - - -## `early_terminate` - -Use early termination (`early_terminate`) to stop poorly performing runs. If early termination occurs, W&B stops the current run before it creates a new run with a new set of hyperparameter values. - -{{% alert %}} -You must specify a stopping algorithm if you use `early_terminate`. Nest the `type` key within `early_terminate` within your sweep configuration. -{{% /alert %}} - - -### Stopping algorithm - -{{% alert %}} -W&B currently supports [Hyperband](https://arxiv.org/abs/1603.06560) stopping algorithm. -{{% /alert %}} - -[Hyperband](https://arxiv.org/abs/1603.06560) hyperparameter optimization evaluates if a program should stop or if it should to continue at one or more pre-set iteration counts, called *brackets*. - -When a W&B run reaches a bracket, the sweep compares that run's metric to all previously reported metric values. The sweep terminates the run if the run's metric value is too high (when the goal is minimization) or if the run's metric is too low (when the goal is maximization). - -Brackets are based on the number of logged iterations. The number of brackets corresponds to the number of times you log the metric you are optimizing. The iterations can correspond to steps, epochs, or something in between. The numerical value of the step counter is not used in bracket calculations. - -{{% alert %}} -Specify either `min_iter` or `max_iter` to create a bracket schedule. -{{% /alert %}} - - -| Key | Description | -| ---------- | -------------------------------------------------------------- | -| `min_iter` | Specify the iteration for the first bracket | -| `max_iter` | Specify the maximum number of iterations. | -| `s` | Specify the total number of brackets (required for `max_iter`) | -| `eta` | Specify the bracket multiplier schedule (default: `3`). | -| `strict` | Enable 'strict' mode that prunes runs aggressively, more closely following the original Hyperband paper. Defaults to false. | - - - -{{% alert %}} -Hyperband checks which [runs]({{< relref "/ref/python/experiments/run.md" >}}) to end once every few minutes. The end run timestamp might differ from the specified brackets if your run or iteration are short. -{{% /alert %}} - -## `command` - - - -Modify the format and contents with nested values within the `command` key. You can directly include fixed components such as filenames. - -{{% alert %}} -On Unix systems, `/usr/bin/env` ensures that the OS chooses the correct Python interpreter based on the environment. -{{% /alert %}} - -W&B supports the following macros for variable components of the command: - -| Command macro | Description | -| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `${env}` | `/usr/bin/env` on Unix systems, omitted on Windows. | -| `${interpreter}` | Expands to `python`. | -| `${program}` | Training script filename specified by the sweep configuration `program` key. | -| `${args}` | Hyperparameters and their values in the form `--param1=value1 --param2=value2`. | -| `${args_no_boolean_flags}` | Hyperparameters and their values in the form `--param1=value1` except boolean parameters are in the form `--boolean_flag_param` when `True` and omitted when `False`. | -| `${args_no_hyphens}` | Hyperparameters and their values in the form `param1=value1 param2=value2`. | -| `${args_json}` | Hyperparameters and their values encoded as JSON. | -| `${args_json_file}` | The path to a file containing the hyperparameters and their values encoded as JSON. | -| `${envvar}` | A way to pass environment variables. `${envvar:MYENVVAR}` __ expands to the value of MYENVVAR environment variable. __ | \ No newline at end of file diff --git a/content/en/guides/models/sweeps/existing-project.md b/content/en/guides/models/sweeps/existing-project.md deleted file mode 100644 index 21996e08a3..0000000000 --- a/content/en/guides/models/sweeps/existing-project.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -description: Tutorial on how to create sweep jobs from a pre-existing W&B project. -menu: - default: - identifier: existing-project - parent: sweeps -title: 'Tutorial: Create sweep job from project' ---- - -This tutorial explains how to create sweep jobs from a pre-existing W&B project. We will use the [Fashion MNIST dataset](https://github.com/zalandoresearch/fashion-mnist) to train a PyTorch convolutional neural network how to classify images. The required code an dataset is located in the [W&B examples repository (PyTorch CNN Fashion)](https://github.com/wandb/examples/tree/master/examples/pytorch/pytorch-cnn-fashion) - -Explore the results in this [W&B Dashboard](https://app.wandb.ai/carey/pytorch-cnn-fashion). - -## 1. Create a project - -First, create a baseline. Download the PyTorch MNIST dataset example model from W&B examples GitHub repository. Next, train the model. The training script is within the `examples/pytorch/pytorch-cnn-fashion` directory. - -1. Clone this repo `git clone https://github.com/wandb/examples.git` -2. Open this example `cd examples/pytorch/pytorch-cnn-fashion` -3. Run a run manually `python train.py` - -Optionally explore the example appear in the W&B App UI dashboard. - -[View an example project page →](https://app.wandb.ai/carey/pytorch-cnn-fashion) - -## 2. Create a sweep - -From your project page, open the [Sweep tab]({{< relref "./sweeps-ui.md" >}}) in the sidebar and select **Create Sweep**. - -{{< img src="/images/sweeps/sweep1.png" alt="Sweep overview" >}} - -The auto-generated configuration guesses values to sweep over based on the runs you have completed. Edit the configuration to specify what ranges of hyperparameters you want to try. When you launch the sweep, it starts a new process on the hosted W&B sweep server. This centralized service coordinates the agents— the machines that are running the training jobs. - -{{< img src="/images/sweeps/sweep2.png" alt="Sweep configuration" >}} - -## 3. Launch agents - -Next, launch an agent locally. You can launch up to 20 agents on different machines in parallel if you want to distribute the work and finish the sweep job more quickly. The agent will print out the set of parameters it’s trying next. - -{{< img src="/images/sweeps/sweep3.png" alt="Launch agents" >}} - -Now you're running a sweep. The following image demonstrates what the dashboard looks like as the example sweep job is running. [View an example project page →](https://app.wandb.ai/carey/pytorch-cnn-fashion) - -{{< img src="/images/sweeps/sweep4.png" alt="Sweep dashboard" >}} - -## Seed a new sweep with existing runs - -Launch a new sweep using existing runs that you've previously logged. - -1. Open your project table. -2. Select the runs you want to use with checkboxes on the left side of the table. -3. Click the dropdown to create a new sweep. - -Your sweep will now be set up on our server. All you need to do is launch one or more agents to start running runs. - -{{< img src="/images/sweeps/tutorial_sweep_runs.png" alt="Seed sweep from runs" >}} - -{{% alert %}} -If you kick off the new sweep as a bayesian sweep, the selected runs will also seed the Gaussian Process. -{{% /alert %}} \ No newline at end of file diff --git a/content/en/guides/models/sweeps/initialize-sweeps.md b/content/en/guides/models/sweeps/initialize-sweeps.md deleted file mode 100644 index 69c47d5b48..0000000000 --- a/content/en/guides/models/sweeps/initialize-sweeps.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -description: Initialize a W&B Sweep -menu: - default: - identifier: initialize-sweeps - parent: sweeps -title: Initialize a sweep -weight: 4 ---- - -W&B uses a _Sweep Controller_ to manage sweeps on the cloud (standard), locally (local) across one or more machines. After a run completes, the sweep controller will issue a new set of instructions describing a new run to execute. These instructions are picked up by _agents_ who actually perform the runs. In a typical W&B Sweep, the controller lives on the W&B server. Agents live on _your_ machines. - -The following code snippets demonstrate how to initialize sweeps with the CLI and within a Jupyter Notebook or Python script. - -{{% alert color="secondary" %}} -1. Before you initialize a sweep, make sure you have a sweep configuration defined either in a YAML file or a nested Python dictionary object in your script. For more information, see [Define sweep configuration]({{< relref "/guides/models/sweeps/define-sweep-configuration.md" >}}). -2. Both the W&B Sweep and the W&B Run must be in the same project. Therefore, the name you provide when you initialize W&B ([`wandb.init()`]({{< relref "/ref/python/functions/init.md" >}})) must match the name of the project you provide when you initialize a W&B Sweep ([`wandb.sweep()`]({{< relref "/ref/python/functions/sweep.md" >}})). -{{% /alert %}} - - -{{< tabpane text=true >}} -{{% tab header="Python script or notebook" %}} - -Use the W&B SDK to initialize a sweep. Pass the sweep configuration dictionary to the `sweep` parameter. Optionally provide the name of the project for the project parameter (`project`) where you want the output of the W&B Run to be stored. If the project is not specified, the run is put in an "Uncategorized" project. - -```python -import wandb - -# Example sweep configuration -sweep_configuration = { - "method": "random", - "name": "sweep", - "metric": {"goal": "maximize", "name": "val_acc"}, - "parameters": { - "batch_size": {"values": [16, 32, 64]}, - "epochs": {"values": [5, 10, 15]}, - "lr": {"max": 0.1, "min": 0.0001}, - }, -} - -sweep_id = wandb.sweep(sweep=sweep_configuration, project="project-name") -``` - -The [`wandb.sweep()`]({{< relref "/ref/python/functions/sweep.md" >}}) function returns the sweep ID. The sweep ID includes the entity name and the project name. Make a note of the sweep ID. - -{{% /tab %}} -{{% tab header="CLI" %}} - -Use the W&B CLI to initialize a sweep. Provide the name of your configuration file. Optionally provide the name of the project for the `project` flag. If the project is not specified, the W&B Run is put in an "Uncategorized" project. - -Use the [`wandb sweep`]({{< relref "/ref/cli/wandb-sweep.md" >}}) command to initialize a sweep. The proceeding code example initializes a sweep for a `sweeps_demo` project and uses a `config.yaml` file for the configuration. - -```bash -wandb sweep --project sweeps_demo config.yaml -``` - -This command will print out a sweep ID. The sweep ID includes the entity name and the project name. Make a note of the sweep ID. - -{{% /tab %}} -{{< /tabpane >}} - diff --git a/content/en/guides/models/sweeps/local-controller.md b/content/en/guides/models/sweeps/local-controller.md deleted file mode 100644 index 3793baebdf..0000000000 --- a/content/en/guides/models/sweeps/local-controller.md +++ /dev/null @@ -1,109 +0,0 @@ ---- -description: Search and stop algorithms locally instead of using the W&B cloud-hosted - service. -menu: - default: - identifier: local-controller - parent: sweeps -title: Manage algorithms locally ---- - -The hyper-parameter controller is hosted by Weights & Biased as a cloud service by default. W&B agents communicate with the controller to determine the next set of parameters to use for training. The controller is also responsible for running early stopping algorithms to determine which runs can be stopped. - -The local controller feature allows the user to commence search and stop algorithms locally. The local controller gives the user the ability to inspect and instrument the code in order to debug issues as well as develop new features which can be incorporated into the cloud service. - -{{% alert color="secondary" %}} -This feature is offered to support faster development and debugging of new algorithms for the Sweeps tool. It is not intended for actual hyperparameter optimization workloads. -{{% /alert %}} - -Before you get start, you must install the W&B SDK(`wandb`). Type the following code snippet into your command line: - -``` -pip install wandb sweeps -``` - -The following examples assume you already have a configuration file and a training loop defined in a python script or Jupyter Notebook. For more information about how to define a configuration file, see [Define sweep configuration]({{< relref "/guides/models/sweeps/define-sweep-configuration/" >}}). - -### Run the local controller from the command line - -Initialize a sweep similarly to how you normally would when you use hyper-parameter controllers hosted by W&B as a cloud service. Specify the controller flag (`controller`) to indicate you want to use the local controller for W&B sweep jobs: - -```bash -wandb sweep --controller config.yaml -``` - -Alternatively, you can separate initializing a sweep and specifying that you want to use a local controller into two steps. - -To separate the steps, first add the following key-value to your sweep's YAML configuration file: - -```yaml -controller: - type: local -``` - -Next, initialize the sweep: - -```bash -wandb sweep config.yaml -``` - -`wandb sweep` generates a sweep ID. After you initialized the sweep, start a controller with [`wandb controller`]({{< relref "/ref/python/functions/controller.md" >}}): - -```bash -wandb controller {user}/{entity}/{sweep_id} -``` - -Once you have specified you want to use a local controller, start one or more Sweep agents to execute the sweep. Start a W&B Sweep similar to how you normally would. See [Start sweep agents]({{< relref "/guides/models/sweeps/start-sweep-agents.md" >}}), for more information. - -```bash -wandb sweep sweep_ID -``` - -### Run a local controller with W&B Python SDK - -The following code snippets demonstrate how to specify and use a local controller with the W&B Python SDK. - -The simplest way to use a controller with the Python SDK is to pass the sweep ID to the [`wandb.controller`]({{< relref "/ref/python/functions/controller.md" >}}) method. Next, use the return objects `run` method to start the sweep job: - -```python -sweep = wandb.controller(sweep_id) -sweep.run() -``` - -If you want more control of the controller loop: - -```python -import wandb - -sweep = wandb.controller(sweep_id) -while not sweep.done(): - sweep.print_status() - sweep.step() - time.sleep(5) -``` - -Or even more control over the parameters served: - -```python -import wandb - -sweep = wandb.controller(sweep_id) -while not sweep.done(): - params = sweep.search() - sweep.schedule(params) - sweep.print_status() -``` - -If you want to specify your sweep entirely with code you can do something like this: - -```python -import wandb - -sweep = wandb.controller() -sweep.configure_search("grid") -sweep.configure_program("train-dummy.py") -sweep.configure_controller(type="local") -sweep.configure_parameter("param1", value=3) -sweep.create() -sweep.run() -``` \ No newline at end of file diff --git a/content/en/guides/models/sweeps/parallelize-agents.md b/content/en/guides/models/sweeps/parallelize-agents.md deleted file mode 100644 index 4853af89df..0000000000 --- a/content/en/guides/models/sweeps/parallelize-agents.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -description: Parallelize W&B Sweep agents on multi-core or multi-GPU machine. -menu: - default: - identifier: parallelize-agents - parent: sweeps -title: Parallelize agents -weight: 6 ---- - - -Parallelize your W&B Sweep agents on a multi-core or multi-GPU machine. Before you get started, ensure you have initialized your W&B Sweep. For more information on how to initialize a W&B Sweep, see [Initialize sweeps]({{< relref "./initialize-sweeps.md" >}}). - -### Parallelize on a multi-CPU machine - -Depending on your use case, explore the proceeding tabs to learn how to parallelize W&B Sweep agents using the CLI or within a Jupyter Notebook. - - -{{< tabpane text=true >}} - {{% tab header="CLI" %}} -Use the [`wandb agent`]({{< relref "/ref/cli/wandb-agent.md" >}}) command to parallelize your sweep agent across multiple CPUs with the terminal. Provide the sweep ID that was returned when you [initialized the sweep]({{< relref "./initialize-sweeps.md" >}}). - -1. Open more than one terminal window on your local machine. -2. Copy and paste the code snippet below and replace `sweep_id` with your sweep ID: - -```bash -wandb agent sweep_id -``` - {{% /tab %}} - {{% tab header="Jupyter Notebook" %}} -Use the W&B Python SDK library to parallelize your W&B Sweep agent across multiple CPUs within Jupyter Notebooks. Ensure you have the sweep ID that was returned when you [initialized the sweep]({{< relref "./initialize-sweeps.md" >}}). In addition, provide the name of the function the sweep will execute for the `function` parameter: - -1. Open more than one Jupyter Notebook. -2. Copy and past the W&B Sweep ID on multiple Jupyter Notebooks to parallelize a W&B Sweep. For example, you can paste the following code snippet on multiple jupyter notebooks to paralleliz your sweep if you have the sweep ID stored in a variable called `sweep_id` and the name of the function is `function_name`: - -```python -wandb.agent(sweep_id=sweep_id, function=function_name) -``` - {{% /tab %}} -{{< /tabpane >}} - - - -### Parallelize on a multi-GPU machine - -Follow the procedure outlined to parallelize your W&B Sweep agent across multiple GPUs with a terminal using CUDA Toolkit: - -1. Open more than one terminal window on your local machine. -2. Specify the GPU instance to use with `CUDA_VISIBLE_DEVICES` when you start a W&B Sweep job ([`wandb agent`]({{< relref "/ref/cli/wandb-agent.md" >}})). Assign `CUDA_VISIBLE_DEVICES` an integer value corresponding to the GPU instance to use. - -For example, suppose you have two NVIDIA GPUs on your local machine. Open a terminal window and set `CUDA_VISIBLE_DEVICES` to `0` (`CUDA_VISIBLE_DEVICES=0`). Replace `sweep_ID` in the proceeding example with the W&B Sweep ID that is returned when you initialized a W&B Sweep: - -Terminal 1 - -```bash -CUDA_VISIBLE_DEVICES=0 wandb agent sweep_ID -``` - -Open a second terminal window. Set `CUDA_VISIBLE_DEVICES` to `1` (`CUDA_VISIBLE_DEVICES=1`). Paste the same W&B Sweep ID for the `sweep_ID` mentioned in the proceeding code snippet: - -Terminal 2 - -```bash -CUDA_VISIBLE_DEVICES=1 wandb agent sweep_ID -``` \ No newline at end of file diff --git a/content/en/guides/models/sweeps/pause-resume-and-cancel-sweeps.md b/content/en/guides/models/sweeps/pause-resume-and-cancel-sweeps.md deleted file mode 100644 index d2a2798217..0000000000 --- a/content/en/guides/models/sweeps/pause-resume-and-cancel-sweeps.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -description: Pause, resume, and cancel a W&B Sweep with the CLI. -menu: - default: - identifier: pause-resume-and-cancel-sweeps - parent: sweeps -title: Manage a W&B Sweep with the CLI -weight: 8 ---- - -Use the [W&B CLI]({{< relref "/ref/cli/wandb-sweep.md" >}}) to pause, resume, and cancel a sweep. The CLI's `sweep` command uses flags such as `--pause` and `--resume` to control the sweep's ability to create new W&B runs, with different effects on existing runs: - -- `--pause`: When you pause a sweep, the agent creates no new runs until you resume the sweep. Existing runs continue to execute normally. -- `--resume`: When you resume a sweep, the agent continues creating new runs according to the search strategy. -- `--stop`: When you stop a sweep, the agent stops creating new runs. Existing runs continue to completion. -- `--cancel`: When you cancel a sweep, the agent immediately kills all currently executing runs and stops creating new runs. - - -Use the following guidance to pause, resume, and cancel a sweep. In each case, provide the sweep ID that was generated when you initialized a sweep. - -### Pause a sweep - -Pause a sweep so it temporarily stops creating new runs. Runs that are already executing will continue to run until completion. Use the [`wandb sweep --pause`]({{< relref "/ref/cli/wandb-sweep.md" >}}) command to pause a sweep. Provide the sweep ID that you want to pause. - -```bash -wandb sweep --pause entity/project/sweep_ID -``` - -### Resume a sweep - -Resume a paused sweep with the [`wandb sweep --resume`]({{< relref "/ref/cli/wandb-sweep.md" >}}) command. The sweep will start creating new runs again according to its search strategy. Provide the sweep ID that you want to resume: - -```bash -wandb sweep --resume entity/project/sweep_ID -``` - -### Stop a sweep - -Finish a sweep to stop creating new runs while letting currently executing runs finish gracefully. Use the [`wandb sweep --stop`]({{< relref "/ref/cli/wandb-sweep.md" >}}) command: - -```bash -wandb sweep --stop entity/project/sweep_ID -``` - -### Cancel a sweep - -Cancel a sweep to immediately kill all running runs and stop creating new runs. This is the only sweep command that forcibly terminates existing runs. Use the [`wandb sweep --cancel`]({{< relref "/ref/cli/wandb-sweep.md" >}}) command to cancel a sweep. Provide the sweep ID that you want to cancel. - -```bash -wandb sweep --cancel entity/project/sweep_ID -``` - -For a full list of CLI command options, see the [wandb sweep]({{< relref "/ref/cli/wandb-sweep.md" >}}) CLI Reference Guide. - -## Understanding sweep and run statuses - -A sweep orchestrates multiple runs to explore hyperparameter combinations. Understanding how sweep status and run status interact is crucial for effectively managing your hyperparameter optimization. - -### Key differences - -- **Sweep status** controls whether new runs are created (Running, Paused, Stopped, Cancelled, Finished, Failed, Crashed) -- **Run status** reflects the execution state of individual runs (Pending, Running, Finished, Failed, Crashed, Killed) - -### Best practices - -- Use `--pause` instead of cancel when you want to temporarily halt exploration without losing running experiments -- Monitor individual run statuses to identify systematic failures -- Use `--stop` for graceful termination when you've found satisfactory hyperparameters -- Reserve `--cancel` for emergencies when runs are consuming excessive resources or producing errors diff --git a/content/en/guides/models/sweeps/start-sweep-agents.md b/content/en/guides/models/sweeps/start-sweep-agents.md deleted file mode 100644 index 9ac5f213f9..0000000000 --- a/content/en/guides/models/sweeps/start-sweep-agents.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -description: Start or stop a W&B Sweep Agent on one or more machines. -menu: - default: - identifier: start-sweep-agents - parent: sweeps -title: Start or stop a sweep agent -weight: 5 ---- - - -Start a W&B Sweep on one or more agents on one or more machines. W&B Sweep agents query the W&B server you launched when you initialized a W&B Sweep (`wandb sweep)` for hyperparameters and use them to run model training. - -To start a W&B Sweep agent, provide the W&B Sweep ID that was returned when you initialized a W&B Sweep. The W&B Sweep ID has the form: - -```bash -entity/project/sweep_ID -``` - -Where: - -* entity: Your W&B username or team name. -* project: The name of the project where you want the output of the W&B Run to be stored. If the project is not specified, the run is put in an "Uncategorized" project. -* sweep_ID: The pseudo random, unique ID generated by W&B. - -Provide the name of the function the W&B Sweep will execute if you start a W&B Sweep agent within a Jupyter Notebook or Python script. - -The proceeding code snippets demonstrate how to start an agent with W&B. We assume you already have a configuration file and you have already initialized a W&B Sweep. For more information about how to define a configuration file, see [Define sweep configuration]({{< relref "/guides/models/sweeps/define-sweep-configuration/" >}}). - -{{< tabpane text=true >}} -{{% tab header="CLI" %}} -Use the `wandb agent` command to start a sweep. Provide the sweep ID that was returned when you initialized the sweep. Copy and paste the code snippet below and replace `sweep_id` with your sweep ID: - -```bash -wandb agent sweep_id -``` -{{% /tab %}} -{{% tab header="Python script or notebook" %}} -Use the W&B Python SDK library to start a sweep. Provide the sweep ID that was returned when you initialized the sweep. In addition, provide the name of the function the sweep will execute. - -```python -wandb.agent(sweep_id=sweep_id, function=function_name) -``` - -{{% alert color="secondary" title="Multiprocessing" %}} -You must wrap your `wandb.agent()` and `wandb.sweep()` calls with `if __name__ == '__main__':` if you use Python standard library's `multiprocessing` or PyTorch's `pytorch.multiprocessing` package. For example: - -```python -if __name__ == '__main__': - wandb.agent(sweep_id="", function="", count="") -``` - -Wrapping your code with this convention ensures that it is only executed when the script is run directly, and not when it is imported as a module in a worker process. - -See [Python standard library `multiprocessing`](https://docs.python.org/3/library/multiprocessing.html#the-spawn-and-forkserver-start-methods) or [PyTorch `multiprocessing`](https://docs.pytorch.org/docs/stable/notes/multiprocessing.html#asynchronous-multiprocess-training-e-g-hogwild) for more information about multiprocessing. See https://realpython.com/if-name-main-python/ for information about the `if __name__ == '__main__':` convention. -{{% /alert %}} - -{{% /tab %}} -{{< /tabpane >}} - - - -### Stop W&B agent - -{{% alert color="secondary" %}} -Random and Bayesian searches will run forever. You must stop the process from the command line, within your python script, or the [Sweeps UI]({{< relref "./visualize-sweep-results.md" >}}). -{{% /alert %}} - -Optionally specify the number of W&B Runs a Sweep agent should try. The following code snippets demonstrate how to set a maximum number of [W&B Runs]({{< relref "/ref/python/experiments/run.md" >}}) with the CLI and within a Jupyter Notebook, Python script. - -{{< tabpane text=true >}} - {{% tab header="Python script or notebook" %}} -First, initialize your sweep. For more information, see [Initialize sweeps]({{< relref "./initialize-sweeps.md" >}}). - -``` -sweep_id = wandb.sweep(sweep_config) -``` - -Next, start the sweep job. Provide the sweep ID generated from sweep initiation. Pass an integer value to the count parameter to set the maximum number of runs to try. - -```python -sweep_id, count = "dtzl1o7u", 10 -wandb.agent(sweep_id, count=count) -``` - -{{% alert color="secondary" %}} -If you start a new run after the sweep agent has finished, within the same script or notebook, then you should call `wandb.teardown()` before starting the new run. -{{% /alert %}} - {{% /tab %}} - {{% tab header="CLI" %}} -First, initialize your sweep with the [`wandb sweep`]({{< relref "/ref/cli/wandb-sweep.md" >}}) command. For more information, see [Initialize sweeps]({{< relref "./initialize-sweeps.md" >}}). - -``` -wandb sweep config.yaml -``` - -Pass an integer value to the count flag to set the maximum number of runs to try. - -```python -NUM=10 -SWEEPID="dtzl1o7u" -wandb agent --count $NUM $SWEEPID -``` - {{% /tab %}} -{{< /tabpane >}} diff --git a/content/en/guides/models/sweeps/sweeps-ui.md b/content/en/guides/models/sweeps/sweeps-ui.md deleted file mode 100644 index 0d031d661b..0000000000 --- a/content/en/guides/models/sweeps/sweeps-ui.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -description: Describes the different components of the Sweeps UI. -menu: - default: - identifier: sweeps-ui - parent: sweeps -title: Sweeps UI ---- - -The state (**State**), creation time (**Created**), the entity that started the sweep (**Creator**), the number of runs completed (**Run count**), and the time it took to compute the sweep (**Compute time**) are displayed in the Sweeps UI. The expected number of runs a sweep will create (**Est. Runs**) is provided when you do a grid search over a discrete search space. You can also click on a sweep to pause, resume, stop, or kill the sweep from the interface. \ No newline at end of file diff --git a/content/en/guides/models/sweeps/troubleshoot-sweeps.md b/content/en/guides/models/sweeps/troubleshoot-sweeps.md deleted file mode 100644 index c6314f1fc0..0000000000 --- a/content/en/guides/models/sweeps/troubleshoot-sweeps.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -description: Troubleshoot common W&B Sweep issues. -menu: - default: - identifier: troubleshoot-sweeps - parent: sweeps -title: Sweeps troubleshooting ---- - -Troubleshoot common error messages with the guidance suggested. - -### `CommError, Run does not exist` and `ERROR Error uploading` - -Your W&B Run ID might be defined if these two error messages are both returned. As an example, you might have a similar code snippet defined somewhere in your Jupyter Notebooks or Python script: - -```python -wandb.init(id="some-string") -``` - -You can not set a Run ID for W&B Sweeps because W&B automatically generates random, unique IDs for Runs created by W&B Sweeps. - -W&B Run IDs need to be unique within a project. - -We recommend you pass a name to the name parameter when you initialized W&B, if you want to set a custom name that will appear on tables and graphs. For example: - -```python -wandb.init(name="a helpful readable run name") -``` - -### `Cuda out of memory` - -Refactor your code to use process-based executions if you see this error message. More specifically, rewrite your code to a Python script. In addition, call the W&B Sweep Agent from the CLI, instead of the W&B Python SDK. - -As an example, suppose you rewrite your code to a Python script called `train.py`. Add the name of the training script (`train.py`) to your YAML Sweep configuration file (`config.yaml` in this example): - -```yaml -program: train.py -method: bayes -metric: - name: validation_loss - goal: maximize -parameters: - learning_rate: - min: 0.0001 - max: 0.1 - optimizer: - values: ["adam", "sgd"] -``` - -Next, add the following to your `train.py` Python script: - -```python -if _name_ == "_main_": - train() -``` - -Navigate to your CLI and initialize a W&B Sweep with wandb sweep: - -```shell -wandb sweep config.yaml -``` - -Make a note of the W&B Sweep ID that is returned. Next, start the Sweep job with [`wandb agent`]({{< relref "/ref/cli/wandb-agent.md" >}}) with the CLI instead of the Python SDK ([`wandb.agent`]({{< relref "/ref/python/functions/agent.md" >}})). Replace `sweep_ID` in the code snippet below with the Sweep ID that was returned in the previous step: - -```shell -wandb agent sweep_ID -``` - -### `anaconda 400 error` - -The following error usually occurs when you do not log the metric that you are optimizing: - -```shell -wandb: ERROR Error while calling W&B API: anaconda 400 error: -{"code": 400, "message": "TypeError: bad operand type for unary -: 'NoneType'"} -``` - -Within your YAML file or nested dictionary you specify a key named "metric" to optimize. Ensure that you log (`wandb.log`) this metric. In addition, ensure you use the _exact_ metric name that you defined the sweep to optimize within your Python script or Jupyter Notebook. For more information about configuration files, see [Define sweep configuration]({{< relref "/guides/models/sweeps/define-sweep-configuration/" >}}). \ No newline at end of file diff --git a/content/en/guides/models/sweeps/useful-resources.md b/content/en/guides/models/sweeps/useful-resources.md deleted file mode 100644 index 584116228e..0000000000 --- a/content/en/guides/models/sweeps/useful-resources.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -description: Collection of useful sources for Sweeps. -menu: - default: - identifier: useful-resources - parent: sweeps -title: Learn more about sweeps ---- - -### Academic papers - -Li, Lisha, et al. "[Hyperband: A novel bandit-based approach to hyperparameter optimization.](https://arxiv.org/pdf/1603.06560.pdf)" _The Journal of Machine Learning Research_ 18.1 (2017): 6765-6816. - -### Sweep Experiments - -The following W&B Reports demonstrate examples of projects that explore hyperparameter optimization with W&B Sweeps. - -* [Drought Watch Benchmark Progress](https://wandb.ai/stacey/droughtwatch/reports/Drought-Watch-Benchmark-Progress--Vmlldzo3ODQ3OQ) - * Description: Developing the baseline and exploring submissions to the Drought Watch benchmark. -* [Tuning Safety Penalties in Reinforcement Learning](https://wandb.ai/safelife/benchmark-sweeps/reports/Tuning-Safety-Penalties-in-Reinforcement-Learning---VmlldzoyNjQyODM) - * Description: We examine agents trained with different side effect penalties on three different tasks: pattern creation, pattern removal, and navigation. -* [Meaning and Noise in Hyperparameter Search with W&B](https://wandb.ai/stacey/pytorch_intro/reports/Meaning-and-Noise-in-Hyperparameter-Search--Vmlldzo0Mzk5MQ) [Stacey Svetlichnaya](https://wandb.ai/stacey) - * Description: How do we distinguish signal from pareidolia (imaginary patterns)? This article is showcases what is possible with W&B and aims to inspire further exploration. -* [Who is Them? Text Disambiguation with Transformers](https://wandb.ai/stacey/winograd/reports/Who-is-Them-Text-Disambiguation-with-Transformers--VmlldzoxMDU1NTc) - * Description: Using Hugging Face to explore models for natural language understanding -* [DeepChem: Molecular Solubility](https://wandb.ai/stacey/deepchem_molsol/reports/DeepChem-Molecular-Solubility--VmlldzoxMjQxMjM) - * Description: Predict chemical properties from molecular structure with random forests and deep nets. -* [Intro to MLOps: Hyperparameter Tuning](https://wandb.ai/iamleonie/Intro-to-MLOps/reports/Intro-to-MLOps-Hyperparameter-Tuning--VmlldzozMTg2OTk3) - * Description: Explore why hyperparameter optimization matters and look at three algorithms to automate hyperparameter tuning for your machine learning models. - -### selfm-anaged - -The following how-to-guide demonstrates how to solve real-world problems with W&B: - -* [Sweeps with XGBoost ](https://github.com/wandb/examples/blob/master/examples/wandb-sweeps/sweeps-xgboost/xgboost_tune.py) - * Description: How to use W&B Sweeps for hyperparameter tuning using XGBoost. - -### Sweep GitHub repository - -W&B advocates open source and welcome contributions from the community. Find the [W&B Sweeps GitHub repository](https://github.com/wandb/sweeps). For information on how to contribute to the W&B open source repo, see the W&B GitHub [Contribution guidelines](https://github.com/wandb/wandb/blob/master/CONTRIBUTING.md). \ No newline at end of file diff --git a/content/en/guides/models/sweeps/visualize-sweep-results.md b/content/en/guides/models/sweeps/visualize-sweep-results.md deleted file mode 100644 index 9abc94f3aa..0000000000 --- a/content/en/guides/models/sweeps/visualize-sweep-results.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -description: Visualize the results of your W&B Sweeps with the W&B App UI. -menu: - default: - identifier: visualize-sweep-results - parent: sweeps -title: Visualize sweep results -weight: 7 ---- - -Visualize the results of your W&B Sweeps with the W&B App. Navigate to the [W&B App](https://wandb.ai/home). Choose the project that you specified when you initialized a sweep. You will be redirected to your project [workspace]({{< relref "/guides/models/track/workspaces.md" >}}). Select the **Sweep icon** on the left panel (broom icon). From the Sweep UI, select the name of your Sweep from the list. - -By default, W&B will automatically create a parallel coordinates plot, a parameter importance plot, and a scatter plot when you start a W&B Sweep job. - -{{< img src="/images/sweeps/navigation_sweeps_ui.gif" alt="Sweep UI navigation" >}} - -Parallel coordinates charts summarize the relationship between large numbers of hyperparameters and model metrics at a glance. For more information on parallel coordinates plots, see [Parallel coordinates]({{< relref "/guides/models/app/features/panels/parallel-coordinates.md" >}}). - -{{< img src="/images/sweeps/example_parallel_coordiantes_plot.png" alt="Example parallel coordinates plot." >}} - -The scatter plot(left) compares the W&B Runs that were generated during the Sweep. For more information about scatter plots, see [Scatter Plots]({{< relref "/guides/models/app/features/panels/scatter-plot.md" >}}). - -The parameter importance plot(right) lists the hyperparameters that were the best predictors of, and highly correlated to desirable values of your metrics. For more information on parameter importance plots, see [Parameter Importance]({{< relref "/guides/models/app/features/panels/parameter-importance.md" >}}). - -{{< img src="/images/sweeps/scatter_and_parameter_importance.png" alt="Scatter plot and parameter importance" >}} - - -You can alter the dependent and independent values (x and y axis) that are automatically used. Within each panel there is a pencil icon called **Edit panel**. Choose **Edit panel**. A model will appear. Within the modal, you can alter the behavior of the graph. - -For more information on all default W&B visualization options, see [Panels]({{< relref "/guides/models/app/features/panels/" >}}). See the [Data Visualization docs]({{< relref "/guides/models/tables/" >}}) for information on how to create plots from W&B Runs that are not part of a W&B Sweep. \ No newline at end of file diff --git a/content/en/guides/models/sweeps/walkthrough.md b/content/en/guides/models/sweeps/walkthrough.md deleted file mode 100644 index 049d4f8ff5..0000000000 --- a/content/en/guides/models/sweeps/walkthrough.md +++ /dev/null @@ -1,142 +0,0 @@ ---- -description: Sweeps quickstart shows how to define, initialize, and run a sweep. There - are four main steps -menu: - default: - identifier: walkthrough_sweeps - parent: sweeps -title: 'Tutorial: Define, initialize, and run a sweep' -weight: 1 ---- - -This page shows how to define, initialize, and run a sweep. There are four main steps: - -1. [Set up your training code]({{< relref "#set-up-your-training-code" >}}) -2. [Define the search space with a sweep configuration]({{< relref "#define-the-search-space-with-a-sweep-configuration" >}}) -3. [Initialize the sweep]({{< relref "#initialize-the-sweep" >}}) -4. [Start the sweep agent]({{< relref "#start-the-sweep" >}}) - - -Copy and paste the following code into a Jupyter Notebook or Python script: - -```python -# Import the W&B Python Library and log into W&B -import wandb - -# 1: Define objective/training function -def objective(config): - score = config.x**3 + config.y - return score - -def main(): - with wandb.init(project="my-first-sweep") as run: - score = objective(run.config) - run.log({"score": score}) - -# 2: Define the search space -sweep_configuration = { - "method": "random", - "metric": {"goal": "minimize", "name": "score"}, - "parameters": { - "x": {"max": 0.1, "min": 0.01}, - "y": {"values": [1, 3, 7]}, - }, -} - -# 3: Start the sweep -sweep_id = wandb.sweep(sweep=sweep_configuration, project="my-first-sweep") - -wandb.agent(sweep_id, function=main, count=10) -``` - -The following sections break down and explains each step in the code sample. - - -## Set up your training code -Define a training function that takes in hyperparameter values from `wandb.Run.config` and uses them to train a model and return metrics. - -Optionally provide the name of the project where you want the output of the W&B Run to be stored (project parameter in [`wandb.init()`]({{< relref "/ref/python/functions/init.md" >}})). If the project is not specified, the run is put in an "Uncategorized" project. - -{{% alert %}} -Both the sweep and the run must be in the same project. Therefore, the name you provide when you initialize W&B must match the name of the project you provide when you initialize a sweep. -{{% /alert %}} - -```python -# 1: Define objective/training function -def objective(config): - score = config.x**3 + config.y - return score - - -def main(): - with wandb.init(project="my-first-sweep") as run: - score = objective(run.config) - run.log({"score": score}) -``` - -## Define the search space with a sweep configuration - -Specify the hyperparameters to sweep in a dictionary. For configuration options, see [Define sweep configuration]({{< relref "/guides/models/sweeps/define-sweep-configuration/" >}}). - -The proceeding example demonstrates a sweep configuration that uses a random search (`'method':'random'`). The sweep will randomly select a random set of values listed in the configuration for the batch size, epoch, and the learning rate. - -W&B minimizes the metric specified in the `metric` key when `"goal": "minimize"` is associated with it. In this case, W&B will optimize for minimizing the metric `score` (`"name": "score"`). - - -```python -# 2: Define the search space -sweep_configuration = { - "method": "random", - "metric": {"goal": "minimize", "name": "score"}, - "parameters": { - "x": {"max": 0.1, "min": 0.01}, - "y": {"values": [1, 3, 7]}, - }, -} -``` - -## Initialize the Sweep - -W&B uses a _Sweep Controller_ to manage sweeps on the cloud (standard), locally (local) across one or more machines. For more information about Sweep Controllers, see [Search and stop algorithms locally]({{< relref "./local-controller.md" >}}). - -A sweep identification number is returned when you initialize a sweep: - -```python -sweep_id = wandb.sweep(sweep=sweep_configuration, project="my-first-sweep") -``` - -For more information about initializing sweeps, see [Initialize sweeps]({{< relref "./initialize-sweeps.md" >}}). - -## Start the Sweep - -Use the [`wandb.agent()`]({{< relref "/ref/python/functions/agent.md" >}}) API call to start a sweep. - -```python -wandb.agent(sweep_id, function=main, count=10) -``` - -{{% alert color="secondary" title="Multiprocessing" %}} -You must wrap your `wandb.agent()` and `wandb.sweep()` calls with `if __name__ == '__main__':` if you use Python standard library's `multiprocessing` or PyTorch's `pytorch.multiprocessing` package. For example: - -```python -if __name__ == '__main__': - wandb.agent(sweep_id="", function="", count="") -``` - -Wrapping your code with this convention ensures that it is only executed when the script is run directly, and not when it is imported as a module in a worker process. - -See [Python standard library `multiprocessing`](https://docs.python.org/3/library/multiprocessing.html#the-spawn-and-forkserver-start-methods) or [PyTorch `multiprocessing`](https://docs.pytorch.org/docs/stable/notes/multiprocessing.html#asynchronous-multiprocess-training-e-g-hogwild) for more information about multiprocessing. See https://realpython.com/if-name-main-python/ for information about the `if __name__ == '__main__':` convention. -{{% /alert %}} - - -## Visualize results (optional) - -Open your project to see your live results in the W&B App dashboard. With just a few clicks, construct rich, interactive charts like [parallel coordinates plots]({{< relref "/guides/models/app/features/panels/parallel-coordinates.md" >}}),[ parameter importance analyzes]({{< relref "/guides/models/app/features/panels/parameter-importance.md" >}}), and [additional chart types]({{< relref "/guides/models/app/features/panels/" >}}). - -{{< img src="/images/sweeps/quickstart_dashboard_example.png" alt="Sweeps Dashboard example" >}} - -For more information about how to visualize results, see [Visualize sweep results]({{< relref "./visualize-sweep-results.md" >}}). For an example dashboard, see this sample [Sweeps Project](https://wandb.ai/anmolmann/pytorch-cnn-fashion/sweeps/pmqye6u3). - -## Stop the agent (optional) - -In the terminal, press `Ctrl+C` to stop the current run. Press it again to terminate the agent. diff --git a/content/en/guides/models/tables/_index.md b/content/en/guides/models/tables/_index.md deleted file mode 100644 index 5256d28e71..0000000000 --- a/content/en/guides/models/tables/_index.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -description: Iterate on datasets and understand model predictions -menu: - default: - identifier: tables - parent: models -title: Tables -weight: 2 -url: guides/tables -cascade: -- url: guides/tables/:filename ---- - -{{< cta-button productLink="https://wandb.ai/wandb/examples/reports/AlphaFold-ed-Proteins-in-W-B-Tables--Vmlldzo4ODc0MDc" colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/datasets-predictions/W%26B_Tables_Quickstart.ipynb" >}} - -Use W&B Tables to visualize and query tabular data. For example: - -* Compare how different models perform on the same test set -* Identify patterns in your data -* Look at sample model predictions visually -* Query to find commonly misclassified examples - -{{< img src="/images/data_vis/tables_sample_predictions.png" alt="Semantic segmentation predictions table" >}} -The above image shows a table with semantic segmentation and custom metrics. View this table here in this [sample project from the W&B ML Course](https://wandb.ai/av-team/mlops-course-001). - -## How it works - -A Table is a two-dimensional grid of data where each column has a single type of data. Tables support primitive and numeric types, as well as nested lists, dictionaries, and rich media types. - -## Log a Table - -Log a table with a few lines of code: - -- [`wandb.init()`]({{< relref "/ref/python/functions/init.md" >}}): Create a [run]({{< relref "/guides/models/track/runs/" >}}) to track results. -- [`wandb.Table()`]({{< relref "/ref/python/data-types/table.md" >}}): Create a new table object. - - `columns`: Set the column names. - - `data`: Set the contents of the table. -- [`run.log()`]({{< relref "/ref/python/experiments/run.md/#method-runlog" >}}): Log the table to save it to W&B. - -```python -import wandb - -run = wandb.init(project="table-test") -my_table = wandb.Table(columns=["a", "b"], data=[["a1", "b1"], ["a2", "b2"]]) -run.log({"Table Name": my_table}) -``` - -## How to get started -* [Quickstart]({{< relref "./tables-walkthrough.md" >}}): Learn to log data tables, visualize data, and query data. -* [Tables Gallery]({{< relref "./tables-gallery.md" >}}): See example use cases for Tables. \ No newline at end of file diff --git a/content/en/guides/models/tables/log_tables.md b/content/en/guides/models/tables/log_tables.md deleted file mode 100644 index c772a51c48..0000000000 --- a/content/en/guides/models/tables/log_tables.md +++ /dev/null @@ -1,261 +0,0 @@ ---- -title: Log tables -weight: 2 ---- - -Visualize and log tabular data with W&B Tables. A W&B Table is a two-dimensional grid of data where each column has a single type of data. Each row represents one or more data points logged to a W&B [run]({{< relref "/guides/models/track/runs/" >}}). W&B Tables support primitive and numeric types, as well as nested lists, dictionaries, and rich media types. - -A W&B Table is a specialized [data type]({{< relref "/ref/python/data-types/" >}}) in W&B, logged as an [artifact]({{< relref "/guides/core/artifacts/" >}}) object. - -You [create and log table objects]({{< relref "#create-and-log-a-new-table" >}}) using the W&B Python SDK. When you create a table object, you specify the columns and data for the table and a [mode]({{< relref "#table-logging-modes" >}}). The mode determines how the table is logged and updated during your ML experiments. - -{{% alert %}} -`INCREMENTAL` mode is supported on W&B Server v0.70.0 and above. -{{% /alert %}} - -## Create and log a table - -1. Initialize a new run with `wandb.init()`. -2. Create a Table object with the [`wandb.Table`]({{< relref "/ref/python/data-types/table" >}}) Class. Specify the columns and data for the table for the `columns` and `data` parameters, respectively. It is recommended to set the optional `log_mode` parameter to one of the three modes: `IMMUTABLE` (the default), `MUTABLE`, or `INCREMENTAL`. See [Table Logging Modes]({{< relref "#logging-modes" >}}) in the next section for more information. -3. Log the table to W&B with `run.log()`. - -The following example shows how to create and log a table with two columns, `a` and `b`, and two rows of data, `["a1", "b1"]` and `["a2", "b2"]`: - -```python -import wandb - -# Start a new run -with wandb.init(project="table-demo") as run: - - # Create a table object with two columns and two rows of data - my_table = wandb.Table( - columns=["a", "b"], - data=[["a1", "b1"], ["a2", "b2"]], - log_mode="IMMUTABLE" - ) - - # Log the table to W&B - run.log({"Table Name": my_table}) -``` - -## Logging modes - -The [`wandb.Table`]({{< relref "/ref/python/data-types/table" >}}) `log_mode` parameter determines how a table is logged and updated during your ML experiments. The `log_mode` parameter accepts one of three arguments: `IMMUTABLE`, `MUTABLE`, and `INCREMENTAL`. Each mode has different implications for how a table is logged, how it can be modified, and how it is rendered in the W&B App. - -The following describes the three logging modes, the high-level differences, and common use case for each mode: - -| Mode | Definition | Use Cases | Benefits | -| ----- | ---------- | ---------- | ----------| -| `IMMUTABLE` | Once a table is logged to W&B, you cannot modify it. |- Storing tabular data generated at the end of a run for further analysis | - Minimal overhead when logged at the end of a run
- All rows rendered in UI | -| `MUTABLE` | After you log a table to W&B, you can overwrite the existing table with a new one. | - Adding columns or rows to existing tables
- Enriching results with new information | - Capture Table mutations
- All rows rendered in UI | -| `INCREMENTAL` | Add batches of new rows to a table throughout the machine learning experiment. | - Adding rows to tables in batches
- Long-running training jobs
- Processing large datasets in batches
- Monitoring ongoing results | - View updates on UI during training
- Ability to step through increments | - -The next sections show example code snippets for each mode along with considerations when to use each mode. - -### MUTABLE mode - -`MUTABLE` mode updates an existing table by replacing the existing table with a new one. `MUTABLE` mode is useful when you want to add new columns and rows to an existing table in a non iterative process. Within the UI, the table is rendered with all rows and columns, including the new ones added after the initial log. - -{{% alert %}} -In `MUTABLE` mode, the table object is replaced each time you log the table. Overwriting a table with a new one is computationally expensive and can be slow for large tables. -{{% /alert %}} - -The following example shows how to create a table in `MUTABLE` mode, log it, and then add new columns to it. The table object is logged three times: once with the initial data, once with the confidence scores, and once with the final predictions. - -{{% alert %}} -The following example uses a placeholder function `load_eval_data()` to load data and a placeholder function `model.predict()` to make predictions. You will need to replace these with your own data loading and prediction functions. -{{% /alert %}} - -```python -import wandb -import numpy as np - -with wandb.init(project="mutable-table-demo") as run: - - # Create a table object with MUTABLE logging mode - table = wandb.Table(columns=["input", "label", "prediction"], - log_mode="MUTABLE") - - # Load data and make predictions - inputs, labels = load_eval_data() # Placeholder function - raw_preds = model.predict(inputs) # Placeholder function - - for inp, label, pred in zip(inputs, labels, raw_preds): - table.add_data(inp, label, pred) - - # Step 1: Log initial data - run.log({"eval_table": table}) # Log initial table - - # Step 2: Add confidence scores (e.g. max softmax) - confidences = np.max(raw_preds, axis=1) - table.add_column("confidence", confidences) - run.log({"eval_table": table}) # Add confidence info - - # Step 3: Add post-processed predictions - # (e.g., thresholded or smoothed outputs) - post_preds = (confidences > 0.7).astype(int) - table.add_column("final_prediction", post_preds) - run.log({"eval_table": table}) # Final update with another column -``` - -If you only want to add new batches of rows (no columns) incrementally like in a training loop, consider using [`INCREMENTAL` mode]({{< relref "#INCREMENTAL-mode" >}}) instead. - -### INCREMENTAL mode - -In incremental mode, you log batches of rows to a table during the machine learning experiment. This is ideal for monitoring long-running jobs or when working with large tables that would be inefficient to log during the run for updates. Within the UI, the table is updated with new rows as they are logged, allowing you to view the latest data without having to wait for the entire run to finish. You can also step through the increments to view the table at different points in time. - -{{% alert %}} -Run workspaces in the W&B App have a limit of 100 increments. If you log more than 100 increments, only the most recent 100 are shown in the run workspace. -{{% /alert %}} - -The following example creates a table in `INCREMENTAL` mode, logs it, and then adds new rows to it. Note that the table is logged once per training step (`step`). - -{{% alert %}} -The following example uses a placeholder function `get_training_batch()` to load data, a placeholder function `train_model_on_batch()` to train the model, and a placeholder function `predict_on_batch()` to make predictions. You will need to replace these with your own data loading, training, and prediction functions. -{{% /alert %}} - -```python -import wandb - -with wandb.init(project="incremental-table-demo") as run: - - # Create a table with INCREMENTAL logging mode - table = wandb.Table(columns=["step", "input", "label", "prediction"], - log_mode="INCREMENTAL") - - # Training loop - for step in range(get_num_batches()): # Placeholder function - # Load batch data - inputs, labels = get_training_batch(step) # Placeholder function - - # Train and predict - train_model_on_batch(inputs, labels) # Placeholder function - predictions = predict_on_batch(inputs) # Placeholder function - - # Add batch data to table - for input_item, label, prediction in zip(inputs, labels, predictions): - table.add_data(step, input_item, label, prediction) - - # Log the table incrementally - run.log({"training_table": table}, step=step) -``` - -Incremental logging is generally more computationally efficient than logging a new table each time (`log_mode=MUTABLE`). However, the W&B App may not render all rows in the table if you log a large number of increments. If your goal is to update and view your table data while your run is ongoing and to have all the data available for analysis, consider using two tables. One with `INCREMENTAL` log mode and one with `IMMUTABLE` log mode. - -The following example shows how to combine `INCREMENTAL` and `IMMUTABLE` logging modes to achieve this. - -```python -import wandb - -with wandb.init(project="combined-logging-example") as run: - - # Create an incremental table for efficient updates during training - incr_table = wandb.Table(columns=["step", "input", "prediction", "label"], - log_mode="INCREMENTAL") - - # Training loop - for step in range(get_num_batches()): - # Process batch - inputs, labels = get_training_batch(step) - predictions = model.predict(inputs) - - # Add data to incremental table - for inp, pred, label in zip(inputs, predictions, labels): - incr_table.add_data(step, inp, pred, label) - - # Log the incremental update (suffix with -incr to distinguish from final table) - run.log({"table-incr": incr_table}, step=step) - - # At the end of training, create a complete immutable table with all data - # Using the default IMMUTABLE mode to preserve the complete dataset - final_table = wandb.Table(columns=incr_table.columns, data=incr_table.data, log_mode="IMMUTABLE") - run.log({"table": final_table}) -``` - -In this example, the `incr_table` is logged incrementally (with `log_mode="INCREMENTAL"`) during training. This allows you to log and view updates to the table as new data is processed. At the end of training, an immutable table (`final_table`) is created with all data from the incremental table. The immutable table is logged to preserve the complete dataset for further analysis and it enables you to view all rows in the W&B App. - -## Examples - -### Enriching evaluation results with MUTABLE - -```python -import wandb -import numpy as np - -with wandb.init(project="mutable-logging") as run: - - # Step 1: Log initial predictions - table = wandb.Table(columns=["input", "label", "prediction"], log_mode="MUTABLE") - inputs, labels = load_eval_data() - raw_preds = model.predict(inputs) - - for inp, label, pred in zip(inputs, labels, raw_preds): - table.add_data(inp, label, pred) - - run.log({"eval_table": table}) # Log raw predictions - - # Step 2: Add confidence scores (e.g. max softmax) - confidences = np.max(raw_preds, axis=1) - table.add_column("confidence", confidences) - run.log({"eval_table": table}) # Add confidence info - - # Step 3: Add post-processed predictions - # (e.g., thresholded or smoothed outputs) - post_preds = (confidences > 0.7).astype(int) - table.add_column("final_prediction", post_preds) - run.log({"eval_table": table}) -``` - -### Resuming runs with INCREMENTAL tables - -You can continue logging to an incremental table when resuming a run: - -```python -# Start or resume a run -resumed_run = wandb.init(project="resume-incremental", id="your-run-id", resume="must") - -# Create the incremental table; no need to populate with data from previously logged table -# Increments will be continue to be added to the Table artifact. -table = wandb.Table(columns=["step", "metric"], log_mode="INCREMENTAL") - -# Continue logging -for step in range(resume_step, final_step): - metric = compute_metric(step) - table.add_data(step, metric) - resumed_run.log({"metrics": table}, step=step) - -resumed_run.finish() -``` - -{{% alert %}} -Increments are logged to a new table if you turn off summaries on a key used for the incremental table using `wandb.Run.define_metric("", summary="none")` or `wandb.Run.define_metric("*", summary="none")`. -{{% /alert %}} - - -### Training with INCREMENTAL batch training - -```python - -with wandb.init(project="batch-training-incremental") as run: - - # Create an incremental table - table = wandb.Table(columns=["step", "input", "label", "prediction"], log_mode="INCREMENTAL") - - # Simulated training loop - for step in range(get_num_batches()): - # Load batch data - inputs, labels = get_training_batch(step) - - # Train the model on this batch - train_model_on_batch(inputs, labels) - - # Run model inference - predictions = predict_on_batch(inputs) - - # Add data to the table - for input_item, label, prediction in zip(inputs, labels, predictions): - table.add_data(step, input_item, label, prediction) - - # Log the current state of the table incrementally - run.log({"training_table": table}, step=step) -``` diff --git a/content/en/guides/models/tables/tables-download.md b/content/en/guides/models/tables/tables-download.md deleted file mode 100644 index c47a15072a..0000000000 --- a/content/en/guides/models/tables/tables-download.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -description: How to export data from tables. -menu: - default: - identifier: tables-download - parent: tables -title: Export table data ---- - -Like all W&B Artifacts, Tables can be converted into pandas dataframes for easy data exporting. - -## Convert `table` to `artifact` -First, you'll need to convert the table to an artifact. The easiest way to do this using `artifact.get(table, "table_name")`: - -```python -# Create and log a new table. -with wandb.init() as r: - artifact = wandb.Artifact("my_dataset", type="dataset") - table = wandb.Table( - columns=["a", "b", "c"], data=[(i, i * 2, 2**i) for i in range(10)] - ) - artifact.add(table, "my_table") - wandb.log_artifact(artifact) - -# Retrieve the created table using the artifact you created. -with wandb.init() as r: - artifact = r.use_artifact("my_dataset:latest") - table = artifact.get("my_table") -``` - -## Convert `artifact` to Dataframe -Then, convert the table into a dataframe: - -```python -# Following from the last code example: -df = table.get_dataframe() -``` - -## Export Data -Now you can export using any method dataframe supports: - -```python -# Converting the table data to .csv -df.to_csv("example.csv", encoding="utf-8") -``` - -# Next Steps -- Check out the [reference documentation]({{< relref "/guides/core/artifacts/construct-an-artifact.md" >}}) on `artifacts`. -- Go through our [Tables Walktrough]({{< relref "/guides/models/tables/tables-walkthrough.md" >}}) guide. -- Check out the [Dataframe](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html) reference docs. \ No newline at end of file diff --git a/content/en/guides/models/tables/tables-gallery.md b/content/en/guides/models/tables/tables-gallery.md deleted file mode 100644 index c9c16203da..0000000000 --- a/content/en/guides/models/tables/tables-gallery.md +++ /dev/null @@ -1,84 +0,0 @@ ---- -description: Examples of W&B Tables -menu: - default: - identifier: tables-gallery - parent: tables -title: Example tables ---- - -The following sections highlight some of the ways you can use tables: - -### View your data - -Log metrics and rich media during model training or evaluation, then visualize results in a persistent database synced to the cloud, or to your [hosting instance]({{< relref "/guides/hosting" >}}). - -{{< img src="/images/data_vis/tables_see_data.png" alt="Data browsing table" max-width="90%" >}} - -For example, check out this table that shows a [balanced split of a photos dataset](https://wandb.ai/stacey/mendeleev/artifacts/balanced_data/inat_80-10-10_5K/ab79f01e007113280018/files/data_split.table.json). - -### Interactively explore your data - -View, sort, filter, group, join, and query tables to understand your data and model performance—no need to browse static files or rerun analysis scripts. - -{{< img src="/images/data_vis/explore_data.png" alt="Audio comparison" max-width="90%">}} - -For example, see this report on [style-transferred audio](https://wandb.ai/stacey/cshanty/reports/Whale2Song-W-B-Tables-for-Audio--Vmlldzo4NDI3NzM). - -### Compare model versions - -Quickly compare results across different training epochs, datasets, hyperparameter choices, model architectures etc. - -{{< img src="/images/data_vis/compare_model_versions.png" alt="Model comparison" max-width="90%">}} - -For example, see this table that compares [two models on the same test images](https://wandb.ai/stacey/evalserver_answers_2/artifacts/results/eval_Daenerys/c2290abd3d7274f00ad8/files/eval_results.table.json#b6dae62d4f00d31eeebf$eval_Bob). - -### Track every detail and see the bigger picture - -Zoom in to visualize a specific prediction at a specific step. Zoom out to see the aggregate statistics, identify patterns of errors, and understand opportunities for improvement. This tool works for comparing steps from a single model training, or results across different model versions. - -{{< img src="/images/data_vis/track_details.png" alt="Tracking experiment details" >}} - -For example, see this example table that analyzes results [after one and then after five epochs on the MNIST dataset](https://wandb.ai/stacey/mnist-viz/artifacts/predictions/baseline/d888bc05719667811b23/files/predictions.table.json#7dd0cd845c0edb469dec). -## Example Projects with W&B Tables -The following highlight some real W&B Projects that use W&B Tables. - -### Image classification - -Read [Visualize Data for Image Classification](https://wandb.ai/stacey/mendeleev/reports/Visualize-Data-for-Image-Classification--VmlldzozNjE3NjA), follow the [data visualization nature Colab](https://wandb.me/dsviz-nature-colab), or explore the [artifacts context](https://wandb.ai/stacey/mendeleev/artifacts/val_epoch_preds/val_pred_gawf9z8j/2dcee8fa22863317472b/files/val_epoch_res.table.json) to see how a CNN identifies ten types of living things (plants, bird, insects, etc) from [iNaturalist](https://www.inaturalist.org/pages/developers) photos. - -{{< img src="/images/data_vis/image_classification.png" alt="Compare the distribution of true labels across two different models' predictions." max-width="90%">}} - -### Audio - -Interact with audio tables in [Whale2Song - W&B Tables for Audio](https://wandb.ai/stacey/cshanty/reports/Whale2Song-W-B-Tables-for-Audio--Vmlldzo4NDI3NzM) on timbre transfer. You can compare a recorded whale song with a synthesized rendition of the same melody on an instrument like violin or trumpet. You can also record your own songs and explore their synthesized versions in W&B with the [audio transfer Colab](http://wandb.me/audio-transfer). - -{{< img src="/images/data_vis/audio.png" alt="Audio table example" max-width="90%">}} - -### Text - -Browse text samples from training data or generated output, dynamically group by relevant fields, and align your evaluation across model variants or experiment settings. Render text as Markdown or use visual diff mode to compare texts. See the [Shakespeare text generation report](https://wandb.ai/stacey/nlg/reports/Visualize-Text-Data-Predictions--Vmlldzo1NzcwNzY) for an example of a character-based RNN. - -{{< img src="/images/data_vis/shakesamples.png" alt="Doubling the size of the hidden layer yields some more creative prompt completions." max-width="90%">}} - -### Video - -Browse and aggregate over videos logged during training to understand your models. Here is an early example using the [SafeLife benchmark](https://wandb.ai/safelife/v1dot2/benchmark) for RL agents seeking to [minimize side effects ](https://wandb.ai/stacey/saferlife/artifacts/video/videos_append-spawn/c1f92c6e27fa0725c154/files/video_examples.table.json) - -{{< img src="/images/data_vis/video.png" alt="Browse easily through the few successful agents" max-width="90%">}} - -### Tabular data - -View a report on how to [split and pre-process tabular data](https://wandb.ai/dpaiton/splitting-tabular-data/reports/Tabular-Data-Versioning-and-Deduplication-with-Weights-Biases--VmlldzoxNDIzOTA1) with version control and de-duplication. - -{{< img src="/images/data_vis/tabs.png" alt="Tables and Artifacts workflow" max-width="90%">}} - -### Comparing model variants (semantic segmentation) - -An [interactive notebook](https://wandb.me/dsviz-cars-demo) and [live example](https://wandb.ai/stacey/evalserver_answers_2/artifacts/results/eval_Daenerys/c2290abd3d7274f00ad8/files/eval_results.table.json#a57f8e412329727038c2$eval_Ada) of logging Tables for semantic segmentation and comparing different models. Try your own queries [in this Table](https://wandb.ai/stacey/evalserver_answers_2/artifacts/results/eval_Daenerys/c2290abd3d7274f00ad8/files/eval_results.table.json). - -{{< img src="/images/data_vis/comparing_model_variants.png" alt="Find the best predictions across two models on the same test set" max-width="90%" >}} - -### Analyzing improvement over training time - -A detailed report on how to [visualize predictions over time](https://wandb.ai/stacey/mnist-viz/reports/Visualize-Predictions-over-Time--Vmlldzo1OTQxMTk) and the accompanying [interactive notebook](https://wandb.me/dsviz-mnist-colab). \ No newline at end of file diff --git a/content/en/guides/models/tables/tables-walkthrough.md b/content/en/guides/models/tables/tables-walkthrough.md deleted file mode 100644 index 5971d8d49d..0000000000 --- a/content/en/guides/models/tables/tables-walkthrough.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -description: Explore how to use W&B Tables with this 5 minute Quickstart. -menu: - default: - identifier: tables-walkthrough - parent: tables -title: 'Tutorial: Log tables, visualize and query data' -weight: 1 ---- - -The following Quickstart demonstrates how to log data tables, visualize data, and query data. - -Select the button below to try a PyTorch Quickstart example project on MNIST data. - -## 1. Log a table -Log a table with W&B. You can either construct a new table or pass a Pandas Dataframe. - -{{< tabpane text=true >}} -{{% tab header="Construct a table" value="construct" %}} -To construct and log a new Table, you will use: -- [`wandb.init()`]({{< relref "/ref/python/functions/init.md" >}}): Create a [run]({{< relref "/guides/models/track/runs/" >}}) to track results. -- [`wandb.Table()`]({{< relref "/ref/python/data-types/table.md" >}}): Create a new table object. - - `columns`: Set the column names. - - `data`: Set the contents of each row. -- [`wandb.Run.log()`]({{< relref "/ref/python/experiments/run.md/#method-runlog" >}}): Log the table to save it to W&B. - -Here's an example: -```python -import wandb - -with wandb.init(project="table-test") as run: - # Create and log a new table. - my_table = wandb.Table(columns=["a", "b"], data=[["a1", "b1"], ["a2", "b2"]]) - run.log({"Table Name": my_table}) -``` -{{% /tab %}} - -{{% tab header="Pandas Dataframe" value="pandas"%}} -Pass a Pandas Dataframe to `wandb.Table()` to create a new table. - -```python -import wandb -import pandas as pd - -df = pd.read_csv("my_data.csv") - -with wandb.init(project="df-table") as run: - # Create a new table from the DataFrame - # and log it to W&B. - my_table = wandb.Table(dataframe=df) - run.log({"Table Name": my_table}) -``` - -For more information on supported data types, see the [`wandb.Table`]({{< relref "/ref/python/data-types/table.md" >}}) in the W&B API Reference Guide. -{{% /tab %}} -{{< /tabpane >}} - - -## 2. Visualize tables in your project workspace - -View the resulting table in your workspace. - -1. Navigate to your project in the W&B App. -2. Select the name of your run in your project workspace. A new panel is added for each unique table key. - -{{< img src="/images/data_vis/wandb_demo_logged_sample_table.png" alt="Sample table logged" >}} - -In this example, `my_table`, is logged under the key `"Table Name"`. - -## 3. Compare across model versions - -Log sample tables from multiple W&B Runs and compare results in the project workspace. In this [example workspace](https://wandb.ai/carey/table-test?workspace=user-carey), we show how to combine rows from multiple different versions in the same table. - -{{< img src="/images/data_vis/wandb_demo_toggle_on_and_off_cross_run_comparisons_in_tables.gif" alt="Cross-run table comparison" >}} - -Use the table filter, sort, and grouping features to explore and evaluate model results. - -{{< img src="/images/data_vis/wandb_demo_filter_on_a_table.png" alt="Table filtering" >}} \ No newline at end of file diff --git a/content/en/guides/models/tables/visualize-tables.md b/content/en/guides/models/tables/visualize-tables.md deleted file mode 100644 index eaaabad55c..0000000000 --- a/content/en/guides/models/tables/visualize-tables.md +++ /dev/null @@ -1,189 +0,0 @@ ---- -description: Visualize and analyze W&B Tables. -menu: - default: - identifier: visualize-tables - parent: tables -title: Visualize and analyze tables -weight: 2 ---- - -Customize your W&B Tables to answer questions about your machine learning model's performance, analyze your data, and more. - -Interactively explore your data to: - -* Compare changes precisely across models, epochs, or individual examples -* Understand higher-level patterns in your data -* Capture and communicate your insights with visual samples - - - -{{% alert %}} -W&B Tables posses the following behaviors: -1. **Stateless in an artifact context**: any table logged alongside an artifact version resets to its default state after you close the browser window -2. **Stateful in a workspace or report context**: any changes you make to a table in a single run workspace, multi-run project workspace, or Report persists. - -For information on how to save your current W&B Table view, see [Save your view]({{< relref "#save-your-view" >}}). -{{% /alert %}} - -## Compare two tables -Compare two tables with a [merged view]({{< relref "#merged-view" >}}) or a [side-by-side view]({{< relref "#side-by-side-view" >}}). For example, the image below demonstrates a table comparison of MNIST data. - -{{< img src="/images/data_vis/table_comparison.png" alt="Training epoch comparison" max-width="90%" >}} - -Follow these steps to compare two tables: - -1. Go to your project in the W&B App. -2. Select the artifacts icon on the left panel. -2. Select an artifact version. - -In the following image we demonstrate a model's predictions on MNIST validation data after each of five epochs ([view interactive example here](https://wandb.ai/stacey/mnist-viz/artifacts/predictions/baseline/d888bc05719667811b23/files/predictions.table.json)). - -{{< img src="/images/data_vis/preds_mnist.png" alt="Click on 'predictions' to view the Table" max-width="90%" >}} - - -3. Hover over the second artifact version you want to compare in the sidebar and click **Compare** when it appears. For example, in the image below we select a version labeled as "v4" to compare to MNIST predictions made by the same model after 5 epochs of training. - -{{< img src="/images/data_vis/preds_2.png" alt="Model prediction comparison" max-width="90%" >}} - -### Merged view - -Initially you see both tables merged together. The first table selected has index 0 and a blue highlight, and the second table has index 1 and a yellow highlight. [View a live example of merged tables here](https://wandb.ai/stacey/mnist-viz/artifacts/predictions/baseline/d888bc05719667811b23/files/predictions.table.json#7dd0cd845c0edb469dec). - -{{< img src="/images/data_vis/merged_view.png" alt="Merged view" max-width="90%">}} - -From the merged view, you can - -* **choose the join key**: use the dropdown at the top left to set the column to use as the join key for the two tables. Typically this is the unique identifier of each row, such as the filename of a specific example in your dataset or an incrementing index on your generated samples. Note that it's currently possible to select _any_ column, which may yield illegible tables and slow queries. -* **concatenate instead of join**: select "concatenating all tables" in this dropdown to _union all the rows_ from both tables into one larger Table instead of joining across their columns -* **reference each Table explicitly**: use 0, 1, and \* in the filter expression to explicitly specify a column in one or both table instances -* **visualize detailed numerical differences as histograms**: compare the values in any cell at a glance - -### Side-by-side view - - - -To view the two tables side-by-side, change the first dropdown from "Merge Tables: Table" to "List of: Table" and then update the "Page size" respectively. Here the first Table selected is on the left and the second one is on the right. Also, you can compare these tables vertically as well by clicking on the "Vertical" checkbox. - -{{< img src="/images/data_vis/side_by_side.png" alt="Side-by-side table view" max-width="90%" >}} - -* **compare the tables at a glance**: apply any operations (sort, filter, group) to both tables in tandem and spot any changes or differences quickly. For example, view the incorrect predictions grouped by guess, the hardest negatives overall, the confidence score distribution by true label, etc. -* **explore two tables independently**: scroll through and focus on the side/rows of interest - - - -## Visualize how values change throughout your runs - -View how values you log to a table change throughout your runs with a step slider. Slide the step slider to view the values logged at different steps. For example, you can view how the loss, accuracy, or other metrics change after each run. - -The slider uses a key to determine the step value. The default key for the slider is `_step`, a special key that W&B automatically logs for you. The `_step` key is an integer that increments by 1 each time you call `wandb.Run.log()` in your code. - -To add a step slider to a W&B Table: - -1. Navigate to your project's workspace. -2. Click **Add panel** in the top right corner of the workspace. -3. Select **Query panel**. -4. Within the query expression editor, select `runs` and press **Enter** on your keyboard. -5. Click the gear icon to view the settings for the panel. -6. Set **Render As** selector to **Stepper**. -7. Set **Stepper Key** to `_step` or the [key to use as the unit]({{< relref "#custom-step-keys" >}}) for the step slider. - -The following image shows a query panel with three W&B runs and the values they logged at step 295. - -{{< img src="/images/data_vis/stepper_key.png" alt="Step slider feature">}} - -Within the W&B App UI you may notice duplicate values for multiple steps. This duplication can occur if multiple runs log the same value at different steps, or if a run does not log values at every step. If a value is missing for a given step, W&B uses the last value that was logged as the slider key. - -### Custom step key - -The step key can be any numeric metric that you log in your runs as the step key, such as `epoch` or `global_step`. When you use a custom step key, W&B maps each value of that key to a step (`_step`) in the run. - -This table shows how a custom step key `epoch` maps to `_step` values for three different runs: `serene-sponge`, `lively-frog`, and `vague-cloud`. Each row represents a call to `wandb.Run.log()` at a particular `_step` in a run. The columns show the corresponding epoch values, if any, that were logged at those steps. Some `_step` values are omitted to save space. - -The first time `wandb.Run.log()` was called, none of the runs logged an `epoch` value, so the table shows empty values for `epoch`. - -| `_step` | vague-cloud (`epoch`) | lively-frog(`epoch`) | serene-sponge (`epoch`) | -| ------- | ------------- | ----------- | ----------- | -| 1 | | | | -| 2 | | | 1 | -| 4 | | 1 | 2 | -| 5 | 1 | | | -| 6 | | | 3 | -| 8 | | 2 | 4 | -| 10 | | | 5 | -| 12 | | 3 | 6 | -| 14 | | | 7 | -| 15 | 2 | | | -| 16 | | 4 | 8 | -| 18 | | | 9 | -| 20 | 3 | 5 | 10 | - -Now, if the slider is set to `epoch = 1`, the following happens: - -* `vague-cloud` finds `epoch = 1` and returns the value logged at `_step = 5` -* `lively-frog` finds `epoch = 1` and returns the value logged at `_step = 4` -* `serene-sponge` finds `epoch = 1` and returns the value logged at `_step = 2` - -If the slider is set to `epoch = 9`: - -* `vague-cloud` also doesn't log `epoch = 9`, so W&B uses the latest prior value `epoch = 3` and returns the value logged at `_step = 20` -* `lively-frog` doesn’t log `epoch = 9`, but the latest prior value is `epoch = 5` so it returns the value logged at `_step = 20` -* `serene-sponge` finds `epoch = 9` and return the value logged at `_step = 18` - - - -## Compare artifacts -You can also [compare tables across time]({{< relref "#compare-tables-across-time" >}}) or [model variants]({{< relref "#compare-tables-across-model-variants" >}}). - - -### Compare tables across time -Log a table in an artifact for each meaningful step of training to analyze model performance over training time. For example, you could log a table at the end of every validation step, after every 50 epochs of training, or any frequency that makes sense for your pipeline. Use the side-by-side view to visualize changes in model predictions. - -{{< img src="/images/data_vis/compare_across_time.png" alt="Training progress comparison" max-width="90%" >}} - -For a more detailed walkthrough of visualizing predictions across training time, see the [predictions over time report](https://wandb.ai/stacey/mnist-viz/reports/Visualize-Predictions-over-Time--Vmlldzo1OTQxMTk) and this interactive [notebook example](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/datasets-predictions/W%26B_Tables_Quickstart.ipynb?_gl=1*kf20ui*_gcl_au*OTI3ODM1OTcyLjE3MzE0MzU1NjU.*_ga*ODEyMjQ4MjkyLjE3MzE0MzU1NjU.*_ga_JH1SJHJQXJ*MTczMTcwNTMwNS45LjEuMTczMTcwNTM5My4zMy4wLjA.*_ga_GMYDGNGKDT*MTczMTcwNTMwNS44LjEuMTczMTcwNTM5My4wLjAuMA..). - -### Compare tables across model variants - -Compare two artifact versions logged at the same step for two different models to analyze model performance across different configurations (hyperparameters, base architectures, and so forth). - -For example, compare predictions between a `baseline` and a new model variant, `2x_layers_2x_lr`, where the first convolutional layer doubles from 32 to 64, the second from 128 to 256, and the learning rate from 0.001 to 0.002. From [this live example](https://wandb.ai/stacey/mnist-viz/artifacts/predictions/baseline/d888bc05719667811b23/files/predictions.table.json#2bb3b1d40aa777496b5d$2x_layers_2x_lr), use the side-by-side view and filter down to the incorrect predictions after 1 (left tab) versus 5 training epochs (right tab). - -{{< tabpane text=true >}} -{{% tab header="1 training epoch" value="one_epoch" %}} -{{< img src="/images/data_vis/compare_across_variants.png" alt="Performance comparison" >}} -{{% /tab %}} -{{% tab header="5 training epochs" value="five_epochs" %}} -{{< img src="/images/data_vis/compare_across_variants_after_5_epochs.png" alt="Variant performance comparison" >}} -{{% /tab %}} -{{< /tabpane >}} - -## Save your view - -Tables you interact with in the run workspace, project workspace, or a report automatically saves their view state. If you apply any table operations then close your browser, the table retains the last viewed configuration when you next navigate to the table. - -{{% alert %}} -Tables you interact with in the artifact context remains stateless. -{{% /alert %}} - -To save a table from a workspace in a particular state, export it to a W&B Report. To export a table to report: -1. Select the kebab icon (three vertical dots) in the top right corner of your workspace visualization panel. -2. Select either **Share panel** or **Add to report**. - -{{< img src="/images/data_vis/share_your_view.png" alt="Report sharing options" max-width="90%">}} - - -## Examples - -These reports highlight the different use cases of W&B Tables: - -* [Visualize Predictions Over Time](https://wandb.ai/stacey/mnist-viz/reports/Visualize-Predictions-over-Time--Vmlldzo1OTQxMTk) -* [How to Compare Tables in Workspaces](https://wandb.ai/stacey/xtable/reports/How-to-Compare-Tables-in-Workspaces--Vmlldzo4MTc0MTA) -* [Image & Classification Models](https://wandb.ai/stacey/mendeleev/reports/Tables-Tutorial-Visualize-Data-for-Image-Classification--VmlldzozNjE3NjA) -* [Text & Generative Language Models](https://wandb.ai/stacey/nlg/reports/Tables-Tutorial-Visualize-Text-Data-Predictions---Vmlldzo1NzcwNzY) -* [Named Entity Recognition](https://wandb.ai/stacey/ner_spacy/reports/Named-Entity-Recognition--Vmlldzo3MDE3NzQ) -* [AlphaFold Proteins](https://wandb.ai/wandb/examples/reports/AlphaFold-ed-Proteins-in-W-B-Tables--Vmlldzo4ODc0MDc) \ No newline at end of file diff --git a/content/en/guides/models/track/_index.md b/content/en/guides/models/track/_index.md deleted file mode 100644 index e0a99f1224..0000000000 --- a/content/en/guides/models/track/_index.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -description: Track machine learning experiments with W&B. -menu: - default: - identifier: experiments - parent: w-b-models -title: Experiments -url: guides/track -weight: 1 -cascade: -- url: guides/track/:filename ---- -{{< cta-button productLink="https://wandb.ai/stacey/deep-drive/workspace?workspace=user-lavanyashukla" colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/intro/Intro_to_Weights_%26_Biases.ipynb" >}} - -Track machine learning experiments with a few lines of code. You can then review the results in an [interactive dashboard]({{< relref "/guides/models/track/workspaces.md" >}}) or export your data to Python for programmatic access using our [Public API]({{< relref "/ref/python/public-api/index.md" >}}). - -Utilize W&B Integrations if you use popular frameworks such as [PyTorch]({{< relref "/guides/integrations/pytorch.md" >}}), [Keras]({{< relref "/guides/integrations/keras.md" >}}), or [Scikit]({{< relref "/guides/integrations/scikit.md" >}}). See our [Integration guides]({{< relref "/guides/integrations/" >}}) for a full list of integrations and information on how to add W&B to your code. - -{{< img src="/images/experiments/experiments_landing_page.png" alt="Experiments dashboard" >}} - -The image above shows an example dashboard where you can view and compare metrics across multiple [runs]({{< relref "/guides/models/track/runs/" >}}). - -## How it works - -Track a machine learning experiment with a few lines of code: -1. Create a [W&B Run]({{< relref "/guides/models/track/runs/" >}}). -2. Store a dictionary of hyperparameters, such as learning rate or model type, into your configuration ([`wandb.Run.config`]({{< relref "./config.md" >}})). -3. Log metrics ([`wandb.Run.log()`]({{< relref "/guides/models/track/log/" >}})) over time in a training loop, such as accuracy and loss. -4. Save outputs of a run, like the model weights or a table of predictions. - -The following code demonstrates a common W&B experiment tracking workflow: - -```python -# Start a run. -# -# When this block exits, it waits for logged data to finish uploading. -# If an exception is raised, the run is marked failed. -with wandb.init(entity="", project="my-project-name") as run: - # Save mode inputs and hyperparameters. - run.config.learning_rate = 0.01 - - # Run your experiment code. - for epoch in range(num_epochs): - # Do some training... - - # Log metrics over time to visualize model performance. - run.log({"loss": loss}) - - # Upload model outputs as artifacts. - run.log_artifact(model) -``` - -## Get started - -Depending on your use case, explore the following resources to get started with W&B Experiments: - -* Read the [W&B Quickstart]({{< relref "/guides/quickstart.md" >}}) for a step-by-step outline of the W&B Python SDK commands you could use to create, track, and use a dataset artifact. -* Explore this chapter to learn how to: - * Create an experiment - * Configure experiments - * Log data from experiments - * View results from experiments -* Explore the [W&B Python Library]({{< relref "/ref/python/index.md" >}}) within the [W&B API Reference Guide]({{< relref "/ref/" >}}). - -## Best practices and tips - -For best practices and tips for experiments and logging, see [Best Practices: Experiments and Logging](https://wandb.ai/wandb/pytorch-lightning-e2e/reports/W-B-Best-Practices-Guide--VmlldzozNTU1ODY1#w&b-experiments-and-logging). \ No newline at end of file diff --git a/content/en/guides/models/track/config.md b/content/en/guides/models/track/config.md deleted file mode 100644 index 99983116e4..0000000000 --- a/content/en/guides/models/track/config.md +++ /dev/null @@ -1,271 +0,0 @@ ---- -description: Use a dictionary-like object to save your experiment configuration -menu: - default: - identifier: config - parent: experiments -weight: 2 -title: Configure experiments ---- -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/wandb-log/Configs_in_W%26B.ipynb" >}} - -Use the `config` property of a run to save your training configuration: -- hyperparameter -- input settings such as the dataset name or model type -- any other independent variables for your experiments. - -The `wandb.Run.config` property makes it easy to analyze your experiments and reproduce your work in the future. You can group by configuration values in the W&B App, compare the configurations of different W&B runs, and evaluate how each training configuration affects the output. The `config` property is a dictionary-like object that can be composed from multiple dictionary-like objects. - -{{% alert %}} -To save output metrics or dependent variables like loss and accuracy, use `wandb.Run.log()` instead of `wandb.Run.config`. -{{% /alert %}} - - - -## Set up an experiment configuration -Configurations are typically defined in the beginning of a training script. Machine learning workflows may vary, however, so you are not required to define a configuration at the beginning of your training script. - -Use dashes (`-`) or underscores (`_`) instead of periods (`.`) in your config variable names. - -Use the dictionary access syntax `["key"]["value"]` instead of the attribute access syntax `config.key.value` if your script accesses `wandb.Run.config` keys below the root. - -The following sections outline different common scenarios of how to define your experiments configuration. - -### Set the configuration at initialization -Pass a dictionary at the beginning of your script when you call the `wandb.init()` API to generate a background process to sync and log data as a W&B Run. - -The proceeding code snippet demonstrates how to define a Python dictionary with configuration values and how to pass that dictionary as an argument when you initialize a W&B Run. - -```python -import wandb - -# Define a config dictionary object -config = { - "hidden_layer_sizes": [32, 64], - "kernel_sizes": [3], - "activation": "ReLU", - "pool_sizes": [2], - "dropout": 0.5, - "num_classes": 10, -} - -# Pass the config dictionary when you initialize W&B -with wandb.init(project="config_example", config=config) as run: - ... -``` - -If you pass a nested dictionary as the `config`, W&B flattens the names using dots. - -Access the values from the dictionary similarly to how you access other dictionaries in Python: - -```python -# Access values with the key as the index value -hidden_layer_sizes = run.config["hidden_layer_sizes"] -kernel_sizes = run.config["kernel_sizes"] -activation = run.config["activation"] - -# Python dictionary get() method -hidden_layer_sizes = run.config.get("hidden_layer_sizes") -kernel_sizes = run.config.get("kernel_sizes") -activation = run.config.get("activation") -``` - -{{% alert %}} -Throughout the Developer Guide and examples we copy the configuration values into separate variables. This step is optional. It is done for readability. -{{% /alert %}} - -### Set the configuration with argparse -You can set your configuration with an argparse object. [argparse](https://docs.python.org/3/library/argparse.html), short for argument parser, is a standard library module in Python 3.2 and above that makes it easy to write scripts that take advantage of all the flexibility and power of command line arguments. - -This is useful for tracking results from scripts that are launched from the command line. - -The proceeding Python script demonstrates how to define a parser object to define and set your experiment config. The functions `train_one_epoch` and `evaluate_one_epoch` are provided to simulate a training loop for the purpose of this demonstration: - -```python -# config_experiment.py -import argparse -import random - -import numpy as np -import wandb - - -# Training and evaluation demo code -def train_one_epoch(epoch, lr, bs): - acc = 0.25 + ((epoch / 30) + (random.random() / 10)) - loss = 0.2 + (1 - ((epoch - 1) / 10 + random.random() / 5)) - return acc, loss - - -def evaluate_one_epoch(epoch): - acc = 0.1 + ((epoch / 20) + (random.random() / 10)) - loss = 0.25 + (1 - ((epoch - 1) / 10 + random.random() / 6)) - return acc, loss - - -def main(args): - # Start a W&B Run - with wandb.init(project="config_example", config=args) as run: - # Access values from config dictionary and store them - # into variables for readability - lr = run.config["learning_rate"] - bs = run.config["batch_size"] - epochs = run.config["epochs"] - - # Simulate training and logging values to W&B - for epoch in np.arange(1, epochs): - train_acc, train_loss = train_one_epoch(epoch, lr, bs) - val_acc, val_loss = evaluate_one_epoch(epoch) - - run.log( - { - "epoch": epoch, - "train_acc": train_acc, - "train_loss": train_loss, - "val_acc": val_acc, - "val_loss": val_loss, - } - ) - - -if __name__ == "__main__": - parser = argparse.ArgumentParser( - formatter_class=argparse.ArgumentDefaultsHelpFormatter - ) - - parser.add_argument("-b", "--batch_size", type=int, default=32, help="Batch size") - parser.add_argument( - "-e", "--epochs", type=int, default=50, help="Number of training epochs" - ) - parser.add_argument( - "-lr", "--learning_rate", type=int, default=0.001, help="Learning rate" - ) - - args = parser.parse_args() - main(args) -``` -### Set the configuration throughout your script -You can add more parameters to your config object throughout your script. The proceeding code snippet demonstrates how to add new key-value pairs to your config object: - -```python -import wandb - -# Define a config dictionary object -config = { - "hidden_layer_sizes": [32, 64], - "kernel_sizes": [3], - "activation": "ReLU", - "pool_sizes": [2], - "dropout": 0.5, - "num_classes": 10, -} - -# Pass the config dictionary when you initialize W&B -with wandb.init(project="config_example", config=config) as run: - # Update config after you initialize W&B - run.config["dropout"] = 0.2 - run.config.epochs = 4 - run.config["batch_size"] = 32 -``` - -You can update multiple values at a time: - -```python -run.config.update({"lr": 0.1, "channels": 16}) -``` - -### Set the configuration after your Run has finished -Use the [W&B Public API]({{< relref "/ref/python/public-api/index.md" >}}) to update a completed run's config. - -You must provide the API with your entity, project name and the run's ID. You can find these details in the Run object or in the [W&B App]({{< relref "/guides/models/track/workspaces.md" >}}): - -```python -with wandb.init() as run: - ... - -# Find the following values from the Run object if it was initiated from the -# current script or notebook, or you can copy them from the W&B App UI. -username = run.entity -project = run.project -run_id = run.id - -# Note that api.run() returns a different type of object than wandb.init(). -api = wandb.Api() -api_run = api.run(f"{username}/{project}/{run_id}") -api_run.config["bar"] = 32 -api_run.update() -``` - - - - -## `absl.FLAGS` - - -You can also pass in [`absl` flags](https://abseil.io/docs/python/guides/flags). - -```python -flags.DEFINE_string("model", None, "model to run") # name, default, help - -run.config.update(flags.FLAGS) # adds absl flags to config -``` - -## File-Based Configs -If you place a file named `config-defaults.yaml` in the same directory as your run script, the run automatically picks up the key-value pairs defined in the file and passes them to `wandb.Run.config`. - -The following code snippet shows a sample `config-defaults.yaml` YAML file: - -```yaml -batch_size: - desc: Size of each mini-batch - value: 32 -``` - -You can override the default values automatically loaded from `config-defaults.yaml` by setting updated values in the `config` argument of `wandb.init`. For example: - -```python -import wandb - -# Override config-defaults.yaml by passing custom values -with wandb.init(config={"epochs": 200, "batch_size": 64}) as run: - ... -``` - -To load a configuration file other than `config-defaults.yaml`, use the `--configs command-line` argument and specify the path to the file: - -```bash -python train.py --configs other-config.yaml -``` - -### Example use case for file-based configs -Suppose you have a YAML file with some metadata for the run, and then a dictionary of hyperparameters in your Python script. You can save both in the nested `config` object: - -```python -hyperparameter_defaults = dict( - dropout=0.5, - batch_size=100, - learning_rate=0.001, -) - -config_dictionary = dict( - yaml=my_yaml_file, - params=hyperparameter_defaults, -) - -with wandb.init(config=config_dictionary) as run: - ... -``` - -## TensorFlow v1 flags - -You can pass TensorFlow flags into the `wandb.Run.config` object directly. - -```python -with wandb.init() as run: - run.config.epochs = 4 - - flags = tf.app.flags - flags.DEFINE_string("data_dir", "/tmp/data") - flags.DEFINE_integer("batch_size", 128, "Batch size.") - run.config.update(flags.FLAGS) # add tensorflow flags as config -``` diff --git a/content/en/guides/models/track/create-an-experiment.md b/content/en/guides/models/track/create-an-experiment.md deleted file mode 100644 index 62d50a5ccc..0000000000 --- a/content/en/guides/models/track/create-an-experiment.md +++ /dev/null @@ -1,158 +0,0 @@ ---- -description: Create a W&B Experiment. -menu: - default: - identifier: create-an-experiment - parent: experiments -weight: 1 -title: Create an experiment ---- - -Use the W&B Python SDK to track machine learning experiments. You can then review the results in an interactive dashboard or export your data to Python for programmatic access with the [W&B Public API]({{< relref "/ref/python/public-api/" >}}). - -This guide describes how to use W&B building blocks to create a W&B Experiment. - -## How to create a W&B Experiment - -Create a W&B Experiment in four steps: - -1. [Initialize a W&B Run]({{< relref "#initialize-a-wb-run" >}}) -2. [Capture a dictionary of hyperparameters]({{< relref "#capture-a-dictionary-of-hyperparameters" >}}) -3. [Log metrics inside your training loop]({{< relref "#log-metrics-inside-your-training-loop" >}}) -4. [Log an artifact to W&B]({{< relref "#log-an-artifact-to-wb" >}}) - -### Initialize a W&B run -Use [`wandb.init()`]({{< relref "/ref/python/functions/init" >}}) to create a W&B Run. - -The following snippet creates a run in a W&B project named `“cat-classification”` with the description `“My first experiment”` to help identify this run. Tags `“baseline”` and `“paper1”` are included to remind us that this run is a baseline experiment intended for a future paper publication. - -```python -import wandb - -with wandb.init( - project="cat-classification", - notes="My first experiment", - tags=["baseline", "paper1"], -) as run: - ... -``` - -`wandb.init()` returns a [Run]({{< relref "/ref/python/experiments/run" >}}) object. - -{{% alert %}} -Note: Runs are added to pre-existing projects if that project already exists when you call `wandb.init()`. For example, if you already have a project called `“cat-classification”`, that project will continue to exist and not be deleted. Instead, a new run is added to that project. -{{% /alert %}} - -### Capture a dictionary of hyperparameters -Save a dictionary of hyperparameters such as learning rate or model type. The model settings you capture in config are useful later to organize and query your results. - -```python -with wandb.init( - ..., - config={"epochs": 100, "learning_rate": 0.001, "batch_size": 128}, -) as run: - ... -``` - -For more information on how to configure an experiment, see [Configure Experiments]({{< relref "./config.md" >}}). - -### Log metrics inside your training loop -Call [`run.log()`]({{< relref "/ref/python/experiments/run/#method-runlog" >}}) to log metrics about each training step such as accuracy and loss. - -```python -model, dataloader = get_model(), get_data() - -for epoch in range(run.config.epochs): - for batch in dataloader: - loss, accuracy = model.training_step() - run.log({"accuracy": accuracy, "loss": loss}) -``` - -For more information on different data types you can log with W&B, see [Log Data During Experiments]({{< relref "/guides/models/track/log/" >}}). - -### Log an artifact to W&B -Optionally log a W&B Artifact. Artifacts make it easy to version datasets and models. -```python -# You can save any file or even a directory. In this example, we pretend -# the model has a save() method that outputs an ONNX file. -model.save("path_to_model.onnx") -run.log_artifact("path_to_model.onnx", name="trained-model", type="model") -``` -Learn more about [Artifacts]({{< relref "/guides/core/artifacts/" >}}) or about versioning models in [Registry]({{< relref "/guides/core/registry/" >}}). - - -### Putting it all together -The full script with the preceding code snippets is found below: -```python -import wandb - -with wandb.init( - project="cat-classification", - notes="", - tags=["baseline", "paper1"], - # Record the run's hyperparameters. - config={"epochs": 100, "learning_rate": 0.001, "batch_size": 128}, -) as run: - # Set up model and data. - model, dataloader = get_model(), get_data() - - # Run your training while logging metrics to visualize model performance. - for epoch in range(run.config["epochs"]): - for batch in dataloader: - loss, accuracy = model.training_step() - run.log({"accuracy": accuracy, "loss": loss}) - - # Upload the trained model as an artifact. - model.save("path_to_model.onnx") - run.log_artifact("path_to_model.onnx", name="trained-model", type="model") -``` - -## Next steps: Visualize your experiment -Use the W&B Dashboard as a central place to organize and visualize results from your machine learning models. With just a few clicks, construct rich, interactive charts like [parallel coordinates plots]({{< relref "/guides/models/app/features/panels/parallel-coordinates.md" >}}),[ parameter importance analyzes]({{< relref "/guides/models/app/features/panels/parameter-importance.md" >}}), and [additional chart types]({{< relref "/guides/models/app/features/panels/" >}}). - -{{< img src="/images/sweeps/quickstart_dashboard_example.png" alt="Quickstart Sweeps Dashboard example" >}} - -For more information on how to view experiments and specific runs, see [Visualize results from experiments]({{< relref "/guides/models/track/workspaces.md" >}}). - - -## Best practices -The following are some suggested guidelines to consider when you create experiments: - -1. **Finish your runs**: Use `wandb.init()` in a `with` statement to automatically mark the run as finished when the code completes or raises an exception. - * In Jupyter notebooks, it may be more convenient to manage the Run object yourself. In this case, you can explicitly call `finish()` on the Run object to mark it complete: - - ```python - # In a notebook cell: - run = wandb.init() - - # In a different cell: - run.finish() - ``` -2. **Config**: Track hyperparameters, architecture, dataset, and anything else you'd like to use to reproduce your model. These will show up in columns— use config columns to group, sort, and filter runs dynamically in the app. -3. **Project**: A project is a set of experiments you can compare together. Each project gets a dedicated dashboard page, and you can easily turn on and off different groups of runs to compare different model versions. -4. **Notes**: Set a quick commit message directly from your script. Edit and access notes in the Overview section of a run in the W&B App. -5. **Tags**: Identify baseline runs and favorite runs. You can filter runs using tags. You can edit tags at a later time on the Overview section of your project's dashboard on the W&B App. -6. **Create multiple run sets to compare experiments**: When comparing experiments, create multiple run sets to make metrics easy to compare. You can toggle run sets on or off on the same chart or group of charts. - -The following code snippet demonstrates how to define a W&B Experiment using the best practices listed above: - -```python -import wandb - -config = { - "learning_rate": 0.01, - "momentum": 0.2, - "architecture": "CNN", - "dataset_id": "cats-0192", -} - -with wandb.init( - project="detect-cats", - notes="tweak baseline", - tags=["baseline", "paper1"], - config=config, -) as run: - ... -``` - -For more information about available parameters when defining a W&B Experiment, see the [`wandb.init()`]({{< relref "/ref/python/functions/init" >}}) API docs in the [API Reference Guide]({{< relref "/ref/python/" >}}). \ No newline at end of file diff --git a/content/en/guides/models/track/environment-variables.md b/content/en/guides/models/track/environment-variables.md deleted file mode 100644 index 2e78d82a07..0000000000 --- a/content/en/guides/models/track/environment-variables.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -description: Set W&B environment variables. -menu: - default: - identifier: environment-variables - parent: experiments -title: Environment variables -weight: 9 ---- - -When you're running a script in an automated environment, you can control W&B with environment variables set before the script runs or within the script. - -```bash -# This is secret and shouldn't be checked into version control -WANDB_API_KEY=$YOUR_API_KEY -# Name and notes optional -WANDB_NAME="My first run" -WANDB_NOTES="Smaller learning rate, more regularization." -``` - -```bash -# Only needed if you don't check in the wandb/settings file -WANDB_ENTITY=$username -WANDB_PROJECT=$project -``` - -```python -# If you don't want your script to sync to the cloud -os.environ["WANDB_MODE"] = "offline" - -# Add sweep ID tracking to Run objects and related classes -os.environ["WANDB_SWEEP_ID"] = "b05fq58z" -``` - -## Optional environment variables - -Use these optional environment variables to do things like set up authentication on remote machines. - -| Variable name | Usage | -| --------------------------- | ---------- | -| `WANDB_ANONYMOUS` | Set this to `allow`, `never`, or `must` to let users create anonymous runs with secret urls. | -| `WANDB_API_KEY` | Sets the authentication key associated with your account. You can find your key on [your settings page](https://app.wandb.ai/settings). This must be set if `wandb login` hasn't been run on the remote machine. | -| `WANDB_BASE_URL` | If you're using [wandb/local]({{< relref "/guides/hosting/" >}}) you should set this environment variable to `http://YOUR_IP:YOUR_PORT` | -| `WANDB_CACHE_DIR` | This defaults to \~/.cache/wandb, you can override this location with this environment variable | -| `WANDB_CONFIG_DIR` | This defaults to \~/.config/wandb, you can override this location with this environment variable | -| `WANDB_CONFIG_PATHS` | Comma separated list of yaml files to load into wandb.config. See [config]({{< relref "./config.md#file-based-configs" >}}). | -| `WANDB_CONSOLE` | Set this to "off" to disable stdout / stderr logging. This defaults to "on" in environments that support it. | -| `WANDB_DATA_DIR` | Where to upload staging artifacts. The default location depends on your platform, because it uses the value of `user_data_dir` from the `platformdirs` Python package. Make sure this directory exists and the running user has permission to write to it. | -| `WANDB_DIR` | Where to store all generated files. If unset, defaults to the `wandb` directory relative to your training script. Make sure this directory exists and the running user has permission to write to it. This does not control the location of downloaded artifacts, which you can set using the `WANDB_ARTIFACT_DIR` environment variable. | -| `WANDB_ARTIFACT_DIR` | Where to store all downloaded artifacts. If unset, defaults to the `artifacts` directory relative to your training script. Make sure this directory exists and the running user has permission to write to it. This does not control the location of generated metadata files, which you can set using the `WANDB_DIR` environment variable. | -| `WANDB_DISABLE_GIT` | Prevent wandb from probing for a git repository and capturing the latest commit / diff. | -| `WANDB_DISABLE_CODE` | Set this to true to prevent wandb from saving notebooks or git diffs. We'll still save the current commit if we're in a git repo. | -| `WANDB_DOCKER` | Set this to a docker image digest to enable restoring of runs. This is set automatically with the wandb docker command. You can obtain an image digest by running `wandb docker my/image/name:tag --digest` | -| `WANDB_ENTITY` | The entity associated with your run. If you have run `wandb init` in the directory of your training script, it will create a directory named _wandb_ and will save a default entity which can be checked into source control. If you don't want to create that file or want to override the file you can use the environmental variable. | -| `WANDB_ERROR_REPORTING` | Set this to false to prevent wandb from logging fatal errors to its error tracking system. | -| `WANDB_HOST` | Set this to the hostname you want to see in the wandb interface if you don't want to use the system provided hostname | -| `WANDB_IGNORE_GLOBS` | Set this to a comma separated list of file globs to ignore. These files will not be synced to the cloud. | -| `WANDB_JOB_NAME` | Specify a name for any jobs created by `wandb`. | -| `WANDB_JOB_TYPE` | Specify the job type, like "training" or "evaluation" to indicate different types of runs. See [grouping]({{< relref "/guides/models/track/runs/grouping.md" >}}) for more info. | -| `WANDB_MODE` | If you set this to "offline" wandb will save your run metadata locally and not sync to the server. If you set this to `disabled` wandb will turn off completely. | -| `WANDB_NAME` | The human-readable name of your run. If not set it will be randomly generated for you | -| `WANDB_NOTEBOOK_NAME` | If you're running in jupyter you can set the name of the notebook with this variable. We attempt to auto detect this. | -| `WANDB_NOTES` | Longer notes about your run. Markdown is allowed and you can edit this later in the UI. | -| `WANDB_PROJECT` | The project associated with your run. This can also be set with `wandb init`, but the environmental variable will override the value. | -| `WANDB_RESUME` | By default this is set to _never_. If set to _auto_ wandb will automatically resume failed runs. If set to _must_ forces the run to exist on startup. If you want to always generate your own unique ids, set this to _allow_ and always set `WANDB_RUN_ID`. | -| `WANDB_RUN_GROUP` | Specify the experiment name to automatically group runs together. See [grouping]({{< relref "/guides/models/track/runs/grouping.md" >}}) for more info. | -| `WANDB_RUN_ID` | Set this to a globally unique string (per project) corresponding to a single run of your script. It must be no longer than 64 characters. All non-word characters will be converted to dashes. This can be used to resume an existing run in cases of failure. | -| `WANDB_QUIET` | Set this to `true` to limit statements logged to standard output to critical statements only. If this is set all logs will be written to `$WANDB_DIR/debug.log`. | -| `WANDB_SILENT` | Set this to `true` to silence wandb log statements. This is useful for scripted commands. If this is set all logs will be written to `$WANDB_DIR/debug.log`. | -| `WANDB_SHOW_RUN` | Set this to `true` to automatically open a browser with the run url if your operating system supports it. | -| `WANDB_SWEEP_ID` | Add sweep ID tracking to `Run` objects and related classes, and display in the UI. | -| `WANDB_TAGS` | A comma separated list of tags to be applied to the run. | -| `WANDB_USERNAME` | The username of a member of your team associated with the run. This can be used along with a service account API key to enable attribution of automated runs to members of your team. | -| `WANDB_USER_EMAIL` | The email of a member of your team associated with the run. This can be used along with a service account API key to enable attribution of automated runs to members of your team. | - -## Singularity environments - -If you're running containers in [Singularity](https://singularity.lbl.gov/index.html) you can pass environment variables by pre-pending the above variables with `SINGULARITYENV_`. More details about Singularity environment variables can be found [here](https://singularity.lbl.gov/docs-environment-metadata#environment). - -## Running on AWS - -If you're running batch jobs in AWS, it's easy to authenticate your machines with your W&B credentials. Get your API key from your [settings page](https://app.wandb.ai/settings), and set the `WANDB_API_KEY` environment variable in the [AWS batch job spec](https://docs.aws.amazon.com/batch/latest/userguide/job_definition_parameters.html#parameters). diff --git a/content/en/guides/models/track/jupyter.md b/content/en/guides/models/track/jupyter.md deleted file mode 100644 index eb8f0d64f3..0000000000 --- a/content/en/guides/models/track/jupyter.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -description: Use W&B with Jupyter to get interactive visualizations without leaving - your notebook. -menu: - default: - identifier: jupyter - parent: experiments -title: Track Jupyter notebooks -weight: 6 ---- - -Use W&B with Jupyter to get interactive visualizations without leaving your notebook. Combine custom analysis, experiments, and prototypes, all fully logged. - -## Use cases for W&B with Jupyter notebooks - -1. **Iterative experimentation**: Run and re-run experiments, tweaking parameters, and have all the runs you do saved automatically to W&B without having to take manual notes along the way. -2. **Code saving**: When reproducing a model, it's hard to know which cells in a notebook ran, and in which order. Turn on code saving on your [settings page]({{< relref "/guides/models/app/settings-page/" >}}) to save a record of cell execution for each experiment. -3. **Custom analysis**: Once runs are logged to W&B, it's easy to get a dataframe from the API and do custom analysis, then log those results to W&B to save and share in reports. - -## Getting started in a notebook - -Start your notebook with the following code to install W&B and link your account: - -```notebook -!pip install wandb -qqq -import wandb -wandb.login() -``` - -Next, set up your experiment and save hyperparameters: - -```python -wandb.init( - project="jupyter-projo", - config={ - "batch_size": 128, - "learning_rate": 0.01, - "dataset": "CIFAR-100", - }, -) -``` - -After running `wandb.init()` , start a new cell with `%%wandb` to see live graphs in the notebook. If you run this cell multiple times, data will be appended to the run. - -```notebook -%%wandb - -# Your training loop here -``` - -Try it for yourself in this [example notebook](https://wandb.me/jupyter-interact-colab). - -{{< img src="/images/track/jupyter_widget.png" alt="Jupyter W&B widget" >}} - -### Rendering live W&B interfaces directly in your notebooks - -You can also display any existing dashboards, sweeps, or reports directly in your notebook using the `%wandb` magic: - -```notebook -# Display a project workspace -%wandb USERNAME/PROJECT -# Display a single run -%wandb USERNAME/PROJECT/runs/RUN_ID -# Display a sweep -%wandb USERNAME/PROJECT/sweeps/SWEEP_ID -# Display a report -%wandb USERNAME/PROJECT/reports/REPORT_ID -# Specify the height of embedded iframe -%wandb USERNAME/PROJECT -h 2048 -``` - -As an alternative to the `%%wandb` or `%wandb` magics, after running `wandb.init()` you can end any cell with `wandb.Run.finish()` to show in-line graphs, or call `ipython.display(...)` on any report, sweep, or run object returned from our apis. - -```python -import wandb -from IPython.display import display -# Initialize a run -run = wandb.init() - -# If cell outputs run.finish(), you'll see live graphs -run.finish() -``` - -{{% alert %}} -Want to know more about what you can do with W&B? Check out our [guide to logging data and media]({{< relref "/guides/models/track/log/" >}}), learn [how to integrate us with your favorite ML toolkits]({{< relref "/guides/integrations/" >}}), or just dive straight into the [reference docs]({{< relref "/ref/python/" >}}) or our [repo of examples](https://github.com/wandb/examples). -{{% /alert %}} - -## Additional Jupyter features in W&B - -1. **Easy authentication in Colab**: When you call `wandb.init` for the first time in a Colab, we automatically authenticate your runtime if you're currently logged in to W&B in your browser. On the overview tab of your run page, you'll see a link to the Colab. -2. **Jupyter Magic:** Display dashboards, sweeps and reports directly in your notebooks. The `%wandb` magic accepts a path to your project, sweeps or reports and will render the W&B interface directly in the notebook. -3. **Launch dockerized Jupyter**: Call `wandb docker --jupyter` to launch a docker container, mount your code in it, ensure Jupyter is installed, and launch on port 8888. -4. **Run cells in arbitrary order without fear**: By default, we wait until the next time `wandb.init` is called to mark a run as `finished`. That allows you to run multiple cells (say, one to set up data, one to train, one to test) in whatever order you like and have them all log to the same run. If you turn on code saving in [settings](https://app.wandb.ai/settings), you'll also log the cells that were executed, in order and in the state in which they were run, enabling you to reproduce even the most non-linear of pipelines. To mark a run as complete manually in a Jupyter notebook, call `run.finish`. - -```python -import wandb - -run = wandb.init() - -# training script and logging goes here - -run.finish() -``` \ No newline at end of file diff --git a/content/en/guides/models/track/limits.md b/content/en/guides/models/track/limits.md deleted file mode 100644 index 1691583479..0000000000 --- a/content/en/guides/models/track/limits.md +++ /dev/null @@ -1,312 +0,0 @@ ---- -description: Keep your pages in W&B faster and more responsive by logging within these - suggested bounds. -menu: - default: - identifier: limits - parent: experiments -title: Experiments limits and performance -weight: 7 ---- - - - -Keep your pages in W&B faster and more responsive by logging within the following suggested bounds. - -## Logging considerations - -Use `wandb.Run.log()` to track experiment metrics. - -### Distinct metric count - -For faster performance, keep the total number of distinct metrics in a project under 10,000. - -```python -import wandb - -with wandb.init() as run: - run.log( - { - "a": 1, # "a" is a distinct metric - "b": { - "c": "hello", # "b.c" is a distinct metric - "d": [1, 2, 3], # "b.d" is a distinct metric - }, - } - ) -``` - -{{% alert %}} -W&B automatically flattens nested values. This means that if you pass a dictionary, W&B turns it into a dot-separated name. For config values, W&B supports 3 dots in the name. For summary values, W&B supports 4 dots. -{{% /alert %}} - -Metric names must follow certain naming constraints imposed by GraphQL. See [Metric naming constraints]({{< relref "/guides/models/track/log/#metric-naming-constraints" >}}) for details. - - - -If your workspace suddenly slows down, check whether recent runs have unintentionally logged thousands of new metrics. (This is easiest to spot by seeing sections with thousands of plots that have only one or two runs visible on them.) If they have, consider deleting those runs and recreating them with the desired metrics. - -### Value width - -Limit the size of a single logged value to under 1 MB and the total size of a single `run.log` call to under 25 MB. This limit does not apply to `wandb.Media` types like `wandb.Image`, `wandb.Audio`, etc. - -```python -import wandb - -run = wandb.init(project="wide-values") - -# not recommended -run.log({"wide_key": range(10000000)}) - -# not recommended -with open("large_file.json", "r") as f: - large_data = json.load(f) - run.log(large_data) - -run.finish() -``` - -Wide values can affect the plot load times for all metrics in the run, not just the metric with the wide values. - -{{% alert %}} -Data is saved and tracked even if you log values wider than the recommended amount. However, your plots may load more slowly. -{{% /alert %}} - -### Metric frequency - -Pick a logging frequency that is appropriate to the metric you are logging. As a general rule of thumb, log wider values less frequently than narrower values. W&B recommends: - -- Scalars: <100,000 logged points per metric -- Media: <50,000 logged points per metric -- Histograms: <10,000 logged points per metric - -```python -import wandb - -with wandb.init(project="metric-frequency") as run: - # Not recommended - run.log( - { - "scalar": 1, # 100,000 scalars - "media": wandb.Image(...), # 100,000 images - "histogram": wandb.Histogram(...), # 100,000 histograms - } - ) - - # Recommended - run.log( - { - "scalar": 1, # 100,000 scalars - }, - commit=True, - ) # Commit batched, per-step metrics together - - run.log( - { - "media": wandb.Image(...), # 50,000 images - }, - commit=False, - ) - - run.log( - { - "histogram": wandb.Histogram(...), # 10,000 histograms - }, - commit=False, - ) -``` - - - -{{% alert %}} -W&B continues to accept your logged data but pages may load more slowly if you exceed guidelines. -{{% /alert %}} - -### Config size - -Limit the total size of your run config to less than 10 MB. Logging large values could slow down your project workspaces and runs table operations. - -```python -import wandb - -# Recommended -with wandb.init( - project="config-size", - config={ - "lr": 0.1, - "batch_size": 32, - "epochs": 4, - } -) as run: - # Your training code here - pass - -# Not recommended -with wandb.init( - project="config-size", - config={ - "large_list": list(range(10000000)), # Large list - "large_string": "a" * 10000000, # Large string - } -) as run: - # Your training code here - pass - -# Not recommended -with open("large_config.json", "r") as f: - large_config = json.load(f) - wandb.init(config=large_config) -``` - -## Workspace considerations - - -### Run count - -To reduce loading times, keep the total number of runs in a single project under: - -- 100,000 on SaaS Cloud -- 10,000 on Dedicated Cloud or Self-managed - -Run counts over these thresholds can slow down operations that involve project workspaces or runs tables, especially when grouping runs or collecting a large number of distinct metrics during runs. See also the [Metric count]({{< relref "#metric-count" >}}) section. - -If your team accesses the same set of runs frequently, such as the set of recent runs, consider [moving less frequently used runs in bulk]({{< relref "/guides/models/track/runs/manage-runs.md" >}}) to a new "archive" project, leaving a smaller set of runs in your working project. - -### Workspace performance -This section gives tips for optimizing the performance of your workspace. - -#### Panel count -By default, a workspace is _automatic_, and generates standard panels for each logged key. If a workspace for a large project includes panels for many logged keys, the workspace may be slow to load and use. To improve performance, you can: - -1. Reset the workspace to manual mode, which includes no panels by default. -1. Use [Quick add]({{< relref "/guides/models/app/features/panels/#quick-add" >}}) to selectively add panels for the logged keys you need to visualize. - -{{% alert %}} -Deleting unused panels one at a time has little impact on performance. Instead, reset the workspace and seletively add back only those panels you need. -{{% /alert %}} - -To learn more about configuring your workspace, refer to [Panels]({{< relref "/guides/models/app/features/panels/" >}}). - -#### Section count - -Having hundreds of sections in a workspace can hurt performance. Consider creating sections based on high-level groupings of metrics and avoiding an anti-pattern of one section for each metric. - -If you find you have too many sections and performance is slow, consider the workspace setting to create sections by prefix rather than suffix, which can result in fewer sections and better performance. - -{{< img src="/images/track/section_prefix_toggle.gif" alt="Toggling section creation" >}} - -### Metric count - -When logging between 5000 and 100,000 metrics per run, W&B recommends using a [manual workspace]({{< relref "/guides/models/app/features/panels/#workspace-modes" >}}). In Manual mode, you can easily add and remove panels in bulk as you choose to explore different sets of metrics. With a more focused set of plots, the workspace loads faster. Metrics that are not plotted are still collected and stored as usual. - -To reset a workspace to manual mode, click the workspace's action `...` menu, then click **Reset workspace**. Resetting a workspace has no impact on stored metrics for runs. See [workspace panel management]({{< relref "/guides/models/app/features/panels/" >}}). - -### File count - -Keep the total number of files uploaded for a single run under 1,000. You can use W&B Artifacts when you need to log a large number of files. Exceeding 1,000 files in a single run can slow down your run pages. - -### Reports vs. Workspaces - -A report is a free-form composition of arbitrary arrangements of panels, text, and media, allowing you to easily share your insights with colleagues. - -By contrast, a workspace allows high-density and performant analysis of dozens to thousands of metrics across hundreds to hundreds of thousands of runs. Workspaces have optimized caching, querying, and loading capabilities, when compared to reports. Workspaces are recommended for a project that is used primarily for analysis, rather than presentation, or when you need to show 20 or more plots together. - -## Python script performance - -There are a few ways that the performance of your python script is reduced: - -1. The size of your data is too large. Large data sizes could introduce a >1 ms overhead to the training loop. -2. The speed of your network and how the W&B backend is configured -3. If you call `wandb.Run.log()` more than a few times per second. This is due to a small latency added to the training loop every time `wandb.Run.log()` is called. - -{{% alert %}} -Is frequent logging slowing your training runs down? Check out [this Colab](https://wandb.me/log-hf-colab) for methods to get better performance by changing your logging strategy. -{{% /alert %}} - -W&B does not assert any limits beyond rate limiting. The W&B Python SDK automatically completes an exponential "backoff" and "retry" requests that exceed limits. W&B Python SDK responds with a “Network failure” on the command line. For unpaid accounts, W&B may reach out in extreme cases where usage exceeds reasonable thresholds. - -## Rate limits - -W&B SaaS Cloud API implements a rate limit to maintain system integrity and ensure availability. This measure prevents any single user from monopolizing available resources in the shared infrastructure, ensuring that the service remains accessible to all users. You may encounter a lower rate limit for a variety of reasons. - -{{% alert %}} -Rate limits are subject to change. -{{% /alert %}} - -If you encounter a rate limit, you receive a HTTP `429` `Rate limit exceeded` error and the response includes [rate limit HTTP headers]({{< relref "#rate-limit-http-headers" >}}). - -### Rate limit HTTP headers - -The preceding table describes rate limit HTTP headers: - -| Header name | Description | -| ------------------- | --------------------------------------------------------------------------------------- | -| RateLimit-Limit | The amount of quota available per time window, scaled in the range of 0 to 1000 | -| RateLimit-Remaining | The amount of quota in the current rate limit window, scaled in the range of 0 and 1000 | -| RateLimit-Reset | The number of seconds until the current quota resets | - -### Rate limits on metric logging API - -`wandb.Run.log()` logs your training data to W&B. This API is engaged through either online or [offline syncing]({{< relref "/ref/cli/wandb-sync.md" >}}). In either case, it imposes a rate limit quota limit in a rolling time window. This includes limits on total request size and request rate, where latter refers to the number of requests in a time duration. - -W&B applies rate limits per W&B project. So if you have 3 projects in a team, each project has its own rate limit quota. Users on [Paid plans](https://wandb.ai/site/pricing) have higher rate limits than Free plans. - -If you encounter a rate limit, you receive a HTTP `429` `Rate limit exceeded` error and the response includes [rate limit HTTP headers]({{< relref "#rate-limit-http-headers" >}}). - -### Suggestions for staying under the metrics logging API rate limit - -Exceeding the rate limit may delay `run.finish()` until the rate limit resets. To avoid this, consider the following strategies: - -- Update your W&B Python SDK version: Ensure you are using the latest version of the W&B Python SDK. The W&B Python SDK is regularly updated and includes enhanced mechanisms for gracefully retrying requests and optimizing quota usage. -- Reduce metric logging frequency: - Minimize the frequency of logging metrics to conserve your quota. For example, you can modify your code to log metrics every five epochs instead of every epoch: - -```python -import wandb -import random - -with wandb.init(project="basic-intro") as run: - for epoch in range(10): - # Simulate training and evaluation - accuracy = 1 - 2 ** -epoch - random.random() / epoch - loss = 2 ** -epoch + random.random() / epoch - - # Log metrics every 5 epochs - if epoch % 5 == 0: - run.log({"acc": accuracy, "loss": loss}) -``` - -- Manual data syncing: W&B store your run data locally if you are rate limited. You can manually sync your data with the command `wandb sync `. For more details, see the [`wandb sync`]({{< relref "/ref/cli/wandb-sync.md" >}}) reference. - -### Rate limits on GraphQL API - -The W&B Models UI and SDK’s [public API]({{< relref "/ref/python/public-api/api.md" >}}) make GraphQL requests to the server for querying and modifying data. For all GraphQL requests in SaaS Cloud, W&B applies rate limits per IP address for unauthorized requests and per user for authorized requests. The limit is based on request rate (request per second) within a fixed time window, where your pricing plan determines the default limits. For relevant SDK requests that specify a project path (for example, reports, runs, artifacts), W&B applies rate limits per project, measured by database query time. - -Users on [Teams and Enterprise plans](https://wandb.ai/site/pricing) receive higher rate limits than those on the Free plan. -When you hit the rate limit while using the W&B Models SDK's public API, you see a relevant message indicating the error in the standard output. - -If you encounter a rate limit, you receive a HTTP `429` `Rate limit exceeded` error and the response includes [rate limit HTTP headers]({{< relref "#rate-limit-http-headers" >}}). - -#### Suggestions for staying under the GraphQL API rate limit - -If you are fetching a large volume of data using the W&B Models SDK's [public API]({{< relref "/ref/python/public-api/api.md" >}}), consider waiting at least one second between requests. If you receive a HTTP `429` `Rate limit exceeded` error or see `RateLimit-Remaining=0` in the response headers, wait for the number of seconds specified in `RateLimit-Reset` before retrying. - -## Browser considerations - -The W&B app can be memory-intensive and performs best in Chrome. Depending on your computer's memory, having W&B active in 3+ tabs at once can cause performance to degrade. If you encounter unexpectedly slow performance, consider closing other tabs or applications. - -## Reporting performance issues to W&B - -W&B takes performance seriously and investigates every report of lag. To expedite investigation, when reporting slow loading times consider invoking W&B's built-in performance logger that captures key metrics and performance events. Append the URL parameter `&PERF_LOGGING` to a page that is loading slowly, then share the output of your console with your account team or Support. - -{{< img src="/images/track/adding_perf_logging.gif" alt="Adding PERF_LOGGING" >}} diff --git a/content/en/guides/models/track/log/_index.md b/content/en/guides/models/track/log/_index.md deleted file mode 100644 index 9189ddae0f..0000000000 --- a/content/en/guides/models/track/log/_index.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -description: Keep track of metrics, videos, custom plots, and more -menu: - default: - identifier: logging - parent: experiments -title: Logging -weight: 6 -url: guides/track/log -cascade: -- url: guides/track/log/:filename ---- - -Log a dictionary of metrics, media, or custom objects to a step with the W&B Python SDK. W&B collects the key-value pairs during each step and stores them in one unified dictionary each time you log data with `wandb.Run.log()`. Data logged from your script is saved locally to your machine in a directory called `wandb`, then synced to the W&B cloud or your [private server]({{< relref "/guides/hosting/" >}}). - -{{% alert %}} -Key-value pairs are stored in one unified dictionary only if you pass the same value for each step. W&B writes all of the collected keys and values to memory if you log a different value for `step`. -{{% /alert %}} - -Each call to `wandb.Run.log()` is a new `step` by default. W&B uses steps as the default x-axis when it creates charts and panels. You can optionally create and use a custom x-axis or capture a custom summary metric. For more information, see [Customize log axes]({{< relref "./customize-logging-axes.md" >}}). - - - - - - -{{% alert color="secondary" %}} -Use `wandb.Run.log()` to log consecutive values for each `step`: 0, 1, 2, and so on. It is not possible to write to a specific history step. W&B only writes to the "current" and "next" step. -{{% /alert %}} - - - - -## Automatically logged data - -W&B automatically logs the following information during a W&B Experiment: - - -* **System metrics**: CPU and GPU utilization, network, etc. For the GPU, these are fetched with [`nvidia-smi`](https://developer.nvidia.com/nvidia-system-management-interface). -* **Command line**: The stdout and stderr are picked up and show in the logs tab on the [run page.]({{< relref "/guides/models/track/runs/" >}}) - -Turn on [Code Saving](https://wandb.me/code-save-colab) in your account's [Settings page](https://wandb.ai/settings) to log: - -* **Git commit**: Pick up the latest git commit and see it on the overview tab of the run page, as well as a `diff.patch` file if there are any uncommitted changes. -* **Dependencies**: The `requirements.txt` file will be uploaded and shown on the files tab of the run page, along with any files you save to the `wandb` directory for the run. - - -## What data is logged with specific W&B API calls? - -With W&B, you can decide exactly what you want to log. The following lists some commonly logged objects: - -* **Datasets**: You have to specifically log images or other dataset samples for them to stream to W&B. -* **Plots**: Use `wandb.plot()` with `wandb.Run.log()` to track charts. See [Log Plots]({{< relref "./plots.md" >}}) for more information. -* **Tables**: Use `wandb.Table` to log data to visualize and query with W&B. See [Log Tables]({{< relref "./log-tables.md" >}}) for more information. -* **PyTorch gradients**: Add `wandb.Run.watch(model)` to see gradients of the weights as histograms in the UI. -* **Configuration information**: Log hyperparameters, a link to your dataset, or the name of the architecture you're using as config parameters, passed in like this: `wandb.init(config=your_config_dictionary)`. See the [PyTorch Integrations]({{< relref "/guides/integrations/pytorch.md" >}}) page for more information. -* **Metrics**: Use `wandb.Run.log()` to see metrics from your model. If you log metrics like accuracy and loss from inside your training loop, you'll get live updating graphs in the UI. - - - -## Metric naming constraints - -Due to GraphQL limitations, metric names in W&B must follow specific naming rules: - -{{< readfile file="/_includes/metric-naming-rules.md" >}} - -{{% alert color="warning" %}} -Avoid naming metrics with invalid characters (such as commas, spaces, or special symbols), which may cause problems with sorting, querying, or display in the W&B UI. -{{% /alert %}} - -{{< readfile file="/_includes/metric-naming-examples.md" >}} - -## Common workflows - -1. **Compare the best accuracy**: To compare the best value of a metric across runs, set the summary value for that metric. By default, summary is set to the last value you logged for each key. This is useful in the table in the UI, where you can sort and filter runs based on their summary metrics, to help compare runs in a table or bar chart based on their _best_ accuracy, instead of final accuracy. For example: `wandb.run.summary["best_accuracy"] = best_accuracy` - -2. **View multiple metrics on one chart**: Log multiple metrics in the same call. For example: - ```python - with wandb.init() as run: - run.log({"acc": 0.9, "loss": 0.1}) - ``` - You can then plot both metrics in the UI. -3. **Customize the x-axis**: Add a custom x-axis to the same log call to visualize your metrics against a different axis in the W&B dashboard. For example: - ```python - with wandb.init() as run: - run.log({'acc': 0.9, 'epoch': 3, 'batch': 117}) - ``` - To set the default x-axis for a given metric use [Run.define_metric()]({{< relref "/ref/python/experiments/run.md#define_metric" >}}). - -4. **Log rich media and charts**: `wandb.Run.log()` supports the logging of a wide variety of data types, from [media like images and videos]({{< relref "./media.md" >}}) to [tables]({{< relref "./log-tables.md" >}}) and [charts]({{< relref "/guides/models/app/features/custom-charts/" >}}). - -## Best practices and tips - -For best practices and tips for Experiments and logging, see [Best Practices: Experiments and Logging](https://wandb.ai/wandb/pytorch-lightning-e2e/reports/W-B-Best-Practices-Guide--VmlldzozNTU1ODY1#w&b-experiments-and-logging). diff --git a/content/en/guides/models/track/log/customize-logging-axes.md b/content/en/guides/models/track/log/customize-logging-axes.md deleted file mode 100644 index cd2b915363..0000000000 --- a/content/en/guides/models/track/log/customize-logging-axes.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -menu: - default: - identifier: customize-logging-axes - parent: logging -title: Customize log axes ---- - -Set a custom x-axis when you log metrics to W&B. By default, W&B logs metrics as *steps*. Each step corresponds to a `wandb.Run.log()` API call. - -For example, the following script has a `for` loop that iterates 10 times. In each iteration, the script logs a metric called `validation_loss` and increments the step number by 1. - -```python -import wandb - -with wandb.init() as run: - # range function creates a sequence of numbers from 0 to 9 - for i in range(10): - log_dict = { - "validation_loss": 1/(i+1) - } - run.log(log_dict) -``` - -In the project's workspace, the `validation_loss` metric is plotted against the `step` x-axis, which increments by 1 each time `wandb.Run.log()` is called. From the previous code, the x-axis shows the step numbers 0, 1, 2, ..., 9. - -{{< img src="/images/experiments/standard_axes.png" alt="Line plot panel that uses `step` as the x-axis." >}} - -In certain situations, it makes more sense to log metrics against a different x-axis such as a logarithmic x-axis. Use the [`define_metric()`]({{< relref "/ref/python/experiments/run/#define_metric" >}}) method to use any metric you log as a custom x-axis. - -Specify the metric that you want to appear as the y-axis with the `name` parameter. The `step_metric` parameter specifies the metric you want to use as the x-axis. When you log a custom metric, specify a value for both the x-axis and the y-axis as key-value pairs in a dictionary. - -Copy and paste the following code snippet to set a custom x-axis metric. Replace the values within `<>` with your own values: - -```python -import wandb - -custom_step = "" # Name of custom x-axis -metric_name = "" # Name of y-axis metric - -with wandb.init() as run: - # Specify the step metric (x-axis) and the metric to log against it (y-axis) - run.define_metric(step_metric = custom_step, name = metric_name) - - for i in range(10): - log_dict = { - custom_step : int, # Value of x-axis - metric_name : int, # Value of y-axis - } - run.log(log_dict) -``` - -As an example, the following code snippet creates a custom x-axis called `x_axis_squared`. The value of the custom x-axis is the square of the for loop index `i` (`i**2`). The y-axis consists of mock values for validation loss (`"validation_loss"`) using Python's built-in `random` module: - -```python -import wandb -import random - -with wandb.init() as run: - run.define_metric(step_metric = "x_axis_squared", name = "validation_loss") - - for i in range(10): - log_dict = { - "x_axis_squared": i**2, - "validation_loss": random.random(), - } - run.log(log_dict) -``` - -The following image shows the resulting plot in the W&B App UI. The `validation_loss` metric is plotted against the custom x-axis `x_axis_squared`, which is the square of the for loop index `i`. Note that the x-axis values are `0, 1, 4, 9, 16, 25, 36, 49, 64, 81`, which correspond to the squares of `0, 1, 2, ..., 9` respectively. - -{{< img src="/images/experiments/custom_x_axes.png" alt="Line plot panel that uses a custom x axis. Values are logged to W&B as the square of the loop number." >}} - -You can set a custom x-axis for multiple metrics using `globs` with string prefixes. As an example, the following code snippet plots logged metrics with the prefix `train/*` to the x-axis `train/step`: - -```python -import wandb - -with wandb.init() as run: - - # set all other train/ metrics to use this step - run.define_metric("train/*", step_metric="train/step") - - for i in range(10): - log_dict = { - "train/step": 2**i, # exponential growth w/ internal W&B step - "train/loss": 1 / (i + 1), # x-axis is train/step - "train/accuracy": 1 - (1 / (1 + i)), # x-axis is train/step - "val/loss": 1 / (1 + i), # x-axis is internal wandb step - } - run.log(log_dict) -``` - - - \ No newline at end of file diff --git a/content/en/guides/models/track/log/distributed-training.md b/content/en/guides/models/track/log/distributed-training.md deleted file mode 100644 index 9e0b14b12d..0000000000 --- a/content/en/guides/models/track/log/distributed-training.md +++ /dev/null @@ -1,325 +0,0 @@ ---- -description: Use W&B to log distributed training experiments with multiple GPUs. -menu: - default: - identifier: distributed-training - parent: logging -title: Log distributed training experiments ---- - -During a distributed training experiment, you train a model using multiple machines or clients in parallel. W&B can help you track distributed training experiments. Based on your use case, track distributed training experiments using one of the following approaches: - -* **Track a single process**: Track a rank 0 process (also known as a "leader" or "coordinator") with W&B. This is a common solution for logging distributed training experiments with the [PyTorch Distributed Data Parallel](https://pytorch.org/docs/stable/generated/torch.nn.parallel.DistributedDataParallel.html#torch.nn.parallel.DistributedDataParallel) (DDP) Class. -* **Track multiple processes**: For multiple processes, you can either: - * Track each process separately using one run per process. You can optionally group them together in the W&B App UI. - * Track all processes to a single run. - - - -## Track a single process - -This section describes how to track values and metrics available to your rank 0 process. Use this approach to track only metrics that are available from a single process. Typical metrics include GPU/CPU utilization, behavior on a shared validation set, gradients and parameters, and loss values on representative data examples. - -Within the rank 0 process, initialize a W&B run with [`wandb.init()`]({{< relref "/ref/python/functions/init" >}}) and log experiments ([`wandb.log`]({{< relref "/ref/python/experiments/run/#method-runlog" >}})) to that run. - -The following [sample Python script (`log-ddp.py`)](https://github.com/wandb/examples/blob/master/examples/pytorch/pytorch-ddp/log-ddp.py) demonstrates one way to track metrics on two GPUs on a single machine using PyTorch DDP. [PyTorch DDP](https://pytorch.org/tutorials/intermediate/ddp_tutorial.html) (`DistributedDataParallel` in`torch.nn`) is a popular library for distributed training. The basic principles apply to any distributed training setup, but the implementation may differ. - -The Python script: -1. Starts multiple processes with `torch.distributed.launch`. -1. Checks the rank with the `--local_rank` command line argument. -1. If the rank is set to 0, sets up `wandb` logging conditionally in the [`train()`](https://github.com/wandb/examples/blob/master/examples/pytorch/pytorch-ddp/log-ddp.py#L24) function. - -```python -if __name__ == "__main__": - # Get args - args = parse_args() - - if args.local_rank == 0: # only on main process - # Initialize wandb run - run = wandb.init( - entity=args.entity, - project=args.project, - ) - # Train model with DDP - train(args, run) - else: - train(args) -``` - -Explore an [example dashboard showing metrics tracked from a single process](https://wandb.ai/ayush-thakur/DDP/runs/1s56u3hc/system). - -The dashboard displays system metrics for both GPUs, such as temperature and utilization. - -{{< img src="/images/track/distributed_training_method1.png" alt="GPU metrics dashboard" >}} - -However, the loss values as a function epoch and batch size were only logged from a single GPU. - -{{< img src="/images/experiments/loss_function_single_gpu.png" alt="Loss function plots" >}} - -## Track multiple processes - -Track multiple processes with W&B with one of the following approaches: -* [Tracking each process separately]({{< relref "distributed-training/#track-each-process-separately" >}}) by creating a run for each process. -* [Tracking all processes to a single run]({{< relref "distributed-training/#track-all-processes-to-a-single-run" >}}). - -### Track each process separately - -This section describes how to track each process separately by creating a run for each process. Within each run you log metrics, artifacts, and forth to their respective run. Call `wandb.Run.finish()` at the end of training, to mark that the run has completed so that all processes exit properly. - -You might find it difficult to keep track of runs across multiple experiments. To mitigate this, provide a value to the `group` parameter when you initialize W&B (`wandb.init(group='group-name')`) to keep track of which run belongs to a given experiment. For more information about how to keep track of training and evaluation W&B Runs in experiments, see [Group Runs]({{< relref "/guides/models/track/runs/grouping.md" >}}). - -{{% alert %}} -**Use this approach if you want to track metrics from individual processes**. Typical examples include the data and predictions on each node (for debugging data distribution) and metrics on individual batches outside of the main node. This approach is not necessary to get system metrics from all nodes nor to get summary statistics available on the main node. -{{% /alert %}} - -The following Python code snippet demonstrates how to set the group parameter when you initialize W&B: - -```python -if __name__ == "__main__": - # Get args - args = parse_args() - # Initialize run - run = wandb.init( - entity=args.entity, - project=args.project, - group="DDP", # all runs for the experiment in one group - ) - # Train model with DDP - train(args, run) - - run.finish() # mark the run as finished -``` - -Explore the W&B App UI to view an [example dashboard](https://wandb.ai/ayush-thakur/DDP?workspace=user-noahluna) of metrics tracked from multiple processes. Note that there are two W&B Runs grouped together in the left sidebar. Click on a group to view the dedicated group page for the experiment. The dedicated group page displays metrics from each process separately. - -{{< img src="/images/experiments/dashboard_grouped_runs.png" alt="Grouped distributed runs" >}} - -The preceding image demonstrates the W&B App UI dashboard. On the sidebar we see two experiments. One labeled 'null' and a second (bound by a yellow box) called 'DPP'. If you expand the group (select the Group dropdown) you will see the W&B Runs that are associated to that experiment. - -### Organize distributed runs - -Set the `job_type` parameter when you initialize W&B (`wandb.init(job_type='type-name')`) to categorize your nodes based on their function. For example, you might have a main coordinating node and several reporting worker nodes. You can set `job_type` to `main` for the main coordinating node and `worker` for the reporting worker nodes: - - ```python - # Main coordinating node - with wandb.init(project="", job_type="main", group="experiment_1") as run: - # Training code - - # Reporting worker nodes - with wandb.init(project="", job_type="worker", group="experiment_1") as run: - # Training code - ``` - -Once you have set the `job_type` for your nodes, you can create [saved views]({{< relref "/guides/models/track/workspaces/#create-a-new-saved-workspace-view" >}}) in your workspace to organize your runs. Click the **...** action menu at the top right and click **Save as new view**. - -For example, you could create the following saved views: - - - **Default view**: Filter out worker nodes to reduce noise - - Click **Filter**, then set **Job Type** to `worker`. - - Shows only your reporting nodes - - - **Debug view**: Focus on worker nodes for troubleshooting - - Click **Filter**, then set **Job Type** `==` `worker` and set **State** to `IN` `crashed`. - - Shows only worker nodes that have crashed or are in error states - - - **All nodes view**: See everything together - - No filter - - Useful for comprehensive monitoring - -To open a saved view, click **Workspaces** in the sidebar, then click the menu. Workspaces appear at the top of the list and saved views appear at the bottom. - -### Track all processes to a single run - -{{% alert color="secondary" %}} -Parameters prefixed by `x_` (such as `x_label`) are in public preview. Create a [GitHub issue in the W&B repository](https://github.com/wandb/wandb) to provide feedback. -{{% /alert %}} - -{{% alert title="Requirements" %}} -To track multiple processes to a single run, you must have: -- W&B Python SDK version `v0.19.9` or newer. - -- W&B Server v0.68 or newer. -{{% /alert %}} - -In this approach you use a primary node and one or more worker nodes. Within the primary node you initialize a W&B run. For each worker node, initialize a run using the run ID used by the primary node. During training each worker node logs to the same run ID as the primary node. W&B aggregates metrics from all nodes and displays them in the W&B App UI. - -Within the primary node, initialize a W&B run with [`wandb.init()`]({{< relref "/ref/python/functions/init" >}}). Pass in a `wandb.Settings` object to the `settings` parameter (`wandb.init(settings=wandb.Settings()`) with the following: - -1. The `mode` parameter set to `"shared"` to enable shared mode. -2. A unique label for [`x_label`](https://github.com/wandb/wandb/blob/main/wandb/sdk/wandb_settings.py#L638). You use the value you specify for `x_label` to identify which node the data is coming from in logs and system metrics in the W&B App UI. If left unspecified, W&B creates a label for you using the hostname and a random hash. -3. Set the [`x_primary`](https://github.com/wandb/wandb/blob/main/wandb/sdk/wandb_settings.py#L660) parameter to `True` to indicate that this is the primary node. -4. Optionally provide a list of GPU indexes ([0,1,2]) to `x_stats_gpu_device_ids` to specify which GPUs W&B tracks metrics for. If you do not provide a list, W&B tracks metrics for all GPUs on the machine. - -Make note of the run ID of the primary node. Each worker node needs the run ID of the primary node. - -{{% alert %}} -`x_primary=True` distinguishes a primary node from worker nodes. Primary nodes are the only nodes that upload files shared across nodes such as configuration files, telemetry and more. Worker nodes do not upload these files. -{{% /alert %}} - -For each worker node, initialize a W&B run with [`wandb.init()`]({{< relref "/ref/python/functions/init" >}}) and provide the following: -1. A `wandb.Settings` object to the `settings` parameter (`wandb.init(settings=wandb.Settings()`) with: - * The `mode` parameter set to `"shared"` to enable shared mode. - * A unique label for `x_label`. You use the value you specify for `x_label` to identify which node the data is coming from in logs and system metrics in the W&B App UI. If left unspecified, W&B creates a label for you using the hostname and a random hash. - * Set the `x_primary` parameter to `False` to indicate that this is a worker node. -2. Pass the run ID used by the primary node to the `id` parameter. -3. Optionally set [`x_update_finish_state`](https://github.com/wandb/wandb/blob/main/wandb/sdk/wandb_settings.py#L772) to `False`. This prevents non-primary nodes from updating the [run's state]({{< relref "/guides/models/track/runs/#run-states" >}}) to `finished` prematurely, ensuring the run state remains consistent and managed by the primary node. - -{{% alert %}} -* Use the same entity and project for all nodes. This helps ensure the correct run ID is found. -* Consider defining an environment variable on each worker node to set the run ID of the primary node. -{{% /alert %}} - -The following sample code demonstrates the high level requirements for tracking multiple processes to a single run: - -```python -import wandb - -entity = "" -project = "" - -# Initialize a run in the primary node -run = wandb.init( - entity=entity, - project=project, - settings=wandb.Settings( - x_label="rank_0", - mode="shared", - x_primary=True, - x_stats_gpu_device_ids=[0, 1], # (Optional) Only track metrics for GPU 0 and 1 - ) -) - -# Note the run ID of the primary node. -# Each worker node needs this run ID. -run_id = run.id - -# Initialize a run in a worker node using the run ID of the primary node -run = wandb.init( - entity=entity, # Use the same entity as the primary node - project=project, # Use the same project as the primary node - settings=wandb.Settings(x_label="rank_1", mode="shared", x_primary=False), - id=run_id, -) - -# Initialize a run in a worker node using the run ID of the primary node -run = wandb.init( - entity=entity, # Use the same entity as the primary node - project=project, # Use the same project as the primary node - settings=wandb.Settings(x_label="rank_2", mode="shared", x_primary=False), - id=run_id, -) -``` - -In a real world example, each worker node might be on a separate machine. - -{{% alert %}} -See the [Distributed Training with Shared Mode](https://wandb.ai/dimaduev/simple-cnn-ddp/reports/Distributed-Training-with-Shared-Mode--VmlldzoxMTI0NTE1NA) report for an end-to-end example on how to train a model on a multi-node and multi-GPU Kubernetes cluster in GKE. -{{% /alert %}} - -View console logs from multi node processes in the project that the run logs to: - -1. Navigate to the project that contains the run. -2. Click on the **Runs** tab in the left sidebar. -3. Click on the run you want to view. -4. Click on the **Logs** tab in the left sidebar. - -You can filter console logs based on the labels you provide for `x_label` in the UI search bar located at the top of the console log page. For example, the following image shows which options are available to filter the console log by if values `rank0`, `rank1`, `rank2`, `rank3`, `rank4`, `rank5`, and `rank6` are provided to `x_label`.` - -{{< img src="/images/track/multi_node_console_logs.png" alt="Multi-node console logs" >}} - -See [Console logs]({{< relref "/guides/models/app/console-logs/" >}}) for more information. - -W&B aggregates system metrics from all nodes and displays them in the W&B App UI. For example, the following image shows a sample dashboard with system metrics from multiple nodes. Each node possesses a unique label (`rank_0`, `rank_1`, `rank_2`) that you specify in the `x_label` parameter. - -{{< img src="/images/track/multi_node_system_metrics.png" alt="Multi-node system metrics" >}} - -See [Line plots]({{< relref "/guides/models/app/features/panels/line-plot/" >}}) for information on how to customize line plot panels. - -## Example use cases - -The following code snippets demonstrate common scenarios for advanced distributed use cases. - -### Spawn process - -Use the `wandb.setup()`method in your main function if you initiate a run in a spawned process: - -```python -import multiprocessing as mp - -def do_work(n): - with wandb.init(config=dict(n=n)) as run: - run.log(dict(this=n * n)) - -def main(): - wandb.setup() - pool = mp.Pool(processes=4) - pool.map(do_work, range(4)) - - -if __name__ == "__main__": - main() -``` - -### Share a run - -Pass a run object as an argument to share runs between processes: - -```python -def do_work(run): - with wandb.init() as run: - run.log(dict(this=1)) - -def main(): - run = wandb.init() - p = mp.Process(target=do_work, kwargs=dict(run=run)) - p.start() - p.join() - run.finish() # mark the run as finished - - -if __name__ == "__main__": - main() -``` - -W&B can not guarantee the logging order. Synchronization should be done by the author of the script. - - -## Troubleshooting - -There are two common issues you might encounter when using W&B and distributed training: - -1. **Hanging at the beginning of training** - A `wandb` process can hang if the `wandb` multiprocessing interferes with the multiprocessing from distributed training. -2. **Hanging at the end of training** - A training job might hang if the `wandb` process does not know when it needs to exit. Call the `wandb.Run.finish()` API at the end of your Python script to tell W&B that the run finished. The `wandb.Run.finish()` API will finish uploading data and will cause W&B to exit. -W&B recommends using `wandb service` command to improve the reliability of your distributed jobs. Both of the preceding training issues are commonly found in versions of the W&B SDK where wandb service is unavailable. - -### Enable W&B Service - -Depending on your version of the W&B SDK, you might already have W&B Service enabled by default. - -#### W&B SDK 0.13.0 and above - -W&B Service is enabled by default for versions of the W&B SDK `0.13.0` and above. - -#### W&B SDK 0.12.5 and above - -Modify your Python script to enable W&B Service for W&B SDK version 0.12.5 and above. Use the `wandb.require` method and pass the string `"service"` within your main function: - -```python -if __name__ == "__main__": - main() - - -def main(): - wandb.require("service") - # rest-of-your-script-goes-here -``` - -For optimal experience we do recommend you upgrade to the latest version. - -**W&B SDK 0.12.4 and below** - -Set the `WANDB_START_METHOD` environment variable to `"thread"` to use multithreading instead if you use a W&B SDK version 0.12.4 and below. diff --git a/content/en/guides/models/track/log/log-models.md b/content/en/guides/models/track/log/log-models.md deleted file mode 100644 index 766b076792..0000000000 --- a/content/en/guides/models/track/log/log-models.md +++ /dev/null @@ -1,213 +0,0 @@ ---- -menu: - default: - identifier: log-models - parent: logging -title: Log models ---- - -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/ken-add-new-model-reg-api/colabs/wandb-model-registry/New_Model_Logging_in_W&B.ipynb" >}} -# Log models - -The following guide describes how to log models to a W&B run and interact with them. - -{{% alert %}} -The following APIs are useful for tracking models as a part of your experiment tracking workflow. Use the APIs listed on this page to log models to a run, and to access metrics, tables, media, and other objects. - -W&B suggests that you use [W&B Artifacts]({{< relref "/guides/core/artifacts/" >}}) if you want to: -- Create and keep track of different versions of serialized data besides models, such as datasets, prompts, and more. -- Explore [lineage graphs]({{< relref "/guides/core/artifacts/explore-and-traverse-an-artifact-graph.md" >}}) of a model or any other objects tracked in W&B. -- Interact with the model artifacts these methods created, such as [updating properties]({{< relref "/guides/core/artifacts/update-an-artifact.md" >}}) (metadata, aliases, and descriptions) - -For more information on W&B Artifacts and advanced versioning use cases, see the [Artifacts]({{< relref "/guides/core/artifacts/" >}}) documentation. -{{% /alert %}} - -## Log a model to a run -Use the [`log_model`]({{< relref "/ref/python/experiments/run.md#log_model" >}}) to log a model artifact that contains content within a directory you specify. The [`log_model`]({{< relref "/ref/python/experiments/run.md#log_model" >}}) method also marks the resulting model artifact as an output of the W&B run. - -You can track a model's dependencies and the model's associations if you mark the model as the input or output of a W&B run. View the lineage of the model within the W&B App UI. See the [Explore and traverse artifact graphs]({{< relref "/guides/core/artifacts/explore-and-traverse-an-artifact-graph.md" >}}) page within the [Artifacts]({{< relref "/guides/core/artifacts/" >}}) chapter for more information. - -Provide the path where your model files are saved to the `path` parameter. The path can be a local file, directory, or [reference URI]({{< relref "/guides/core/artifacts/track-external-files.md#amazon-s3--gcs--azure-blob-storage-references" >}}) to an external bucket such as `s3://bucket/path`. - -Ensure to replace values enclosed in `<>` with your own. - -```python -import wandb - -# Initialize a W&B run -run = wandb.init(project="", entity="") - -# Log the model -run.log_model(path="", name="") -``` - -Optionally provide a name for the model artifact for the `name` parameter. If `name` is not specified, W&B will use the basename of the input path prepended with the run ID as the name. - -{{% alert %}} -Keep track of the `name` that you, or W&B assigns, to the model. You will need the name of the model to retrieve the model path with the [`use_model`]({{< relref "/ref/python/experiments/run.md#use_model" >}}) method. -{{% /alert %}} - -See [`log_model`]({{< relref "/ref/python/experiments/run.md#log_model" >}}) in the API Reference for parameters. - -
- -Example: Log a model to a run - -```python -import os -import wandb -from tensorflow import keras -from tensorflow.keras import layers - -config = {"optimizer": "adam", "loss": "categorical_crossentropy"} - -# Initialize a W&B run -run = wandb.init(entity="charlie", project="mnist-experiments", config=config) - -# Hyperparameters -loss = run.config["loss"] -optimizer = run.config["optimizer"] -metrics = ["accuracy"] -num_classes = 10 -input_shape = (28, 28, 1) - -# Training algorithm -model = keras.Sequential( - [ - layers.Input(shape=input_shape), - layers.Conv2D(32, kernel_size=(3, 3), activation="relu"), - layers.MaxPooling2D(pool_size=(2, 2)), - layers.Conv2D(64, kernel_size=(3, 3), activation="relu"), - layers.MaxPooling2D(pool_size=(2, 2)), - layers.Flatten(), - layers.Dropout(0.5), - layers.Dense(num_classes, activation="softmax"), - ] -) - -# Configure the model for training -model.compile(loss=loss, optimizer=optimizer, metrics=metrics) - -# Save model -model_filename = "model.h5" -local_filepath = "./" -full_path = os.path.join(local_filepath, model_filename) -model.save(filepath=full_path) - -# Log the model to the W&B run -run.log_model(path=full_path, name="MNIST") -run.finish() -``` - -When the user called `log_model`, a model artifact named `MNIST` was created and the file `model.h5` was added to the model artifact. Your terminal or notebook will print information of where to find information about the run the model was logged to. - -```python -View run different-surf-5 at: https://wandb.ai/charlie/mnist-experiments/runs/wlby6fuw -Synced 5 W&B file(s), 0 media file(s), 1 artifact file(s) and 0 other file(s) -Find logs at: ./wandb/run-20231206_103511-wlby6fuw/logs -``` - -
- - -## Download and use a logged model -Use the [`use_model`]({{< relref "/ref/python/experiments/run.md#use_model" >}}) function to access and download models files previously logged to a W&B run. - -Provide the name of the model artifact where the model files you are want to retrieve are stored. The name you provide must match the name of an existing logged model artifact. - -If you did not define `name` when originally logged the files with `log_model`, the default name assigned is the basename of the input path, prepended with the run ID. - -Ensure to replace other the values enclosed in `<>` with your own: - -```python -import wandb - -# Initialize a run -run = wandb.init(project="", entity="") - -# Access and download model. Returns path to downloaded artifact -downloaded_model_path = run.use_model(name="") -``` - -The [use_model]({{< relref "/ref/python/experiments/run.md#use_model" >}}) function returns the path of downloaded model files. Keep track of this path if you want to link this model later. In the preceding code snippet, the returned path is stored in a variable called `downloaded_model_path`. - -
- -Example: Download and use a logged model - -For example, in the proceeding code snippet a user called the `use_model` API. They specified the name of the model artifact they want to fetch and they also provided a version/alias. They then stored the path that is returned from the API to the `downloaded_model_path` variable. - -```python -import wandb - -entity = "luka" -project = "NLP_Experiments" -alias = "latest" # semantic nickname or identifier for the model version -model_artifact_name = "fine-tuned-model" - -# Initialize a run -run = wandb.init(project=project, entity=entity) -# Access and download model. Returns path to downloaded artifact -downloaded_model_path = run.use_model(name = f"{model_artifact_name}:{alias}") -``` -
- -See [`use_model`]({{< relref "/ref/python/experiments/run.md#use_model" >}}) in the API Reference for parameters and return type. - -## Log and link a model to the W&B Model Registry - -{{% alert %}} -The [`link_model`]({{< relref "/ref/python/experiments/run.md#link_model" >}}) method is currently only compatible with the legacy W&B Model Registry, which will soon be deprecated. To learn how to link a model artifact to the new edition of model registry, visit the [Registry linking guide]({{< relref "/guides/core/registry/link_version.md" >}}). -{{% /alert %}} - -Use the [`link_model`]({{< relref "/ref/python/experiments/run.md#link_model" >}}) method to log model files to a W&B Run and link it to the [W&B Model Registry]({{< relref "/guides/core/registry/model_registry/" >}}). If no registered model exists, W&B will create a new one for you with the name you provide for the `registered_model_name` parameter. - -Linking a model is analogous to 'bookmarking' or 'publishing' a model to a centralized team repository of models that others members of your team can view and consume. - -When you link a model, that model is not duplicated in the [Registry]({{< relref "/guides/core/registry/model_registry/" >}}) or moved out of the project and into the registry. A linked model is a pointer to the original model in your project. - -Use the [Registry]({{< relref "/guides/core/registry/" >}}) to organize your best models by task, manage model lifecycle, facilitate easy tracking and auditing throughout the ML lifecyle, and [automate]({{< relref "/guides/core/automations/" >}}) downstream actions with webhooks or jobs. - -A *Registered Model* is a collection or folder of linked model versions in the [Model Registry]({{< relref "/guides/core/registry/model_registry/" >}}). Registered models typically represent candidate models for a single modeling use case or task. - -The proceeding code snippet shows how to link a model with the [`link_model`]({{< relref "/ref/python/experiments/run.md#link_model" >}}) API. Ensure to replace other the values enclosed in `<>` with your own: - -```python -import wandb - -run = wandb.init(entity="", project="") -run.link_model(path="", registered_model_name="") -run.finish() -``` - -See [`link_model`]({{< relref "/ref/python/experiments/run.md#link_model" >}}) in the API Reference guide for optional parameters. - -If the `registered-model-name` matches the name of a registered model that already exists within the Model Registry, the model will be linked to that registered model. If no such registered model exists, a new one will be created and the model will be the first one linked. - -For example, suppose you have an existing registered model named "Fine-Tuned-Review-Autocompletion" in your Model Registry (see example [here](https://wandb.ai/reviewco/registry/model?selectionPath=reviewco%2Fmodel-registry%2FFinetuned-Review-Autocompletion&view=all-models)). And suppose that a few model versions are already linked to it: v0, v1, v2. If you call `link_model` with `registered-model-name="Fine-Tuned-Review-Autocompletion"`, the new model will be linked to this existing registered model as v3. If no registered model with this name exists, a new one will be created and the new model will be linked as v0. - - -
- -Example: Log and link a model to the W&B Model Registry - -For example, the proceeding code snippet logs model files and links the model to a registered model name `"Fine-Tuned-Review-Autocompletion"`. - -To do this, a user calls the `link_model` API. When they call the API, they provide a local filepath that points the content of the model (`path`) and they provide a name for the registered model to link it to (`registered_model_name`). - -```python -import wandb - -path = "/local/dir/model.pt" -registered_model_name = "Fine-Tuned-Review-Autocompletion" - -run = wandb.init(project="llm-evaluation", entity="noa") -run.link_model(path=path, registered_model_name=registered_model_name) -run.finish() -``` - -{{% alert %}} -Reminder: A registered model houses a collection of bookmarked model versions. -{{% /alert %}} - -
\ No newline at end of file diff --git a/content/en/guides/models/track/log/log-summary.md b/content/en/guides/models/track/log/log-summary.md deleted file mode 100644 index 7f380c1422..0000000000 --- a/content/en/guides/models/track/log/log-summary.md +++ /dev/null @@ -1,154 +0,0 @@ ---- -menu: - default: - identifier: log-summary - parent: logging -title: Log summary metrics ---- - -In addition to values that change over time during training, it is often important to track a single value that summarizes a model or a preprocessing step. Log this information in a W&B Run's `summary` dictionary. A Run's summary dictionary can handle numpy arrays, PyTorch tensors or TensorFlow tensors. When a value is one of these types we persist the entire tensor in a binary file and store high level metrics in the summary object, such as min, mean, variance, percentiles, and more. - -The last value logged with `wandb.Run.log()` is automatically set as the summary dictionary in a W&B Run. If a summary metric dictionary is modified, the previous value is lost. - -The following code snippet demonstrates how to provide a custom summary metric to W&B: - -```python -import wandb -import argparse - -with wandb.init(config=args) as run: - best_accuracy = 0 - for epoch in range(1, args.epochs + 1): - test_loss, test_accuracy = test() - if test_accuracy > best_accuracy: - run.summary["best_accuracy"] = test_accuracy - best_accuracy = test_accuracy -``` - -You can update the summary attribute of an existing W&B Run after training has completed. Use the [W&B Public API]({{< relref "/ref/python/public-api/" >}}) to update the summary attribute: - -```python -api = wandb.Api() -run = api.run("username/project/run_id") -run.summary["tensor"] = np.random.random(1000) -run.summary.update() -``` - -## Customize summary metrics - -Custom summary metrics are useful for capturing model performance at the best step of training in your `run.summary`. For example, you might want to capture the maximum accuracy or the minimum loss value, instead of the final value. - -By default, the summary uses the final value from history. To customize summary metrics, pass the `summary` argument in `define_metric`. It accepts the following values: - -* `"min"` -* `"max"` -* `"mean"` -* `"best"` -* `"last"` -* `"none"` - -You can use `"best"` only when you also set the optional `objective` argument to `"minimize"` or `"maximize"`. - -The following example adds the min and max values of loss and accuracy to the summary: - -```python -import wandb -import random - -random.seed(1) - -with wandb.init() as run: - # Min and max summary values for loss - run.define_metric("loss", summary="min") - run.define_metric("loss", summary="max") - - # Min and max summary values for accuracy - run.define_metric("acc", summary="min") - run.define_metric("acc", summary="max") - - for i in range(10): - log_dict = { - "loss": random.uniform(0, 1 / (i + 1)), - "acc": random.uniform(1 / (i + 1), 1), - } - run.log(log_dict) -``` - -## View summary metrics - -View summary values in a run's **Overview** page or the project's runs table. - -{{< tabpane text=true >}} -{{% tab header="Run Overview" value="overview" %}} - -1. Navigate to the W&B App. -2. Select the **Workspace** tab. -3. From the list of runs, click the name of the run that logged the summary values. -4. Select the **Overview** tab. -5. View the summary values in the **Summary** section. - -{{< img src="/images/track/customize_summary.png" alt="Run overview" >}} - -{{% /tab %}} -{{% tab header="Run Table" value="run table" %}} - -1. Navigate to the W&B App. -2. Select the **Runs** tab. -3. Within the runs table, you can view the summary values within the columns based on the name of the summary value. - -{{% /tab %}} - -{{% tab header="W&B Public API" value="api" %}} - -You can use the W&B Public API to fetch the summary values of a run. - -The following code example demonstrates one way to retrieve the summary values logged to a specific run using the W&B Public API and pandas: - -```python -import wandb -import pandas - -entity = "" -project = "" -run_name = "" # Name of run with summary values - -all_runs = [] - -for run in api.runs(f"{entity}/{project_name}"): - print("Fetching details for run: ", run.id, run.name) - run_data = { - "id": run.id, - "name": run.name, - "url": run.url, - "state": run.state, - "tags": run.tags, - "config": run.config, - "created_at": run.created_at, - "system_metrics": run.system_metrics, - "summary": run.summary, - "project": run.project, - "entity": run.entity, - "user": run.user, - "path": run.path, - "notes": run.notes, - "read_only": run.read_only, - "history_keys": run.history_keys, - "metadata": run.metadata, - } - all_runs.append(run_data) - -# Convert to DataFrame -df = pd.DataFrame(all_runs) - -# Get row based on the column name (run) and convert to dictionary -df[df['name']==run_name].summary.reset_index(drop=True).to_dict() -``` - -{{% /tab %}} -{{< /tabpane >}} - - - - - - diff --git a/content/en/guides/models/track/log/log-tables.md b/content/en/guides/models/track/log/log-tables.md deleted file mode 100644 index 06ec9b723c..0000000000 --- a/content/en/guides/models/track/log/log-tables.md +++ /dev/null @@ -1,218 +0,0 @@ ---- -description: Log tables with W&B. -menu: - default: - identifier: log-tables - parent: logging -title: Log tables ---- - -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/keras/Use_WandbModelCheckpoint_in_your_Keras_workflow.ipynb" >}} -Use `wandb.Table` to log data to visualize and query with W&B. In this guide, learn how to: - -1. [Create Tables]({{< relref "./log-tables.md#create-tables" >}}) -2. [Add Data]({{< relref "./log-tables.md#add-data" >}}) -3. [Retrieve Data]({{< relref "./log-tables.md#retrieve-data" >}}) -4. [Save Tables]({{< relref "./log-tables.md#save-tables" >}}) - -## Create tables - -To define a Table, specify the columns you want to see for each row of data. Each row might be a single item in your training dataset, a particular step or epoch during training, a prediction made by your model on a test item, an object generated by your model, etc. Each column has a fixed type: numeric, text, boolean, image, video, audio, etc. You do not need to specify the type in advance. Give each column a name, and make sure to only pass data of that type into that column index. For a more detailed example, see the [W&B Tables guide](https://wandb.ai/stacey/mnist-viz/reports/Guide-to-W-B-Tables--Vmlldzo2NTAzOTk#1.-how-to-log-a-wandb.table). - -Use the `wandb.Table` constructor in one of two ways: - -1. **List of Rows:** Log named columns and rows of data. For example the proceeding code snippet generates a table with two rows and three columns: - -```python -wandb.Table(columns=["a", "b", "c"], data=[["1a", "1b", "1c"], ["2a", "2b", "2c"]]) -``` - - -2. **Pandas DataFrame:** Log a DataFrame using `wandb.Table(dataframe=my_df)`. Column names will be extracted from the DataFrame. - -#### From an existing array or dataframe - -```python -# assume a model has returned predictions on four images -# with the following fields available: -# - the image id -# - the image pixels, wrapped in a wandb.Image() -# - the model's predicted label -# - the ground truth label -my_data = [ - [0, wandb.Image("img_0.jpg"), 0, 0], - [1, wandb.Image("img_1.jpg"), 8, 0], - [2, wandb.Image("img_2.jpg"), 7, 1], - [3, wandb.Image("img_3.jpg"), 1, 1], -] - -# create a wandb.Table() with corresponding columns -columns = ["id", "image", "prediction", "truth"] -test_table = wandb.Table(data=my_data, columns=columns) -``` - -## Add data - -Tables are mutable. As your script executes you can add more data to your table, up to 200,000 rows. There are two ways to add data to a table: - -1. **Add a Row**: `table.add_data("3a", "3b", "3c")`. Note that the new row is not represented as a list. If your row is in list format, use the star notation, `*` ,to expand the list to positional arguments: `table.add_data(*my_row_list)`. The row must contain the same number of entries as there are columns in the table. -2. **Add a Column**: `table.add_column(name="col_name", data=col_data)`. Note that the length of `col_data` must be equal to the table's current number of rows. Here, `col_data` can be a list data, or a NumPy NDArray. - -### Adding data incrementally - -This code sample shows how to create and populate a W&B table incrementally. You define the table with predefined columns, including confidence scores for all possible labels, and add data row by row during inference. You can also [add data to tables incrementally when resuming runs]({{< relref "#adding-data-to-resumed-runs" >}}). - -```python -# Define the columns for the table, including confidence scores for each label -columns = ["id", "image", "guess", "truth"] -for digit in range(10): # Add confidence score columns for each digit (0-9) - columns.append(f"score_{digit}") - -# Initialize the table with the defined columns -test_table = wandb.Table(columns=columns) - -# Iterate through the test dataset and add data to the table row by row -# Each row includes the image ID, image, predicted label, true label, and confidence scores -for img_id, img in enumerate(mnist_test_data): - true_label = mnist_test_data_labels[img_id] # Ground truth label - guess_label = my_model.predict(img) # Predicted label - test_table.add_data( - img_id, wandb.Image(img), guess_label, true_label - ) # Add row data to the table -``` - -#### Adding data to resumed runs - -You can incrementally update a W&B table in resumed runs by loading an existing table from an artifact, retrieving the last row of data, and adding the updated metrics. Then, reinitialize the table for compatibility and log the updated version back to W&B. - -```python -import wandb - -# Initialize a run -with wandb.init(project="my_project") as run: - - # Load the existing table from the artifact - best_checkpt_table = run.use_artifact(table_tag).get(table_name) - - # Get the last row of data from the table for resuming - best_iter, best_metric_max, best_metric_min = best_checkpt_table.data[-1] - - # Update the best metrics as needed - - # Add the updated data to the table - best_checkpt_table.add_data(best_iter, best_metric_max, best_metric_min) - - # Reinitialize the table with its updated data to ensure compatibility - best_checkpt_table = wandb.Table( - columns=["col1", "col2", "col3"], data=best_checkpt_table.data - ) - - # Initialize the Run - run = wandb.init() - - # Log the updated table to W&B - run.log({table_name: best_checkpt_table}) -``` - -## Retrieve data - -Once data is in a Table, access it by column or by row: - -1. **Row Iterator**: Users can use the row iterator of Table such as `for ndx, row in table.iterrows(): ...` to efficiently iterate over the data's rows. -2. **Get a Column**: Users can retrieve a column of data using `table.get_column("col_name")` . As a convenience, users can pass `convert_to="numpy"` to convert the column to a NumPy NDArray of primitives. This is useful if your column contains media types such as `wandb.Image` so that you can access the underlying data directly. - -## Save tables - -After you generate a table of data in your script, for example a table of model predictions, save it to W&B to visualize the results live. - -### Log a table to a run - -Use `wandb.Run.log()` to save your table to the run, like so: - -```python -with wandb.init() as run: - my_table = wandb.Table(columns=["a", "b"], data=[["1a", "1b"], ["2a", "2b"]]) - run.log({"table_key": my_table}) -``` - -Each time a table is logged to the same key, a new version of the table is created and stored in the backend. This means you can log the same table across multiple training steps to see how model predictions improve over time, or compare tables across different runs, as long as they're logged to the same key. You can log up to 200,000 rows. - -{{% alert %}} -To log more than 200,000 rows, you can override the limit with: - -`wandb.Table.MAX_ARTIFACT_ROWS = X` - -However, this would likely cause performance issues, such as slower queries, in the UI. -{{% /alert %}} - -### Access tables programmatically - -In the backend, Tables are persisted as Artifacts. If you are interested in accessing a specific version, you can do so with the artifact API: - -```python -with wandb.init() as run: - my_table = run.use_artifact("run--:").get("") -``` - -For more information on Artifacts, see the [Artifacts Chapter]({{< relref "/guides/core/artifacts/" >}}) in the Developer Guide. - -### Visualize tables - -Any table logged this way will show up in your Workspace on both the Run Page and the Project Page. For more information, see [Visualize and Analyze Tables]({{< relref "/guides/models/tables//visualize-tables.md" >}}). - - -## Artifact tables - -Use `artifact.add()` to log tables to the Artifacts section of your run instead of the workspace. This could be useful if you have a dataset that you want to log once and then reference for future runs. - -```python -with wandb.init(project="my_project") as run: - # create a wandb Artifact for each meaningful step - test_predictions = wandb.Artifact("mnist_test_preds", type="predictions") - - # [build up your predictions data as above] - test_table = wandb.Table(data=data, columns=columns) - test_predictions.add(test_table, "my_test_key") - run.log_artifact(test_predictions) -``` - -Refer to this Colab for a [detailed example of artifact.add() with image data](https://wandb.me/dsviz-nature-colab) and this Report for an example of how to use Artifacts and Tables to [version control and deduplicate tabular data](https://wandb.me/TBV-Dedup). - -### Join Artifact tables - -You can join tables you have locally constructed or tables you have retrieved from other artifacts using `wandb.JoinedTable(table_1, table_2, join_key)`. - -| Args | Description | -| --------- | ------------------------------------------------------------------------------------------------------------------ | -| table_1 | (str, `wandb.Table`, ArtifactEntry) the path to a `wandb.Table` in an artifact, the table object, or ArtifactEntry | -| table_2 | (str, `wandb.Table`, ArtifactEntry) the path to a `wandb.Table` in an artifact, the table object, or ArtifactEntry | -| join_key | (str, [str, str]) key or keys on which to perform the join | - - -To join two Tables you have logged previously in an artifact context, fetch them from the artifact and join the result into a new Table. - -For example, the proceeding code example demonstrates how to read one Table of original songs called `'original_songs'` and another Table of synthesized versions of the same songs called `'synth_songs'`. The code joins the two tables on `"song_id"`, and uploads the resulting table as a new W&B Table: - -```python -import wandb - -with wandb.init(project="my_project") as run: - - # fetch original songs table - orig_songs = run.use_artifact("original_songs:latest") - orig_table = orig_songs.get("original_samples") - - # fetch synthesized songs table - synth_songs = run.use_artifact("synth_songs:latest") - synth_table = synth_songs.get("synth_samples") - - # join tables on "song_id" - join_table = wandb.JoinedTable(orig_table, synth_table, "song_id") - join_at = wandb.Artifact("synth_summary", "analysis") - - # add table to artifact and log to W&B - join_at.add(join_table, "synth_explore") - run.log_artifact(join_at) -``` - -[Read this tutorial](https://wandb.ai/stacey/cshanty/reports/Whale2Song-W-B-Tables-for-Audio--Vmlldzo4NDI3NzM) for an example on how to combine two previously stored tables stored in different Artifact objects. diff --git a/content/en/guides/models/track/log/media.md b/content/en/guides/models/track/log/media.md deleted file mode 100644 index cb09a82b30..0000000000 --- a/content/en/guides/models/track/log/media.md +++ /dev/null @@ -1,662 +0,0 @@ ---- -description: Log rich media, from 3D point clouds and molecules to HTML and histograms -menu: - default: - identifier: media - parent: logging -title: Log media and objects ---- - - -{{< cta-button colabLink="https://colab.research.google.com/github/wandb/examples/blob/master/colabs/wandb-log/Log_(Almost)_Anything_with_W%26B_Media.ipynb" >}} - -We support images, video, audio, and more. Log rich media to explore your results and visually compare your runs, models, and datasets. Read on for examples and how-to guides. - -{{% alert %}} -For details, see the [Data types reference]({{< relref "/ref/python/data-types/" >}}). -{{% /alert %}} - -{{% alert %}} -For more details, check out a [demo report about visualize model predictions](https://wandb.ai/lavanyashukla/visualize-predictions/reports/Visualize-Model-Predictions--Vmlldzo1NjM4OA) or watch a [video walkthrough](https://www.youtube.com/watch?v=96MxRvx15Ts). -{{% /alert %}} - -## Pre-requisites -In order to log media objects with the W&B SDK, you may need to install additional dependencies. -You can install these dependencies by running the following command: - -```bash -pip install wandb[media] -``` - -## Images - -Log images to track inputs, outputs, filter weights, activations, and more. - -{{< img src="/images/track/log_images.png" alt="Autoencoder inputs and outputs" >}} - -Images can be logged directly from NumPy arrays, as PIL images, or from the filesystem. - -Each time you log images from a step, we save them to show in the UI. Expand the image panel, and use the step slider to look at images from different steps. This makes it easy to compare how a model's output changes during training. - -{{% alert %}} -It's recommended to log fewer than 50 images per step to prevent logging from becoming a bottleneck during training and image loading from becoming a bottleneck when viewing results. -{{% /alert %}} - -{{< tabpane text=true >}} - {{% tab header="Logging arrays as Images" %}} -Provide arrays directly when constructing images manually, such as by using [`make_grid` from `torchvision`](https://pytorch.org/vision/stable/utils.html#torchvision.utils.make_grid). - -Arrays are converted to png using [Pillow](https://pillow.readthedocs.io/en/stable/index.html). - -```python -import wandb - -with wandb.init(project="image-log-example") as run: - - images = wandb.Image(image_array, caption="Top: Output, Bottom: Input") - - run.log({"examples": images}) -``` - -We assume the image is gray scale if the last dimension is 1, RGB if it's 3, and RGBA if it's 4. If the array contains floats, we convert them to integers between `0` and `255`. If you want to normalize your images differently, you can specify the [`mode`](https://pillow.readthedocs.io/en/stable/handbook/concepts.html#modes) manually or just supply a [`PIL.Image`](https://pillow.readthedocs.io/en/stable/reference/Image.html), as described in the "Logging PIL Images" tab of this panel. - {{% /tab %}} - {{% tab header="Logging PIL Images" %}} -For full control over the conversion of arrays to images, construct the [`PIL.Image`](https://pillow.readthedocs.io/en/stable/reference/Image.html) yourself and provide it directly. - -```python -from PIL import Image - -with wandb.init(project="") as run: - # Create a PIL image from a NumPy array - image = Image.fromarray(image_array) - - # Optionally, convert to RGB if needed - if image.mode != "RGB": - image = image.convert("RGB") - - # Log the image - run.log({"example": wandb.Image(image, caption="My Image")}) -``` - - {{% /tab %}} - {{% tab header="Logging Images from Files" %}} -For even more control, create images however you like, save them to disk, and provide a filepath. - -```python -import wandb -from PIL import Image - -with wandb.init(project="") as run: - - im = Image.fromarray(...) - rgb_im = im.convert("RGB") - rgb_im.save("myimage.jpg") - - run.log({"example": wandb.Image("myimage.jpg")}) -``` - {{% /tab %}} -{{< /tabpane >}} - - -## Image overlays - - -{{< tabpane text=true >}} - {{% tab header="Segmentation Masks" %}} -Log semantic segmentation masks and interact with them (altering opacity, viewing changes over time, and more) via the W&B UI. - -{{< img src="/images/track/semantic_segmentation.gif" alt="Interactive mask viewing" >}} - -To log an overlay, provide a dictionary with the following keys and values to the `masks` keyword argument of `wandb.Image`: - -* one of two keys representing the image mask: - * `"mask_data"`: a 2D NumPy array containing an integer class label for each pixel - * `"path"`: (string) a path to a saved image mask file -* `"class_labels"`: (optional) a dictionary mapping the integer class labels in the image mask to their readable class names - -To log multiple masks, log a mask dictionary with multiple keys, as in the code snippet below. - -[See a live example](https://app.wandb.ai/stacey/deep-drive/reports/Image-Masks-for-Semantic-Segmentation--Vmlldzo4MTUwMw) - -[Sample code](https://colab.research.google.com/drive/1SOVl3EvW82Q4QKJXX6JtHye4wFix_P4J) - -```python -mask_data = np.array([[1, 2, 2, ..., 2, 2, 1], ...]) - -class_labels = {1: "tree", 2: "car", 3: "road"} - -mask_img = wandb.Image( - image, - masks={ - "predictions": {"mask_data": mask_data, "class_labels": class_labels}, - "ground_truth": { - # ... - }, - # ... - }, -) -``` - -Segmentation masks for a key are defined at each step (each call to `run.log()`). -- If steps provide different values for the same mask key, only the most recent value for the key is applied to the image. -- If steps provide different mask keys, all values for each key are shown, but only those defined in the step being viewed are applied to the image. Toggling the visibility of masks not defined in the step do not change the image. - {{% /tab %}} - {{% tab header="Bounding Boxes" %}} -Log bounding boxes with images, and use filters and toggles to dynamically visualize different sets of boxes in the UI. - -{{< img src="/images/track/bb-docs.jpeg" alt="Bounding box example" >}} - -[See a live example](https://app.wandb.ai/stacey/yolo-drive/reports/Bounding-Boxes-for-Object-Detection--Vmlldzo4Nzg4MQ) - -To log a bounding box, you'll need to provide a dictionary with the following keys and values to the boxes keyword argument of `wandb.Image`: - -* `box_data`: a list of dictionaries, one for each box. The box dictionary format is described below. - * `position`: a dictionary representing the position and size of the box in one of two formats, as described below. Boxes need not all use the same format. - * _Option 1:_ `{"minX", "maxX", "minY", "maxY"}`. Provide a set of coordinates defining the upper and lower bounds of each box dimension. - * _Option 2:_ `{"middle", "width", "height"}`. Provide a set of coordinates specifying the `middle` coordinates as `[x,y]`, and `width` and `height` as scalars. - * `class_id`: an integer representing the class identity of the box. See `class_labels` key below. - * `scores`: a dictionary of string labels and numeric values for scores. Can be used for filtering boxes in the UI. - * `domain`: specify the units/format of the box coordinates. **Set this to "pixel"** if the box coordinates are expressed in pixel space, such as integers within the bounds of the image dimensions. By default, the domain is assumed to be a fraction/percentage of the image, expressed as a floating point number between 0 and 1. - * `box_caption`: (optional) a string to be displayed as the label text on this box -* `class_labels`: (optional) A dictionary mapping `class_id`s to strings. By default we will generate class labels `class_0`, `class_1`, etc. - -Check out this example: - -```python -import wandb - -class_id_to_label = { - 1: "car", - 2: "road", - 3: "building", - # ... -} - -img = wandb.Image( - image, - boxes={ - "predictions": { - "box_data": [ - { - # one box expressed in the default relative/fractional domain - "position": {"minX": 0.1, "maxX": 0.2, "minY": 0.3, "maxY": 0.4}, - "class_id": 2, - "box_caption": class_id_to_label[2], - "scores": {"acc": 0.1, "loss": 1.2}, - # another box expressed in the pixel domain - # (for illustration purposes only, all boxes are likely - # to be in the same domain/format) - "position": {"middle": [150, 20], "width": 68, "height": 112}, - "domain": "pixel", - "class_id": 3, - "box_caption": "a building", - "scores": {"acc": 0.5, "loss": 0.7}, - # ... - # Log as many boxes an as needed - } - ], - "class_labels": class_id_to_label, - }, - # Log each meaningful group of boxes with a unique key name - "ground_truth": { - # ... - }, - }, -) - -with wandb.init(project="my_project") as run: - run.log({"driving_scene": img}) -``` - {{% /tab %}} -{{< /tabpane >}} - - - -## Image overlays in Tables - -{{< tabpane text=true >}} - {{% tab header="Segmentation Masks" %}} -{{< img src="/images/track/Segmentation_Masks.gif" alt="Interactive Segmentation Masks in Tables" >}} - -To log Segmentation Masks in tables, you will need to provide a `wandb.Image` object for each row in the table. - -An example is provided in the Code snippet below: - -```python -table = wandb.Table(columns=["ID", "Image"]) - -for id, img, label in zip(ids, images, labels): - mask_img = wandb.Image( - img, - masks={ - "prediction": {"mask_data": label, "class_labels": class_labels} - # ... - }, - ) - - table.add_data(id, mask_img) - -with wandb.init(project="my_project") as run: - run.log({"Table": table}) -``` - {{% /tab %}} - {{% tab header="Bounding Boxes" %}} -{{< img src="/images/track/Bounding_Boxes.gif" alt="Interactive Bounding Boxes in Tables" >}} - -To log Images with Bounding Boxes in tables, you will need to provide a `wandb.Image` object for each row in the table. - -An example is provided in the code snippet below: - -```python -table = wandb.Table(columns=["ID", "Image"]) - -for id, img, boxes in zip(ids, images, boxes_set): - box_img = wandb.Image( - img, - boxes={ - "prediction": { - "box_data": [ - { - "position": { - "minX": box["minX"], - "minY": box["minY"], - "maxX": box["maxX"], - "maxY": box["maxY"], - }, - "class_id": box["class_id"], - "box_caption": box["caption"], - "domain": "pixel", - } - for box in boxes - ], - "class_labels": class_labels, - } - }, - ) -``` - {{% /tab %}} -{{< /tabpane >}} - - - -## Histograms - -{{< tabpane text=true >}} - {{% tab header="Basic Histogram Logging" %}} -If a sequence of numbers, such as a list, array, or tensor, is provided as the first argument, we will construct the histogram automatically by calling `np.histogram`. All arrays/tensors are flattened. You can use the optional `num_bins` keyword argument to override the default of `64` bins. The maximum number of bins supported is `512`. - -In the UI, histograms are plotted with the training step on the x-axis, the metric value on the y-axis, and the count represented by color, to ease comparison of histograms logged throughout training. See the "Histograms in Summary" tab of this panel for details on logging one-off histograms. - -```python -run.log({"gradients": wandb.Histogram(grads)}) -``` - -{{< img src="/images/track/histograms.png" alt="GAN discriminator gradients" >}} - {{% /tab %}} - {{% tab header="Flexible Histogram Logging" %}} -If you want more control, call `np.histogram` and pass the returned tuple to the `np_histogram` keyword argument. - -```python -np_hist_grads = np.histogram(grads, density=True, range=(0.0, 1.0)) -run.log({"gradients": wandb.Histogram(np_hist_grads)}) -``` - {{% /tab %}} -{{< /tabpane >}} - - - -If histograms are in your summary they will appear on the Overview tab of the [Run Page]({{< relref "/guides/models/track/runs/" >}}). If they are in your history, we plot a heatmap of bins over time on the Charts tab. - -## 3D visualizations - -Log 3D point clouds and Lidar scenes with bounding boxes. Pass in a NumPy array containing coordinates and colors for the points to render. - -```python -point_cloud = np.array([[0, 0, 0, COLOR]]) - -run.log({"point_cloud": wandb.Object3D(point_cloud)}) -``` - -{{% alert %}} -The W&B UI truncates the data at 300,000 points. -{{% /alert %}} - -#### NumPy array formats - -Three different formats of NumPy arrays are supported for flexible color schemes. - -* `[[x, y, z], ...]` `nx3` -* `[[x, y, z, c], ...]` `nx4` `| c is a category` in the range `[1, 14]` (Useful for segmentation) -* `[[x, y, z, r, g, b], ...]` `nx6 | r,g,b` are values in the range `[0,255]`for red, green, and blue color channels. - -#### Python object - -Using this schema, you can define a Python object and pass it in to [the `from_point_cloud` method]({{< relref "/ref/python/data-types/Object3D/#from_point_cloud" >}}). - -* `points`is a NumPy array containing coordinates and colors for the points to render using [the same formats as the simple point cloud renderer shown above]({{< relref "#python-object" >}}). -* `boxes` is a NumPy array of python dictionaries with three attributes: - * `corners`- a list of eight corners - * `label`- a string representing the label to be rendered on the box (Optional) - * `color`- rgb values representing the color of the box - * `score` - a numeric value that will be displayed on the bounding box that can be used to filter the bounding boxes shown (for example, to only show bounding boxes where `score` > `0.75`). (Optional) -* `type` is a string representing the scene type to render. Currently the only supported value is `lidar/beta` - -```python -point_list = [ - [ - 2566.571924017235, # x - 746.7817289698219, # y - -15.269245470863748,# z - 76.5, # red - 127.5, # green - 89.46617199365393 # blue - ], - [ 2566.592983606823, 746.6791987335685, -15.275803826279521, 76.5, 127.5, 89.45471117247024 ], - [ 2566.616361739416, 746.4903185513501, -15.28628929674075, 76.5, 127.5, 89.41336375503832 ], - [ 2561.706014951675, 744.5349468458361, -14.877496818222781, 76.5, 127.5, 82.21868245418283 ], - [ 2561.5281847916694, 744.2546118233013, -14.867862032341005, 76.5, 127.5, 81.87824684536432 ], - [ 2561.3693562897465, 744.1804761656741, -14.854129178142523, 76.5, 127.5, 81.64137897587152 ], - [ 2561.6093071504515, 744.0287526628543, -14.882135189841177, 76.5, 127.5, 81.89871499537098 ], - # ... and so on -] - -run.log({"my_first_point_cloud": wandb.Object3D.from_point_cloud( - points = point_list, - boxes = [{ - "corners": [ - [ 2601.2765123137915, 767.5669506323393, -17.816764802288663 ], - [ 2599.7259021588347, 769.0082337923552, -17.816764802288663 ], - [ 2599.7259021588347, 769.0082337923552, -19.66876480228866 ], - [ 2601.2765123137915, 767.5669506323393, -19.66876480228866 ], - [ 2604.8684867834395, 771.4313904894723, -17.816764802288663 ], - [ 2603.3178766284827, 772.8726736494882, -17.816764802288663 ], - [ 2603.3178766284827, 772.8726736494882, -19.66876480228866 ], - [ 2604.8684867834395, 771.4313904894723, -19.66876480228866 ] - ], - "color": [0, 0, 255], # color in RGB of the bounding box - "label": "car", # string displayed on the bounding box - "score": 0.6 # numeric displayed on the bounding box - }], - vectors = [ - {"start": [0, 0, 0], "end": [0.1, 0.2, 0.5], "color": [255, 0, 0]}, # color is optional - ], - point_cloud_type = "lidar/beta", -)}) -``` - -When viewing a point cloud, you can hold control and use the mouse to move around inside the space. - -#### Point cloud files - -You can use [the `from_file` method]({{< relref "/ref/python/data-types/Object3D/#from_file" >}}) to load in a JSON file full of point cloud data. - -```python -run.log({"my_cloud_from_file": wandb.Object3D.from_file( - "./my_point_cloud.pts.json" -)}) -``` - -An example of how to format the point cloud data is shown below. - -```json -{ - "boxes": [ - { - "color": [ - 0, - 255, - 0 - ], - "score": 0.35, - "label": "My label", - "corners": [ - [ - 2589.695869075582, - 760.7400443552185, - -18.044831294622487 - ], - [ - 2590.719039645323, - 762.3871153874499, - -18.044831294622487 - ], - [ - 2590.719039645323, - 762.3871153874499, - -19.54083129462249 - ], - [ - 2589.695869075582, - 760.7400443552185, - -19.54083129462249 - ], - [ - 2594.9666662674313, - 757.4657929961453, - -18.044831294622487 - ], - [ - 2595.9898368371723, - 759.1128640283766, - -18.044831294622487 - ], - [ - 2595.9898368371723, - 759.1128640283766, - -19.54083129462249 - ], - [ - 2594.9666662674313, - 757.4657929961453, - -19.54083129462249 - ] - ] - } - ], - "points": [ - [ - 2566.571924017235, - 746.7817289698219, - -15.269245470863748, - 76.5, - 127.5, - 89.46617199365393 - ], - [ - 2566.592983606823, - 746.6791987335685, - -15.275803826279521, - 76.5, - 127.5, - 89.45471117247024 - ], - [ - 2566.616361739416, - 746.4903185513501, - -15.28628929674075, - 76.5, - 127.5, - 89.41336375503832 - ] - ], - "type": "lidar/beta" -} -``` -#### NumPy arrays - -Using [the same array formats defined above]({{< relref "#numpy-array-formats" >}}), you can use `numpy` arrays directly with [the `from_numpy` method]({{< relref "/ref/python/data-types/Object3D/#from_numpy" >}}) to define a point cloud. - -```python -run.log({"my_cloud_from_numpy_xyz": wandb.Object3D.from_numpy( - np.array( - [ - [0.4, 1, 1.3], # x, y, z - [1, 1, 1], - [1.2, 1, 1.2] - ] - ) -)}) -``` -```python -run.log({"my_cloud_from_numpy_cat": wandb.Object3D.from_numpy( - np.array( - [ - [0.4, 1, 1.3, 1], # x, y, z, category - [1, 1, 1, 1], - [1.2, 1, 1.2, 12], - [1.2, 1, 1.3, 12], - [1.2, 1, 1.4, 12], - [1.2, 1, 1.5, 12], - [1.2, 1, 1.6, 11], - [1.2, 1, 1.7, 11], - ] - ) -)}) -``` -```python -run.log({"my_cloud_from_numpy_rgb": wandb.Object3D.from_numpy( - np.array( - [ - [0.4, 1, 1.3, 255, 0, 0], # x, y, z, r, g, b - [1, 1, 1, 0, 255, 0], - [1.2, 1, 1.3, 0, 255, 255], - [1.2, 1, 1.4, 0, 255, 255], - [1.2, 1, 1.5, 0, 0, 255], - [1.2, 1, 1.1, 0, 0, 255], - [1.2, 1, 0.9, 0, 0, 255], - ] - ) -)}) -``` - - - - -```python -run.log({"protein": wandb.Molecule("6lu7.pdb")}) -``` - -Log molecular data in any of 10 file types:`pdb`, `pqr`, `mmcif`, `mcif`, `cif`, `sdf`, `sd`, `gro`, `mol2`, or `mmtf.` - -W&B also supports logging molecular data from SMILES strings, [`rdkit`](https://www.rdkit.org/docs/index.html) `mol` files, and `rdkit.Chem.rdchem.Mol` objects. - -```python -resveratrol = rdkit.Chem.MolFromSmiles("Oc1ccc(cc1)C=Cc1cc(O)cc(c1)O") - -run.log( - { - "resveratrol": wandb.Molecule.from_rdkit(resveratrol), - "green fluorescent protein": wandb.Molecule.from_rdkit("2b3p.mol"), - "acetaminophen": wandb.Molecule.from_smiles("CC(=O)Nc1ccc(O)cc1"), - } -) -``` - -When your run finishes, you'll be able to interact with 3D visualizations of your molecules in the UI. - -[See a live example using AlphaFold](https://wandb.me/alphafold-workspace) - -{{< img src="/images/track/docs-molecule.png" alt="Molecule structure" >}} - - - -### PNG image - -[`wandb.Image`]({{< relref "/ref/python/data-types/image.md" >}}) converts `numpy` arrays or instances of `PILImage` to PNGs by default. - -```python -run.log({"example": wandb.Image(...)}) -# Or multiple images -run.log({"example": [wandb.Image(...) for img in images]}) -``` - -### Video - -Videos are logged using the [`wandb.Video`]({{< relref "/ref/python/data-types/Video" >}}) data type: - -```python -run.log({"example": wandb.Video("myvideo.mp4")}) -``` - -Now you can view videos in the media browser. Go to your project workspace, run workspace, or report and click **Add visualization** to add a rich media panel. - -## 2D view of a molecule - -You can log a 2D view of a molecule using the [`wandb.Image`]({{< relref "/ref/python/data-types/image.md" >}}) data type and [`rdkit`](https://www.rdkit.org/docs/index.html): - -```python -molecule = rdkit.Chem.MolFromSmiles("CC(=O)O") -rdkit.Chem.AllChem.Compute2DCoords(molecule) -rdkit.Chem.AllChem.GenerateDepictionMatching2DStructure(molecule, molecule) -pil_image = rdkit.Chem.Draw.MolToImage(molecule, size=(300, 300)) - -run.log({"acetic_acid": wandb.Image(pil_image)}) -``` - - -## Other media - -W&B also supports logging of a variety of other media types. - -### Audio - -```python -run.log({"whale songs": wandb.Audio(np_array, caption="OooOoo", sample_rate=32)}) -``` - -A maximum of 100 audio clips can be logged per step. For more usage information, see [`audio-file`]({{< relref "/ref/query-panel/audio-file.md" >}}). - -### Video - -```python -run.log({"video": wandb.Video(numpy_array_or_path_to_video, fps=4, format="gif")}) -``` - -If a numpy array is supplied we assume the dimensions are, in order: time, channels, width, height. By default we create a 4 fps gif image ([`ffmpeg`](https://www.ffmpeg.org) and the [`moviepy`](https://pypi.org/project/moviepy/) python library are required when passing numpy objects). Supported formats are `"gif"`, `"mp4"`, `"webm"`, and `"ogg"`. If you pass a string to `wandb.Video` we assert the file exists and is a supported format before uploading to wandb. Passing a `BytesIO` object will create a temporary file with the specified format as the extension. - -On the W&B [Run]({{< relref "/guides/models/track/runs/" >}}) and [Project]({{< relref "/guides/models/track/project-page.md" >}}) Pages, you will see your videos in the Media section. - -For more usage information, see [`video-file`]({{< relref "/ref/query-panel/video-file" >}}). - -### Text - -Use `wandb.Table` to log text in tables to show up in the UI. By default, the column headers are `["Input", "Output", "Expected"]`. To ensure optimal UI performance, the default maximum number of rows is set to 10,000. However, users can explicitly override the maximum with `wandb.Table.MAX_ROWS = {DESIRED_MAX}`. - -```python -with wandb.init(project="my_project") as run: - columns = ["Text", "Predicted Sentiment", "True Sentiment"] - # Method 1 - data = [["I love my phone", "1", "1"], ["My phone sucks", "0", "-1"]] - table = wandb.Table(data=data, columns=columns) - run.log({"examples": table}) - - # Method 2 - table = wandb.Table(columns=columns) - table.add_data("I love my phone", "1", "1") - table.add_data("My phone sucks", "0", "-1") - run.log({"examples": table}) -``` - -You can also pass a pandas `DataFrame` object. - -```python -table = wandb.Table(dataframe=my_dataframe) -``` - -For more usage information, see [`string`]({{< relref "/ref/query-panel/" >}}). - -### HTML - -```python -run.log({"custom_file": wandb.Html(open("some.html"))}) -run.log({"custom_string": wandb.Html('Link')}) -``` - -Custom HTML can be logged at any key, and this exposes an HTML panel on the run page. By default, we inject default styles; you can turn off default styles by passing `inject=False`. - -```python -run.log({"custom_file": wandb.Html(open("some.html"), inject=False)}) -``` - -For more usage information, see [`html-file`]({{< relref "/ref/query-panel/html-file" >}}). - diff --git a/content/en/guides/models/track/log/plots.md b/content/en/guides/models/track/log/plots.md deleted file mode 100644 index 9bf16009e2..0000000000 --- a/content/en/guides/models/track/log/plots.md +++ /dev/null @@ -1,362 +0,0 @@ ---- -description: Create and track plots from machine learning experiments. -menu: - default: - identifier: plots - parent: logging -title: Create and track plots from experiments ---- - -Using the methods in `wandb.plot`, you can track charts with `wandb.Run.log()`, including charts that change over time during training. To learn more about our custom charting framework, check out the [custom charts walkthrough]({{< relref "/guides/models/app/features/custom-charts/walkthrough.md" >}}). - -### Basic charts - -These simple charts make it easy to construct basic visualizations of metrics and results. - -{{< tabpane text=true >}} - {{% tab header="Line" %}} - -Log a custom line plot—a list of connected and ordered points on arbitrary axes. - -```python -import wandb - -with wandb.init() as run: - data = [[x, y] for (x, y) in zip(x_values, y_values)] - table = wandb.Table(data=data, columns=["x", "y"]) - run.log( - { - "my_custom_plot_id": wandb.plot.line( - table, "x", "y", title="Custom Y vs X Line Plot" - ) - } - ) -``` - -You can use this to log curves on any two dimensions. If you're plotting two lists of values against each other, the number of values in the lists must match exactly. For example, each point must have an x and a y. - -{{< img src="/images/track/line_plot.png" alt="Custom line plot" >}} - -[See in the app](https://wandb.ai/wandb/plots/reports/Custom-Line-Plots--VmlldzoyNjk5NTA) - -[Run the code](https://tiny.cc/custom-charts) - {{% /tab %}} - {{% tab header="Scatter" %}} - -Log a custom scatter plot—a list of points (x, y) on a pair of arbitrary axes x and y. - -```python -import wandb - -with wandb.init() as run: - data = [[x, y] for (x, y) in zip(class_x_scores, class_y_scores)] - table = wandb.Table(data=data, columns=["class_x", "class_y"]) - run.log({"my_custom_id": wandb.plot.scatter(table, "class_x", "class_y")}) -``` - -You can use this to log scatter points on any two dimensions. If you're plotting two lists of values against each other, the number of values in the lists must match exactly. For example, each point must have an x and a y. - -{{< img src="/images/track/demo_scatter_plot.png" alt="Custom scatter plot" >}} - -[See in the app](https://wandb.ai/wandb/plots/reports/Custom-Scatter-Plots--VmlldzoyNjk5NDQ) - -[Run the code](https://tiny.cc/custom-charts) - {{% /tab %}} - {{% tab header="Bar" %}} - -Log a custom bar chart—a list of labeled values as bars—natively in a few lines: - -```python -import wandb - -with wandb.init() as run: - data = [[label, val] for (label, val) in zip(labels, values)] - table = wandb.Table(data=data, columns=["label", "value"]) - run.log( - { - "my_bar_chart_id": wandb.plot.bar( - table, "label", "value", title="Custom Bar Chart" - ) - } -) -``` - -You can use this to log arbitrary bar charts. The number of labels and values in the lists must match exactly. Each data point must have both. - -{{< img src="/images/track/basic_charts_bar.png" alt="Custom bar chart" >}} - -[See in the app](https://wandb.ai/wandb/plots/reports/Custom-Bar-Charts--VmlldzoyNzExNzk) - -[Run the code](https://tiny.cc/custom-charts) - {{% /tab %}} - {{% tab header="Histogram" %}} - -Log a custom histogram—sort a list of values into bins by count/frequency of occurrence—natively in a few lines. Let's say I have a list of prediction confidence scores (`scores`) and want to visualize their distribution: - -```python -import wandb - -with wandb.init() as run: - data = [[s] for s in scores] - table = wandb.Table(data=data, columns=["scores"]) - run.log({"my_histogram": wandb.plot.histogram(table, "scores", title="Histogram")}) -``` - -You can use this to log arbitrary histograms. Note that `data` is a list of lists, intended to support a 2D array of rows and columns. - -{{< img src="/images/track/demo_custom_chart_histogram.png" alt="Custom histogram" >}} - -[See in the app](https://wandb.ai/wandb/plots/reports/Custom-Histograms--VmlldzoyNzE0NzM) - -[Run the code](https://tiny.cc/custom-charts) - {{% /tab %}} - {{% tab header="Multi-line" %}} - -Plot multiple lines, or multiple different lists of x-y coordinate pairs, on one shared set of x-y axes: - -```python -import wandb -with wandb.init() as run: - run.log( - { - "my_custom_id": wandb.plot.line_series( - xs=[0, 1, 2, 3, 4], - ys=[[10, 20, 30, 40, 50], [0.5, 11, 72, 3, 41]], - keys=["metric Y", "metric Z"], - title="Two Random Metrics", - xname="x units", - ) - } -) -``` - -Note that the number of x and y points must match exactly. You can supply one list of x values to match multiple lists of y values, or a separate list of x values for each list of y values. - -{{< img src="/images/track/basic_charts_histogram.png" alt="Multi-line plot" >}} - -[See in the app](https://wandb.ai/wandb/plots/reports/Custom-Multi-Line-Plots--VmlldzozOTMwMjU) - {{% /tab %}} -{{< /tabpane >}} - - - -### Model evaluation charts - -These preset charts have built-in `wandb.plot()` methods that make it quick and easy to log charts directly from your script and see the exact information you're looking for in the UI. - -{{< tabpane text=true >}} - {{% tab header="Precision-recall curves" %}} - -Create a [Precision-Recall curve](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.precision_recall_curve.html#sklearn.metrics.precision_recall_curve) in one line: - -```python -import wandb -with wandb.init() as run: - # ground_truth is a list of true labels, predictions is a list of predicted scores - # e.g. ground_truth = [0, 1, 1, 0], predictions = [0.1, 0.4, 0.35, 0.8] - ground_truth = [0, 1, 1, 0] - predictions = [0.1, 0.4, 0.35, 0.8] - run.log({"pr": wandb.plot.pr_curve(ground_truth, predictions)}) -``` - -You can log this whenever your code has access to: - -* a model's predicted scores (`predictions`) on a set of examples -* the corresponding ground truth labels (`ground_truth`) for those examples -* (optionally) a list of the labels/class names (`labels=["cat", "dog", "bird"...]` if label index 0 means cat, 1 = dog, 2 = bird, etc.) -* (optionally) a subset (still in list format) of the labels to visualize in the plot - -{{< img src="/images/track/model_eval_charts_precision_recall.png" alt="Precision-recall curve" >}} - -[See in the app](https://wandb.ai/wandb/plots/reports/Plot-Precision-Recall-Curves--VmlldzoyNjk1ODY) - -[Run the code](https://colab.research.google.com/drive/1mS8ogA3LcZWOXchfJoMrboW3opY1A8BY?usp=sharing) - {{% /tab %}} - {{% tab header="ROC curves" %}} - -Create an [ROC curve](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.roc_curve.html#sklearn.metrics.roc_curve) in one line: - -```python -import wandb - -with wandb.init() as run: - # ground_truth is a list of true labels, predictions is a list of predicted scores - # e.g. ground_truth = [0, 1, 1, 0], predictions = [0.1, 0.4, 0.35, 0.8] - ground_truth = [0, 1, 1, 0] - predictions = [0.1, 0.4, 0.35, 0.8] - run.log({"roc": wandb.plot.roc_curve(ground_truth, predictions)}) -``` - -You can log this whenever your code has access to: - -* a model's predicted scores (`predictions`) on a set of examples -* the corresponding ground truth labels (`ground_truth`) for those examples -* (optionally) a list of the labels/ class names (`labels=["cat", "dog", "bird"...]` if label index 0 means cat, 1 = dog, 2 = bird, etc.) -* (optionally) a subset (still in list format) of these labels to visualize on the plot - -{{< img src="/images/track/demo_custom_chart_roc_curve.png" alt="ROC curve" >}} - -[See in the app](https://wandb.ai/wandb/plots/reports/Plot-ROC-Curves--VmlldzoyNjk3MDE) - -[Run the code](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/wandb-log/Plot_ROC_Curves_with_W%26B.ipynb) - {{% /tab %}} - {{% tab header="Confusion matrix" %}} - -Create a multi-class [confusion matrix](https://scikit-learn.org/stable/auto_examples/model_selection/plot_confusion_matrix.html) in one line: - -```python -import wandb - -cm = wandb.plot.confusion_matrix( - y_true=ground_truth, preds=predictions, class_names=class_names -) - -with wandb.init() as run: - run.log({"conf_mat": cm}) -``` - -You can log this wherever your code has access to: - -* a model's predicted labels on a set of examples (`preds`) or the normalized probability scores (`probs`). The probabilities must have the shape (number of examples, number of classes). You can supply either probabilities or predictions but not both. -* the corresponding ground truth labels for those examples (`y_true`) -* a full list of the labels/class names as strings of `class_names`. Examples: `class_names=["cat", "dog", "bird"]` if index 0 is `cat`, 1 is `dog`, 2 is `bird`. - -{{< img src="/images/experiments/confusion_matrix.png" alt="Confusion matrix" >}} - -​[See in the app](https://wandb.ai/wandb/plots/reports/Confusion-Matrix--VmlldzozMDg1NTM)​ - -​[Run the code](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/wandb-log/Log_a_Confusion_Matrix_with_W%26B.ipynb) - {{% /tab %}} -{{< /tabpane >}} - - -### Interactive custom charts - -For full customization, tweak a built-in [Custom Chart preset]({{< relref "/guides/models/app/features/custom-charts/walkthrough.md" >}}) or create a new preset, then save the chart. Use the chart ID to log data to that custom preset directly from your script. - -```python -import wandb -# Create a table with the columns to plot -table = wandb.Table(data=data, columns=["step", "height"]) - -# Map from the table's columns to the chart's fields -fields = {"x": "step", "value": "height"} - -# Use the table to populate the new custom chart preset -# To use your own saved chart preset, change the vega_spec_name -# To edit the title, change the string_fields -my_custom_chart = wandb.plot_table( - vega_spec_name="carey/new_chart", - data_table=table, - fields=fields, - string_fields={"title": "Height Histogram"}, -) - -with wandb.init() as run: - # Log the custom chart - run.log({"my_custom_chart": my_custom_chart}) -``` - -[Run the code](https://tiny.cc/custom-charts) - -### Matplotlib and Plotly plots - -Instead of using W&B [Custom Charts]({{< relref "/guides/models/app/features/custom-charts/walkthrough.md" >}}) with `wandb.plot()`, you can log charts generated with [matplotlib](https://matplotlib.org/) and [Plotly](https://plotly.com/). - -```python -import wandb -import matplotlib.pyplot as plt - -with wandb.init() as run: - # Create a simple matplotlib plot - plt.figure() - plt.plot([1, 2, 3, 4]) - plt.ylabel("some interesting numbers") - - # Log the plot to W&B - run.log({"chart": plt}) -``` - -Just pass a `matplotlib` plot or figure object to `wandb.Run.log()`. By default we'll convert the plot into a [Plotly](https://plot.ly/) plot. If you'd rather log the plot as an image, you can pass the plot into `wandb.Image`. We also accept Plotly charts directly. - -{{% alert %}} -If you’re getting an error “You attempted to log an empty plot” then you can store the figure separately from the plot with `fig = plt.figure()` and then log `fig` in your call to `wandb.Run.log()`. -{{% /alert %}} - -### Log custom HTML to W&B Tables - -W&B supports logging interactive charts from Plotly and Bokeh as HTML and adding them to Tables. - -#### Log Plotly figures to Tables as HTML - -You can log interactive Plotly charts to wandb Tables by converting them to HTML. - -```python -import wandb -import plotly.express as px - -# Initialize a new run -with wandb.init(project="log-plotly-fig-tables", name="plotly_html") as run: - - # Create a table - table = wandb.Table(columns=["plotly_figure"]) - - # Create path for Plotly figure - path_to_plotly_html = "./plotly_figure.html" - - # Example Plotly figure - fig = px.scatter(x=[0, 1, 2, 3, 4], y=[0, 1, 4, 9, 16]) - - # Write Plotly figure to HTML - # Set auto_play to False prevents animated Plotly charts - # from playing in the table automatically - fig.write_html(path_to_plotly_html, auto_play=False) - - # Add Plotly figure as HTML file into Table - table.add_data(wandb.Html(path_to_plotly_html)) - - # Log Table - run.log({"test_table": table}) -``` - -#### Log Bokeh figures to Tables as HTML - -You can log interactive Bokeh charts to wandb Tables by converting them to HTML. - -```python -from scipy.signal import spectrogram -import holoviews as hv -import panel as pn -from scipy.io import wavfile -import numpy as np -from bokeh.resources import INLINE - -hv.extension("bokeh", logo=False) -import wandb - - -def save_audio_with_bokeh_plot_to_html(audio_path, html_file_name): - sr, wav_data = wavfile.read(audio_path) - duration = len(wav_data) / sr - f, t, sxx = spectrogram(wav_data, sr) - spec_gram = hv.Image((t, f, np.log10(sxx)), ["Time (s)", "Frequency (hz)"]).opts( - width=500, height=150, labelled=[] - ) - audio = pn.pane.Audio(wav_data, sample_rate=sr, name="Audio", throttle=500) - slider = pn.widgets.FloatSlider(end=duration, visible=False) - line = hv.VLine(0).opts(color="white") - slider.jslink(audio, value="time", bidirectional=True) - slider.jslink(line, value="glyph.location") - combined = pn.Row(audio, spec_gram * line, slider).save(html_file_name) - - -html_file_name = "audio_with_plot.html" -audio_path = "hello.wav" -save_audio_with_bokeh_plot_to_html(audio_path, html_file_name) - -wandb_html = wandb.Html(html_file_name) - -with wandb.init(project="audio_test") as run: - my_table = wandb.Table(columns=["audio_with_plot"], data=[[wandb_html]]) - run.log({"audio_table": my_table}) -``` \ No newline at end of file diff --git a/content/en/guides/models/track/log/working-with-csv.md b/content/en/guides/models/track/log/working-with-csv.md deleted file mode 100644 index 522b920c65..0000000000 --- a/content/en/guides/models/track/log/working-with-csv.md +++ /dev/null @@ -1,227 +0,0 @@ ---- -description: Importing and logging data into W&B -menu: - default: - identifier: working-with-csv - parent: logging -title: Track CSV files with experiments ---- - -Use the W&B Python Library to log a CSV file and visualize it in a [W&B Dashboard]({{< relref "/guides/models/track/workspaces.md" >}}). W&B Dashboard are the central place to organize and visualize results from your machine learning models. This is particularly useful if you have a [CSV file that contains information of previous machine learning experiments]({{< relref "#import-and-log-your-csv-of-experiments" >}}) that are not logged in W&B or if you have [CSV file that contains a dataset]({{< relref "#import-and-log-your-dataset-csv-file" >}}). - -## Import and log your dataset CSV file - - - -We suggest you utilize W&B Artifacts to make it easier to re-use the contents of the CSV file easier to use. - -1. To get started, first import your CSV file. In the proceeding code snippet, replace the `iris.csv` filename with the name of your CSV filename: - -```python -import wandb -import pandas as pd - -# Read our CSV into a new DataFrame -new_iris_dataframe = pd.read_csv("iris.csv") -``` - -2. Convert the CSV file to a W&B Table to utilize [W&B Dashboards]({{< relref "/guides/models/track/workspaces.md" >}}). - -```python -# Convert the DataFrame into a W&B Table -iris_table = wandb.Table(dataframe=new_iris_dataframe) -``` - -3. Next, create a W&B Artifact and add the table to the Artifact: - -```python -# Add the table to an Artifact to increase the row -# limit to 200000 and make it easier to reuse -iris_table_artifact = wandb.Artifact("iris_artifact", type="dataset") -iris_table_artifact.add(iris_table, "iris_table") - -# Log the raw csv file within an artifact to preserve our data -iris_table_artifact.add_file("iris.csv") -``` -For more information about W&B Artifacts, see the [Artifacts chapter]({{< relref "/guides/core/artifacts/" >}}). - -4. Lastly, start a new W&B Run to track and log to W&B with `wandb.init`: - -```python -# Start a W&B run to log data -run = wandb.init(project="tables-walkthrough") - -# Log the table to visualize with a run... -run.log({"iris": iris_table}) - -# and Log as an Artifact to increase the available row limit! -run.log_artifact(iris_table_artifact) -``` - -The `wandb.init()` API spawns a new background process to log data to a Run, and it synchronizes data to wandb.ai (by default). View live visualizations on your W&B Workspace Dashboard. The following image demonstrates the output of the code snippet demonstration. - -{{< img src="/images/track/import_csv_tutorial.png" alt="CSV file imported into W&B Dashboard" >}} - - -The full script with the preceding code snippets is found below: - -```python -import wandb -import pandas as pd - -# Read our CSV into a new DataFrame -new_iris_dataframe = pd.read_csv("iris.csv") - -# Convert the DataFrame into a W&B Table -iris_table = wandb.Table(dataframe=new_iris_dataframe) - -# Add the table to an Artifact to increase the row -# limit to 200000 and make it easier to reuse -iris_table_artifact = wandb.Artifact("iris_artifact", type="dataset") -iris_table_artifact.add(iris_table, "iris_table") - -# log the raw csv file within an artifact to preserve our data -iris_table_artifact.add_file("iris.csv") - -# Start a W&B run to log data -run = wandb.init(project="tables-walkthrough") - -# Log the table to visualize with a run... -run.log({"iris": iris_table}) - -# and Log as an Artifact to increase the available row limit! -run.log_artifact(iris_table_artifact) - -# Finish the run (useful in notebooks) -run.finish() -``` - -## Import and log your CSV of Experiments - - - -In some cases, you might have your experiment details in a CSV file. Common details found in such CSV files include: - -* A name for the experiment run -* Initial [notes]({{< relref "/guides/models/track/runs/#add-a-note-to-a-run" >}}) -* [Tags]({{< relref "/guides/models/track/runs/tags.md" >}}) to differentiate the experiments -* Configurations needed for your experiment (with the added benefit of being able to utilize our [Sweeps Hyperparameter Tuning]({{< relref "/guides/models/sweeps/" >}})). - -| Experiment | Model Name | Notes | Tags | Num Layers | Final Train Acc | Final Val Acc | Training Losses | -| ------------ | ---------------- | ------------------------------------------------ | ------------- | ---------- | --------------- | ------------- | ------------------------------------- | -| Experiment 1 | mnist-300-layers | Overfit way too much on training data | \[latest] | 300 | 0.99 | 0.90 | \[0.55, 0.45, 0.44, 0.42, 0.40, 0.39] | -| Experiment 2 | mnist-250-layers | Current best model | \[prod, best] | 250 | 0.95 | 0.96 | \[0.55, 0.45, 0.44, 0.42, 0.40, 0.39] | -| Experiment 3 | mnist-200-layers | Did worse than the baseline model. Need to debug | \[debug] | 200 | 0.76 | 0.70 | \[0.55, 0.45, 0.44, 0.42, 0.40, 0.39] | -| ... | ... | ... | ... | ... | ... | ... | | -| Experiment N | mnist-X-layers | NOTES | ... | ... | ... | ... | \[..., ...] | - -W&B can take CSV files of experiments and convert it into a W&B Experiment Run. The proceeding code snippets and code script demonstrates how to import and log your CSV file of experiments: - -1. To get started, first read in your CSV file and convert it into a Pandas DataFrame. Replace `"experiments.csv"` with the name of your CSV file: - -```python -import wandb -import pandas as pd - -FILENAME = "experiments.csv" -loaded_experiment_df = pd.read_csv(FILENAME) - -PROJECT_NAME = "Converted Experiments" - -EXPERIMENT_NAME_COL = "Experiment" -NOTES_COL = "Notes" -TAGS_COL = "Tags" -CONFIG_COLS = ["Num Layers"] -SUMMARY_COLS = ["Final Train Acc", "Final Val Acc"] -METRIC_COLS = ["Training Losses"] - -# Format Pandas DataFrame to make it easier to work with -for i, row in loaded_experiment_df.iterrows(): - run_name = row[EXPERIMENT_NAME_COL] - notes = row[NOTES_COL] - tags = row[TAGS_COL] - - config = {} - for config_col in CONFIG_COLS: - config[config_col] = row[config_col] - - metrics = {} - for metric_col in METRIC_COLS: - metrics[metric_col] = row[metric_col] - - summaries = {} - for summary_col in SUMMARY_COLS: - summaries[summary_col] = row[summary_col] -``` - - -2. Next, start a new W&B Run to track and log to W&B with [`wandb.init()`]({{< relref "/ref/python/functions/init" >}}): - - ```python - run = wandb.init( - project=PROJECT_NAME, name=run_name, tags=tags, notes=notes, config=config - ) - ``` - -As an experiment runs, you might want to log every instance of your metrics so they are available to view, query, and analyze with W&B. Use the [`run.log()`]({{< relref "/ref/python/experiments/run/#method-runlog" >}}) command to accomplish this: - -```python -run.log({key: val}) -``` - -You can optionally log a final summary metric to define the outcome of the run using the [`define_metric`]({{< relref "/ref/python/experiments/run#define_metric" >}}) API. This example adds the summary metrics to our run with `run.summary.update()`: - -```python -run.summary.update(summaries) -``` - -For more information about summary metrics, see [Log Summary Metrics]({{< relref "./log-summary.md" >}}). - -Below is the full example script that converts the above sample table into a [W&B Dashboard]({{< relref "/guides/models/track/workspaces.md" >}}): - -```python -FILENAME = "experiments.csv" -loaded_experiment_df = pd.read_csv(FILENAME) - -PROJECT_NAME = "Converted Experiments" - -EXPERIMENT_NAME_COL = "Experiment" -NOTES_COL = "Notes" -TAGS_COL = "Tags" -CONFIG_COLS = ["Num Layers"] -SUMMARY_COLS = ["Final Train Acc", "Final Val Acc"] -METRIC_COLS = ["Training Losses"] - -for i, row in loaded_experiment_df.iterrows(): - run_name = row[EXPERIMENT_NAME_COL] - notes = row[NOTES_COL] - tags = row[TAGS_COL] - - config = {} - for config_col in CONFIG_COLS: - config[config_col] = row[config_col] - - metrics = {} - for metric_col in METRIC_COLS: - metrics[metric_col] = row[metric_col] - - summaries = {} - for summary_col in SUMMARY_COLS: - summaries[summary_col] = row[summary_col] - - run = wandb.init( - project=PROJECT_NAME, name=run_name, tags=tags, notes=notes, config=config - ) - - for key, val in metrics.items(): - if isinstance(val, list): - for _val in val: - run.log({key: _val}) - else: - run.log({key: val}) - - run.summary.update(summaries) - run.finish() -``` \ No newline at end of file diff --git a/content/en/guides/models/track/project-page.md b/content/en/guides/models/track/project-page.md deleted file mode 100644 index 57f4376145..0000000000 --- a/content/en/guides/models/track/project-page.md +++ /dev/null @@ -1,358 +0,0 @@ ---- -description: Compare versions of your model, explore results in a scratch workspace, - and export findings to a report to save notes and visualizations -menu: - default: - identifier: project-page - parent: experiments -title: Projects -weight: 3 ---- - -A *project* is a central location where you visualize results, compare experiments, view and download artifacts, create an automation, and more. - -{{% alert %}} -Each project has a visibility setting that determines who can access it. For more information about who can access a project, see [Project visibility]({{< relref "/guides/hosting/iam/access-management/restricted-projects.md" >}}). -{{% /alert %}} - -Each project contains the following tabs: - -* [Overview]({{< relref "project-page.md#overview-tab" >}}): snapshot of your project -* [Workspace]({{< relref "project-page.md#workspace-tab" >}}): personal visualization sandbox -* [Runs]({{< relref "#runs-tab" >}}): A table that lists all the runs in your project -* [Automations]({{< relref "#automations-tab">}}): Automations configured in your project -* [Sweeps]({{< relref "project-page.md#sweeps-tab" >}}): automated exploration and optimization -* [Reports]({{< relref "project-page.md#reports-tab" >}}): saved snapshots of notes, runs, and graphs -* [Artifacts]({{< relref "#artifacts-tab" >}}): Contains all runs and the artifacts associated with that run - -## Overview tab - -* **Project name**: The name of the project. W&B creates a project for you when you initialize a run with the name you provide for the project field. You can change the name of the project at any time by selecting the **Edit** button in the upper right corner. -* **Description**: A description of the project. -* **Project visibility**: The visibility of the project. The visibility setting that determines who can access it. See [Project visibility]({{< relref "/guides/hosting/iam/access-management/restricted-projects.md" >}}) for more information. -* **Last active**: Timestamp of the last time data is logged to this project -* **Owner**: The entity that owns this project -* **Contributors**: The number of users that contribute to this project -* **Total runs**: The total number of runs in this project -* **Total compute**: we add up all the run times in your project to get this total -* **Undelete runs**: Click the dropdown menu and click "Undelete all runs" to recover deleted runs in your project. -* **Delete project**: click the dot menu in the right corner to delete a project - -[View a live example](https://app.wandb.ai/example-team/sweep-demo/overview) - -{{< img src="/images/track/overview_tab_image.png" alt="Project overview tab" >}} - -To change a project's privacy from the **Overview** tab: - -{{% readfile file="/content/en/_includes/project-visibility-settings.md" %}} - -## Workspace tab - -A project's *workspace* gives you a personal sandbox to compare experiments. Use projects to organize models that can be compared, working on the same problem with different architectures, hyperparameters, datasets, preprocessing etc. - - -**Runs Sidebar**: list of all the runs in your project. - -* **Dot menu**: hover over a row in the sidebar to see the menu appear on the left side. Use this menu to rename a run, delete a run, or stop and active run. -* **Visibility icon**: click the eye to turn on and off runs on graphs -* **Color**: change the run color to another one of our presets or a custom color -* **Search**: search runs by name. This also filters visible runs in the plots. -* **Filter**: use the sidebar filter to narrow down the set of runs visible -* **Group**: select a config column to dynamically group your runs, for example by architecture. Grouping makes plots show up with a line along the mean value, and a shaded region for the variance of points on the graph. -* **Sort**: pick a value to sort your runs by, for example runs with the lowest loss or highest accuracy. Sorting will affect which runs show up on the graphs. -* **Expand button**: expand the sidebar into the full table -* **Run count**: the number in parentheses at the top is the total number of runs in the project. The number (N visualized) is the number of runs that have the eye turned on and are available to be visualized in each plot. In the example below, the graphs are only showing the first 10 of 183 runs. Edit a graph to increase the max number of runs visible. - -If you pin, hide, or change the order of columns in the [Runs tab](#runs-tab), the Runs sidebar reflects these customizations. - -**Panels layout**: use this scratch space to explore results, add and remove charts, and compare versions of your models based on different metrics - -[View a live example](https://app.wandb.ai/example-team/sweep-demo) - -{{< img src="/images/app_ui/workspace_tab_example.png" alt="Project workspace" >}} - - -### Add a section of panels - -Click the section dropdown menu and click "Add section" to create a new section for panels. You can rename sections, drag them to reorganize them, and expand and collapse sections. - -Each section has options in the upper right corner: - -* **Add section**: Add a section above or below from the dropdown menu, or click the button at the bottom of the page to add a new section. -* **Rename section**: Change the title for your section. -* **Export section to report**: Save this section of panels to a new report. -* **Delete section**: Remove the whole section and all the charts. This can be undone with the undo button at the bottom of the page in the workspace bar. -* **Add panel**: Click the plus button to add a panel to the section. - -{{< img src="/images/app_ui/add-section.gif" alt="Adding workspace section" >}} - -### Move panels between sections - -Drag and drop panels to reorder and organize into sections. You can also click the "Move" button in the upper right corner of a panel to select a section to move the panel to. - -{{< img src="/images/app_ui/move-panel.gif" alt="Moving panels between sections" >}} - -### Resize panels - -All panels maintain the same size, and there are pages of panels. You can resize the panels by clicking and dragging the lower right corner. Resize the section by clicking and dragging the lower right corner of the section. - -{{< img src="/images/app_ui/resize-panel.gif" alt="Resizing panels" >}} - -### Search for metrics - -Use the search box in the workspace to filter down the panels. This search matches the panel titles, which are by default the name of the metrics visualized. - -{{< img src="/images/app_ui/search_in_the_workspace.png" alt="Workspace search" >}} - -## Runs tab - -Use the Runs tab to filter, group, and sort your runs. - -{{< img src="/images/runs/run-table-example.png" alt="Runs table" >}} - -The proceeding tabs demonstrate some common actions you can take in the Runs tab. - -{{< tabpane text=true >}} - {{% tab header="Customize columns" %}} -The Runs tab shows details about runs in the project. It shows a large number of columns by default. - -{{% alert %}} -When you customize the Runs tab, the customization is also reflected in the **Runs** selector of the [Workspace tab]({{< relref "#workspace-tab" >}}). -{{% /alert %}} - -- To view all visible columns, scroll the page horizontally. -- To change the order of the columns, drag a column to the left or right. -- To pin a column, hover over the column name, click the action menu `...`. that appears, then click **Pin column**. Pinned columns appear near the left of the page, after the **Name** column. To unpin a pinned column, choose **Unpin column**. -- To hide a column, hover over the column name, click the action menu `...`. that appears, then click **Hide column**. To view all columns that are currently hidden, click **Columns**. -- To show, hide, pin, and unpin multiple columns at once, click **Columns**. - - Click the name of a hidden column to unhide it. - - Click the name of a visible column to hide it. - - Click the pin icon next to a visible column to pin it. - - {{% /tab %}} - - {{% tab header="Sort" %}} -Sort all rows in a Table by the value in a given column. - -1. Hover your mouse over the column title. A kebab menu will appear (three vertical docs). -2. Select on the kebab menu (three vertical dots). -3. Choose **Sort Asc** or **Sort Desc** to sort the rows in ascending or descending order, respectively. - -{{< img src="/images/data_vis/data_vis_sort_kebob.png" alt="Confident predictions" >}} - -The preceding image demonstrates how to view sorting options for a Table column called `val_acc`. - {{% /tab %}} - {{% tab header="Filter" %}} -Filter all rows by an expression with the **Filter** button on the top left of the dashboard. - -{{< img src="/images/data_vis/filter.png" alt="Incorrect predictions filter" >}} - -Select **Add filter** to add one or more filters to your rows. Three dropdown menus will appear. From left to right the filter types are based on: Column name, Operator , and Values - -| | Column name | Binary relation | Value | -| ----------- | ----------- | ----------- | ----------- | -| Accepted values | String | =, ≠, ≤, ≥, IN, NOT IN, | Integer, float, string, timestamp, null | - - -The expression editor shows a list of options for each term using autocomplete on column names and logical predicate structure. You can connect multiple logical predicates into one expression using "and" or "or" (and sometimes parentheses). - -{{< img src="/images/data_vis/filter_example.png" alt="Filtering runs by validation loss" >}} -The preceding image shows a filter that is based on the `val_loss` column. The filter shows runs with a validation loss less than or equal to 1. - {{% /tab %}} - {{% tab header="Group" %}} -Group all rows by the value in a particular column with the **Group by** button in a column header. - -{{< img src="/images/data_vis/group.png" alt="Error distribution analysis" >}} - -By default, this turns other numeric columns into histograms showing the distribution of values for that column across the group. Grouping is helpful for understanding higher-level patterns in your data. - {{% /tab %}} -{{< /tabpane >}} - - - - -## Automations tab -Automate downstream actions for versioning artifacts. To create an automation, define trigger events and resulting actions. Actions include executing a webhook or launching a W&B job. For more information, see [Automations]({{< relref "/guides/core/automations/" >}}). - -{{< img src="/images/app_ui/automations_tab.png" alt="Automation tab" >}} - -## Reports tab - -See all the snapshots of results in one place, and share findings with your team. - -{{< img src="/images/app_ui/reports-tab.png" alt="Reports tab" >}} - -## Sweeps tab - -Start a new [sweep]({{< relref "/guides/models/sweeps/" >}}) from your project. - -{{< img src="/images/app_ui/sweeps-tab.png" alt="Sweeps tab" >}} - -## Artifacts tab - -View all [artifacts]({{< relref "/guides/core/artifacts/" >}}) associated with a project, from training datasets and [fine-tuned models]({{< relref "/guides/core/registry/" >}}) to [tables of metrics and media]({{< relref "/guides/models/tables/tables-walkthrough.md" >}}). - -### Overview panel - -{{< img src="/images/app_ui/overview_panel.png" alt="Artifact overview panel" >}} - -On the overview panel, you'll find a variety of high-level information about the artifact, including its name and version, the hash digest used to detect changes and prevent duplication, the creation date, and any aliases. You can add or remove aliases here, take notes on both the version as well as the artifact as a whole. - -### Metadata panel - -{{< img src="/images/app_ui/metadata_panel.png" alt="Artifact metadata panel" >}} - -The metadata panel provides access to the artifact's metadata, which is provided when the artifact is constructed. This metadata might include configuration arguments required to reconstruct the artifact, URLs where more information can be found, or metrics produced during the run which logged the artifact. Additionally, you can see the configuration for the run which produced the artifact as well as the history metrics at the time of logging the artifact. - -### Usage panel - -{{< img src="/images/app_ui/usage_panel.png" alt="Artifact usage panel" >}} - -The Usage panel provides a code snippet for downloading the artifact for use outside of the web app, for example on a local machine. This section also indicates and links to the run which output the artifact and any runs which use the artifact as an input. - -### Files panel - -{{< img src="/images/app_ui/files_panel.png" alt="Artifact files panel" >}} - -The files panel lists the files and folders associated with the artifact. W&B uploads certain files for a run automatically. For example, `requirements.txt` shows the versions of each library the run used, and `wandb-metadata.json`, and `wandb-summary.json` include information about the run. Other files may be uploaded, such as artifacts or media, depending on the run's configuration. You can navigate through this file tree and view the contents directly in the W&B web app. - -[Tables]({{< relref "/guides/models/tables//tables-walkthrough.md" >}}) associated with artifacts are particularly rich and interactive in this context. Learn more about using Tables with Artifacts [here]({{< relref "/guides/models/tables//visualize-tables.md" >}}). - -{{< img src="/images/app_ui/files_panel_table.png" alt="Artifact table view" >}} - -### Lineage panel - -{{< img src="/images/app_ui/lineage_panel.png" alt="Artifact lineage" >}} - -The lineage panel provides a view of all of the artifacts associated with a project and the runs that connect them to each other. It shows run types as blocks and artifacts as circles, with arrows to indicate when a run of a given type consumes or produces an artifact of a given type. The type of the particular artifact selected in the left-hand column is highlighted. - -Click the Explode toggle to view all of the individual artifact versions and the specific runs that connect them. - -### Action History Audit tab - -{{< img src="/images/app_ui/action_history_audit_tab_1.png" alt="Action history audit" >}} - -{{< img src="/images/app_ui/action_history_audit_tab_2.png" alt="Action history" >}} - -The action history audit tab shows all of the alias actions and membership changes for a Collection so you can audit the entire evolution of the resource. - -### Versions tab - -{{< img src="/images/app_ui/versions_tab.png" alt="Artifact versions tab" >}} - -The versions tab shows all versions of the artifact as well as columns for each of the numeric values of the Run History at the time of logging the version. This allows you to compare performance and quickly identify versions of interest. - -## Create a project -You can create a project in the W&B App or programmatically by specifying a project in a call to `wandb.init()`. - -{{< tabpane text=true >}} - {{% tab header="W&B App" %}} -In the W&B App, you can create a project from the **Projects** page or from a team's landing page. - -From the **Projects** page: -1. Click the global navigation icon in the upper left. The navigation sidebar opens. -1. In the **Projects** section of the navigation, click **View all** to open the project overview page. -1. Click **Create new project**. -1. Set **Team** to the name of the team that will own the project. -1. Specify a name for your project using the **Name** field. -1. Set **Project visibility**, which defaults to **Team**. -1. Optionally, provide a **Description**. -1. Click **Create project**. - -From a team's landing page: -1. Click the global navigation icon in the upper left. The navigation sidebar opens. -1. In the **Teams** section of the navigation, click the name of a team to open its landing page. -1. In the landing page, click **Create new project**. -1. **Team** is automatically set to the team that owns the landing page you were viewing. If necessary, change the team. -1. Specify a name for your project using the **Name** field. -1. Set **Project visibility**, which defaults to **Team**. -1. Optionally, provide a **Description**. -1. Click **Create project**. - - {{% /tab %}} - {{% tab header="Python SDK" %}} -To create a project programmatically, specify a `project` when calling `wandb.init()`. If the project does not yet exist, it is created automatically, and is owned by the specified entity. For example: - -```python -import wandb with wandb.init(entity="", project="") as run: run.log({"accuracy": .95}) -``` - -Refer to the [`wandb.init()` API reference]({{< relref "/ref/python/functions/init/#examples" >}}). - {{% /tab %}} -{{< /tabpane >}} - -## Star a project - -Add a star to a project to mark that project as important. Projects that you and your team mark as important with stars appear at the top of your organization's homepage. - - -For example, the proceeding image shows two projects that are marked as important, the `zoo_experiment` and `registry_demo`. Both projects appear within the top of the organization's homepage within the **Starred projects** section. -{{< img src="/images/track/star-projects.png" alt="Starred projects section" >}} - - -There are two ways to mark a project as important: within a project's overview tab or within your team's profile page. - -{{< tabpane text=true >}} - {{% tab header="Project overview" %}} -1. Navigate to your W&B project on the W&B App at `https://wandb.ai//`. -2. Select the **Overview** tab from the project sidebar. -3. Choose the star icon in the upper right corner next to the **Edit** button. - -{{< img src="/images/track/star-project-overview-tab.png" alt="Star project from overview" >}} - {{% /tab %}} - {{% tab header="Team profile" %}} -1. Navigate to your team's profile page at `https://wandb.ai//projects`. -2. Select the **Projects** tab. -3. Hover your mouse next to the project you want to star. Click on star icon that appears. - -For example, the proceeding image shows the star icon next to the "Compare_Zoo_Models" project. -{{< img src="/images/track/star-project-team-profile-page.png" alt="Star project from team page" >}} - {{% /tab %}} -{{< /tabpane >}} - - - - - -Confirm that your project appears on the landing page of your organization by clicking on the organization name in the top left corner of the app. - - -## Delete a project - -You can delete your project by clicking the three dots on the right of the overview tab. - -{{< img src="/images/app_ui/howto_delete_project.gif" alt="Delete project workflow" >}} - -If the project is empty, you can delete it by clicking the dropdown menu in the top-right and selecting **Delete project**. - -{{< img src="/images/app_ui/howto_delete_project_2.png" alt="Delete empty project" >}} - - - -## Add notes to a project - -Add notes to your project either as a description overview or as a markdown panel within your workspace. - -### Add description overview to a project - -Descriptions you add to your page appear in the **Overview** tab of your profile. - -1. Navigate to your W&B project -2. Select the **Overview** tab from the project sidebar -3. Choose Edit in the upper right hand corner -4. Add your notes in the **Description** field -5. Select the **Save** button - -{{% alert title="Create reports to create descriptive notes comparing runs" %}} -You can also create a W&B Report to add plots and markdown side by side. Use different sections to show different runs, and tell a story about what you worked on. -{{% /alert %}} - - -### Add notes to run workspace - -1. Navigate to your W&B project -2. Select the **Workspace** tab from the project sidebar -3. Choose the **Add panels** button from the top right corner -4. Select the **TEXT AND CODE** dropdown from the modal that appears -5. Select **Markdown** -6. Add your notes in the markdown panel that appears in your workspace \ No newline at end of file diff --git a/content/en/guides/models/track/public-api-guide.md b/content/en/guides/models/track/public-api-guide.md deleted file mode 100644 index 354e8de0f0..0000000000 --- a/content/en/guides/models/track/public-api-guide.md +++ /dev/null @@ -1,679 +0,0 @@ ---- -description: Import data from MLFlow, export or update data that you have saved to - W&B -menu: - default: - identifier: public-api-guide - parent: experiments -title: Import and export data -weight: 8 ---- - -Export data or import data with W&B Public APIs. - -{{% alert %}} -This feature requires python>=3.8 -{{% /alert %}} - -## Import data from MLFlow - -W&B supports importing data from MLFlow, including experiments, runs, artifacts, metrics, and other metadata. - -Install dependencies: - -```shell -# note: this requires py38+ -pip install wandb[importers] -``` - -Log in to W&B. Follow the prompts if you have not logged in before. - -```shell -wandb login -``` - -Import all runs from an existing MLFlow server: - -```py -from wandb.apis.importers.mlflow import MlflowImporter - -importer = MlflowImporter(mlflow_tracking_uri="...") - -runs = importer.collect_runs() -importer.import_runs(runs) -``` - -By default, `importer.collect_runs()` collects all runs from the MLFlow server. If you prefer to upload a special subset, you can construct your own runs iterable and pass it to the importer. - -```py -import mlflow -from wandb.apis.importers.mlflow import MlflowRun - -client = mlflow.tracking.MlflowClient(mlflow_tracking_uri) - -runs: Iterable[MlflowRun] = [] -for run in mlflow_client.search_runs(...): - runs.append(MlflowRun(run, client)) - -importer.import_runs(runs) -``` - -{{% alert %}} -You might need to [configure the Databricks CLI first](https://docs.databricks.com/dev-tools/cli/index.html) if you import from Databricks MLFlow. - -Set `mlflow-tracking-uri="databricks"` in the previous step. -{{% /alert %}} - -To skip importing artifacts, you can pass `artifacts=False`: - -```py -importer.import_runs(runs, artifacts=False) -``` - -To import to a specific W&B entity and project, you can pass a `Namespace`: - -```py -from wandb.apis.importers import Namespace - -importer.import_runs(runs, namespace=Namespace(entity, project)) -``` - - - -## Export Data - -Use the Public API to export or update data that you have saved to W&B. Before using this API, log data from your script. Check the [Quickstart]({{< relref "/guides/quickstart.md" >}}) for more details. - -**Use Cases for the Public API** - -- **Export Data**: Pull down a dataframe for custom analysis in a Jupyter Notebook. Once you have explored the data, you can sync your findings by creating a new analysis run and logging results, for example: `wandb.init(job_type="analysis")` -- **Update Existing Runs**: You can update the data logged in association with a W&B run. For example, you might want to update the config of a set of runs to include additional information, like the architecture or a hyperparameter that wasn't originally logged. - -See the [Generated Reference Docs]({{< relref "/ref/python/public-api/" >}}) for details on available functions. - -### Create an API key - -An API key authenticates your machine to W&B. You can generate an API key from your user profile. - -{{% alert %}} -For a more streamlined approach, you can generate an API key by going directly to the [W&B authorization page](https://wandb.ai/authorize). Copy the displayed API key and save it in a secure location such as a password manager. -{{% /alert %}} - -1. Click your user profile icon in the upper right corner. -1. Select **User Settings**, then scroll to the **API Keys** section. -1. Click **Reveal**. Copy the displayed API key. To hide the API key, reload the page. - - -### Find the run path - -To use the Public API, you'll often need the run path which is `//`. In the app UI, open a run page and click the [Overview tab ]({{< relref "/guides/models/track/runs/#overview-tab" >}})to get the run path. - - -### Export Run Data - -Download data from a finished or active run. Common usage includes downloading a dataframe for custom analysis in a Jupyter notebook, or using custom logic in an automated environment. - -```python -import wandb - -api = wandb.Api() -run = api.run("//") -``` - -The most commonly used attributes of a run object are: - -| Attribute | Meaning | -| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `run.config` | A dictionary of the run's configuration information, such as the hyperparameters for a training run or the preprocessing methods for a run that creates a dataset Artifact. Think of these as the run's inputs. | -| `run.history()` | A list of dictionaries meant to store values that change while the model is training such as loss. The command `run.log()` appends to this object. | -| `run.summary` | A dictionary of information that summarizes the run's results. This can be scalars like accuracy and loss, or large files. By default, `run.log()` sets the summary to the final value of a logged time series. The contents of the summary can also be set directly. Think of the summary as the run's outputs. | - -You can also modify or update the data of past runs. By default a single instance of an api object will cache all network requests. If your use case requires real time information in a running script, call `api.flush()` to get updated values. - -### Understanding different run attributes - -The following code snippet shows how to create a run, log some data, and then access the run's attributes: - -```python -import wandb -import random - -with wandb.init(project="public-api-example") as run: - n_epochs = 5 - config = {"n_epochs": n_epochs} - run.config.update(config) - for n in range(run.config.get("n_epochs")): - run.log( - {"val": random.randint(0, 1000), "loss": (random.randint(0, 1000) / 1000.00)} - ) -``` - -The following sections describe the different outputs for the above run object attributes - -##### `run.config` - -```python -{"n_epochs": 5} -``` - -#### `run.summary` - -```python -{ - "_runtime": 4, - "_step": 4, - "_timestamp": 1644345412, - "_wandb": {"runtime": 3}, - "loss": 0.041, - "val": 525, -} -``` - -### Sampling - -The default history method samples the metrics to a fixed number of samples (the default is 500, you can change this with the `samples` __ argument). If you want to export all of the data on a large run, you can use the `run.scan_history()` method. For more details see the [API Reference]({{< relref "/ref/python/public-api" >}}). - -### Querying Multiple Runs - -{{< tabpane text=true >}} - {{% tab header="DataFrame and CSVs" %}} -This example script finds a project and outputs a CSV of runs with name, configs and summary stats. Replace `` and `` with your W&B entity and the name of your project, respectively. - -```python -import pandas as pd -import wandb - -api = wandb.Api() -entity, project = "", "" -runs = api.runs(entity + "/" + project) - -summary_list, config_list, name_list = [], [], [] -for run in runs: - # .summary contains output keys/values for - # metrics such as accuracy. - # We call ._json_dict to omit large files - summary_list.append(run.summary._json_dict) - - # .config contains the hyperparameters. - # We remove special values that start with _. - config_list.append({k: v for k, v in run.config.items() if not k.startswith("_")}) - - # .name is the human-readable name of the run. - name_list.append(run.name) - -runs_df = pd.DataFrame( - {"summary": summary_list, "config": config_list, "name": name_list} -) - -runs_df.to_csv("project.csv") - -run.finish() -``` - {{% /tab %}} - {{% tab header="MongoDB Style" %}} -The W&B API also provides a way for you to query across runs in a project with api.runs(). The most common use case is exporting runs data for custom analysis. The query interface is the same as the one [MongoDB uses](https://docs.mongodb.com/manual/reference/operator/query). - -```python -runs = api.runs( - "username/project", - {"$or": [{"config.experiment_name": "foo"}, {"config.experiment_name": "bar"}]}, -) -print(f"Found {len(runs)} runs") -``` - {{% /tab %}} -{{< /tabpane >}} - - -Calling `api.runs` returns a `Runs` object that is iterable and acts like a list. By default the object loads 50 runs at a time in sequence as required, but you can change the number loaded per page with the `per_page` keyword argument. - -`api.runs` also accepts an `order` keyword argument. The default order is `-created_at`. To order results ascending, specify `+created_at`. You can also sort by config or summary values. For example, `summary.val_acc` or `config.experiment_name`. - -### Error Handling - -If errors occur while talking to W&B servers a `wandb.CommError` will be raised. The original exception can be introspected via the `exc` attribute. - -### Get the latest git commit through the API - -In the UI, click on a run and then click the Overview tab on the run page to see the latest git commit. It's also in the file `wandb-metadata.json` . Using the public API, you can get the git hash with `run.commit`. - -### Get a run's name and ID during a run - -After calling `wandb.init()` you can access the random run ID or the human readable run name from your script like this: - -- Unique run ID (8 character hash): `run.id` -- Random run name (human readable): `run.name` - -If you're thinking about ways to set useful identifiers for your runs, here's what we recommend: - -- **Run ID**: leave it as the generated hash. This needs to be unique across runs in your project. -- **Run name**: This should be something short, readable, and preferably unique so that you can tell the difference between different lines on your charts. -- **Run notes**: This is a great place to put a quick description of what you're doing in your run. You can set this with `wandb.init(notes="your notes here")` -- **Run tags**: Track things dynamically in run tags, and use filters in the UI to filter your table down to just the runs you care about. You can set tags from your script and then edit them in the UI, both in the runs table and the overview tab of the run page. See the detailed instructions [here]({{< relref "/guides/models/track/runs/tags.md" >}}). - -## Public API Examples - -### Export data to visualize in matplotlib or seaborn - -Check out our [API examples]({{< relref "/ref/python/public-api/" >}}) for some common export patterns. You can also click the download button on a custom plot or on the expanded runs table to download a CSV from your browser. - -### Read metrics from a run - -This example outputs timestamp and accuracy saved with `run.log({"accuracy": acc})` for a run saved to `"//"`. - -```python -import wandb - -api = wandb.Api() - -run = api.run("//") -if run.state == "finished": - for i, row in run.history().iterrows(): - print(row["_timestamp"], row["accuracy"]) -``` - -### Filter runs - -You can filters by using the MongoDB Query Language. - -#### Date - -```python -runs = api.runs( - "/", - {"$and": [{"created_at": {"$lt": "YYYY-MM-DDT##", "$gt": "YYYY-MM-DDT##"}}]}, -) -``` - -### Read specific metrics from a run - -To pull specific metrics from a run, use the `keys` argument. The default number of samples when using `run.history()` is 500. Logged steps that do not include a specific metric will appear in the output dataframe as `NaN`. The `keys` argument will cause the API to sample steps that include the listed metric keys more frequently. - -```python -import wandb - -api = wandb.Api() - -run = api.run("//") -if run.state == "finished": - for i, row in run.history(keys=["accuracy"]).iterrows(): - print(row["_timestamp"], row["accuracy"]) -``` - -### Compare two runs - -This will output the config parameters that are different between `run1` and `run2`. - -```python -import pandas as pd -import wandb - -api = wandb.Api() - -# replace with your , , and -run1 = api.run("//") -run2 = api.run("//") - - -df = pd.DataFrame([run1.config, run2.config]).transpose() - -df.columns = [run1.name, run2.name] -print(df[df[run1.name] != df[run2.name]]) -``` - -Outputs: - -``` - c_10_sgd_0.025_0.01_long_switch base_adam_4_conv_2fc -batch_size 32 16 -n_conv_layers 5 4 -optimizer rmsprop adam -``` - -### Update metrics for a run, after the run has finished - -This example sets the accuracy of a previous run to `0.9`. It also modifies the accuracy histogram of a previous run to be the histogram of `numpy_array`. - -```python -import wandb - -api = wandb.Api() - -run = api.run("//") -run.summary["accuracy"] = 0.9 -run.summary["accuracy_histogram"] = wandb.Histogram(numpy_array) -run.summary.update() -``` - -### Rename a metric in a completed run - -This example renames a summary column in your tables. - -```python -import wandb - -api = wandb.Api() - -run = api.run("//") -run.summary["new_name"] = run.summary["old_name"] -del run.summary["old_name"] -run.summary.update() -``` - -{{% alert %}} -Renaming a column only applies to tables. Charts will still refer to metrics by their original names. -{{% /alert %}} - - - -### Update config for an existing run - -This examples updates one of your configuration settings. - -```python -import wandb - -api = wandb.Api() - -run = api.run("//") -run.config["key"] = updated_value -run.update() -``` - -### Export system resource consumptions to a CSV file - -The snippet below would find the system resource consumptions and then, save them to a CSV. - -```python -import wandb - -run = wandb.Api().run("//") - -system_metrics = run.history(stream="events") -system_metrics.to_csv("sys_metrics.csv") -``` - -### Get unsampled metric data - -When you pull data from history, by default it's sampled to 500 points. Get all the logged data points using `run.scan_history()`. Here's an example downloading all the `loss` data points logged in history. - -```python -import wandb - -api = wandb.Api() - -run = api.run("//") -history = run.scan_history() -losses = [row["loss"] for row in history] -``` - -### Get paginated data from history - -If metrics are being fetched slowly on our backend or API requests are timing out, you can try lowering the page size in `scan_history` so that individual requests don't time out. The default page size is 500, so you can experiment with different sizes to see what works best: - -```python -import wandb - -api = wandb.Api() - -run = api.run("//") -run.scan_history(keys=sorted(cols), page_size=100) -``` - -### Export metrics from all runs in a project to a CSV file - -This script pulls down the runs in a project and produces a dataframe and a CSV of runs including their names, configs, and summary stats. Replace `` and `` with your W&B entity and the name of your project, respectively. - -```python -import pandas as pd -import wandb - -api = wandb.Api() -entity, project = "", "" -runs = api.runs(entity + "/" + project) - -summary_list, config_list, name_list = [], [], [] -for run in runs: - # .summary contains the output keys/values - # for metrics such as accuracy. - # We call ._json_dict to omit large files - summary_list.append(run.summary._json_dict) - - # .config contains the hyperparameters. - # We remove special values that start with _. - config_list.append({k: v for k, v in run.config.items() if not k.startswith("_")}) - - # .name is the human-readable name of the run. - name_list.append(run.name) - -runs_df = pd.DataFrame( - {"summary": summary_list, "config": config_list, "name": name_list} -) - -runs_df.to_csv("project.csv") -``` - -### Get the starting time for a run - -This code snippet retrieves the time at which the run was created. - -```python -import wandb - -api = wandb.Api() - -run = api.run("entity/project/run_id") -start_time = run.created_at -``` - -### Upload files to a finished run - -The code snippet below uploads a selected file to a finished run. - -```python -import wandb - -api = wandb.Api() - -run = api.run("entity/project/run_id") -run.upload_file("file_name.extension") -``` - -### Download a file from a run - -This finds the file "model-best.h5" associated with run ID uxte44z7 in the cifar project and saves it locally. - -```python -import wandb - -api = wandb.Api() - -run = api.run("//") -run.file("model-best.h5").download() -``` - -### Download all files from a run - -This finds all files associated with a run and saves them locally. - -```python -import wandb - -api = wandb.Api() - -run = api.run("//") -for file in run.files(): - file.download() -``` - -### Get runs from a specific sweep - -This snippet downloads all the runs associated with a particular sweep. - -```python -import wandb - -api = wandb.Api() - -sweep = api.sweep("//") -sweep_runs = sweep.runs -``` - -### Get the best run from a sweep - -The following snippet gets the best run from a given sweep. - -```python -import wandb - -api = wandb.Api() - -sweep = api.sweep("//") -best_run = sweep.best_run() -``` - -The `best_run` is the run with the best metric as defined by the `metric` parameter in the sweep config. - -### Download the best model file from a sweep - -This snippet downloads the model file with the highest validation accuracy from a sweep with runs that saved model files to `model.h5`. - -```python -import wandb - -api = wandb.Api() - -sweep = api.sweep("//") -runs = sorted(sweep.runs, key=lambda run: run.summary.get("val_acc", 0), reverse=True) -val_acc = runs[0].summary.get("val_acc", 0) -print(f"Best run {runs[0].name} with {val_acc}% val accuracy") - -runs[0].file("model.h5").download(replace=True) -print("Best model saved to model-best.h5") -``` - -### Delete all files with a given extension from a run - -This snippet deletes files with a given extension from a run. - -```python -import wandb - -api = wandb.Api() - -run = api.run("//") - -extension = ".png" -files = run.files() -for file in files: - if file.name.endswith(extension): - file.delete() -``` - -### Download system metrics data - -This snippet produces a dataframe with all the system resource consumption metrics for a run and then saves it to a CSV. - -```python -import wandb - -api = wandb.Api() - -run = api.run("//") -system_metrics = run.history(stream="events") -system_metrics.to_csv("sys_metrics.csv") -``` - -### Update summary metrics - -You can pass a dictionary to update summary metrics. - -```python -summary.update({"key": val}) -``` - -### Get the command that ran the run - -Each run captures the command that launched it on the run overview page. To pull this command down from the API, you can run: - -```python -import wandb - -api = wandb.Api() - -run = api.run("//") - -meta = json.load(run.file("wandb-metadata.json").download()) -program = ["python"] + [meta["program"]] + meta["args"] -``` \ No newline at end of file diff --git a/content/en/guides/models/track/reproduce_experiments.md b/content/en/guides/models/track/reproduce_experiments.md deleted file mode 100644 index fc940be30c..0000000000 --- a/content/en/guides/models/track/reproduce_experiments.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -menu: - default: - identifier: reproduce_experiments - parent: track -title: Reproduce experiments -weight: 7 ---- - -Reproduce an experiment that a team member creates to verify and validate their results. - -Before you reproduce an experiment, you need to make note of the: - -* Name of the project the run was logged to -* Name of the run you want to reproduce - -To reproduce an experiment: - -1. Navigate to the project where the run is logged to. -2. Select the **Workspace** tab in the left sidebar. -3. From the list of runs, select the run that you want to reproduce. -4. Click **Overview**. - -To continue, download the experiment's code at a given hash or clone the experiment's entire repository. - -{{< tabpane text=true >}} -{{% tab "Download Python script or notebook" %}} - -Download the experiment's Python script or notebook: - -1. In the **Command** field, make a note of the name of the script that created the experiment. -2. Select the **Code** tab in the left navigation bar. -3. Click **Download** next to the file that corresponds to the script or notebook. - - -{{% /tab %}} -{{% tab "GitHub" %}} - -Clone the GitHub repository your teammate used when creating the experiment. To do this: - -1. If necessary, gain access to the GitHub repository that your teammate used to create the experiment. -2. Copy the **Git repository** field, which contains the GitHub repository URL. -3. Clone the repository: - ```bash - git clone https://github.com/your-repo.git && cd your-repo - ``` -4. Copy and paste the **Git state** field into your terminal. The Git state is a set of Git commands that checks out the exact commit that your teammate used to create the experiment. Replace values specified in the proceeding code snippet with your own: - ```bash - git checkout -b "" 0123456789012345678901234567890123456789 - ``` - - - -{{% /tab %}} -{{< /tabpane >}} - -5. Select **Files** in the left navigation bar. -6. Download the `requirements.txt` file and store it in your working directory. This directory should contain either the cloned GitHub repository or the downloaded Python script or notebook. -7. (Recommended) Create a Python virtual environment. -8. Install the requirements specified in the `requirements.txt` file. - ```bash - pip install -r requirements.txt - ``` - -9. Now that you have the code and dependencies, you can run the script or notebook to reproduce the experiment. If you cloned a repository, you might need to navigate to the directory where the script or notebook is located. Otherwise, you can run the script or notebook from your working directory. - -{{< tabpane text=true >}} -{{% tab "Python notebook" %}} - -If you downloaded a Python notebook, navigate to the directory where you downloaded the notebook and run the following command in your terminal: -```bash -jupyter notebook -``` - -{{% /tab %}} -{{% tab "Python script" %}} - -If you downloaded a Python script, navigate to the directory where you downloaded the script and run the following command in your terminal; Replace values enclosed in `<>` with your own: - -```bash -python .py -``` - - -{{% /tab %}} -{{< /tabpane >}} \ No newline at end of file diff --git a/content/en/guides/models/track/runs/_index.md b/content/en/guides/models/track/runs/_index.md deleted file mode 100644 index bd9ae9bc1f..0000000000 --- a/content/en/guides/models/track/runs/_index.md +++ /dev/null @@ -1,623 +0,0 @@ ---- -description: Learn about the basic building block of W&B, Runs. -menu: - default: - identifier: what-are-runs - parent: experiments -title: What are runs? -weight: 5 -url: guides/runs -cascade: -- url: guides/runs/:filename ---- - - -A *run* is a single unit of computation logged by W&B. You can think of a W&B Run as an atomic element of your whole project. In other words, each run is a record of a specific computation, such as training a model and logging the results, hyperparameter sweeps, and so forth. - -Common patterns for initiating a run include, but are not limited to: - -* Training a model -* Changing a hyperparameter and conducting a new experiment -* Conducting a new machine learning experiment with a different model -* Logging data or a model as a [W&B Artifact]({{< relref "/guides/core/artifacts/" >}}) -* [Downloading a W&B Artifact]({{< relref "/guides/core/artifacts/download-and-use-an-artifact.md" >}}) - - -W&B stores runs that you create into [*projects*]({{< relref "/guides/models/track/project-page.md" >}}). You can view runs and their properties within the run's project workspace on the W&B App. You can also programmatically access run properties with the [`wandb.Api.Run`]({{< relref "/ref/python/experiments/run.md" >}}) object. - -Anything you log with `wandb.Run.log()` is recorded in that run. - -{{ %alert% }} -Pass your W&B entity to the `entity` variable in the code snippets below if you want to follow along. Your entity is your W&B username or team name. You can find it in the URL of your W&B App workspace. For example, if your workspace URL is `https://wandb.ai/nico/awesome-project`, then your entity is `nico`. -{{ /%alert% }} - -```python -import wandb - -entity = "nico" # Replace with your W&B entity -project = "awesome-project" - -with wandb.init(entity=entity, project=project) as run: - run.log({"accuracy": 0.9, "loss": 0.1}) -``` - -The first line imports the W&B Python SDK. The second line initializes a run in the project `awesome-project` under the entity `nico`. The third line logs the accuracy and loss of the model to that run. - -Within the terminal, W&B returns: - -```bash -wandb: Syncing run earnest-sunset-1 -wandb: ⭐️ View project at https://wandb.ai/nico/awesome-project -wandb: 🚀 View run at https://wandb.ai/nico/awesome-project/runs/1jx1ud12 -wandb: -wandb: -wandb: Run history: -wandb: accuracy ▁ -wandb: loss ▁ -wandb: -wandb: Run summary: -wandb: accuracy 0.9 -wandb: loss 0.5 -wandb: -wandb: 🚀 View run earnest-sunset-1 at: https://wandb.ai/nico/awesome-project/runs/1jx1ud12 -wandb: ⭐️ View project at: https://wandb.ai/nico/awesome-project -wandb: Synced 6 W&B file(s), 0 media file(s), 0 artifact file(s) and 0 other file(s) -wandb: Find logs at: ./wandb/run-20241105_111006-1jx1ud12/logs -``` - -The URL W&B returns in the terminal to redirects you to the run's workspace in the W&B App UI. Note that the panels generated in the workspace corresponds to the single point. - -{{< img src="/images/runs/single-run-call.png" alt="Single run workspace" >}} - -Logging a metrics at a single point of time might not be that useful. A more realistic example in the case of training discriminative models is to log metrics at regular intervals. For example, consider the proceeding code snippet: - -```python -import wandb -import random - -config = { - "epochs": 10, - "learning_rate": 0.01, -} - -with wandb.init(project="awesome-project", config=config) as run: - print(f"lr: {config['learning_rate']}") - - # Simulating a training run - for epoch in range(config['epochs']): - offset = random.random() / 5 - acc = 1 - 2**-epoch - random.random() / (epoch + 1) - offset - loss = 2**-epoch + random.random() / (epoch + 1) + offset - print(f"epoch={epoch}, accuracy={acc}, loss={loss}") - run.log({"accuracy": acc, "loss": loss}) -``` - -This returns the following output: - -```bash -wandb: Syncing run jolly-haze-4 -wandb: ⭐️ View project at https://wandb.ai/nico/awesome-project -wandb: 🚀 View run at https://wandb.ai/nico/awesome-project/runs/pdo5110r -lr: 0.01 -epoch=0, accuracy=-0.10070974957523078, loss=1.985328507123956 -epoch=1, accuracy=0.2884687745057535, loss=0.7374362314407752 -epoch=2, accuracy=0.7347387967382066, loss=0.4402409835486663 -epoch=3, accuracy=0.7667969248039795, loss=0.26176963846423457 -epoch=4, accuracy=0.7446848791003173, loss=0.24808611724405083 -epoch=5, accuracy=0.8035095836268268, loss=0.16169791827329466 -epoch=6, accuracy=0.861349032371624, loss=0.03432578493587426 -epoch=7, accuracy=0.8794926436276016, loss=0.10331872172219471 -epoch=8, accuracy=0.9424839917077272, loss=0.07767793473500445 -epoch=9, accuracy=0.9584880427028566, loss=0.10531971149250456 -wandb: 🚀 View run jolly-haze-4 at: https://wandb.ai/nico/awesome-project/runs/pdo5110r -wandb: Find logs at: wandb/run-20241105_111816-pdo5110r/logs -``` - -The training script calls `wandb.Run.log()` 10 times. Each time the script calls `wandb.Run.log()`, W&B logs the accuracy and loss for that epoch. Selecting the URL that W&B prints from the preceding output, directs you to the run's workspace in the W&B App UI. - -W&B captures the simulated training loop within a single run called `jolly-haze-4`. This is because the script calls `wandb.init()` method only once. - -{{< img src="/images/runs/run_log_example_2.png" alt="Training run with logged metrics" >}} - -As another example, during a [sweep]({{< relref "/guides/models/sweeps/" >}}), W&B explores a hyperparameter search space that you specify. W&B implements each new hyperparameter combination that the sweep creates as a unique run. - - -## Initialize a W&B Run - -Initialize a W&B Run with [`wandb.init()`]({{< relref "/ref/python/functions/init" >}}). The proceeding code snippet shows how to import the W&B Python SDK and initialize a run. - -Ensure to replace values enclosed in angle brackets (`< >`) with your own values: - -```python -import wandb - -with wandb.init(entity="", project="") as run: - # Your code here -``` - -When you initialize a run, W&B logs your run to the project you specify for the project field (`wandb.init(project=""`). W&B creates a new project if the project does not already exist. If the project already exists, W&B stores the run in that project. - -{{% alert %}} -If you do not specify a project name, W&B stores the run in a project called `Uncategorized`. -{{% /alert %}} - -Each run in W&B has a [unique identifier known as a *run ID*]({{< relref "#unique-run-identifiers" >}}). [You can specify a unique ID]({{< relref "#unique-run-identifiers" >}}) or let [W&B randomly generate one for you]({{< relref "#autogenerated-run-ids" >}}). - -Each run also has a human-readable, non-unique [run name]({{< relref "#name-your-run" >}}). You can specify a name for your run or let W&B randomly generate one for you. You can rename a run after initializing it. - -For example, consider the following code snippet: - -```python title="basic.py" -import wandb - -run = wandb.init(entity="wandbee", project="awesome-project") -``` -The code snippet produces the following output: - -```bash -🚀 View run exalted-darkness-6 at: -https://wandb.ai/nico/awesome-project/runs/pgbn9y21 -Find logs at: wandb/run-20241106_090747-pgbn9y21/logs -``` - -Since the preceding code did not specify an argument for the id parameter, W&B creates a unique run ID. Where `nico` is the entity that logged the run, `awesome-project` is the name of the project the run is logged to, `exalted-darkness-6` is the name of the run, and `pgbn9y21` is the run ID. - -{{% alert title="Notebook users" %}} -Specify `run.finish()` at the end of your run to mark the run finished. This helps ensure that the run is properly logged to your project and does not continue in the background. - -```python title="notebook.ipynb" -import wandb - -run = wandb.init(entity="", project="") -# Training code, logging, and so forth -run.finish() -``` -{{% /alert %}} - -If you [group runs]({{< relref "grouping.md" >}}) into experiments, you can move a run into or out of a group or from one group to another. - -Each run has a state that describes the current status of the run. See [Run states]({{< relref "#run-states" >}}) for a full list of possible run states. - -## Run states -The proceeding table describes the possible states a run can be in: - -| State | Description | -| ----- | ----- | -| `Crashed` | Run stopped sending heartbeats in the internal process, which can happen if the machine crashes. | -| `Failed` | Run ended with a non-zero exit status. | -| `Finished`| Run ended and fully synced data, or called `wandb.Run.finish()`. | -| `Killed` | Run was forcibly stopped before it could finish. | -| `Running` | Run is still running and has recently sent a heartbeat. | -| `Pending` | Run is scheduled but not yet started (common in sweeps and Launch jobs). | - -### Run states in sweeps - -When runs are part of a [sweep]({{< relref "/guides/models/sweeps/" >}}), their states behave independently from the sweep's status: - -- **Individual run states** reflect each run's execution status (Running, Finished, Failed, etc.) -- **Sweep status** controls whether new runs are created, not how existing runs execute -- Pausing or stopping a sweep doesn't affect already-running runs -- Only cancelling a sweep forcibly kills running runs (changes their state to `Killed`) - -For a detailed explanation of how sweep and run statuses interact, see [Understanding sweep and run statuses]({{< relref "/guides/models/sweeps/pause-resume-and-cancel-sweeps.md#understanding-sweep-and-run-statuses" >}}). - - -## Unique run identifiers - -Run IDs are unique identifiers for runs. By default, [W&B generates a random and unique run ID for you]({{< relref "#autogenerated-run-ids" >}}) when you initialize a new run. You can also [specify your own unique run ID]({{< relref "#custom-run-ids" >}}) when you initialize a run. - -### Autogenerated run IDs - -If you do not specify a run ID when you initialize a run, W&B generates a random run ID for you. You can find the unique ID of a run in the W&B App. - -1. Navigate to the [W&B App](https://wandb.ai/home). -2. Navigate to the W&B project you specified when you initialized the run. -3. Within your project's workspace, select the **Runs** tab. -4. Select the **Overview** tab. - -W&B displays the unique run ID in the **Run path** field. The run path consists of the name of your team, the name of the project, and the run ID. The unique ID is the last part of the run path. - -For example, in the proceeding image, the unique run ID is `9mxi1arc`: - -{{< img src="/images/runs/unique-run-id.png" alt="Run ID location" >}} - - -### Custom run IDs -You can specify your own run ID by passing the `id` parameter to the [`wandb.init()`]({{< relref "/ref/python/functions/init" >}}) method. - -```python -import wandb - -run = wandb.init(entity="", project="", id="") -``` - -You can use a run's unique ID to directly navigate to the run's overview page in the W&B App. The proceeding cell shows the URL path for a specific run: - -```text title="W&B App URL for a specific run" -https://wandb.ai/// -``` - -Where values enclosed in angle brackets (`< >`) are placeholders for the actual values of the entity, project, and run ID. - -## Name your run -The name of a run is a human-readable, non-unique identifier. - -By default, W&B generates a random run name when you initialize a new run. The name of a run appears within your project's workspace and at the top of the [run's overview page]({{< relref "#overview-tab" >}}). - -{{% alert %}} -Use run names as a way to quickly identify a run in your project workspace. -{{% /alert %}} - -You can specify a name for your run by passing the `name` parameter to the [`wandb.init()`]({{< relref "/ref/python/functions/init" >}}) method. - - -```python -import wandb - -with wandb.init(entity="", project="", name="") as run: - # Your code here -``` - -### Rename a run - -After you initialize a run, you can rename it from your workspace or its **Runs** page. - -1. Navigate to your W&B project. -1. Select the **Workspace** or **Runs** tab from the project sidebar. -1. Search or scroll to the run you want to rename. - - Hover over the run name, click the three vertical dots, then select the scope: - - **Rename run for project**: The run is renamed across the project. - - **Rename run for workspace**: The run is renamed only in this workspace. -1. Type a new name for the run. To generate a new random name, leave the field blank. -1. Submit the form. The run's new name displays. An information icon appears next to a run that has a custom name in the workspace. Hover over it for more details. - -You can also rename a run from a run set in a [report]({{< relref "/guides/core/reports/edit-a-report.md" >}}): - -1. In the report, click the pencil icon to open the report editor. -1. In the run set, find the run to rename. Hover over the report name, click the three vertical dots, then select either: - - - **Rename run for project**: rename the run across the entire project. To generate a new random name, leave the field blank. - - **Rename run for panel grid** rename the run only in the report, preserving the existing name in other contexts. Generating a new random name is not supported. - - Submit the form. -1. Click **Publish report**. - -## Add a note to a run -Notes that you add to a specific run appear on the run page in the **Overview** tab and in the table of runs on the project page. - -1. Navigate to your W&B project -2. Select the **Workspace** tab from the project sidebar -3. Select the run you want to add a note to from the run selector -4. Choose the **Overview** tab -5. Select the pencil icon next to the **Description** field and add your notes - -## Stop a run -Stop a run from the W&B App or programmatically. - -{{< tabpane text=true >}} - {{% tab header="Programmatically" %}} -1. Navigate to the terminal or code editor where you initialized the run. -2. Press `Ctrl+D` to stop the run. - -For example, following the preceding instructions, your terminal might looks similar to the following: - -```bash -KeyboardInterrupt -wandb: 🚀 View run legendary-meadow-2 at: https://wandb.ai/nico/history-blaster-4/runs/o8sdbztv -wandb: Synced 5 W&B file(s), 0 media file(s), 0 artifact file(s) and 1 other file(s) -wandb: Find logs at: ./wandb/run-20241106_095857-o8sdbztv/logs -``` - -Navigate to the W&B App to confirm the run is no longer active: - -1. Navigate to the project that your run was logging to. -2. Select the name of the run. - {{% alert %}} - You can find the name of the run that you stop from the output of your terminal or code editor. For example, in the preceding example, the name of the run is `legendary-meadow-2`. - {{% /alert %}} -3. Choose the **Overview** tab from the project sidebar. - -Next to the **State** field, the run's state changes from `running` to `Killed`. - -{{< img src="/images/runs/stop-run-terminal.png" alt="Run stopped via terminal" >}} - {{% /tab %}} - {{% tab header="W&B App" %}} - -1. Navigate to the project that your run is logging to. -2. Select the run you want to stop within the run selector. -3. Choose the **Overview** tab from the project sidebar. -4. Select the top button next to the **State** field. -{{< img src="/images/runs/stop-run-manual.png" alt="Manual run stop button" >}} - -Next to the **State** field, the run's state changes from `running` to `Killed`. - -{{< img src="/images/runs/stop-run-manual-status.png" alt="Run status after manual stop" >}} - {{% /tab %}} -{{< /tabpane >}} - -See [State fields]({{< relref "#run-states" >}}) for a full list of possible run states. - -## View logged runs - -View a information about a specific run such as the state of the run, artifacts logged to the run, log files recorded during the run, and more. - -{{< img src="/images/runs/demo-project.gif" alt="Project navigation demo" >}} - -To view a specific run: - -1. Navigate to the [W&B App](https://wandb.ai/home). -2. Navigate to the W&B project you specified when you initialized the run. -3. Within the project sidebar, select the **Workspace** tab. -4. Within the run selector, click the run you want to view, or enter a partial run name to filter for matching runs. - -Note that the URL path of a specific run has the proceeding format: - -```text -https://wandb.ai///runs/ -``` - -Where values enclosed in angle brackets (`< >`) are placeholders for the actual values of the team name, project name, and run ID. - -### Customize how runs are displayed -This section shows how to customize how runs are displayed in your project's workspace and runs table. - -{{% alert %}} -A workspace is limited to displaying a maximum of 1000 runs, regardless of its configuration. -{{% /alert %}} - -#### Add or remove columns - -To customize which columns are visible in the Runs table or Workspace: -1. In the project sidebar, select either the **Runs** tab or the **Workspace** tab. -1. Above the list of runs, click **Columns**. -1. Click the name of a hidden column to show it. Click the name of a visible column to hide it. - You can optionally search by column name using fuzzy search, an exact match, or regular expressions. Drag columns to change their order. -1. Click **Done** to close the column browser. - -#### Sort runs by column - -To sort the list of runs by any visible column: - -1. Hover over the column name, then click its action `...` menu. -1. Click **Sort ascending** or **Sort descending**. - -#### Pin columns - -Pinned columns are shown on the left-hand side. Unpinned columns are shown on the right-hand side of the **Runs** tab and are not shown on the **Workspace** tab. - -To pin a column: -1. In the project sidebar, navigate to the **Runs** tab. -1. Click **Pin column**. - -To unpin a column: -1. In the project sidebar, navigate to the **Workspace** or **Runs** tab. -1. Hover over the column name, then click its action `...` menu. -1. Click **Unpin column**. - -#### Customize run name truncation - -By default, long run names are truncated in the middle for readability. To customize the truncation of run names: - -1. Click the action `...` menu at the top of the list of runs. -1. Set **Run name cropping** to crop the end, middle, or beginning. - -### Overview tab -Use the **Overview** tab to learn about specific run information in a project, such as: - -* **Author**: The W&B entity that creates the run. -* **Command**: The command that initializes the run. -* **Description**: A description of the run that you provided. This field is empty if you do not specify a description when you create the run. You can add a description to a run with the W&B App UI or programmatically with the Python SDK. -* **Tracked Hours**: The amount of time the run is actively computing or logging data, excluding any pauses or waiting periods. This metric helps you understand the actual computational time spent on your run. -* **Runtime**: Measures the total time from the start to the end of the run. It's the wall-clock time for the run, including any time where the run is paused or waiting for resources. This metric provides the complete elapsed time for your run. -* **Git repository**: The git repository associated with the run. You must [enable git]({{< relref "/guides/models/app/settings-page/user-settings.md#personal-github-integration" >}}) to view this field. -* **Host name**: Where W&B computes the run. W&B displays the name of your machine if you initialize the run locally on your machine. -* **Name**: The name of the run. -* **OS**: Operating system that initializes the run. -* **Python executable**: The command that starts the run. -* **Python version**: Specifies the Python version that creates the run. -* **Run path**: Identifies the unique run identifier in the form `entity/project/run-ID`. -* **Start time**: The timestamp when you initialize the run. -* **State**: The [state of the run]({{< relref "#run-states" >}}). -* **System hardware**: The hardware W&B uses to compute the run. -* **Tags**: A list of strings. Tags are useful for organizing related runs together or applying temporary labels like `baseline` or `production`. -* **W&B CLI version**: The W&B CLI version installed on the machine that hosted the run command. -* **Git state**: The most recent git commit SHA of a repository or working directory where the run is initialized. This field is empty if you do not enable Git when you create the run or if the git information is not available. - -W&B stores the proceeding information below the overview section: - -* **Artifact Outputs**: Artifact outputs produced by the run. -* **Config**: List of config parameters saved with [`wandb.Run.config`]({{< relref "/guides/models/track/config.md" >}}). -* **Summary**: List of summary parameters saved with [`wandb.Run.log()`]({{< relref "/guides/models/track/log/" >}}). By default, W&B sets this value to the last value logged. - -{{< img src="/images/app_ui/wandb_run_overview_page.png" alt="W&B Dashboard run overview tab" >}} - -View an example project overview [here](https://wandb.ai/stacey/deep-drive/overview). - -### Workspace tab -Use the Workspace tab to view, search, group, and arrange visualizations such as autogenerated and custom plots, system metrics, and more. - -{{< img src="/images/app_ui/wandb-run-page-workspace-tab.png" alt="Run workspace tab" >}} - -View an example project workspace [here](https://wandb.ai/stacey/deep-drive/workspace?nw=nwuserstacey) - -### Runs tab - -Use the Runs tab to filter, group, and sort your runs. - -{{< img src="/images/runs/run-table-example.png" alt="Runs table" >}} - - - - -The proceeding tabs demonstrate some common actions you can take in the Runs tab. - -{{< tabpane text=true >}} - {{% tab header="Customize columns" %}} -The Runs tab shows details about runs in the project. It shows a large number of columns by default. - -- To view all visible columns, scroll the page horizontally. -- To change the order of the columns, drag a column to the left or right. -- To pin a column, hover over the column name, click the action menu `...`. that appears, then click **Pin column**. Pinned columns appear near the left of the page, after the **Name** column. To unpin a pinned column, choose **Unpin column** -- To hide a column, hover over the column name, click the action menu `...`. that appears, then click **Hide column**. To view all columns that are currently hidden, click **Columns**. -- To show, hide, pin, and unpin multiple columns at once, click **Columns**. - - Click the name of a hidden column to unhide it. - - Click the name of a visible column to hide it. - - Click the pin icon next to a visible column to pin it. - -When you customize the Runs tab, the customization is also reflected in the **Runs** selector of the [Workspace tab]({{< relref "#workspace-tab" >}}). - - {{% /tab %}} - - {{% tab header="Sort" %}} -Sort all rows in a Table by the value in a given column. - -1. Hover your mouse over the column title. A kebab menu will appear (three vertical docs). -2. Select on the kebab menu (three vertical dots). -3. Choose **Sort Asc** or **Sort Desc** to sort the rows in ascending or descending order, respectively. - -{{< img src="/images/data_vis/data_vis_sort_kebob.png" alt="Confident predictions" >}} - -The preceding image demonstrates how to view sorting options for a Table column called `val_acc`. - {{% /tab %}} - {{% tab header="Filter" %}} -Filter all rows by an expression with the **Filter** button above the dashboard. - -{{< img src="/images/data_vis/filter.png" alt="Incorrect predictions filter" >}} - -Select **Add filter** to add one or more filters to your rows. Three dropdown menus will appear. From left to right the filter types are based on: Column name, Operator , and Values - -| | Column name | Binary relation | Value | -| ----------- | ----------- | ----------- | ----------- | -| Accepted values | String | =, ≠, ≤, ≥, IN, NOT IN, | Integer, float, string, timestamp, null | - - -The expression editor shows a list of options for each term using autocomplete on column names and logical predicate structure. You can connect multiple logical predicates into one expression using "and" or "or" (and sometimes parentheses). - -{{< img src="/images/data_vis/filter_example.png" alt="Run filtering example" >}} -The preceding image shows a filter that is based on the `val_loss` column. The filter shows runs with a validation loss less than or equal to 1. - {{% /tab %}} - {{% tab header="Group" %}} -Group all rows by the value in a particular column with the **Group by** button above the dashboard. - -{{< img src="/images/data_vis/group.png" alt="Error distribution analysis" >}} - -By default, this turns other numeric columns into histograms that each show the distribution of values for that column across the group. Grouping is helpful for understanding higher-level patterns in your data. - -{{% alert %}} -The **Group by** feature is distinct from a [run's run group]({{< relref "grouping.md" >}}). You can group runs by run group. To move a run to a different run group, refer to [Assign a group or job type to a run]({{< relref "#assign-a-group-or-job-type-to-a-run" >}}). -{{% /alert %}} - - {{% /tab %}} -{{< /tabpane >}} - -### Logs tab -The **Log tab** shows output printed on the command line such as the standard output (`stdout`) and standard error (`stderr`). - -Choose the **Download** button in the upper right hand corner to download the log file. - -{{< img src="/images/app_ui/wandb_run_page_log_tab.png" alt="Run logs tab" >}} - -View an example logs tab [here](https://app.wandb.ai/stacey/deep-drive/runs/pr0os44x/logs). - -### Files tab -Use the **Files tab** to view files associated with a specific run such as model checkpoints, validation set examples, and more - -{{< img src="/images/app_ui/wandb_run_page_files_tab.png" alt="Run files tab" >}} - -View an example files tab [here](https://app.wandb.ai/stacey/deep-drive/runs/pr0os44x/files/media/images). - -### Artifacts tab -The **Artifacts** tab lists the input and output [artifacts]({{< relref "/guides/core/artifacts/" >}}) for the specified run. - -{{< img src="/images/app_ui/artifacts_tab.png" alt="Run artifacts tab" >}} - -View [example artifact graphs]({{< relref "/guides/core/artifacts/explore-and-traverse-an-artifact-graph.md" >}}). - -## Delete runs - -Delete one or more runs from a project with the W&B App. - -1. Navigate to the project that contains the runs you want to delete. -2. Select the **Runs** tab from the project sidebar. -3. Select the checkbox next to the runs you want to delete. -4. Choose the **Delete** button (trash can icon) above the table. -5. From the modal that appears, choose **Delete**. - -{{% alert %}} -Once a run with a specific ID is deleted, its ID may not be used again. Trying to initiate a run with a previously deleted ID will show an error and prevent initiation. -{{% /alert %}} - -{{% alert %}} -For projects that contain a large number of runs, you can use either the search bar to filter runs you want to delete using Regex or the filter button to filter runs based on their status, tags, or other properties. -{{% /alert %}} - -### Run deletion workflow - -The following diagram illustrates the complete run deletion process, including the handling of associated artifacts and Model Registry links: - -```mermaid -graph TB - Start([User Initiates
Run Deletion]) --> RunSelect[Select Runs
to Delete] - - RunSelect --> DeletePrompt{Delete Associated
Artifacts?} - - DeletePrompt -->|No| DeleteRunOnly[Delete Run Only

- Run metadata removed
- Artifacts remain available
- Can still access artifacts] - - DeletePrompt -->|Yes| CheckArtifacts[Check for
Associated Artifacts] - - CheckArtifacts --> HasRegistry{Artifacts Linked to
Model Registry?} - - HasRegistry -->|Yes| RegistryWarning[⚠️ Warning

Registry models will be deleted
Production aliases affected] - HasRegistry -->|No| DirectDelete - - RegistryWarning --> ConfirmRegistry{Confirm Registry
Model Deletion?} - - ConfirmRegistry -->|No| DeleteRunOnly - ConfirmRegistry -->|Yes| DirectDelete[Delete Run + Artifacts

- Run metadata removed
- Artifacts permanently deleted
- Registry links removed
- Cannot be recovered] - - DeleteRunOnly --> PartialEnd([Run Deleted
Artifacts Preserved]) - DirectDelete --> FullEnd([Run + Artifacts
Permanently Deleted]) - - style Start fill:#e1f5fe,stroke:#333,stroke-width:2px,color:#000 - style DeletePrompt fill:#fff3e0,stroke:#333,stroke-width:2px,color:#000 - style RegistryWarning fill:#ffecb3,stroke:#333,stroke-width:2px,color:#000 - style DirectDelete fill:#ffebee,stroke:#333,stroke-width:2px,color:#000 - style DeleteRunOnly fill:#e8f5e9,stroke:#333,stroke-width:2px,color:#000 - style PartialEnd fill:#c8e6c9,stroke:#333,stroke-width:2px,color:#000 - style FullEnd fill:#ffcdd2,stroke:#333,stroke-width:2px,color:#000 -``` - -{{% alert title="Important" %}} -When you delete a run and choose to delete associated artifacts, the artifacts are permanently removed and can't be recovered, even if the run is restored later. This includes models linked to the Model Registry. -{{% /alert %}} - -## Organize runs - -This section provides instructions on how to organize runs using groups and job types. By assigning runs to groups (for example, experiment names) and specifying job types (for example, preprocessing, training, evaluation, debugging), you can streamline your workflow and improve model comparison. - -### Assign a group or job type to a run - -Each run in W&B can be categorized by **group** and a **job type**: - -- **Group**: a broad category for the experiment, used to organize and filter runs. -- **Job type**: the function of the run, such as `preprocessing`, `training`, or `evaluation`. - -The proceeding [example workspace](https://wandb.ai/stacey/model_iterz?workspace=user-stacey), trains a baseline model using increasing amounts of data from the Fashion-MNIST dataset. The workspace uses colors to represent the amount of data used: - -- **Yellow to dark green** indicate increasing amounts of data for the baseline model. -- **Light blue to violet to magenta** indicate amounts of data for a more complex "double" model with additional parameters. - -Use W&B's filtering options and search bar to compare runs based on specific conditions, such as: -- Training on the same dataset. -- Evaluating on the same test set. - -When you apply filters, the **Table** view is updated automatically. This allows you to identify performance differences between models, such as determining which classes are significantly more challenging for one model compared to another. - - diff --git a/content/en/guides/models/track/runs/alert.md b/content/en/guides/models/track/runs/alert.md deleted file mode 100644 index 151fa83475..0000000000 --- a/content/en/guides/models/track/runs/alert.md +++ /dev/null @@ -1,106 +0,0 @@ ---- -description: Send alerts, triggered from your Python code, to your Slack or email -menu: - default: - identifier: alert - parent: what-are-runs -title: Send an alert ---- - -{{< cta-button colabLink="https://wandb.me/alerts-colab" >}} - -Create alerts with Slack or email if your run crashes or with a custom trigger. For example, you can create an alert if the gradient of your training loop starts to blow up (reports NaN) or a step in your ML pipeline completes. Alerts apply to all projects where you initialize runs, including both personal and team projects. - - -And then see W&B Alerts messages in Slack (or your email): - -{{< img src="/images/track/send_alerts_slack.png" alt="Slack alert setup" >}} - -{{% alert %}} -W&B Alerts require you to add `run.alert()` to your code. Without modifying your code, [Automations]({{< relref "/guides/core/automations/" >}}) provide another way to notify Slack based on an event in W&B, such as when an [artifact]({{< relref "/guides/core/artifacts" >}}) artifact version is created or when a [run metric]({{< relref "/guides/models/track/runs.md" >}}) meets or changes by a threshold. - -For example, an automation can notify a Slack channel when a new version is created, run an automated testing webhook when the `production` alias is added to an artifact, or start a validation job only when a run's `loss` is within acceptable bounds. - -Read the [Automations overview]({{< relref "/guides/core/automations/" >}}) or [create an automation]({{< relref "/guides/core/automations/create-automations/" >}}). -{{% /alert %}} - - -## Create an alert - -{{% alert %}} -The following guide only applies to alerts in multi-tenant cloud. - -If you're using [W&B Server]({{< relref "/guides/hosting/" >}}) in your Private Cloud or on W&B Dedicated Cloud, refer to [Configure Slack alerts in W&B Server]({{< relref "/guides/hosting/monitoring-usage/slack-alerts.md" >}}) to set up Slack alerts. -{{% /alert %}} - -To set up an alert, take these steps, which are detailed in the following sections: - -1. Turn on Alerts in your W&B [User Settings](https://wandb.ai/settings). -2. Add `run.alert()` to your code. -3. Test the configuration. - -### 1. Turn on alerts in your W&B User Settings - -In your [User Settings](https://wandb.ai/settings): - -* Scroll to the **Alerts** section -* Turn on **Scriptable run alerts** to receive alerts from `run.alert()` -* Use **Connect Slack** to pick a Slack channel to post alerts. We recommend the **Slackbot** channel because it keeps the alerts private. -* **Email** will go to the email address you used when you signed up for W&B. We recommend setting up a filter in your email so all these alerts go into a folder and don't fill up your inbox. - -You will only have to do this the first time you set up W&B Alerts, or when you'd like to modify how you receive alerts. - -{{< img src="/images/track/demo_connect_slack.png" alt="Alerts settings in W&B User Settings" >}} - -### 2. Add `run.alert()` to your code - -Add `run.alert()` to your code (either in a Notebook or Python script) wherever you'd like it to be triggered - -```python -import wandb - -run = wandb.init() -run.alert(title="High Loss", text="Loss is increasing rapidly") -``` - -### 3. Test the configuration - -Check your Slack or emails for the alert message. If you didn't receive any, make sure you've got emails or Slack turned on for **Scriptable Alerts** in your [User Settings](https://wandb.ai/settings) - -## Example - -This simple alert sends a warning when accuracy falls below a threshold. In this example, it only sends alerts at least 5 minutes apart. - -```python -import wandb -from wandb import AlertLevel - -run = wandb.init() - -if acc < threshold: - run.alert( - title="Low accuracy", - text=f"Accuracy {acc} is below the acceptable threshold {threshold}", - level=AlertLevel.WARN, - wait_duration=300, - ) -``` - - -## Tag or mention users - -Use the at sign `@` followed by the Slack user ID to tag yourself or your colleagues in either the title or the text of the alert. You can find a Slack user ID from their Slack profile page. - -```python -run.alert(title="Loss is NaN", text=f"Hey <@U1234ABCD> loss has gone to NaN") -``` - -## Configure team alerts - -Team admins can set up alerts for the team on the team settings page: `wandb.ai/teams/your-team`. - -Team alerts apply to everyone on your team. W&B recommends using the **Slackbot** channel because it keeps alerts private. - -## Change Slack channel to send alerts to - -To change what channel alerts are sent to, click **Disconnect Slack** and then reconnect. After you reconnect, pick a different Slack channel. \ No newline at end of file diff --git a/content/en/guides/models/track/runs/color-code-runs.md b/content/en/guides/models/track/runs/color-code-runs.md deleted file mode 100644 index c033c35e9d..0000000000 --- a/content/en/guides/models/track/runs/color-code-runs.md +++ /dev/null @@ -1,126 +0,0 @@ ---- -description: Create semantic legends for charts -menu: - default: - identifier: color-code-runs - parent: what-are-runs -title: Semantic run plot legends ---- - -Create visually meaningful line plots and plot legends by color-coding your W&B runs based on metrics or configuration parameters. Identify patterns and trends across experiments by coloring runs according to their performance metrics (highest, lowest, or latest values). W&B automatically groups your runs into color-coded buckets based on the values of your selected parameter. - -To use metric or configuration-based colors for your runs, you need to configure two settings: - -### Turn on key-based colors - -1. Navigate to your W&B project. -2. Select the **Workspace** tab from the project sidebar. -3. Click on the **Settings** icon in the top right corner. -4. From the drawer, select **Runs**. -5. In the **Run colors** section, select **Key-based colors**. -6. Configure the following options: - - From the **Key** dropdown, select the metric you want to use for assigning colors to runs. - - From the **Y value** dropdown, select the y value you want to use for assigning colors to runs. - - Set the number of buckets to a value from 2 to 8. - -{{% alert %}} -When you use key-based colors, the option to [customize run colors]({{ relref "/guides/track/runs/run-colors.md" }}) is not available. -{{% /alert %}} - -The following sections describe how to set the metric and y value and as how to customize the buckets used for assigning colors to runs. - -### Example: Key-based coloring with loss metric - -In this example plot, runs are colored with a gradient where darker colors represent higher loss values and lighter colors represent lower loss values. The Y value is set to `latest` to use the most recent loss value for each run. - -{{< img src="/images/app_ui/run-colors-key-based.png" alt="W&B workspace showing runs colored based on their loss values using key-based coloring.">}} - -## Set a metric - -The metric options in your **Key** dropdown are derived from the key-value pairs [you log to W&B]({{< relref "guides/models/track/runs/color-code-runs/#custom-metrics" >}}) and [default metrics]({{< relref "guides/models/track/runs/color-code-runs/#default-metrics" >}}) defined by W&B. - -### Default metrics - -* `Relative Time (Process)`: The relative time of the run, measured in seconds since the start of the run. -* `Relative Time (Wall)`: The relative time of the run, measured in seconds since the start of the run, adjusted for wall clock time. -* `Wall Time`: The wall clock time of the run, measured in seconds since the epoch. -* `Step`: The step number of the run, which is typically used to track the progress of training or evaluation. - -### Custom metrics - -Color runs and create meaningful plot legends based on custom metrics logged by your training or evaluation scripts. Custom metrics are logged as key-value pairs, where the key is the name of the metric and the value is the metric value. - -For example, the following code snippet logs accuracy (`"acc"` key) and loss (`"loss"` key) during a training loop: - -```python -import wandb -import random - -epochs = 10 - -with wandb.init(project="basic-intro") as run: - # Block simulates a training loop logging metrics - offset = random.random() / 5 - for epoch in range(2, epochs): - acc = 1 - 2 ** -epoch - random.random() / epoch - offset - loss = 2 ** -epoch + random.random() / epoch + offset - - # Log metrics from your script to W&B - run.log({"acc": acc, "loss": loss}) -``` - -Within the **Key** dropdown, both `"acc"` and `"loss"` are available options. - -## Set a configuration key - -The configuration options in your **Key** dropdown are derived from the key-value pairs you pass to the `config` parameter when you initialize a W&B run. Configuration keys are typically used to log hyperparameters or other settings used in your training or evaluation scripts. - -```python -import wandb - -config = { - "learning_rate": 0.01, - "batch_size": 32, - "optimizer": "adam" -} - -with wandb.init(project="basic-intro", config=config) as run: - # Your training code here - pass -``` - -Within the **Key** dropdown, `"learning_rate"`, `"batch_size"`, and `"optimizer"` are available options. - -## Set a y value - -You can choose from the following options: - -- **Latest**: Determine color based on Y value at last logged step for each line. -- **Max**: Color based on highest Y value logged against the metric. -- **Min**: Color based on lowest Y value logged against the metric. - -## Customize buckets - -Buckets are ranges of values that W&B uses to categorize runs based on the metric or configuration key you select. Buckets are evenly distributed across the range of values for the specified metric or configuration key and each bucket is assigned a unique color. Runs that fall within that bucket's range are displayed in that color. - -Consider the following: - -{{< img src="/images/track/color-coding-runs.png" alt="Color coded runs" >}} - -- **Key** is set to `"Accuracy"` (abbreviated as `"acc"`). -- **Y value** is set to `"Max"` - -With this configuration, W&B colors each run based on their accuracy values. The colors vary from a light yellow color to a deep color. Lighter colors represent lower accuracy values, while deeper colors represent higher accuracy values. - -Six buckets are defined for the metric, with each bucket representing a range of accuracy values. Within the **Buckets** section, the following range of buckets are defined: - -- Bucket 1: (Min - 0.7629) -- Bucket 2: (0.7629 - 0.7824) -- Bucket 3: (0.7824 - 0.8019) -- Bucket 4: (0.8019 - 0.8214) -- Bucket 5: (0.8214 - 0.8409) -- Bucket 6: (0.8409 - Max) - -In the line plot below, the run with the highest accuracy (0.8232) is colored in a deep purple (Bucket 5), while the run with the lowest accuracy (0.7684) is colored in a light orange (Bucket 2). The other runs are colored based on their accuracy values, with the color gradient indicating their relative performance. - -{{< img src="/images/track/color-code-runs-plot.png" alt="Color coded runs plot" >}} diff --git a/content/en/guides/models/track/runs/filter-runs.md b/content/en/guides/models/track/runs/filter-runs.md deleted file mode 100644 index ebdfbc4537..0000000000 --- a/content/en/guides/models/track/runs/filter-runs.md +++ /dev/null @@ -1,96 +0,0 @@ ---- -description: How to use the sidebar and table on the project page -menu: - default: - identifier: filter-runs - parent: what-are-runs -title: Filter and search runs ---- - -Use your project page to gain insights from runs logged to W&B. You can filter and search runs from both the **Workspace** page and the **Runs** page. - -## Filter runs - -Filter runs based on their status, [tags]({{< relref "#filter-runs-with-tags" >}}), [regular expressions (RegEx)]({{< relref "#filter-runs-with-regular-expressions-regex" >}}) or other properties with the filter button. - -See Customize run colors for more information on how to [edit, randomize, and reset run colors]({{< relref "guides/models/track/runs/run-colors" >}}). - -### Filter runs with tags - -Filter runs based on their tags with the filter button. - -1. Click on the **Runs** tab from the project sidebar. -2. Select the **Filter** button, which looks like a funnel, at the top of the runs table. -3. From left to right, select `"Tags"` from the dropdown menu, select a logic operator, and select a filter search value. - -### Filter runs with regex - -If regex doesn't provide you the desired results, you can make use of [tags]({{< relref "tags.md" >}}) to filter out the runs in Runs Table. Tags can be added either on run creation or after they're finished. Once the tags are added to a run, you can add a tag filter as shown in the gif below. - -{{< img src="/images/app_ui/filter_runs.gif" alt="Filter runs by tags" >}} - -1. Click on the **Runs** tab from the project sidebar. -2. Click on the search box at the top of the runs table. -3. Ensure that the **RegEx** toggle (.*) is enabled (the toggle should be blue). -4. Enter your regular expression in the search box. - -## Search runs - -Use regular expressions (RegEx) to find runs with the regular expression you specify. When you type a query in the search box, that will filter down the visible runs in the graphs on the workspace as well as filtering the rows of the table. - -## Group runs - -To group runs by one or more columns (including hidden columns): - -1. Below the search box, click the **Group** button, which looks like a lined sheet of paper. -1. Select one or more columns to group results by. -1. Each set of grouped runs is collapsed by default. To expand it, click the arrow next to the group name. - -## Sort runs by minimum and maximum values -Sort the runs table by the minimum or maximum value of a logged metric. This is particularly useful if you want to view the best (or worst) recorded value. - -The following steps describe how to sort the run table by a specific metric based on the minimum or maximum recorded value: - -1. Hover your mouse over the column with the metric you want to sort with. -2. Select the kebab menu (three vertical lines). -3. From the dropdown, select either **Show min** or **Show max**. -4. From the same dropdown, select **Sort by asc** or **Sort by desc** to sort in ascending or descending order, respectively. - -{{< img src="/images/app_ui/runs_min_max.gif" alt="Sort by min/max values" >}} - -## Search End Time for runs - -We provide a column named `End Time` that logs that last heartbeat from the client process. The field is hidden by default. - -{{< img src="/images/app_ui/search_run_endtime.png" alt="End Time column" >}} - -## Export runs table to CSV - -Export the table of all your runs, hyperparameters, and summary metrics to a CSV with the download button. - -{{< img src="/images/app_ui/export_to_csv.gif" alt="Modal with preview of export to CSV" >}} - - - - - - - \ No newline at end of file diff --git a/content/en/guides/models/track/runs/forking.md b/content/en/guides/models/track/runs/forking.md deleted file mode 100644 index ceafe697e9..0000000000 --- a/content/en/guides/models/track/runs/forking.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -description: Forking a W&B run -menu: - default: - identifier: forking - parent: what-are-runs -title: Fork a run ---- - -{{% alert color="secondary" %}} -The ability to fork a run is in private preview. Contact W&B Support at support@wandb.com to request access to this feature. -{{% /alert %}} - -Use `fork_from` when you initialize a run with [`wandb.init()`]({{< relref "/ref/python/functions/init" >}}) to "fork" from an existing W&B run. When you fork from a run, W&B creates a new run using the `run ID` and `step` of the source run. - -Forking a run enables you to explore different parameters or models from a specific point in an experiment without impacting the original run. - -{{% alert %}} -* Forking a run requires [`wandb`](https://pypi.org/project/wandb/) SDK version >= 0.16.5 -* Forking a run requires monotonically increasing steps. You can not use non-monotonic steps defined with [`define_metric()`]({{< relref "/ref/python/experiments/run#define_metric" >}}) to set a fork point because it would disrupt the essential chronological order of run history and system metrics. -{{% /alert %}} - - -## Start a forked run - -To fork a run, use the `fork_from` argument in [`wandb.init()`]({{< relref "/ref/python/functions/init" >}}) and specify the source `run ID` and the `step` from the source run to fork from: - -```python -import wandb - -# Initialize a run to be forked later -original_run = wandb.init(project="your_project_name", entity="your_entity_name") -# ... perform training or logging ... -original_run.finish() - -# Fork the run from a specific step -forked_run = wandb.init( - project="your_project_name", - entity="your_entity_name", - fork_from=f"{original_run.id}?_step=200", -) -``` - -### Using an immutable run ID - -Use an immutable run ID to ensure you have a consistent and unchanging reference to a specific run. Follow these steps to obtain the immutable run ID from the user interface: - -1. **Access the Overview Tab:** Navigate to the [**Overview** tab]({{< relref "./#overview-tab" >}}) on the source run's page. - -2. **Copy the Immutable Run ID:** Click on the `...` menu (three dots) located in the top-right corner of the **Overview** tab. Select the `Copy Immutable Run ID` option from the dropdown menu. - -By following these steps, you will have a stable and unchanging reference to the run, which can be used for forking a run. - -## Continue from a forked run -After initializing a forked run, you can continue logging to the new run. You can log the same metrics for continuity and introduce new metrics. - -For example, the following code example shows how to first fork a run and then how to log metrics to the forked run starting from a training step of 200: - -```python -import wandb -import math - -# Initialize the first run and log some metrics -run1 = wandb.init("your_project_name", entity="your_entity_name") -for i in range(300): - run1.log({"metric": i}) -run1.finish() - -# Fork from the first run at a specific step and log the metric starting from step 200 -run2 = wandb.init( - "your_project_name", entity="your_entity_name", fork_from=f"{run1.id}?_step=200" -) - -# Continue logging in the new run -# For the first few steps, log the metric as is from run1 -# After step 250, start logging the spikey pattern -for i in range(200, 300): - if i < 250: - run2.log({"metric": i}) # Continue logging from run1 without spikes - else: - # Introduce the spikey behavior starting from step 250 - subtle_spike = i + (2 * math.sin(i / 3.0)) # Apply a subtle spikey pattern - run2.log({"metric": subtle_spike}) - # Additionally log the new metric at all steps - run2.log({"additional_metric": i * 1.1}) -run2.finish() -``` - -{{% alert title="Rewind and forking compatibility" %}} -Forking compliments a [`rewind`]({{< relref "/guides/models/track/runs/rewind" >}}) by providing more flexibility in managing and experimenting with your runs. - -When you fork from a run, W&B creates a new branch off a run at a specific point to try different parameters or models. - -When you rewind a run, W&B let's you correct or modify the run history itself. -{{% /alert %}} diff --git a/content/en/guides/models/track/runs/grouping.md b/content/en/guides/models/track/runs/grouping.md deleted file mode 100644 index 31f984bdfb..0000000000 --- a/content/en/guides/models/track/runs/grouping.md +++ /dev/null @@ -1,109 +0,0 @@ ---- -description: Group training and evaluation runs into larger experiments -menu: - default: - identifier: grouping - parent: what-are-runs -title: Group runs into experiments ---- - -Group individual jobs into experiments by passing a unique **group** name to **wandb.init()**. - -## Use cases - -1. **Distributed training:** Use grouping if your experiments are split up into different pieces with separate training and evaluation scripts that should be viewed as parts of a larger whole. -2. **Multiple processes**: Group multiple smaller processes together into an experiment. -3. **K-fold cross-validation**: Group together runs with different random seeds to see a larger experiment. Here's [an example](https://github.com/wandb/examples/tree/master/examples/wandb-sweeps/sweeps-cross-validation) of k-fold cross-validation with sweeps and grouping. - -There are several ways to set grouping: - -### 1. Set group in your script - -Pass an optional group and `job_type` to `wandb.init()`. This gives you a dedicated group page for each experiment, which contains the individual runs. For example:`wandb.init(group="experiment_1", job_type="eval")` - -### 2. Set a group environment variable - -Use `WANDB_RUN_GROUP` to specify a group for your runs as an environment variable. For more on this, check our docs for [Environment Variables]({{< relref "/guides/models/track/environment-variables.md" >}}). **Group** should be unique within your project and shared by all runs in the group. You can use `wandb.util.generate_id()` to generate a unique 8 character string to use in all your processes— for example, `os.environ["WANDB_RUN_GROUP"] = "experiment-" + wandb.util.generate_id()` - -### 3. Set a group in the UI - - -After a run is initialized, you can move it to a new group from your workspace or its **Runs** page. - -1. Navigate to your W&B project. -1. Select the **Workspace** or **Runs** tab from the project sidebar. -1. Search or scroll to the run you want to rename. - - Hover over the run name, click the three vertical dots, then click **Move to another group**. -1. To create a new group, click **New group**. Type a group name, then submit the form. -1. Select the run's new group from the list, then click **Move**. - -### 4. Toggle grouping by columns in the UI - -You can dynamically group by any column, including a column that is hidden. For example, if you use `wandb.Run.config` to log batch size or learning rate, you can then group by those hyperparameters dynamically in the web app. The **Group by** feature is distinct from a [run's run group]({{< relref "grouping.md" >}}). You can group runs by run group. To move a run to a different run group, refer to [Set a group in the UI]({{< relref "#set-a-group-in-the-ui" >}}). - -{{% alert %}} -In the list of runs, the **Group** column is hidden by default. -{{% /alert %}} - -To group runs by one or more columns: - -1. Click **Group**. -1. Click the names of one or more columns. -1. If you selected more than one column, drag them to change the grouping order. -1. Click anywhere outside of the form to dismiss it. - -### Customize how runs are displayed -You can customize how runs are displayed in your project from the **Workspace** or **Runs** tabs. Both tabs use the same display configuration. - -To customize which columns are visible: -1. Above the list of runs, click **Columns**. -1. Click the name of a hidden column to show it. Click the name of a visible column to hide it. - - You can optionally search by column name using fuzzy search, an exact match, or regular expressions. Drag columns to change their order. -1. Click **Done** to close the column browser. - -To sort the list of runs by any visible column: - -1. Hover over the column name, then click its action `...` menu. -1. Click **Sort ascending** or **Sort descending**. - -Pinned columns are shown on the right-hand side. To pin or unpin a column: -1. Hover over the column name, then click its action `...` menu. -1. Click **Pin column** or **Unpin column**. - -By default, long run names are truncated in the middle for readability. To customize the truncation of run names: - -1. Click the action `...` menu at the top of the list of runs. -1. Set **Run name cropping** to crop the end, middle, or beginning. - -## Distributed training with grouping - -Suppose you set grouping in `wandb.init()`, we will group runs by default in the UI. You can toggle this on and off by clicking the **Group** button at the top of the table. Here's an [example project](https://wandb.ai/carey/group-demo?workspace=user-carey) generated from [sample code](https://wandb.me/grouping) where we set grouping. You can click on each "Group" row in the sidebar to get to a dedicated group page for that experiment. - -{{< img src="/images/track/distributed_training_wgrouping_1.png" alt="Grouped runs view" >}} - -From the project page above, you can click a **Group** in the left sidebar to get to a dedicated page like [this one](https://wandb.ai/carey/group-demo/groups/exp_5?workspace=user-carey): - -{{< img src="/images/track/distributed_training_wgrouping_2.png" alt="Group details page" >}} - -## Grouping dynamically in the UI - -You can group runs by any column, for example by hyperparameter. Here's an example of what that looks like: - -* **Sidebar**: Runs are grouped by the number of epochs. -* **Graphs**: Each line represents the group's mean, and the shading indicates the variance. This behavior can be changed in the graph settings. - -{{< img src="/images/track/demo_grouping.png" alt="Dynamic grouping by epochs" >}} - -## Turn off grouping - -Click the grouping button and clear group fields at any time, which returns the table and graphs to their ungrouped state. - -{{< img src="/images/track/demo_no_grouping.png" alt="Ungrouped runs table" >}} - -## Grouping graph settings - -Click the edit button in the upper right corner of a graph and select the **Advanced** tab to change the line and shading. You can select the mean, minimum, or maximum value for the line in each group. For the shading, you can turn off shading, and show the min and max, the standard deviation, and the standard error. - -{{< img src="/images/track/demo_grouping_options_for_line_plots.gif" alt="Line plot grouping options" >}} \ No newline at end of file diff --git a/content/en/guides/models/track/runs/manage-runs.md b/content/en/guides/models/track/runs/manage-runs.md deleted file mode 100644 index 3104d96afe..0000000000 --- a/content/en/guides/models/track/runs/manage-runs.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -menu: - default: - identifier: manage-runs - parent: what-are-runs -title: Move runs ---- - -This page shows how to move a run from one project to another, into or out of a team, or from one team to another. You must have access to the run at its current and new locations. - -{{% alert %}} -When you move a run, historical artifacts associated with it are not moved. To move an artifact manually, you can use the [`wandb artifact get`]({{< relref "/ref/cli/wandb-artifact/wandb-artifact-get/" >}}) SDK command or the [`Api.artifact` API]({{< relref "/ref/python/public-api/api/#artifact" >}}) to download the artifact, then use [`wandb artifact put`]({{< relref "/ref/cli/wandb-artifact/wandb-artifact-put/" >}}) or the `Api.artifact` API to upload it to the run's new location. -{{% /alert %}} - -To customize the **Runs** tab, refer to [Project page]({{< relref "/guides/models/track/project-page.md#runs-tab" >}}). - -If you group runs into experiments, refer to [Set a group in the UI]({{< relref "grouping.md#set-a-group-in-the-ui" >}}). - -## Move runs between your projects - -To move runs from one project to another: - -1. Navigate to the project that contains the runs you want to move. -2. Select the **Runs** tab from the project sidebar. -3. Select the checkbox next to the runs you want to move. -4. Choose the **Move** button above the table. -5. Select the destination project from the dropdown. - -{{< img src="/images/app_ui/howto_move_runs.gif" alt="Demo of moving a run between projects" >}} - -## Move runs to a team - -Move runs to a team you are a member of: - -1. Navigate to the project that contains the runs you want to move. -2. Select the **Runs** tab from the project sidebar. -3. Select the checkbox next to the runs you want to move. -4. Choose the **Move** button above the table. -5. Select the destination team and project from the dropdown. - -{{< img src="/images/app_ui/demo_move_runs.gif" alt="Demo of moving a run to a team" >}} \ No newline at end of file diff --git a/content/en/guides/models/track/runs/multiple-runs-per-process.md b/content/en/guides/models/track/runs/multiple-runs-per-process.md deleted file mode 100644 index 137c26cd78..0000000000 --- a/content/en/guides/models/track/runs/multiple-runs-per-process.md +++ /dev/null @@ -1,155 +0,0 @@ ---- -description: Manage multiple runs in a single Python process using W&B’s reinit functionality -menu: - default: - identifier: multiple-runs - parent: what-are-runs -title: Create and manage multiple runs in a single process ---- - -Manage multiple runs in a single Python process. This is useful for workflows where you want to keep a primary process active while creating short-lived secondary processes for sub-tasks. Some use cases include: - -- Keeping a single “primary” run active throughout a script while spinning up short-lived “secondary” runs for evaluations or sub-tasks. -- Orchestrating sub-experiments in a single file. -- Logging from one “main” process to several runs that represent different tasks or time periods. - -By default, W&B assumes each Python process has only one active run at a time when you call `wandb.init()`. If you call `wandb.init()` again, W&B will either return the same run or finish the old run before starting a new one, depending on the configuration. The content in this guide explains how to use `reinit` to modify the `wandb.init()` behavior to enable multiple runs in a single Python process. - -{{% alert title="Requirements" %}} -To manage multiple runs in a single Python process, you must have W&B Python SDK version `v0.19.10` or newer. -{{% /alert %}} - -## `reinit` options - -Use the `reinit` parameter to configure how W&B handles multiple calls to `wandb.init()`. The following table describes valid arguments and their effects: - -| | Description | Creates a run? | Example use case | -|----------------|----------------|----------------| -----------------| -| `create_new` |Create a new run with `wandb.init()` without finishing existing, active runs. W&B does not automatically switch the global `wandb.Run` to new runs. You must hold onto each run object yourself. See the [multiple runs in one process example]({{< relref "multiple-runs-per-process/#example-multiple-runs-in-one-process" >}}) below for details. | Yes | Ideal for creating and managing concurrent processes. For example, a “primary” run that remains active while you start or end “secondary” runs.| -| `finish_previous` | Finish all active runs with `run.finish()` before creating a new one run with `wandb.init()`. Default behavior for non notebook environments. | Yes | Ideal when you want to break sequential sub-processes into separate individual runs. | -| `return_previous` | Return the most recent, unfinished run. Default behavior for notebook environments. | No | | - -{{% alert %}} -W&B does not support `create_new` mode for [W&B Integrations]({{< relref "/guides/integrations/" >}}) that assume a single global run, such as Hugging Face Trainer, Keras callbacks, and PyTorch Lightning. If you use these integrations, you should run each sub-experiment in a separate process. -{{% /alert %}} - -## Specifying `reinit` - - - -- Use `wandb.init()` with the `reinit` argument directly: - ```python - import wandb - wandb.init(reinit="") - ``` -- Use `wandb.init()` and pass a `wandb.Settings` object to the `settings` parameter. Specify `reinit` in the `Settings` object: - - ```python - import wandb - wandb.init(settings=wandb.Settings(reinit="")) - ``` - -- Use `wandb.setup()` to set the `reinit` option globally for all runs in the current process. This is useful if you want to configure the behavior once and have it apply to all subsequent `wandb.init()` calls in that process. - - ```python - import wandb - wandb.setup(wandb.Settings(reinit="")) - ``` - -- Specify the desired value for `reinit` in the environment variable `WANDB_REINIT`. Defining an environment variable applies the `reinit` option to `wandb.init()` calls. - - ```bash - export WANDB_REINIT="" - ``` - -The following code snippet shows a high level overview how to set up W&B to create a new run each time you call `wandb.init()`: - -```python -import wandb - -wandb.setup(wandb.Settings(reinit="create_new")) - -with wandb.init() as experiment_results_run: - # This run will be used to log the results of each experiment. - # You can think of this as a parent run that collects results - with wandb.init() as run: - # The do_experiment() function logs fine-grained metrics - # to the given run and returns result metrics that - # you want to track separately. - experiment_results = do_experiment(run) - - # After each experiment, log its results to a parent - # run. Each point in the parent run's charts corresponds - # to one experiment's results. - experiment_results_run.log(experiment_results) -``` - -## Example: Concurrent processes - -Suppose you want to create a primary process that remains open for the script's entire lifespan, while periodically spawning short-lived secondary processes without finishing the primary process. For example, this pattern can be useful if you want to train a model in the primary run, but compute evaluations or do other work in separate runs. - -To achieve this, use `reinit="create_new"` and initialize multiple runs. For this example, suppose "Run A" is the primary process that remains open throughout the script, while "Run B1", "Run B2", are short-lived secondary runs for tasks like evaluation. - -The high level workflow might look like this: - -1. Initialize the primary process Run A with `wandb.init()` and log training metrics. -2. Initialize Run B1 (with `wandb.init()`), log data, then finish it. -3. Log more data to Run A. -4. Initialize Run B2, log data, then finish it. -5. Continue logging to Run A. -6. Finally finish Run A at the end. - -The following Python code example demonstrates this workflow: - -```python -import wandb - -def train(name: str) -> None: - """Perform one training iteration in its own W&B run. - - Using a 'with wandb.init()' block with `reinit="create_new"` ensures that - this training sub-run can be created even if another run (like our primary - tracking run) is already active. - """ - with wandb.init( - project="my_project", - name=name, - reinit="create_new" - ) as run: - # In a real script, you'd run your training steps inside this block. - run.log({"train_loss": 0.42}) # Replace with your real metric(s) - -def evaluate_loss_accuracy() -> (float, float): - """Returns the current model's loss and accuracy. - - Replace this placeholder with your real evaluation logic. - """ - return 0.27, 0.91 # Example metric values - -# Create a 'primary' run that remains active throughout multiple train/eval steps. -with wandb.init( - project="my_project", - name="tracking_run", - reinit="create_new" -) as tracking_run: - # 1) Train once under a sub-run named 'training_1' - train("training_1") - loss, accuracy = evaluate_loss_accuracy() - tracking_run.log({"eval_loss": loss, "eval_accuracy": accuracy}) - - # 2) Train again under a sub-run named 'training_2' - train("training_2") - loss, accuracy = evaluate_loss_accuracy() - tracking_run.log({"eval_loss": loss, "eval_accuracy": accuracy}) - - # The 'tracking_run' finishes automatically when this 'with' block ends. -``` - -Note three key points from the previous example: - -1. `reinit="create_new"` creates a new run each time you call `wandb.init()`. -2. You keep references of each run. `wandb.run` does not automatically point to the new run created with `reinit="create_new"`. Store new runs in variables like `run_a`, `run_b1`, etc., and call `.log()` or `.finish()` on those objects as needed. -3. You can finish sub-runs whenever you want while keeping the primary run open until. -4. Finish your runs with `run.finish()` when you are done logging to them. This ensures that all data is uploaded and the run is properly closed. - - diff --git a/content/en/guides/models/track/runs/resuming.md b/content/en/guides/models/track/runs/resuming.md deleted file mode 100644 index 1e93db2771..0000000000 --- a/content/en/guides/models/track/runs/resuming.md +++ /dev/null @@ -1,136 +0,0 @@ ---- -description: Resume a paused or exited W&B Run -menu: - default: - identifier: resuming - parent: what-are-runs -title: Resume a run ---- - -Specify how a run should behave in the event that run stops or crashes. To resume or enable a run to automatically resume, you will need to specify the unique run ID associated with that run for the `id` parameter: - -```python -run = wandb.init(entity="", \ - project="", id="", resume="") -``` - -{{% alert %}} -W&B encourages you to provide the name of the W&B Project where you want to store the run. -{{% /alert %}} - -Pass one of the following arguments to the `resume` parameter to determine how W&B should respond. In each case, W&B first checks if the run ID already exists. - -|Argument | Description | Run ID exists| Run ID does not exist | Use case | -| --- | --- | -- | --| -- | -| `"must"` | W&B must resume run specified by the run ID. | W&B resumes run with the same run ID. | W&B raises an error. | Resume a run that must use the same run ID. | -| `"allow"`| Allow W&B to resume run if run ID exists. | W&B resumes run with the same run ID. | W&B initializes a new run with specified run ID. | Resume a run without overriding an existing run. | -| `"never"`| Never allow W&B to resume a run specified by run ID. | W&B raises an error. | W&B initializes a new run with specified run ID. | | - - - -You can also specify `resume="auto"` to let W&B to automatically try to restart the run on your behalf. However, you will need to ensure that you restart your run from the same directory. See the [Enable runs to automatically resume]({{< relref "#enable-runs-to-automatically-resume" >}}) section for more information. - -For all the examples below, replace values enclosed within `<>` with your own. - -## Resume a run that must use the same run ID -If a run is stopped, crashes, or fails, you can resume it using the same run ID. To do so, initialize a run and specify the following: - -* Set the `resume` parameter to `"must"` (`resume="must"`) -* Provide the run ID of the run that stopped or crashed - - - -The following code snippet shows how to accomplish this with the W&B Python SDK: - -```python -run = wandb.init(entity="", \ - project="", id="", resume="must") -``` - -{{% alert color="secondary" %}} -Unexpected results will occur if multiple processes use the same `id` concurrently. - - -For more information on how to manage multiple processes, see the [Log distributed training experiments]({{< relref "/guides/models/track/log/distributed-training.md" >}}) -{{% /alert %}} - -## Resume a run without overriding the existing run -Resume a run that stopped or crashed without overriding the existing run. This is especially helpful if your process doesn't exit successfully. The next time you start W&B, W&B will start logging from the last step. - -Set the `resume` parameter to `"allow"` (`resume="allow"`) when you initialize a run with W&B. Provide the run ID of the run that stopped or crashed. The following code snippet shows how to accomplish this with the W&B Python SDK: - -```python -import wandb - -run = wandb.init(entity="", \ - project="", id="", resume="allow") -``` - - -## Enable runs to automatically resume -The following code snippet shows how to enable runs to automatically resume with the Python SDK or with environment variables. - -{{< tabpane text=true >}} - {{% tab header="W&B Python SDK" %}} -The following code snippet shows how to specify a W&B run ID with the Python SDK. - -Replace values enclosed within `<>` with your own: - -```python -run = wandb.init(entity="", \ - project="", id="", resume="") -``` - {{% /tab %}} - {{% tab header="Shell script" %}} - -The following example shows how to specify the W&B `WANDB_RUN_ID` variable in a bash script: - -```bash title="run_experiment.sh" -RUN_ID="$1" - -WANDB_RESUME=allow WANDB_RUN_ID="$RUN_ID" python eval.py -``` -Within your terminal, you could run the shell script along with the W&B run ID. The following code snippet passes the run ID `akj172`: - -```bash -sh run_experiment.sh akj172 -``` - -{{% /tab %}} -{{< /tabpane >}} - - -{{% alert color="secondary" %}} -Automatic resuming only works if the process is restarted on top of the same filesystem as the failed process. -{{% /alert %}} - - -For example, suppose you execute a python script called `train.py` in a directory called `Users/AwesomeEmployee/Desktop/ImageClassify/training/`. Within `train.py`, the script creates a run that enables automatic resuming. Suppose next that the training script is stopped. To resume this run, you would need to restart your `train.py` script within `Users/AwesomeEmployee/Desktop/ImageClassify/training/` . - - -{{% alert %}} -If you can not share a filesystem, specify the `WANDB_RUN_ID` environment variable or pass the run ID with the W&B Python SDK. See the [Custom run IDs]({{< relref "./#custom-run-ids" >}}) section in the "What are runs?" page for more information on run IDs. -{{% /alert %}} - - - - - -## Resume preemptible Sweeps runs -Automatically requeue interrupted [sweep]({{< relref "/guides/models/sweeps/" >}}) runs. This is particularly useful if you run a sweep agent in a compute environment that is subject to preemption such as a SLURM job in a preemptible queue, an EC2 spot instance, or a Google Cloud preemptible VM. - -Use the [`mark_preempting`]({{< relref "/ref/python/experiments/run#mark_preempting" >}}) function to automatically requeue interrupted sweep runs. For example: - -```python -run = wandb.init() # Initialize a run -run.mark_preempting() -``` -The following table outlines how W&B handles runs based on the exit status of the a sweep run. - -|Status| Behavior | -|------| ---------| -|Status code 0| Run is considered to have terminated successfully and it will not be requeued. | -|Nonzero status| W&B automatically appends the run to a run queue associated with the sweep.| -|No status| Run is added to the sweep run queue. Sweep agents consume runs off the run queue until the queue is empty. Once the queue is empty, the sweep queue resumes generating new runs based on the sweep search algorithm.| \ No newline at end of file diff --git a/content/en/guides/models/track/runs/rewind.md b/content/en/guides/models/track/runs/rewind.md deleted file mode 100644 index 3f45f2dd76..0000000000 --- a/content/en/guides/models/track/runs/rewind.md +++ /dev/null @@ -1,110 +0,0 @@ ---- -description: Rewind -menu: - default: - identifier: rewind - parent: what-are-runs -title: Rewind a run ---- - -# Rewind a run -{{% alert color="secondary" %}} -The option to rewind a run is in private preview. Contact W&B Support at support@wandb.com to request access to this feature. - -W&B currently does not support: -* **Log rewind**: Logs are reset in the new run segment. -* **System metrics rewind**: W&B logs only new system metrics after the rewind point. -* **Artifact association**: W&B associates artifacts with the source run that produces them. -{{% /alert %}} - -{{% alert %}} -* To rewind a run, you must have [W&B Python SDK](https://pypi.org/project/wandb/) version >= `0.17.1`. -* You must use monotonically increasing steps. This does not work with non-monotonic steps defined with [`define_metric()`]({{< relref "/ref/python/experiments/run#define_metric" >}}) because it disrupts the required chronological order of run history and system metrics. -{{% /alert %}} - -Rewind a run to correct or modify the history of a run without losing the original data. In addition, when you -rewind a run, you can log new data from that point in time. W&B recomputes the summary metrics for the run you rewind based on the newly logged history. This means the following behavior: -- **History truncation**: W&B truncates the history to the rewind point, allowing new data logging. -- **Summary metrics**: Recomputed based on the newly logged history. -- **Configuration preservation**: W&B preserves the original configurations and you can merge new configurations. - - -When you rewind a run, W&B resets the state of the run to the specified step, preserving the original data and maintaining a consistent run ID. This means that: - -- **Run archiving**: W&B archives the original runs. Runs are accessible from the [Run Overview]({{< relref "./#overview-tab" >}}) tab. -- **Artifact association**: Associates artifacts with the run that produce them. -- **Immutable run IDs**: Introduced for consistent forking from a precise state. -- **Copy immutable run ID**: A button to copy the immutable run ID for improved run management. - -{{% alert title="Rewind and forking compatibility" %}} -Forking compliments a rewind. - -When you fork from a run, W&B creates a new branch off a run at a specific point to try different parameters or models. - -When you rewind a run, W&B lets you correct or modify the run history itself. -{{% /alert %}} - - - -## Rewind a run - -Use `resume_from` with [`wandb.init()`]({{< relref "/ref/python/functions/init" >}}) to "rewind" a run’s history to a specific step. Specify the name of the run and the step you want to rewind from: - -```python -import wandb -import math - -# Initialize the first run and log some metrics -# Replace with your_project_name and your_entity_name! -run1 = wandb.init(project="your_project_name", entity="your_entity_name") -for i in range(300): - run1.log({"metric": i}) -run1.finish() - -# Rewind from the first run at a specific step and log the metric starting from step 200 -run2 = wandb.init(project="your_project_name", entity="your_entity_name", resume_from=f"{run1.id}?_step=200") - -# Continue logging in the new run -# For the first few steps, log the metric as is from run1 -# After step 250, start logging the spikey pattern -for i in range(200, 300): - if i < 250: - run2.log({"metric": i, "step": i}) # Continue logging from run1 without spikes - else: - # Introduce the spikey behavior starting from step 250 - subtle_spike = i + (2 * math.sin(i / 3.0)) # Apply a subtle spikey pattern - run2.log({"metric": subtle_spike, "step": i}) - # Additionally log the new metric at all steps - run2.log({"additional_metric": i * 1.1, "step": i}) -run2.finish() -``` - -## View an archived run - - -After you rewind a run, you can explore archived run with the W&B App UI. Follow these steps to view archived runs: - -1. **Access the Overview Tab:** Navigate to the [**Overview** tab]({{< relref "./#overview-tab" >}}) on the run's page. This tab provides a comprehensive view of the run's details and history. -2. **Locate the Forked From field:** Within the **Overview** tab, find the `Forked From` field. This field captures the history of the resumptions. The **Forked From** field includes a link to the source run, allowing you to trace back to the original run and understand the entire rewind history. - -By using the `Forked From` field, you can effortlessly navigate the tree of archived resumptions and gain insights into the sequence and origin of each rewind. - -## Fork from a run that you rewind - -To fork from a rewound run, use the [`fork_from`]({{< relref "/guides/models/track/runs/forking" >}}) argument in `wandb.init()` and specify the source run ID and the step from the source run to fork from: - -```python -import wandb - -# Fork the run from a specific step -forked_run = wandb.init( - project="your_project_name", - entity="your_entity_name", - fork_from=f"{rewind_run.id}?_step=500", -) - -# Continue logging in the new run -for i in range(500, 1000): - forked_run.log({"metric": i*3}) -forked_run.finish() -``` \ No newline at end of file diff --git a/content/en/guides/models/track/runs/run-colors.md b/content/en/guides/models/track/runs/run-colors.md deleted file mode 100644 index 365daa51b6..0000000000 --- a/content/en/guides/models/track/runs/run-colors.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -description: -menu: - default: - identifier: run-colors - parent: Customize run colors -title: Customize run colors ---- - -W&B automatically assigns a color to each run that you create in your project. You can customize these colors to help you visually distinguish runs in tables and graphs. Run colors are locally scoped—on the project page, custom colors apply only to your own workspace. In reports, custom colors for runs apply only at the section level. - -## Choose a color palette - -W&B provides several predefined color palettes to suit different needs and preferences. You can select a palette that works best for your team and use case. - - -1. Navigate to your W&B project. -2. Click on the **Workspace** tab from the project sidebar. -3. Click the **Settings** icon in the top right corner. -4. Select **Runs** from the settings drawer. -5. In the **Color palette** section, choose from the available options. - -### Available color palettes - -W&B offers three color palette options: - -- **Default**: The standard W&B color palette with a vibrant range of colors -- **Colorblind-safe (deuteranomaly)**: Optimized for red-green color blindness, the most common form. -- **Colorblind-safe (all other forms)**: Optimized for protanopia, tritanopia, and other forms of color vision difference. - -The colorblind-safe palettes use colors that remain distinguishable across different types of color vision difference, while maintaining visual appeal for users with typical color vision. - -#### Default palette -In this example plot, runs are colored with the default palette, displaying a variety of vibrant colors for different runs. - -{{< img src="/images/app_ui/run-colors-default.png" alt="W&B workspace showing runs colored with the default palette" >}} - -#### Colorblind-safe (deuteranomaly) palette -In this example plot, runs are colored with the colorblind-safe palette optimized for deuteranomaly (red-green color blindness), using colors that remain distinguishable for affected users. - -{{< img src="/images/app_ui/run-colors-colorblind-deuteranomaly.png" alt="W&B workspace showing runs colored with the colorblind-safe palette optimized for deuteranomaly (red-green color blindness)" >}} - -#### Colorblind-safe (all other forms) palette -In this example plot, runs are colored with the colorblind-safe palette optimized for protanopia, tritanopia, and other forms of color vision difference. - -{{< img src="/images/app_ui/run-colors-colorblind-other.png" alt="W&B workspace showing runs colored with the colorblind-safe palette optimized for protanopia, tritanopia, and other forms of color vision difference" >}} - -## Edit individual run colors - -To manually change the color of specific runs: - -1. Click the **Runs** tab from the project sidebar. -2. Click the dot color next to the run name in the **Name** column. -3. Select a color from the color palette or the color picker, or enter a hex code. - -{{< img src="/images/runs/run-color-palette.png" alt="Edit default run color in project workspace">}} - -## Randomize run colors - -To randomize the colors of all runs in the table: - -1. Click the **Runs** tab from the project sidebar. -2. Hover over the **Name** column header, click the three horizontal dots (**...**), and select **Randomize run colors** from the dropdown menu. - -{{% alert %}} -The option to randomize run colors is available only after modifying the run's table in some way, such as by sorting, filtering, searching, or grouping. -{{% /alert %}} - -## Color options for grouped runs - -When using the **Run colors** setting, you have two options: - -- **Original project colors**: Uses the default color assignment for runs. -- **Key-based colors**: Colors runs based on metric or configuration values (see [Semantic run plot legends]({{< relref "color-code-runs" >}}) for details). - -## Reset run colors - -To restore the default colors for all runs in the table: - -1. Click the **Runs** tab from the project sidebar. -2. Hover over the **Name** column header, click the three horizontal dots (**...**), and select **Reset colors** from the dropdown menu. - -{{< img src="/images/runs/reset-run-colors.png" alt="Reset run colors in project workspace">}} diff --git a/content/en/guides/models/track/runs/tags.md b/content/en/guides/models/track/runs/tags.md deleted file mode 100644 index 45dca60a08..0000000000 --- a/content/en/guides/models/track/runs/tags.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -menu: - default: - identifier: tags - parent: what-are-runs -title: Add labels to runs with tags ---- - -Add tags to label runs with particular features that might not be obvious from the logged metrics or artifact data. - -For example, you can add a tag to a run to indicated that run's model is `in_production`, that run is `preemptible`, this run represents the `baseline`, and so forth. - -## Add tags to one or more runs - -Programmatically or interactively add tags to your runs. - -Based on your use case, select the tab below that best fits your needs: - -{{< tabpane text=true >}} - {{% tab header="W&B Python SDK" %}} -You can add tags to a run when it is created: - -```python -import wandb - -run = wandb.init( - entity="entity", - project="", - tags=["tag1", "tag2"] -) -``` - -You can also update the tags after you initialize a run. For example, the proceeding code snippet shows how to update a tag if a particular metrics crosses a pre-defined threshold: - -```python -import wandb - -run = wandb.init( - entity="entity", - project="capsules", - tags=["debug"] - ) - -# python logic to train model - -if current_loss < threshold: - run.tags = run.tags + ("release_candidate",) -``` - {{% /tab %}} - {{% tab header="Public API" %}} -After you create a run, you can update tags using [the Public API]({{< relref "/guides/models/track/public-api-guide.md" >}}). For example: - -```python -run = wandb.Api().run("{entity}/{project}/{run-id}") -run.tags.append("tag1") # you can choose tags based on run data here -run.update() -``` - {{% /tab %}} - {{% tab header="Project page" %}} -This method is best suited to tagging large numbers of runs with the same tag or tags. - -1. Navigate to your project workspace. -2. Select **Runs** in the from the project sidebar. -3. Select one or more runs from the table. -4. Once you select one or more runs, select the **Tag** button above the table. -5. Type the tag you want to add and select the **Create new tag** checkbox to add the tag. - {{% /tab %}} - {{% tab header="Run page" %}} -This method is best suited to applying a tag or tags to a single run manually. - -1. Navigate to your project workspace. -2. Select a run from the list of runs within your project's workspace. -1. Select **Overview** from the project sidebar. -2. Select the gray plus icon (**+**) button next to **Tags**. -3. Type a tag you want to add and select **Add** below the text box to add a new tag. - {{% /tab %}} -{{< /tabpane >}} - - - -## Remove tags from one or more runs - -Tags can also be removed from runs with the W&B App UI. - -{{< tabpane text=true >}} -{{% tab header="Project page"%}} -This method is best suited to removing tags from a large numbers of runs. - -1. In the Run sidebar of the project, select the table icon in the upper-right. This will expand the sidebar into the full runs table. -2. Hover over a run in the table to see a checkbox on the left or look in the header row for a checkbox to select all runs. -3. Select the checkbox to enable bulk actions. -4. Select the runs you want to remove tags. -5. Select the **Tag** button above the rows of runs. -6. Select the checkbox next to a tag to remove it from the run. - -{{% /tab %}} -{{% tab header="Run page"%}} - -1. In the left sidebar of the Run page, select the top **Overview** tab. The tags on the run are visible here. -2. Hover over a tag and select the "x" to remove it from the run. - -{{% /tab %}} -{{< /tabpane >}} - - diff --git a/content/en/guides/models/track/workspaces.md b/content/en/guides/models/track/workspaces.md deleted file mode 100644 index a645d328d5..0000000000 --- a/content/en/guides/models/track/workspaces.md +++ /dev/null @@ -1,182 +0,0 @@ ---- -description: A playground for exploring run data with interactive visualizations -menu: - default: - identifier: workspaces - parent: experiments -title: View experiments results -weight: 4 ---- - -W&B workspace is your personal sandbox to customize charts and explore model results. A W&B workspace consists of *Tables* and *Panel sections*: - -* **Tables**: All runs logged to your project are listed in the project's table. Turn on and off runs, change colors, and expand the table to see notes, config, and summary metrics for each run. -* **Panel sections**: A section that contains one or more [panels]({{< relref "/guides/models/app/features/panels/" >}}). Create new panels, organize them, and export to reports to save snapshots of your workspace. - -{{< img src="/images/app_ui/workspace_table_and_panels.png" alt="Workspace table and panels" >}} - -## Workspace types -There are two main workspace categories: **Personal workspaces** and **Saved views**. - -* **Personal workspaces:** A customizable workspace for in-depth analysis of models and data visualizations. Only the owner of the workspace can edit and save changes. Teammates can view a personal workspace but teammates can not make changes to someone else's personal workspace. -* **Saved views:** Saved views are collaborative snapshots of a workspace. Anyone on your team can view, edit, and save changes to saved workspace views. Use saved workspace views for reviewing and discussing experiments, runs, and more. - -The proceeding image shows multiple personal workspaces created by Cécile-parker's teammates. In this project, there are no saved views: -{{< img src="/images/app_ui/Menu_No_views.jpg" alt="No saved views" >}} - -## Saved workspace views -Improve team collaboration with tailored workspace views. Create Saved Views to organize your preferred setup of charts and data. - -### Create a new saved workspace view - -1. Navigate to a personal workspace or a saved view. -2. Make edits to the workspace. -3. Click on the meatball menu (three horizontal dots) at the top right corner of your workspace. Click on **Save as a new view**. - -New saved views appear in the workspace navigation menu. - -{{< img src="/images/app_ui/Menu_Views.jpg" alt="Saved views menu" >}} - -### Update a saved workspace view -Saved changes overwrite the previous state of the saved view. Unsaved changes are not retained. To update a saved workspace view in W&B: - -1. Navigate to a saved view. -2. Make the desired changes to your charts and data within the workspace. -3. Click the **Save** button to confirm your changes. - -{{% alert %}} -A confirmation dialog appears when you save your updates to a workspace view. If you prefer not to see this prompt in the future, select the option **Do not show this modal next time** before confirming your save. -{{% /alert %}} - -### Delete a saved workspace view -Remove saved views that are no longer needed. - -1. Navigate to the saved view you want to remove. -2. Select the three horizontal lines (**...**) at the top right of the view. -3. Choose **Delete view**. -4. Confirm the deletion to remove the view from your workspace menu. - -### Share a workspace view -Share your customized workspace with your team by sharing the workspace URL directly. All users with access to the workspace project can see the saved Views of that workspace. - -## Workspace templates -{{% alert %}}This feature requires an [Enterprise](https://wandb.ai/site/pricing/) license.{{% /alert %}} - -Use _workspace templates_ to quickly create workspaces using the same settings as an existing workspace instead of the [default settings for new workspaces]({{< relref "#default-workspace-settings" >}}). Currently, a workspace template can define custom [line plot settings]({{< relref "/guides/models/app/features/panels/line-plot/#all-line-plots-in-a-workspace" >}}). - -### Default workspace settings -By default, new workspaces use these default settings for line plots: - -| Setting | Default | -|-------|---------- -| X axis | Step | -| Smoothing type | Time weight EMA | -| Smoothing weight | 0 | -| Max runs | 10 | -| Grouping in charts | on | -| Group aggregation | Mean | - -### Configure your workspace template -1. Open any workspace or create a new one. -1. Configure the workspace's [line plot settings]({{< relref "/guides/models/app/features/panels/line-plot/#all-line-plots-in-a-workspace" >}}) according to your preferences. -1. Save the settings to your workspace template: - 1. At the top of the workspace, click the action menu `...` near the **Undo** and **Redo** arrow icons. - 1. Click **Save personal workspace template**. - 1. Review the line plot settings for the template, then click **Save**. - -New workspaces will use these settings instead of the defaults. - -### View your workspace template -To view your workspace template's current configuration: -1. From any page, select your user icon on the top right corner. From the dropdown, choose **Settings**. -1. Navigate to the **Personal workspace template** section. If you are using a workspace template, its configuration displays. Otherwise, the section includes no details. - -### Update your workspace template -To update your workspace template: - -1. Open any workspace. -1. Modify the workspace's settings. For example, set the number of runs to include to `11`. -1. To save the changes to the template, click the action menu `...` near the **Undo** and **Redo** arrow icons, then click **Update personal workspace template**. -1. Verify the settings, then click **Update**. The template is updated, and reapplied to all workspaces that use it. - -### Delete your workspace template -To delete your workspace template and go back to the default settings: - -1. From any page, select your user icon on the top right corner. From the dropdown, choose **Settings**. -1. Navigate to the **Personal workspace template** section. Your workspace template's configuration displays. -1. Click the trash icon next to **Settings**. - -{{% alert %}} -For Dedicated Cloud and Self-Managed, deleting your workspace template is supported on v0.70 and above. On older Server versions, update your workspace template to use the [default settings]({{< relref "#default-workspace-settings" >}}) instead. -{{% /alert %}} - -## Programmatically create workspaces - -[`wandb-workspaces`](https://github.com/wandb/wandb-workspaces/tree/main) is a Python library for programmatically working with [W&B](https://wandb.ai/) workspaces and reports. - -Define a workspace programmatically with [`wandb-workspaces`](https://github.com/wandb/wandb-workspaces/tree/main). [`wandb-workspaces`](https://github.com/wandb/wandb-workspaces/tree/main) is a Python library for programmatically working with [W&B](https://wandb.ai/) workspaces and reports. - -You can define the workspace's properties, such as: - -* Set panel layouts, colors, and section orders. -* Configure workspace settings like default x-axis, section order, and collapse states. -* Add and customize panels within sections to organize workspace views. -* Load and modify existing workspaces using a URL. -* Save changes to existing workspaces or save as new views. -* Filter, group, and sort runs programmatically using simple expressions. -* Customize run appearance with settings like colors and visibility. -* Copy views from one workspace to another for integration and reuse. - - - -### Install Workspace API - -In addition to `wandb`, ensure that you install `wandb-workspaces`: - -```bash -pip install wandb wandb-workspaces -``` - - - -### Define and save a workspace view programmatically - - -```python -import wandb_workspaces.reports.v2 as ws - -workspace = ws.Workspace(entity="your-entity", project="your-project", views=[...]) -workspace.save() -``` - -### Edit an existing view -```python -existing_workspace = ws.Workspace.from_url("workspace-url") -existing_workspace.views[0] = ws.View(name="my-new-view", sections=[...]) -existing_workspace.save() -``` - -### Copy a workspace `saved view` to another workspace - -```python -old_workspace = ws.Workspace.from_url("old-workspace-url") -old_workspace_view = old_workspace.views[0] -new_workspace = ws.Workspace(entity="new-entity", project="new-project", views=[old_workspace_view]) - -new_workspace.save() -``` - -See [`wandb-workspace examples`](https://github.com/wandb/wandb-workspaces/tree/main/examples/workspaces) for comprehensive workspace API examples. For an end to end tutorial, see [Programmatic Workspaces]({{< relref "/tutorials/workspaces.md" >}}) tutorial. \ No newline at end of file diff --git a/content/en/guides/models_quickstart.md b/content/en/guides/models_quickstart.md deleted file mode 100644 index d95b8693de..0000000000 --- a/content/en/guides/models_quickstart.md +++ /dev/null @@ -1,253 +0,0 @@ ---- -title: Get Started with W&B Models -weight: 20 ---- - -Learn when and how to use W&B to track, share, and manage model artifacts in your machine learning workflows. This page covers logging experiments, generating reports, and accessing logged data using the appropriate W&B API for each task. - -This tutorial uses the following: - -* [W&B Python SDK]({{< relref "/ref/python" >}}) (`wandb.sdk`): to log and monitor experiments during training. -* [W&B Public API]({{< relref "/ref/python/public-api" >}}) (`wandb.apis.public`): to query and analyze logged experiment data. -* [W&B Reports and Workspaces API]({{< relref "/ref/wandb_workspaces" >}}) (`wandb.wandb-workspaces`): to create a report to summarize findings. - -## Sign up and create an API key -To authenticate your machine with W&B, you must first generate an API key at [wandb.ai/authorize](https://wandb.ai/authorize). Copy the API key and store it securely. - -## Install and import packages - -Install the W&B library and some other packages you will need for this walkthrough. - -```python -pip install wandb -``` - -Import W&B Python SDK: - - -```python -import wandb -``` - -Specify the entity of your team in the following code block: - - -```python -TEAM_ENTITY = "" # Replace with your team entity -PROJECT = "my-awesome-project" -``` - -## Train a model - -The following code simulates a basic machine learning workflow: training a model, logging metrics, and saving the model as an artifact. - -Use the W&B Python SDK (`wandb.sdk`) to interact with W&B during training. Log the loss using [`wandb.Run.log()`]({{< relref "/ref/python/experiments/run/#method-runlog" >}}), then save the trained model as an artifact using [`wandb.Artifact`]({{< relref "/ref/python/experiments/artifact.md" >}}) before finally adding the model file using [`Artifact.add_file`]({{< relref "/ref/python/experiments/artifact.md#add_file" >}}). - -```python -import random # For simulating data - -def model(training_data: int) -> int: - """Model simulation for demonstration purposes.""" - return training_data * 2 + random.randint(-1, 1) - -# Simulate weights and noise -weights = random.random() # Initialize random weights -noise = random.random() / 5 # Small random noise to simulate noise - -# Hyperparameters and configuration -config = { - "epochs": 10, # Number of epochs to train - "learning_rate": 0.01, # Learning rate for the optimizer -} - -# Use context manager to initialize and close W&B runs -with wandb.init(project=PROJECT, entity=TEAM_ENTITY, config=config) as run: - # Simulate training loop - for epoch in range(config["epochs"]): - xb = weights + noise # Simulated input training data - yb = weights + noise * 2 # Simulated target output (double the input noise) - - y_pred = model(xb) # Model prediction - loss = (yb - y_pred) ** 2 # Mean Squared Error loss - - print(f"epoch={epoch}, loss={y_pred}") - # Log epoch and loss to W&B - run.log({ - "epoch": epoch, - "loss": loss, - }) - - # Unique name for the model artifact, - model_artifact_name = f"model-demo" - - # Local path to save the simulated model file - PATH = "model.txt" - - # Save model locally - with open(PATH, "w") as f: - f.write(str(weights)) # Saving model weights to a file - - # Create an artifact object - # Add locally saved model to artifact object - artifact = wandb.Artifact(name=model_artifact_name, type="model", description="My trained model") - artifact.add_file(local_path=PATH) - artifact.save() -``` - -The key takeaways from the previous code block are: -* Use `wandb.Run.log()` to log metrics during training. -* Use `wandb.Artifact` to save models (datasets, and so forth) as an artifact to your W&B project. - -Now that you have trained a model and saved it as an artifact, you can publish it to a registry in W&B. Use [`wandb.Run.use_artifact()`]({{< relref "/ref/python/experiments/run/#method-runuse_artifact" >}}) to retrieve the artifact from your project and prepare it for publication in the Model registry. `wandb.Run.use_artifact()` serves two key purposes: -* Retrieves the artifact object from your project. -* Marks the artifact as an input to the run, ensuring reproducibility and traceability. See [Create and view lineage map]({{< relref "/guides/core/registry/lineage/" >}}) for details. - -## View the training data in the dashboard - -Log in to your account at https://wandb.ai/login - -Under **Projects** you should see `my-awesome-project` (or whatever you used as a project name above). Click this to enter the workspace for your project. - -From here, you can see details about every run you've done. In this screenshot, the code was re-run several times, generating a number of runs, each of which is given a randomly-generated name. - -{{< img "/images/quickstart/quickstart_image.png" >}} - - -## Publish the model to the Model registry - -To share the model with others in your organization, publish it to a [collection]({{< relref "/guides/core/registry/create_collection" >}}) using `wandb.Run.link_artifact()`. The following code links the artifact to the [core Model registry]({{< relref "/guides/core/registry/registry_types/#core-registry" >}}), making it accessible to your team. - -```python -# Artifact name specifies the specific artifact version within our team's project -artifact_name = f'{TEAM_ENTITY}/{PROJECT}/{model_artifact_name}:v0' -print("Artifact name: ", artifact_name) - -REGISTRY_NAME = "Model" # Name of the registry in W&B -COLLECTION_NAME = "DemoModels" # Name of the collection in the registry - -# Create a target path for our artifact in the registry -target_path = f"wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}" -print("Target path: ", target_path) - -run = wandb.init(entity=TEAM_ENTITY, project=PROJECT) -model_artifact = run.use_artifact(artifact_or_name=artifact_name, type="model") -run.link_artifact(artifact=model_artifact, target_path=target_path) -run.finish() -``` - -After running `wandb.Run.link_artifact()`, the model artifact will be in the `DemoModels` collection in your registry. From there, you can view details such as the version history, [lineage map]({{< relref "/guides/core/registry/lineage/" >}}), and other [metadata]({{< relref "/guides/core/registry/registry_cards/" >}}). - -For additional information on how to link artifacts to a registry, see [Link artifacts to a registry]({{< relref "/guides/core/registry/link_version/" >}}). - -## Retrieve model artifact from registry for inference - -To use a model for inference, use `wandb.Run.use_artifact()` to retrieve the published artifact from the registry. This returns an artifact object that you can then use [`wandb.Artifact.download()`]({{< relref "/ref/python/experiments/artifact/#method-artifactdownload" >}}) to download the artifact to a local file. - -```python -REGISTRY_NAME = "Model" # Name of the registry in W&B -COLLECTION_NAME = "DemoModels" # Name of the collection in the registry -VERSION = 0 # Version of the artifact to retrieve - -model_artifact_name = f"wandb-registry-{REGISTRY_NAME}/{COLLECTION_NAME}:v{VERSION}" -print(f"Model artifact name: {model_artifact_name}") - -run = wandb.init(entity=TEAM_ENTITY, project=PROJECT) -registry_model = run.use_artifact(artifact_or_name=model_artifact_name) -local_model_path = registry_model.download() -``` - -For more information on how to retrieve artifacts from a registry, see [Download an artifact from a registry]({{< relref "/guides/core/registry/download_use_artifact/" >}}). - -Depending on your machine learning framework, you may need to recreate the model architecture before loading the weights. This is left as an exercise for the reader, as it depends on the specific framework and model you are using. - -## Share your finds with a report - -{{% alert %}} -W&B Report and Workspace API is in Public Preview. -{{% /alert %}} - -Create and share a [report]({{< relref "/guides/core/reports/_index.md" >}}) to summarize your work. To create a report programmatically, use the [W&B Report and Workspace API]({{< relref "/ref/wandb_workspaces/reports.md" >}}). - -First, install the W&B Reports API: - -```python -pip install wandb wandb-workspaces -qqq -``` - -The following code block creates a report with multiple blocks, including markdown, panel grids, and more. You can customize the report by adding more blocks or changing the content of existing blocks. - -The output of the code block prints a link to the URL report created. You can open this link in your browser to view the report. - -```python -import wandb_workspaces.reports.v2 as wr - -experiment_summary = """This is a summary of the experiment conducted to train a simple model using W&B.""" -dataset_info = """The dataset used for training consists of synthetic data generated by a simple model.""" -model_info = """The model is a simple linear regression model that predicts output based on input data with some noise.""" - -report = wr.Report( - project=PROJECT, - entity=TEAM_ENTITY, - title="My Awesome Model Training Report", - description=experiment_summary, - blocks= [ - wr.TableOfContents(), - wr.H2("Experiment Summary"), - wr.MarkdownBlock(text=experiment_summary), - wr.H2("Dataset Information"), - wr.MarkdownBlock(text=dataset_info), - wr.H2("Model Information"), - wr.MarkdownBlock(text = model_info), - wr.PanelGrid( - panels=[ - wr.LinePlot(title="Train Loss", x="Step", y=["loss"], title_x="Step", title_y="Loss") - ], - ), - ] - -) - -# Save the report to W&B -report.save() -``` - -For more information on how to create a report programmatically or how to create a report interactively with the W&B App, see [Create a report]({{< relref "/guides/core/reports/create-a-report.md" >}}) in the W&B Docs Developer guide. - -## Query the registry -Use the [W&B Public APIs]({{< relref "/ref/python/public-api/_index.md" >}}) to query, analyze, and manage historical data from W&B. This can be useful for tracking the lineage of artifacts, comparing different versions, and analyzing the performance of models over time. - -The following code block demonstrates how to query the Model registry for all artifacts in a specific collection. It retrieves the collection and iterates through its versions, printing out the name and version of each artifact. - -```python -import wandb - -# Initialize wandb API -api = wandb.Api() - -# Find all artifact versions that contains the string `model` and -# has either the tag `text-classification` or an `latest` alias -registry_filters = { - "name": {"$regex": "model"} -} - -# Use logical $or operator to filter artifact versions -version_filters = { - "$or": [ - {"tag": "text-classification"}, - {"alias": "latest"} - ] -} - -# Returns an iterable of all artifact versions that match the filters -artifacts = api.registries(filter=registry_filters).collections().versions(filter=version_filters) - -# Print out the name, collection, aliases, tags, and created_at date of each artifact found -for art in artifacts: - print(f"artifact name: {art.name}") - print(f"collection artifact belongs to: { art.collection.name}") - print(f"artifact aliases: {art.aliases}") - print(f"tags attached to artifact: {art.tags}") - print(f"artifact created at: {art.created_at}\n") -``` - -For more information on querying the registry, see the [Query registry items with MongoDB-style queries]({{< relref "/guides/core/registry/search_registry.md#query-registry-items-with-mongodb-style-queries" >}}). diff --git a/content/en/guides/quickstart.md b/content/en/guides/quickstart.md deleted file mode 100644 index fab57a57d8..0000000000 --- a/content/en/guides/quickstart.md +++ /dev/null @@ -1,126 +0,0 @@ ---- -description: W&B Quickstart -menu: - default: - identifier: quickstart_models - parent: guides -title: W&B Quickstart -url: quickstart -weight: 10 ---- -Install W&B to track, visualize, and manage machine learning experiments of any size. - -{{% alert %}} -Are you looking for information on W&B Weave? See the [Weave Python SDK quickstart](https://weave-docs.wandb.ai/quickstart) or [Weave TypeScript SDK quickstart](https://weave-docs.wandb.ai/reference/generated_typescript_docs/intro-notebook). -{{% /alert %}} - -## Sign up and create an API key - -To authenticate your machine with W&B, generate an API key from your user profile or at [wandb.ai/authorize](https://wandb.ai/authorize). Copy the API key and store it securely. - -## Install the `wandb` library and log in - -{{< tabpane text=true >}} -{{% tab header="Command Line" value="cli" %}} - -1. Set the `WANDB_API_KEY` [environment variable]({{< relref "/guides/models/track/environment-variables.md" >}}). - - ```bash - export WANDB_API_KEY= - ``` - -2. Install the `wandb` library and log in. - - ```shell - pip install wandb - wandb login - ``` - -{{% /tab %}} - -{{% tab header="Python" value="python" %}} - -```bash -pip install wandb -``` -```python -import wandb - -wandb.login() -``` - -{{% /tab %}} - -{{% tab header="Python notebook" value="notebook" %}} - -```notebook -!pip install wandb -import wandb -wandb.login() -``` - -{{% /tab %}} -{{< /tabpane >}} - -## Start a run and track hyperparameters - -In your Python script or notebook, initialize a W&B run object with [`wandb.init()`]({{< relref "/ref/python/experiments/run.md" >}}). Use a dictionary for the `config` parameter to specify hyperparameter names and values. - -```python -run = wandb.init( - project="my-awesome-project", # Specify your project - config={ # Track hyperparameters and metadata - "learning_rate": 0.01, - "epochs": 10, - }, -) -``` - -A [run]({{< relref "/guides/models/track/runs/" >}}) serves as the core element of W&B, used to [track metrics]({{< relref "/guides/models/track/" >}}), [create logs]({{< relref "/guides/models/track/log/" >}}), and more. - -## Assemble the components - -This mock training script logs simulated accuracy and loss metrics to W&B: - -```python -import wandb -import random - -wandb.login() - -# Project that the run is recorded to -project = "my-awesome-project" - -# Dictionary with hyperparameters -config = { - 'epochs' : 10, - 'lr' : 0.01 -} - -with wandb.init(project=project, config=config) as run: - offset = random.random() / 5 - print(f"lr: {config['lr']}") - - # Simulate a training run - for epoch in range(2, config['epochs']): - acc = 1 - 2**-config['epochs'] - random.random() / config['epochs'] - offset - loss = 2**-config['epochs'] + random.random() / config['epochs'] + offset - print(f"epoch={config['epochs']}, accuracy={acc}, loss={loss}") - run.log({"accuracy": acc, "loss": loss}) -``` - -Visit [wandb.ai/home](https://wandb.ai/home) to view recorded metrics such as accuracy and loss and how they changed during each training step. The following image shows the loss and accuracy tracked from each run. Each run object appears in the **Runs** column with generated names. - -{{< img src="/images/quickstart/quickstart_image.png" alt="Shows loss and accuracy tracked from each run." >}} - -## Next steps - -Explore more features of the W&B ecosystem: - -1. Read the [W&B Integration tutorials]({{< relref "guides/integrations/" >}}) that combine W&B with frameworks like PyTorch, libraries like Hugging Face, and services like SageMaker. -2. Organize runs, automate visualizations, summarize findings, and share updates with collaborators using [W&B Reports]({{< relref "/guides/core/reports/" >}}). -3. Create [W&B Artifacts]({{< relref "/guides/core/artifacts/" >}}) to track datasets, models, dependencies, and results throughout your machine learning pipeline. -4. Automate hyperparameter searches and optimize models with [W&B Sweeps]({{< relref "/guides/models/sweeps/" >}}). -5. Analyze runs, visualize model predictions, and share insights on a [central dashboard]({{< relref "/guides/models/tables/" >}}). -6. Visit [W&B AI Academy](https://wandb.ai/site/courses/) to learn about LLMs, MLOps, and W&B Models through hands-on courses. -7. Visit [weave-docs.wandb.ai](https://weave-docs.wandb.ai/) to learn how to track track, experiment with, evaluate, deploy, and improve your LLM-based applications using Weave. diff --git a/content/en/guides/training/_index.md b/content/en/guides/training/_index.md deleted file mode 100644 index 44c8325d3b..0000000000 --- a/content/en/guides/training/_index.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -menu: - default: - identifier: training -title: W&B Training -description: Post-train your models using reinforcement learning. -weight: 60 ---- - -Now in public preview, W&B Training offers serverless reinforcement learning (RL) for post-training large language models (LLMs) to improve their reliability performing multi-turn, agentic tasks while also increasing speed and reducing costs. RL is a training technique where models learn to improve their behavior through feedback on their outputs. - -W&B Training includes integration with: - -* [ART](https://art.openpipe.ai/getting-started/about), a flexible RL fine-tuning framework. -* [RULER](https://openpipe.ai/blog/ruler), a universal verifier. -* A fully-managed backend on [CoreWeave Cloud](https://docs.coreweave.com/docs/platform). - -To get started, satisfy the [prerequisites]({{< relref "/guides/training/prerequisites" >}}) to start using the service and then see [OpenPipe's Serverless RL quickstart](https://art.openpipe.ai/getting-started/quick-start) to learn how to post-train your models. \ No newline at end of file diff --git a/content/en/guides/training/api-reference.md b/content/en/guides/training/api-reference.md deleted file mode 100644 index ac0480a9a8..0000000000 --- a/content/en/guides/training/api-reference.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "API Reference" -linkTitle: "API Reference" -weight: 100 -manualLink: "/ref/training" -description: > - Complete API documentation for W&B Training. ---- \ No newline at end of file diff --git a/content/en/guides/training/prerequisites.md b/content/en/guides/training/prerequisites.md deleted file mode 100644 index 1023f1cf98..0000000000 --- a/content/en/guides/training/prerequisites.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: "Prerequisites" -linkTitle: "Prerequisites" -weight: 1 -description: > - Set up your environment to use W&B Training. ---- - -Complete these steps before using W&B Training features through the OpenPipe ART framework or API. - -{{< alert title="Tip" >}} -Before starting, review the [usage information and limits]({{< relref "guides/training/serverless-rl/usage-limits" >}}) to understand costs and restrictions. -{{< /alert >}} - -## Sign up and create an API key - -To authenticate your machine with W&B, you must first generate an API key at [wandb.ai/authorize](https://wandb.ai/authorize). Copy the API key and store it securely. - -## Create a project in W&B - -Create a project in your W&B account to track usage, record training metrics, and save trained models. See the [Projects guide](https://docs.wandb.ai/guides/track/project-page) for more information. - -## Next steps - -After completing the prerequisites: - -* Check the [API reference]({{< relref "/ref/training" >}}) to learn about available endpoints -* Try the [ART quickstart](https://art.openpipe.ai/getting-started/quick-start) diff --git a/content/en/guides/training/serverless-rl/_index.md b/content/en/guides/training/serverless-rl/_index.md deleted file mode 100644 index 7d4794d6d4..0000000000 --- a/content/en/guides/training/serverless-rl/_index.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -menu: - default: - identifier: serverless-rl -title: Serverless RL -description: Learn about how to more efficiently post-train your models using reinforcement learning. -weight: 5 ---- - -Now in public preview, Serverless RL helps developers post-train LLMs to learn new behaviors and improve reliability, speed, and costs when performing multi-turn agentic tasks. W&B provision the training infrastructure ([on CoreWeave](https://docs.coreweave.com/docs/platform)) for you while allowing full flexibility in your environment's setup. Serverless RL gives you instant access to a managed training cluster that elastically auto-scales to dozens of GPUs. By splitting RL workflows into inference and training phases and multiplexing them across jobs, Serverless RL increases GPU utilization and reduces your training time and costs. - -Serverless RL is ideal for tasks like: -* Voice agents -* Deep research assistants -* On-prem models -* Content marketing analysis agents - -Serverless RL trains low-rank adapters (LoRAs) to specialize a model for your agent's specific task. This extends the original model’s capabilities with on-the-job experience. The LoRAs you train are automatically stored as artifacts in your W&B account, and can be saved locally or to a third party for backup. Models that you train through Serverless RL are also automatically hosted on W&B Inference. - -See the ART [quickstart](https://art.openpipe.ai/getting-started/quick-start) or [Google Colab notebook](https://colab.research.google.com/github/openpipe/art-notebooks/blob/main/examples/2048/2048.ipynb) to get started. - -## Why Serverless RL? - -Reinforcement learning (RL) is a set of powerful training techniques that you can use in many kinds of training setups, including on GPUs that you own or rent directly. Serverless RL can provide the following advantages in your RL post-training: - -* **Lower training costs**: By multiplexing shared infrastructure across many users, skipping the setup process for each job, and scaling your GPU costs down to 0 when you're not actively training, Serverless RL reduces training costs significantly. -* **Faster training time**: By splitting inference requests across many GPUs and immediately provisioning training infrastructure when you need it, Serverless RL speeds up your training jobs and lets you iterate faster. -* **Automatic deployment**: Serverless RL automatically deploys every checkpoint you train, eliminating the need to manually set up hosting infrastructure. Trained models can be accessed and tested immediately in local, staging, or production environments. - -## How Serverless RL uses W&B services - -Serverless RL uses a combination of the following W&B components to operate: - -* [Inference]({{< relref "guides/inference" >}}): To run your models -* [Models]({{< relref "guides/models" >}}): To track performance metrics during the LoRA adapter's training -* [Artifacts]({{< relref "guides/core/artifacts" >}}): To store and version the LoRA adapters -* [Weave (optional)]({{< relref "guides/models" >}}): To gain observability into how the model responds at each step of the training loop - -Serverless RL is in public preview. During the preview, you are charged only for the use of inference and the storage of artifacts. W&B does not charge for adapter training during the preview period. \ No newline at end of file diff --git a/content/en/guides/training/serverless-rl/available-models.md b/content/en/guides/training/serverless-rl/available-models.md deleted file mode 100644 index c1b187b617..0000000000 --- a/content/en/guides/training/serverless-rl/available-models.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: "Available models" -linkTitle: "Available models" -weight: 40 -description: > - See the models you can train with Serverless RL. ---- - -Serverless RL currently only supports a single open-source foundation model for training. - -To express interest in a particular model, contact [support](mailto:support@wandb.ai). - -## Model catalog - -| Model | Model ID (for API usage) | Type | Context Window | Parameters | Description | -|-------|--------------------------|------|----------------|------------|-------------| -| OpenPipe Qwen3 14B Instruct | `OpenPipe/Qwen3-14B-Instruct` | Text | 32.8K | 14.8B (Active-Total) | An efficient multilingual, dense, instruction-tuned model, optimized by OpenPipe for building agents with finetuning. | diff --git a/content/en/guides/training/serverless-rl/serverless-rl.md b/content/en/guides/training/serverless-rl/serverless-rl.md deleted file mode 100644 index d3d6d755e9..0000000000 --- a/content/en/guides/training/serverless-rl/serverless-rl.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -description: Get started using Serverless RL. -title: Use Serverless RL -weight: 10 ---- - -Serverless RL is supported through [OpenPipe's ART framework](https://art.openpipe.ai/getting-started/about) and the [W&B Training API]({{< relref "ref/training" >}}). - -To start using Serverless RL, satisfy the [prerequisites]({{< relref "guides/training/prerequisites.md" >}}) to use W&B tools, and then go through the ART [quickstart](https://art.openpipe.ai/getting-started/quick-start). -- For code examples and workflows, see the [Google Colab notebook](https://colab.research.google.com/github/openpipe/art-notebooks/blob/main/examples/2048/2048.ipynb)). -- To learn about Serverless RL's API endpoints, see the [W&B Training API reference]({{< relref "ref/training" >}}). \ No newline at end of file diff --git a/content/en/guides/training/serverless-rl/usage-limits.md b/content/en/guides/training/serverless-rl/usage-limits.md deleted file mode 100644 index 1a518868a6..0000000000 --- a/content/en/guides/training/serverless-rl/usage-limits.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: "Usage information and limits" -linkTitle: "Usage & limits" -weight: 30 -description: > - Understand pricing, usage limits, and account restrictions for W&B Serverless RL. ---- - -## Pricing - -Pricing has three components: inference, training, and storage. For specific billing rates, visit our [pricing page](https://wandb.ai/site/pricing/reinforcement-learning). - -### Inference - -Pricing for Serverless RL inference requests matches W&B Inference pricing. See [model-specific costs](https://site.wandb.ai/pricing/reinforcement-learning) for more details. Learn more about purchasing credits, account tiers, and usage caps in the [W&B Inference docs]({{< relref "/guides/inference/usage-limits/#purchase-more-credits" >}}). - -### Training - -At each training step, Serverless RL collects batches of trajectories that include your agent's outputs and associated rewards (calculated by your reward function). The batched trajectories are then used to update the weights of a LoRA adapter that specializes a base model for your task. The training jobs to update these LoRAs run on dedicated GPU clusters managed by Serverless RL. - -Training is free during the public preview period. - -### Model storage - -Serverless RL stores checkpoints of your trained LoRAs so you can evaluate, serve, or continue training them at any time. Storage is billed monthly based on total checkpoint size and your [pricing plan](https://wandb.ai/site/pricing). Every plan includes at least 5GB of free storage, which is enough for roughly 30 LoRAs. We recommend deleting low-performing LoRAs to save space. See the [ART SDK](https://art.openpipe.ai/features/checkpoint-deletion) for instructions on how to do this. - -## Limits - -* **Inference concurrency limits**: By default, Serverless RL currently supports up to 2000 concurrent requests per user and 6000 per project. If you exceed your rate limit, the Inference API returns a `429 Concurrency limit reached for requests` response. To avoid this error, reduce the number of concurrent requests your training job or production workload makes at once. If you need a higher rate limit, you can request one at support@wandb.com. - -* **Personal entities unsupported**: Serverless RL and W&B Inference don't support personal entities (personal accounts). To access Serverless RL, switch to a non-personal account by [creating a Team]({{< relref "/guides/hosting/iam/access-management/manage-organization/#add-and-manage-teams" >}}). Personal entities (personal accounts) were deprecated in May 2024, so this advisory only applies to legacy accounts. - -* **Geographic restrictions**: Serverless RL is only available in supported geographic locations. For more information, see the [Terms of Service](https://site.wandb.ai/terms/). \ No newline at end of file diff --git a/content/en/guides/training/serverless-rl/use-trained-models.md b/content/en/guides/training/serverless-rl/use-trained-models.md deleted file mode 100644 index c87d037697..0000000000 --- a/content/en/guides/training/serverless-rl/use-trained-models.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -title: "Use your trained models" -linkTitle: "Use trained models" -weight: 20 -description: Make inference requests to the models you've trained. ---- - -After training a model with Serverless RL, it is automatically available for inference. - -To send requests to your trained model, you need: -* Your [W&B API key](https://wandb.ai/authorize) -* The [Training API's]({{< relref "/ref/training" >}}) base URL, `https://api.training.wandb.ai/v1/` -* Your model's endpoint - -The model's endpoint uses the following schema: - -``` -wandb-artifact://///: -``` - -The schema consists of: - -* Your W&B entity's (team) name -* The name of the project associated with your model -* The trained model's name -* The training step of the model you want to deploy (this is usually the step where the model performed best in your evaluations) - -For example, if your W&B team is named `email-specialists`, your project is called `mail-search`, your trained model is named `agent-001`, and you wanted to deploy it on step 25, the endpoint looks like this: - -``` -wandb-artifact:///email-specialists/mail-search/agent-001:step25 -``` - -Once you have your endpoint, you can integrate it into your normal inference workflows. The following examples show how to make inference requests to your trained model using a cURL request or the [Python OpenAI SDK](https://github.com/openai/openai-python). - -### cURL - -```shell -curl https://api.training.wandb.ai/v1/chat/completions \ - -H "Authorization: Bearer $WANDB_API_KEY" \ - -H "Content-Type: application/json" \ - -d '{ - "model": "wandb-artifact://///:", - "messages": [ - {"role": "system", "content": "You are a helpful assistant."}, - {"role": "user", "content": "Summarize our training run."} - ], - "temperature": 0.7, - "top_p": 0.95 - }' -``` - -### OpenAI SDK - -```python -from openai import OpenAI - -WANDB_API_KEY = "your-wandb-api-key" -ENTITY = "my-entity" -PROJECT = "my-project" - -client = OpenAI( - base_url="https://api.training.wandb.ai/v1", - api_key=WANDB_API_KEY -) - -response = client.chat.completions.create( - model=f"wandb-artifact:///{ENTITY}/{PROJECT}/my-model:step100", - messages=[ - {"role": "system", "content": "You are a helpful assistant."}, - {"role": "user", "content": "Summarize our training run."}, - ], - temperature=0.7, - top_p=0.95, -) - -print(response.choices[0].message.content) -``` \ No newline at end of file diff --git a/content/en/guides/weave/_index.md b/content/en/guides/weave/_index.md deleted file mode 100644 index d6d9b73cf9..0000000000 --- a/content/en/guides/weave/_index.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -menu: - default: - identifier: weave -title: W&B Weave -weight: 40 ---- - -{{% alert %}} -Are you looking for the official Weave documentation? Head over to [weave-docs.wandb.ai](https://weave-docs.wandb.ai/). -{{% /alert %}} - -W&B Weave is a framework for tracking, experimenting with, evaluating, deploying, and improving LLM-based applications. Designed for flexibility and scalability, Weave supports every stage of your LLM application development workflow: - -- **Tracing & Monitoring**: Track LLM calls and application logic to debug and analyze production systems. -- **Systematic Iteration**: Refine and iterate on prompts, datasets and models. -- **Experimentation**: Experiment with different models and prompts in the LLM Playground. -- **Evaluation**: Use custom or pre-built scorers alongside our comparison tools to systematically assess and enhance application performance. -- **Guardrails**: Protect your application with safeguards for content moderation, prompt safety, and more. - -## Get started with Weave - -Are you new to Weave? Set up and start using Weave with the [Python quickstart](https://weave-docs.wandb.ai/quickstart) or [TypeScript quickstart](https://weave-docs.wandb.ai/reference/generated_typescript_docs/intro-notebook). - -## Advanced guides - -Learn more about advanced topics: - -- [Integrations](https://weave-docs.wandb.ai/guides/integrations/): Use Weave with popular LLM providers, local models, frameworks, and third-party services. -- [Cookbooks](https://weave-docs.wandb.ai/reference/gen_notebooks/intro_notebook): Build with Weave using Python and TypeScript. Tutorials are available as interactive notebooks. -- [W&B AI Academy](https://www.wandb.courses/pages/w-b-courses): Build advanced RAG systems, improve LLM prompting, fine-tune LLMs, and more. -- [Weave Python SDK](https://weave-docs.wandb.ai/reference/python-sdk/weave/) -- [Weave TypeScript SDK](https://weave-docs.wandb.ai/reference/typescript-sdk/weave/) -- [Weave Service API](https://weave-docs.wandb.ai/reference/service-api/call-start-call-start-post) diff --git a/content/en/guides/weave/set-up-weave.md b/content/en/guides/weave/set-up-weave.md deleted file mode 100644 index 5f0baaddd4..0000000000 --- a/content/en/guides/weave/set-up-weave.md +++ /dev/null @@ -1,89 +0,0 @@ ---- -description: How to use install and configure Weave to capture data and metrics about your LLM workflows. -title: Use Weave in your W&B runs -weight: 100 ---- - -Integrating Weave with your W&B runs gives you a complete picture of how your LLM workflows behave. While W&B tracks experiments, metrics, and artifacts, Weave adds visibility into the step-by-step execution of your models by capturing prompts, responses, tool calls, latencies, and token usage automatically. By importing `weave` alongside `wandb.init()`, you can start collecting traces with no extra setup. This makes it easy to debug and measure the performance of your agents over time in the W&B dashboard. - -See the [Weave's documentation](https://weave-docs.wandb.ai/) to learn more about capturing traces and how you can start evaluating your LLM's responses. - -## Install Weave - -To install Weave, run: - -```bash -pip install wandb weave -``` - -## Auto-initialize Weave with W&B - -Once you've installed Weave, import it and initialize a W&B run. No additional configuration is required to initialize Weave. - -```python -import wandb -import weave - -wandb.init(project="weave-demo") - -# Weave is now auto-initialized and ready to capture traces. -# Use your code as usual; traces are associated with this W&B run. -``` - -## Start tracking LLM workflows - -Weave automatically tracks LLM calls by patching popular LLM libraries like OpenAI, Anthropic, and Gemini. This means that you can call your LLM as you normally would, and Weave will automatically track the call. - -For example, the following code snippet makes a basic call to OpenAI and Weave captures a trace without any additional configuration: - -```python -import wandb -import weave -from openai import OpenAI - -wandb.init(project="weave-demo") -client = OpenAI() - -# Weave will automatically track this call -response = client.chat.completions.create( - model="gpt-4o-mini", - messages=[{"role": "user", "content": "What is the capital of France?"}] -) -``` - -You can also use Weave to track arbitrary Python functions by decorating them with `@weave.op`, like this: - -```python -import wandb -import weave - -wandb.init(project="weave-demo") - -@weave.op -def agent_step(**kwargs): - ... - -def internal_step(**kwargs): - ... - - -# Weave automatically tracks this call -agent_step() - -# Weave does not track this call -internal_step() -``` - -This allows you to capture data about functions that handle things like retrieval, scoring, or data preprocessing so you can see how non-LLM steps contribute to your agent’s overall behavior. - -## View your traces - -After running your code, `wandb.init()` returns several links to the W&B dashboard. The link to your trace looks similar to this: - -```shell -weave: Logged in as Weights & Biases user: example-user. -weave: View Weave data at https://wandb.ai/wandb/your-project/weave -weave: 🍩 https://wandb.ai/wandb/your-project/r/call/0198f4f7-2869-7694-ab8d-3d602de64377 -``` - -Open the link in a browser to view the trace in the dashboard. You can explore dashboard to see the various metrics and data collected during the trace, and share the results with your team. diff --git a/content/en/launch-library/_index.md b/content/en/launch-library/_index.md deleted file mode 100644 index 4e1f275892..0000000000 --- a/content/en/launch-library/_index.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: launch-library -menu: - launch: - identifier: launch-library -type: docs -hidden: true -cascade: - type: docs - hidden: true - menu: - launch-library: - parent: launch-library ---- - - - - - -## Classes - -[`class LaunchAgent`](./launchagent.md): Launch agent class which polls run given run queues and launches runs for wandb launch. - -## Functions - -[`launch(...)`](./launch.md): Launch a W&B launch experiment. - -[`launch_add(...)`](./launch_add.md): Enqueue a W&B launch experiment. With either a source uri, job or docker_image. diff --git a/content/en/launch-library/launch.md b/content/en/launch-library/launch.md deleted file mode 100644 index 34ecebe33f..0000000000 --- a/content/en/launch-library/launch.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: launch api ---- - -{{< cta-button githubLink=https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/_launch.py#L249-L331 >}} - -Launch a W&B launch experiment. - -```python -launch( - api: Api, - job: Optional[str] = None, - entry_point: Optional[List[str]] = None, - version: Optional[str] = None, - name: Optional[str] = None, - resource: Optional[str] = None, - resource_args: Optional[Dict[str, Any]] = None, - project: Optional[str] = None, - entity: Optional[str] = None, - docker_image: Optional[str] = None, - config: Optional[Dict[str, Any]] = None, - synchronous: Optional[bool] = (True), - run_id: Optional[str] = None, - repository: Optional[str] = None -) -> AbstractRun -``` - -| Arguments | | -| :--- | :--- | -| `job` | string reference to a wandb.Job eg: wandb/test/my-job:latest | -| `api` | An instance of a wandb Api from wandb.apis.internal. | -| `entry_point` | Entry point to run within the project. Defaults to using the entry point used in the original run for wandb URIs, or main.py for git repository URIs. | -| `version` | For Git-based projects, either a commit hash or a branch name. | -| `name` | Name run under which to launch the run. | -| `resource` | Execution backend for the run. | -| `resource_args` | Resource related arguments for launching runs onto a remote backend. Will be stored on the constructed launch config under `resource_args`. | -| `project` | Target project to send launched run to | -| `entity` | Target entity to send launched run to | -| `config` | A dictionary containing the configuration for the run. May also contain resource specific arguments under the key "resource_args". | -| `synchronous` | Whether to block while waiting for a run to complete. Defaults to True. Note that if `synchronous` is False and `backend` is "local-container", this method will return, but the current process will block when exiting until the local run completes. If the current process is interrupted, any asynchronous runs launched via this method will be terminated. If `synchronous` is True and the run fails, the current process will error out as well. | -| `run_id` | ID for the run (To ultimately replace the :name: field) | -| `repository` | string name of repository path for remote registry | - -#### Example: - -```python -from wandb.sdk.launch import launch - -job = "wandb/jobs/Hello World:latest" -params = {"epochs": 5} -# Run W&B project and create a reproducible docker environment -# on a local host -api = wandb.apis.internal.Api() -launch(api, job, parameters=params) -``` - -| Returns | | -| :--- | :--- | -| an instance of`wandb.launch.SubmittedRun` exposing information (e.g. run ID) about the launched run. | - -| Raises | | -| :--- | :--- | -| `wandb.exceptions.ExecutionError` If a run launched in blocking mode is unsuccessful. | diff --git a/content/en/launch-library/launch_add.md b/content/en/launch-library/launch_add.md deleted file mode 100644 index 2a49308d99..0000000000 --- a/content/en/launch-library/launch_add.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: launch_add ---- - -{{< cta-button githubLink=https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/_launch_add.py#L34-L131 >}} - -Enqueue a W&B launch experiment. With either a source uri, job or docker_image. - -```python -launch_add( - uri: Optional[str] = None, - job: Optional[str] = None, - config: Optional[Dict[str, Any]] = None, - template_variables: Optional[Dict[str, Union[float, int, str]]] = None, - project: Optional[str] = None, - entity: Optional[str] = None, - queue_name: Optional[str] = None, - resource: Optional[str] = None, - entry_point: Optional[List[str]] = None, - name: Optional[str] = None, - version: Optional[str] = None, - docker_image: Optional[str] = None, - project_queue: Optional[str] = None, - resource_args: Optional[Dict[str, Any]] = None, - run_id: Optional[str] = None, - build: Optional[bool] = (False), - repository: Optional[str] = None, - sweep_id: Optional[str] = None, - author: Optional[str] = None, - priority: Optional[int] = None -) -> "public.QueuedRun" -``` - -| Arguments | | -| :--- | :--- | -| `uri` | URI of experiment to run. A wandb run uri or a Git repository URI. | -| `job` | string reference to a wandb.Job eg: wandb/test/my-job:latest | -| `config` | A dictionary containing the configuration for the run. May also contain resource specific arguments under the key "resource_args" | -| `template_variables` | A dictionary containing values of template variables for a run queue. Expected format of `{"VAR_NAME": VAR_VALUE}` | -| `project` | Target project to send launched run to | -| `entity` | Target entity to send launched run to | -| `queue` | the name of the queue to enqueue the run to | -| `priority` | the priority level of the job, where 1 is the highest priority | -| `resource` | Execution backend for the run: W&B provides built-in support for "local-container" backend | -| `entry_point` | Entry point to run within the project. Defaults to using the entry point used in the original run for wandb URIs, or main.py for git repository URIs. | -| `name` | Name run under which to launch the run. | -| `version` | For Git-based projects, either a commit hash or a branch name. | -| `docker_image` | The name of the docker image to use for the run. | -| `resource_args` | Resource related arguments for launching runs onto a remote backend. Will be stored on the constructed launch config under `resource_args`. | -| `run_id` | optional string indicating the id of the launched run | -| `build` | optional flag defaulting to false, requires queue to be set if build, an image is created, creates a job artifact, pushes a reference to that job artifact to queue | -| `repository` | optional string to control the name of the remote repository, used when pushing images to a registry | -| `project_queue` | optional string to control the name of the project for the queue. Primarily used for back compatibility with project scoped queues | - -#### Example: - -```python -from wandb.sdk.launch import launch_add - -project_uri = "https://github.com/wandb/examples" -params = {"alpha": 0.5, "l1_ratio": 0.01} -# Run W&B project and create a reproducible docker environment -# on a local host -api = wandb.apis.internal.Api() -launch_add(uri=project_uri, parameters=params) -``` - -| Returns | | -| :--- | :--- | -| an instance of`wandb.api.public.QueuedRun` which gives information about the queued run, or if `wait_until_started` or `wait_until_finished` are called, gives access to the underlying Run information. | - -| Raises | | -| :--- | :--- | -| `wandb.exceptions.LaunchError` if unsuccessful | diff --git a/content/en/launch-library/launchagent.md b/content/en/launch-library/launchagent.md deleted file mode 100644 index d1fa5627a8..0000000000 --- a/content/en/launch-library/launchagent.md +++ /dev/null @@ -1,181 +0,0 @@ ---- -title: LaunchAgent ---- - -{{< cta-button githubLink=https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L164-L924 >}} - -Launch agent class which polls run given run queues and launches runs for wandb launch. - -```python -LaunchAgent( - api: Api, - config: Dict[str, Any] -) -``` - -| Arguments | | -| :--- | :--- | -| `api` | Api object to use for making requests to the backend. | -| `config` | Config dictionary for the agent. | - -| Attributes | | -| :--- | :--- | -| `num_running_jobs` | Return the number of jobs not including schedulers. | -| `num_running_schedulers` | Return just the number of schedulers. | -| `thread_ids` | Returns a list of keys running thread ids for the agent. | - -## Methods - -### `check_sweep_state` - -[View source](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L786-L803) - -```python -check_sweep_state( - launch_spec, api -) -``` - -Check the state of a sweep before launching a run for the sweep. - -### `fail_run_queue_item` - -[View source](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L295-L304) - -```python -fail_run_queue_item( - run_queue_item_id, message, phase, files=None -) -``` - -### `finish_thread_id` - -[View source](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L416-L509) - -```python -finish_thread_id( - thread_id, exception=None -) -``` - -Removes the job from our list for now. - -### `get_job_and_queue` - -[View source](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L908-L915) - -```python -get_job_and_queue() -``` - -### `initialized` - -[View source](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L190-L193) - -```python -@classmethod -initialized() -> bool -``` - -Return whether the agent is initialized. - -### `loop` - -[View source](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L572-L653) - -```python -loop() -``` - -Loop infinitely to poll for jobs and run them. - -| Raises | | -| :--- | :--- | -| `KeyboardInterrupt` | if the agent is requested to stop. | - -### `name` - -[View source](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L180-L188) - -```python -@classmethod -name() -> str -``` - -Return the name of the agent. - -### `pop_from_queue` - -[View source](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L340-L363) - -```python -pop_from_queue( - queue -) -``` - -Pops an item off the runqueue to run as a job. - -| Arguments | | -| :--- | :--- | -| `queue` | Queue to pop from. | - -| Returns | | -| :--- | :--- | -| Item popped off the queue. | - -| Raises | | -| :--- | :--- | -| `Exception` | if there is an error popping from the queue. | - -### `print_status` - -[View source](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L365-L381) - -```python -print_status() -> None -``` - -Prints the current status of the agent. - -### `run_job` - -[View source](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L511-L541) - -```python -run_job( - job, queue, file_saver -) -``` - -Set up project and run the job. - -| Arguments | | -| :--- | :--- | -| `job` | Job to run. | - -### `task_run_job` - -[View source](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L656-L688) - -```python -task_run_job( - launch_spec, job, default_config, api, job_tracker -) -``` - -### `update_status` - -[View source](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L383-L394) - -```python -update_status( - status -) -``` - -Update the status of the agent. - -| Arguments | | -| :--- | :--- | -| `status` | Status to update the agent to. | diff --git a/content/en/launch/_index.md b/content/en/launch/_index.md deleted file mode 100644 index 48311f62f1..0000000000 --- a/content/en/launch/_index.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -description: Easily scale and manage ML jobs using W&B Launch. -menu: - launch: - identifier: launch -type: docs -cascade: - type: docs - menu: - launch: - parent: launch -title: Launch -url: guides/launch ---- diff --git a/content/en/launch/create-and-deploy-jobs/_index.md b/content/en/launch/create-and-deploy-jobs/_index.md deleted file mode 100644 index 3171988535..0000000000 --- a/content/en/launch/create-and-deploy-jobs/_index.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -menu: - launch: - identifier: create-and-deploy-jobs - parent: launch -title: Create and deploy jobs ---- - diff --git a/content/en/launch/create-and-deploy-jobs/add-job-to-queue.md b/content/en/launch/create-and-deploy-jobs/add-job-to-queue.md deleted file mode 100644 index 6d5092f8aa..0000000000 --- a/content/en/launch/create-and-deploy-jobs/add-job-to-queue.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -menu: - launch: - identifier: add-job-to-queue - parent: create-and-deploy-jobs -title: Add job to queue -url: guides/launch/add-job-to-queue ---- -The following page describes how to add launch jobs to a launch queue. - -{{% alert %}} -Ensure that you, or someone on your team, has already configured a launch queue. For more information, see the [Set up Launch]({{< relref "/launch/set-up-launch/" >}}) page. -{{% /alert %}} - -## Add jobs to your queue - -Add jobs to your queue interactively with the W&B App or programmatically with the W&B CLI. - -{{< tabpane text=true >}} -{{% tab "W&B app" %}} -Add a job to your queue programmatically with the W&B App. - -1. Navigate to your W&B Project Page. -2. Select the **Jobs** icon on the left panel: - {{< img src="/images/launch/project_jobs_tab_gs.png" alt="Project Jobs tab" >}} -3. The **Jobs** page displays a list of W&B launch jobs that were created from previously executed W&B runs. - {{< img src="/images/launch/view_jobs.png" alt="Jobs listing" >}} -4. Select the **Launch** button next to the name of the Job name. A modal will appear on the right side of the page. -5. From the **Job version** dropdown, select the version of the launch job you want to use. Launch jobs are versioned like any other [W&B Artifact]({{< relref "/guides/core/artifacts/create-a-new-artifact-version.md" >}}). Different versions of the same launch job will be created if you make modifications to the software dependencies or source code used to run the job. -6. Within the **Overrides** section, provide new values for any inputs that are configured for your launch job. Common overrides include a new entrypoint command, arguments, or values in the `wandb.Run.config` of your new W&B run. - {{< img src="/images/launch/create_starter_queue_gs.png" alt="Queue configuration" >}} - You can copy and paste values from other W&B runs that used your launch job by clicking on the **Paste from...** button. -7. From the **Queue** dropdown, select the name of the launch queue you want to add your launch job to. -8. Use the **Job Priority** dropdown to specify the priority of your launch job. A launch job's priority is set to "Medium" if the launch queue does not support prioritization. -9. **(Optional) Follow this step only if a queue config template was created by your team admin** -Within the **Queue Configurations** field, provide values for configuration options that were created by the admin of your team. -For example, in the following example, the team admin configured AWS instance types that can be used by the team. In this case, team members can pick either the `ml.m4.xlarge` or `ml.p3.xlarge` compute instance type to train their model. -{{< img src="/images/launch/team_member_use_config_template.png" alt="Config template selection" >}} -10. Select the **Destination project**, where the resulting run will appear. This project needs to belong to the same entity as the queue. -11. Select the **Launch now** button. - -{{% /tab %}} -{{% tab "W&B CLI" %}} - -Use the `wandb launch` command to add jobs to a queue. Create a JSON configuration with hyperparameter overrides. For example, using the script from the [Quickstart]({{< relref "../walkthrough.md" >}}) guide, we create a JSON file with the following overrides: - -```json title="config.json" -{ - "overrides": { - "args": [], - "run_config": { - "learning_rate": 0, - "epochs": 0 - }, - "entry_point": [] - } -} -``` - -{{% alert %}} -W&B Launch will use the default parameters if you do not provide a JSON configuration file. -{{% /alert %}} - -If you want to override the queue configuration, or if your launch queue does not have a configuration resource defined, you can specify the `resource_args` key in your config.json file. For example, following continuing the example above, your config.json file might look similar to the following: - -```json title="config.json" -{ - "overrides": { - "args": [], - "run_config": { - "learning_rate": 0, - "epochs": 0 - }, - "entry_point": [] - }, - "resource_args": { - "" : { - "": "" - } - } -} -``` - -Replace values within the `<>` with your own values. - -Provide the name of the queue for the `queue`(`-q`) flag, the name of the job for the `job`(`-j`) flag, and the path to the configuration file for the `config`(`-c`) flag. - -```bash -wandb launch -j -q \ --e -c path/to/config.json -``` -If you work within a W&B Team, we suggest you specify the `entity` flag (`-e`) to indicate which entity the queue will use. - -{{% /tab %}} -{{% /tabpane %}} \ No newline at end of file diff --git a/content/en/launch/create-and-deploy-jobs/create-launch-job.md b/content/en/launch/create-and-deploy-jobs/create-launch-job.md deleted file mode 100644 index 4c1cbafc2b..0000000000 --- a/content/en/launch/create-and-deploy-jobs/create-launch-job.md +++ /dev/null @@ -1,162 +0,0 @@ ---- -menu: - launch: - identifier: create-launch-job - parent: create-and-deploy-jobs -title: Create a launch job -url: guides/launch/create-launch-job ---- -{{< cta-button colabLink="https://colab.research.google.com/drive/1wX0OSVxZJDHRsZaOaOEDx-lLUrO1hHgP" >}} - -Launch jobs are blueprints for reproducing W&B runs. Jobs are W&B Artifacts that capture the source code, dependencies, and inputs required to execute a workload. - -Create and run jobs with the `wandb launch` command. - -{{% alert %}} -To create a job without submitting it for execution, use the `wandb job create` command. See the [command reference docs]({{< relref "/ref/cli/wandb-job/wandb-job-create.md" >}}) for more information. -{{% /alert %}} - - -## Git jobs - -You can create a Git-based job where code and other tracked assets are cloned from a certain commit, branch, or tag in a remote git repository with W&B Launch. Use the `--uri` or `-u` flag to specify the URI containing the code, along with optionally a `--build-context` flag to specify a subdirectory. - -Run a "hello world" job from a git repository with the following command: - -```bash -wandb launch --uri "https://github.com/wandb/launch-jobs.git" --build-context jobs/hello_world --dockerfile Dockerfile.wandb --project "hello-world" --job-name "hello-world" --entry-point "python job.py" -``` - -The command does the following: -1. Clones the [W&B Launch jobs repository](https://github.com/wandb/launch-jobs) to a temporary directory. -2. Creates a job named **hello-world-git** in the **hello** project. The job is associated with the commit at the head of the default branch of the repository. -3. Builds a container image from the `jobs/hello_world` directory and the `Dockerfile.wandb`. -4. Starts the container and runs `python job.py`. - -To build a job from a specific branch or commit hash, append the `-g`, `--git-hash` argument. For a full list of arguments, run `wandb launch --help`. - -### Remote URL format - -The git remote associated with a Launch job can be either an HTTPS or an SSH URL. The URL type determines the protocol used to fetch job source code. - -| Remote URL Type| URL Format | Requirements for access and authentication | -| ----------| ------------------- | ------------------------------------------ | -| https | `https://github.com/organization/repository.git` | username and password to authenticate with the git remote | -| ssh | `git@github.com:organization/repository.git` | ssh key to authenticate with the git remote | - -Note that the exact URL format varies by hosting provider. Jobs created with `wandb launch --uri` will use the transfer protocol specified in the provided `--uri`. - - -## Code artifact jobs - -Jobs can be created from any source code stored in a W&B Artifact. Use a local directory with the `--uri` or `-u` argument to create a new code artifact and job. - -To get started, create an empty directory and add a Python script named `main.py` with the following content: - -```python -import wandb - -with wandb.init() as run: - run.log({"metric": 0.5}) -``` - -Add a file `requirements.txt` with the following content: - -```txt -wandb>=0.17.1 -``` - -Log the directory as a code artifact and launch a job with the following command: - -```bash -wandb launch --uri . --job-name hello-world-code --project launch-quickstart --entry-point "python main.py" -``` - -The preceding command does the following: -1. Logs the current directory as a code artifact named `hello-world-code`. -2. Creates a job named `hello-world-code` in the `launch-quickstart` project. -3. Builds a container image from the current directory and Launch's default Dockerfile. The default Dockerfile will install the `requirements.txt` file and set the entry point to `python main.py`. - -## Image jobs - -Alternatively, you can build jobs off of pre-made Docker images. This is useful when you already have an established build system for your ML code, or when you don't expect to adjust the code or requirements for the job but do want to experiment with hyperparameters or different infrastructure scales. - -The image is pulled from a Docker registry and run with the specified entry point, or the default entry point if none is specified. Pass a full image tag to the `--docker-image` option to create and run a job from a Docker image. - -To run a simple job from a pre-made image, use the following command: - -```bash -wandb launch --docker-image "wandb/job_hello_world:main" --project "hello-world" -``` - - -## Automatic job creation - -W&B will automatically create and track a job for any run with tracked source code, even if that run was not created with Launch. Runs are considered to have tracked source code if any of the three following conditions are met: -- The run has an associated git remote and commit hash. -- The run logged a code artifact. See [`Run.log_code`]({{< relref "/ref/python/experiments/run#log_code" >}}). -- The run was executed in a Docker container with the `WANDB_DOCKER` environment variable set to an image tag - -The Git remote URL is inferred from the local git repository if your Launch job is created automatically by a W&B run. - -### Launch job names - -By default, W&B automatically generates a job name for you. The name is generated depending on how the job is created (GitHub, code artifact, or Docker image). Alternatively, you can define a Launch job's name with environment variables or with the W&B Python SDK. - -The following table describes the job naming convention used by default based on job source: - -| Source | Naming convention | -| ------------- | --------------------------------------- | -| GitHub | `job--` | -| Code artifact | `job-` | -| Docker image | `job-` | - -Name your job with a W&B environment variable or with the W&B Python SDK - -{{< tabpane text=true >}} -{{% tab "Environment variable" %}} -Set the `WANDB_JOB_NAME` environment variable to your preferred job name. For example: - -```bash -WANDB_JOB_NAME=awesome-job-name -``` -{{% /tab %}} -{{% tab "W&B Python SDK" %}} -Define the name of your job with `wandb.Settings`. Then pass this object when you initialize W&B with `wandb.init`. For example: - -```python -settings = wandb.Settings(job_name="my-job-name") -wandb.init(settings=settings) -``` -{{% /tab %}} -{{< /tabpane >}} - -{{% alert %}} -For docker image jobs, the version alias is automatically added as an alias to the job. -{{% /alert %}} - -## Containerization - -Jobs are executed in a container. Image jobs use a pre-built Docker image, while Git and code artifact jobs require a container build step. - -Job containerization can be customized with arguments to `wandb launch` and files within the job source code. - -### Build context - -The term build context refers to the tree of files and directories that are sent to the Docker daemon to build a container image. By default, Launch uses the root of the job source code as the build context. To specify a subdirectory as the build context, use the `--build-context` argument of `wandb launch` when creating and launching a job. - -{{% alert %}} -The `--build-context` argument is particularly useful for working with Git jobs that refer to a monorepo with multiple projects. By specifying a subdirectory as the build context, you can build a container image for a specific project within the monorepo. - -See the [example above]({{< relref "#git-jobs" >}}) for a demonstration of how to use the `--build-context` argument with the official W&B Launch jobs repository. -{{% /alert %}} - -### Dockerfile - -The Dockerfile is a text file that contains instructions for building a Docker image. By default, Launch uses a default Dockerfile that installs the `requirements.txt` file. To use a custom Dockerfile, specify the path to the file with the `--dockerfile` argument of `wandb launch`. - -The Dockerfile path is specified relative to the build context. For example, if the build context is `jobs/hello_world`, and the Dockerfile is located in the `jobs/hello_world` directory, the `--dockerfile` argument should be set to `Dockerfile.wandb`. See the [example above]({{< relref "#git-jobs" >}}) for a demonstration of how to use the `--dockerfile` argument with the official W&B Launch jobs repository. - -### Requirements file - -If no custom Dockerfile is provided, Launch will look in the build context for Python dependencies to install. If a `requirements.txt` file is found at the root of the build context, Launch will install the dependencies listed in the file. Otherwise, if a `pyproject.toml` file is found, Launch will install dependencies from the `project.dependencies` section. \ No newline at end of file diff --git a/content/en/launch/create-and-deploy-jobs/job-inputs.md b/content/en/launch/create-and-deploy-jobs/job-inputs.md deleted file mode 100644 index 152935b6f0..0000000000 --- a/content/en/launch/create-and-deploy-jobs/job-inputs.md +++ /dev/null @@ -1,264 +0,0 @@ ---- -menu: - launch: - identifier: job-inputs - parent: create-and-deploy-jobs -title: Manage job inputs -url: guides/launch/job-inputs ---- -The core experience of Launch is easily experimenting with different job inputs like hyperparameters and datasets, and routing these jobs to appropriate hardware. Once a job is created, users beyond the original author can adjust these inputs via the W&B GUI or CLI. For information on how job inputs can be set when launching from the CLI or UI, see the [Enqueue jobs]({{< relref "./add-job-to-queue.md" >}}) guide. - -This section describes how to programmatically control the inputs that can be tweaked for a job. - -By default, W&B jobs capture the entire `Run.config` as the inputs to a job, but the Launch SDK provides a function to control select keys in the run config or to specify JSON or YAML files as inputs. - - -{{% alert %}} -Launch SDK functions require `wandb-core`. See the [`wandb-core` README](https://github.com/wandb/wandb/blob/main/core/README.md) for more information. -{{% /alert %}} - -## Reconfigure the `Run` object - -The `Run` object returned by `wandb.init` in a job can be reconfigured, by default. The Launch SDK provides a way to customize what parts of the `Run.config` object can be reconfigured when launching the job. - - -```python -import wandb -from wandb.sdk import launch - -# Required for launch sdk use. -wandb.require("core") - -config = { - "trainer": { - "learning_rate": 0.01, - "batch_size": 32, - "model": "resnet", - "dataset": "cifar10", - "private": { - "key": "value", - }, - }, - "seed": 42, -} - - -with wandb.init(config=config): - launch.manage_wandb_config( - include=["trainer"], - exclude=["trainer.private"], - ) - # Etc. -``` - -The function `launch.manage_wandb_config` configures the job to accept input values for the `Run.config` object. The optional `include` and `exclude` options take path prefixes within the nested config object. This can be useful if, for example, a job uses a library whose options you don't want to expose to end users. - -If `include` prefixes are provided, only paths within the config that match an `include` prefix will accept input values. If `exclude` prefixes are provided, no paths that match the `exclude` list will be filtered out of the input values. If a path matches both an `include` and an `exclude` prefix, the `exclude` prefix will take precedence. - -In the preceding example, the path `["trainer.private"]` will filter out the `private` key from the `trainer` object, and the path `["trainer"]` will filter out all keys not under the `trainer` object. - -{{% alert %}} -Use a `\`-escaped `.` to filter out keys with a `.` in their name. - -For example, `r"trainer\.private"` filters out the `trainer.private` key rather than the `private` key under the `trainer` object. - -Note that the `r` prefix above denotes a raw string. -{{% /alert %}} - -If the code above is packaged and run as a job, the input types of the job will be: - -```json -{ - "trainer": { - "learning_rate": "float", - "batch_size": "int", - "model": "str", - "dataset": "str", - }, -} -``` - -When launching the job from the W&B CLI or UI, the user will be able to override only the four `trainer` parameters. - -### Access run config inputs - -Jobs launched with run config inputs can access the input values through the `Run.config`. The `Run` returned by `wandb.init` in the job code will have the input values automatically set. Use -```python -from wandb.sdk import launch - -run_config_overrides = launch.load_wandb_config() -``` -to load the run config input values anywhere in the job code. - -## Reconfigure a file - -The Launch SDK also provides a way to manage input values stored in config files in the job code. This is a common pattern in many deep learning and large language model use cases, like this [torchtune](https://github.com/pytorch/torchtune/blob/main/recipes/configs/llama3/8B_lora.yaml) example or this [Axolotl config](https://github.com/OpenAccess-AI-Collective/axolotl/blob/main/examples/llama-3/qlora-fsdp-70b.yaml)). - -{{% alert %}} -[Sweeps on Launch]({{< relref "../sweeps-on-launch.md" >}}) does not support the use of config file inputs as sweep parameters. Sweep parameters must be controlled through the `Run.config` object. -{{% /alert %}} - -The `launch.manage_config_file` function can be used to add a config file as an input to the Launch job, giving you access to edit values within the config file when launching the job. - -By default, no run config inputs will be captured if `launch.manage_config_file` is used. Calling `launch.manage_wandb_config` overrides this behavior. - -Consider the following example: - -```python -import yaml -import wandb -from wandb.sdk import launch - -# Required for launch sdk use. -wandb.require("core") - -launch.manage_config_file("config.yaml") - -with open("config.yaml", "r") as f: - config = yaml.safe_load(f) - -with wandb.init(config=config): - # Etc. - pass -``` - -Imagine the code is run with an adjacent file `config.yaml`: - -```yaml -learning_rate: 0.01 -batch_size: 32 -model: resnet -dataset: cifar10 -``` - -The call to `launch.manage_config_file` will add the `config.yaml` file as an input to the job, making it reconfigurable when launching from the W&B CLI or UI. - -The `include` and `exclude` keyword arugments may be used to filter the acceptable input keys for the config file in the same way as `launch.manage_wandb_config`. - - -### Access config file inputs - -When `launch.manage_config_file` is called in a run created by Launch, `launch` patches the contents of the config file with the input values. The patched config file is available in the job environment. - -{{% alert color="secondary" %}} -Call `launch.manage_config_file` before reading the config file in the job code to ensure input values are used. -{{% /alert %}} - - -### Customize a job's launch drawer UI - -Defining a schema for a job's inputs allows you to create a custom UI for launching the job. To define a job's schema, include it in the call to `launch.manage_wandb_config` or `launch.manage_config_file`. The schema can either be a python dict in the form of a [JSON Schema](https://json-schema.org/understanding-json-schema/reference) or a Pydantic model class. - -{{% alert color="secondary" %}} -Job input schemas are not used to validate inputs. They are only used to define the UI in the launch drawer. -{{% /alert %}} - - -{{< tabpane text=true >}} -{{% tab "JSON schema" %}} -The following example shows a schema with these properties: - -- `seed`, an integer -- `trainer`, a dictionary with some keys specified: - - `trainer.learning_rate`, a float that must be greater than zero - - `trainer.batch_size`, an integer that must be either 16, 64, or 256 - - `trainer.dataset`, a string that must be either `cifar10` or `cifar100` - -```python -schema = { - "type": "object", - "properties": { - "seed": { - "type": "integer" - } - "trainer": { - "type": "object", - "properties": { - "learning_rate": { - "type": "number", - "description": "Learning rate of the model", - "exclusiveMinimum": 0, - }, - "batch_size": { - "type": "integer", - "description": "Number of samples per batch", - "enum": [16, 64, 256] - }, - "dataset": { - "type": "string", - "description": "Name of the dataset to use", - "enum": ["cifar10", "cifar100"] - } - } - } - } -} - -launch.manage_wandb_config( - include=["seed", "trainer"], - exclude=["trainer.private"], - schema=schema, -) -``` - -In general, the following JSON Schema attributes are supported: - -| Attribute | Required | Notes | -| --- | --- | --- | -| `type` | Yes | Must be one of `number`, `integer`, `string`, or `object` | -| `title` | No | Overrides the property's display name | -| `description` | No | Gives the property helper text | -| `enum` | No | Creates a dropdown select instead of a freeform text entry | -| `minimum` | No | Allowed only if `type` is `number` or `integer` | -| `maximum` | No | Allowed only if `type` is `number` or `integer` | -| `exclusiveMinimum` | No | Allowed only if `type` is `number` or `integer` | -| `exclusiveMaximum` | No | Allowed only if `type` is `number` or `integer` | -| `properties` | No | If `type` is `object`, used to define nested configurations | -{{% /tab %}} -{{% tab "Pydantic model" %}} -The following example shows a schema with these properties: - -- `seed`, an integer -- `trainer`, a schema with some sub-attributes specified: - - `trainer.learning_rate`, a float that must be greater than zero - - `trainer.batch_size`, an integer that must be between 1 and 256, inclusive - - `trainer.dataset`, a string that must be either `cifar10` or `cifar100` - -```python -class DatasetEnum(str, Enum): - cifar10 = "cifar10" - cifar100 = "cifar100" - -class Trainer(BaseModel): - learning_rate: float = Field(gt=0, description="Learning rate of the model") - batch_size: int = Field(ge=1, le=256, description="Number of samples per batch") - dataset: DatasetEnum = Field(title="Dataset", description="Name of the dataset to use") - -class Schema(BaseModel): - seed: int - trainer: Trainer - -launch.manage_wandb_config( - include=["seed", "trainer"], - exclude=["trainer.private"], - schema=Schema, -) -``` - -You can also use an instance of the class: - -```python -t = Trainer(learning_rate=0.01, batch_size=32, dataset=DatasetEnum.cifar10) -s = Schema(seed=42, trainer=t) -launch.manage_wandb_config( - include=["seed", "trainer"], - exclude=["trainer.private"], - input_schema=s, -) -``` -{{% /tab %}} -{{< /tabpane >}} - -Adding a job input schema will create a structured form in the launch drawer, making it easier to launch the job. - -{{< img src="/images/launch/schema_overrides.png" alt="Job input schema form" >}} \ No newline at end of file diff --git a/content/en/launch/create-and-deploy-jobs/launch-queue-observability.md b/content/en/launch/create-and-deploy-jobs/launch-queue-observability.md deleted file mode 100644 index b38ea5b652..0000000000 --- a/content/en/launch/create-and-deploy-jobs/launch-queue-observability.md +++ /dev/null @@ -1,89 +0,0 @@ ---- -menu: - launch: - identifier: launch-queue-observability - parent: create-and-deploy-jobs -title: Monitor launch queue -url: guides/launch/launch-queue-observability ---- - -Use the interactive **Queue monitoring dashboard** to view when a launch queue is in heavy use or idle, visualize workloads that are running, and spot inefficient jobs. The launch queue dashboard is especially useful for deciding whether or not you are effectively using your compute hardware or cloud resources. - -For deeper analysis, the page links to the W&B experiment tracking workspace and to external infrastructure monitoring providers like Datadog, NVIDIA Base Command, or cloud consoles. - -{{% alert %}} -Queue monitoring dashboards are currently available only in the W&B Multi-tenant Cloud deployment option. -{{% /alert %}} - -## Dashboard and plots -Use the **Monitor** tab to view the activity of a queue that occurred during the last seven days. Use the left panel to control time ranges, grouping, and filters. - -The dashboard contains a number of plots answering common questions about performance and efficiency. The proceeding sections describe UI elements of queue dashboards. - -### Job status -The **Job status** plot shows how many jobs are running, pending, queued, or completed in each time interval. Use the **Job status** plot for identifying periods of idleness in the queue. - -{{< img src="/images/launch/launch_obs_jobstatus.png" alt="Job status timeline" >}} - -For example, suppose you have a fixed resource (such as DGX BasePod). If you observe an idle queue with the fixed resource, this might suggest an opportunity to run lower-priority pre-emptible launch jobs such as sweeps. - -On the other hand, suppose you use a cloud resource and you see periodic bursts of activity. Periodic bursts of activity might suggest an opportunity to save money by reserving resources for particular times. - -To the right of the plot is a key that shows which colors represent the [status of a launch job]({{< relref "./launch-view-jobs.md#check-the-status-of-a-job" >}}). - -{{% alert %}} -`Queued` items might indicate opportunities to shift workloads to other queues. A spike in failures can identify users who might need help with their launch job setup. -{{% /alert %}} - - - -### Queued time - -The **Queued time** plots shows the amount of time (in seconds) that a launch job was on a queue for a given date or time range. - -{{< img src="/images/launch/launch_obs_queuedtime.png" alt="Queued time metrics" >}} - -The x-axis shows a time frame that you specify and the y-axis shows the time (in seconds) a launch job was on a launch queue. For example, suppose on a given day there are 10 launch jobs queued. The **Queue time** plot shows 600 seconds if those 10 launch jobs wait an average of 60 seconds each. - -{{% alert %}} -Use the **Queued time** plot to identify users affected by long queue times. -{{% /alert %}} - -Customize the color of each job with the `Grouping` control in the left bar. - -which can be particularly helpful for identifying which users and jobs are feeling the pain of scarce queue capacity. - -### Job runs - -{{< img src="/images/launch/launch_obs_jobruns2.png" alt="Job runs timeline" >}} - - -This plot shows the start and end of every job executed in a time period, with distinct colors for each run. This makes it easy to see at a glance what workloads the queue was processing at a given time. - -Use the Select tool in the bottom right of the panel to brush over jobs to populate details in the table below. - - - -### CPU and GPU usage -Use the **GPU use by a job**, **CPU use by a job**, **GPU memory by job**, and **System memory by job** to view the efficiency of your launch jobs. - -{{< img src="/images/launch/launch_obs_gpu.png" alt="GPU usage metrics" >}} - - -For example, you can use the **GPU memory by job** to view if a W&B run took a long time to complete and whether or not it used a low percentage of its CPU cores. - -The x-axis of each plot shows the duration of a W&B run (created by a launch job) in seconds. Hover your mouse over a data point to view information about a W&B run such as the run ID, the project the run belongs to, the launch job that created the W&B run and more. - -### Errors - -The **Errors** panel shows errors that occurred on a given launch queue. More specifically, the Errors panel shows a timestamp of when the error occurred, the name of the launch job where the error comes from, and the error message that was created. By default, errors are ordered from latest to oldest. - -{{< img src="/images/launch/launch_obs_errors.png" alt="Error logs panel" >}} - -Use the **Errors** panel to identify and unblock users. - -## External links - -The queue observability dashboard's view is consistent across all queue types, but in many cases, it can be useful to jump directly into environment-specific monitors. To accomplish this, add a link from the console directly from the queue observability dashboard. - -At the bottom of the page, click `Manage Links` to open a panel. Add the full URL of the page you want. Next, add a label. Links that you add appear in the **External Links** section. \ No newline at end of file diff --git a/content/en/launch/create-and-deploy-jobs/launch-view-jobs.md b/content/en/launch/create-and-deploy-jobs/launch-view-jobs.md deleted file mode 100644 index 2a62161c4c..0000000000 --- a/content/en/launch/create-and-deploy-jobs/launch-view-jobs.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -menu: - launch: - identifier: launch-view-jobs - parent: create-and-deploy-jobs -title: View launch jobs -url: guides/launch/launch-view-jobs ---- - -The following page describes how to view information about launch jobs added to queues. - -## View jobs - -View jobs added to a queue with the W&B App. - -1. Navigate to the W&B App at https://wandb.ai/home. -2. Select **Launch** within the **Applications** section of the left sidebar. -3. Select the **All entities** dropdown and select the entity the launch job belongs to. -4. Expand the collapsible UI from the Launch Application page to view a list of jobs added to that specific queue. - -{{% alert %}} -A run is created when the launch agent executes a launch job. In other words, each run listed corresponds to a specific job that was added to that queue. -{{% /alert %}} - -For example, the following image shows two runs that were created from a job called `job-source-launch_demo-canonical`. The job was added to a queue called `Start queue`. The first run listed in the queue called `resilient-snowball` and the second run listed is called `earthy-energy-165`. - - -{{< img src="/images/launch/launch_jobs_status.png" alt="Launch jobs status view" >}} - -Within the W&B App UI you can find additional information about runs created from launch jobs such as the: - - **Run**: The name of the W&B run assigned to that job. - - **Job ID**: The name of the job. - - **Project**: The name of the project the run belongs to. - - **Status**: The status of the queued run. - - **Author**: The W&B entity that created the run. - - **Creation date**: The timestamp when the queue was created. - - **Start time**: The timestamp when the job started. - - **Duration**: Time, in seconds, it took to complete the job’s run. - -## List jobs -View a list of jobs that exist within a project with the W&B CLI. Use the W&B job list command and provide the name of the project and entity the launch job belongs to the `--project` and `--entity` flags, respectively. - -```bash - wandb job list --entity your-entity --project project-name -``` - -## Check the status of a job - -The following table defines the status a queued run can have: - - -| Status | Description | -| --- | --- | -| **Idle** | The run is in a queue with no active agents. | -| **Queued** | The run is in a queue waiting for an agent to process it. | -| **Pending** | The run has been picked up by an agent but has not yet started. This could be due to resources being unavailable on the cluster. | -| **Running** | The run is currently executing. | -| **Killed** | The job was killed by the user. | -| **Crashed** | The run stopped sending data or did not successfully start. | -| **Failed** | The run ended with a non-zero exit code or the run failed to start. | -| **Finished** | The job completed successfully. | \ No newline at end of file diff --git a/content/en/launch/integration-guides/_index.md b/content/en/launch/integration-guides/_index.md deleted file mode 100644 index 3eac4116b5..0000000000 --- a/content/en/launch/integration-guides/_index.md +++ /dev/null @@ -1,3 +0,0 @@ ---- -title: Launch integration guides ---- \ No newline at end of file diff --git a/content/en/launch/integration-guides/dagster.md b/content/en/launch/integration-guides/dagster.md deleted file mode 100644 index 5a1aa28728..0000000000 --- a/content/en/launch/integration-guides/dagster.md +++ /dev/null @@ -1,1005 +0,0 @@ ---- -description: Guide on how to integrate W&B with Dagster. -menu: - launch: - identifier: dagster - parent: launch-integration-guides -title: Dagster -url: guides/integrations/dagster ---- -Use Dagster and W&B (W&B) to orchestrate your MLOps pipelines and maintain ML assets. The integration with W&B makes it easy within Dagster to: - -* Create and use a [W&B Artifact]({{< relref "/guides/core/artifacts/" >}}). -* Use and create Registered Models in [W&B Registry]({{< relref "/guides/core/registry/" >}}). -* Run training jobs on dedicated compute using [W&B Launch]({{< relref "/launch/" >}}). -* Use the [wandb]({{< relref "/ref/python/" >}}) client in ops and assets. - -The W&B Dagster integration provides a W&B-specific Dagster resource and IO Manager: - -* `wandb_resource`: a Dagster resource used to authenticate and communicate to the W&B API. -* `wandb_artifacts_io_manager`: a Dagster IO Manager used to consume W&B Artifacts. - -The following guide demonstrates how to satisfy prerequisites to use W&B in Dagster, how to create and use W&B Artifacts in ops and assets, how to use W&B Launch and recommended best practices. - -## Before you get started -You will need the following resources to use Dagster within W&B: -1. **W&B API Key**. -2. **W&B entity (user or team)**: An entity is a username or team name where you send W&B Runs and Artifacts. Make sure to create your account or team entity in the W&B App UI before you log runs. If you do not specify ain entity, the run will be sent to your default entity, which is usually your username. Change your default entity in your settings under **Project Defaults**. -3. **W&B project**: The name of the project where [W&B Runs]({{< relref "/guides/models/track/runs/" >}}) are stored. - -Find your W&B entity by checking the profile page for that user or team in the W&B App. You can use a pre-existing W&B project or create a new one. New projects can be created on the W&B App homepage or on user/team profile page. If a project does not exist it will be automatically created when you first use it. The proceeding instructions demonstrate how to get an API key: - -### How to get an API key -1. [Log in to W&B](https://wandb.ai/login). Note: if you are using W&B Server ask your admin for the instance host name. -2. Collect your API key by navigating to the [authorize page](https://wandb.ai/authorize) or in your user/team settings. For a production environment we recommend using a [service account]({{< relref "/support/kb-articles/service_account_useful.md" >}}) to own that key. -3. Set an environment variable for that API key export `WANDB_API_KEY=YOUR_KEY`. - - -The proceeding examples demonstrate where to specify your API key in your Dagster code. Make sure to specify your entity and project name within the `wandb_config` nested dictionary. You can pass different `wandb_config` values to different ops/assets if you want to use a different W&B Project. For more information about possible keys you can pass, see the Configuration section below. - - -{{< tabpane text=true >}} -{{% tab "Config for @job" %}} -Example: configuration for `@job` -```python -# add this to your config.yaml -# alternatively you can set the config in Dagit's Launchpad or JobDefinition.execute_in_process -# Reference: https://docs.dagster.io/concepts/configuration/config-schema#specifying-runtime-configuration -resources: - wandb_config: - config: - entity: my_entity # replace this with your W&B entity - project: my_project # replace this with your W&B project - - -@job( - resource_defs={ - "wandb_config": make_values_resource( - entity=str, - project=str, - ), - "wandb_resource": wandb_resource.configured( - {"api_key": {"env": "WANDB_API_KEY"}} - ), - "io_manager": wandb_artifacts_io_manager, - } -) -def simple_job_example(): - my_op() -``` -{{% /tab %}} -{{% tab "Config for @repository using assets" %}} - -Example: configuration for `@repository` using assets - -```python -from dagster_wandb import wandb_artifacts_io_manager, wandb_resource -from dagster import ( - load_assets_from_package_module, - make_values_resource, - repository, - with_resources, -) - -from . import assets - -@repository -def my_repository(): - return [ - *with_resources( - load_assets_from_package_module(assets), - resource_defs={ - "wandb_config": make_values_resource( - entity=str, - project=str, - ), - "wandb_resource": wandb_resource.configured( - {"api_key": {"env": "WANDB_API_KEY"}} - ), - "wandb_artifacts_manager": wandb_artifacts_io_manager.configured( - {"cache_duration_in_minutes": 60} # only cache files for one hour - ), - }, - resource_config_by_key={ - "wandb_config": { - "config": { - "entity": "my_entity", # replace this with your W&B entity - "project": "my_project", # replace this with your W&B project - } - } - }, - ), - ] -``` -Note that we are configuring the IO Manager cache duration in this example contrary to the example for `@job`. -{{% /tab %}} -{{< /tabpane >}} - - -### Configuration -The proceeding configuration options are used as settings on the W&B-specific Dagster resource and IO Manager provided by the integration. - -* `wandb_resource`: Dagster [resource](https://docs.dagster.io/concepts/resources) used to communicate with the W&B API. It automatically authenticates using the provided API key. Properties: - * `api_key`: (str, required): a W&B API key necessary to communicate with the W&B API. - * `host`: (str, optional): the API host server you wish to use. Only required if you are using W&B Server. It defaults to the Public Cloud host, `https://api.wandb.ai`. -* `wandb_artifacts_io_manager`: Dagster [IO Manager](https://docs.dagster.io/concepts/io-management/io-managers) to consume W&B Artifacts. Properties: - * `base_dir`: (int, optional) Base directory used for local storage and caching. W&B Artifacts and W&B Run logs will be written and read from that directory. By default, it’s using the `DAGSTER_HOME` directory. - * `cache_duration_in_minutes`: (int, optional) to define the amount of time W&B Artifacts and W&B Run logs should be kept in the local storage. Only files and directories that were not opened for that amount of time are removed from the cache. Cache purging happens at the end of an IO Manager execution. You can set it to 0, if you want to turn off caching completely. Caching improves speed when an Artifact is reused between jobs running on the same machine. It defaults to 30 days. - * `run_id`: (str, optional): A unique ID for this run, used for resuming. It must be unique in the project, and if you delete a run you can't reuse the ID. Use the name field for a short descriptive name, or config for saving hyperparameters to compare across runs. The ID cannot contain the following special characters: `/\#?%:..` You need to set the Run ID when you are doing experiment tracking inside Dagster to allow the IO Manager to resume the run. By default it’s set to the Dagster Run ID e.g `7e4df022-1bf2-44b5-a383-bb852df4077e`. - * `run_name`: (str, optional) A short display name for this run to help you identify this run in the UI. By default, it is a string with the following format: `dagster-run-[8 first characters of the Dagster Run ID]`. For example, `dagster-run-7e4df022`. - * `run_tags`: (list[str], optional): A list of strings, which will populate the list of tags on this run in the UI. Tags are useful for organizing runs together, or applying temporary labels like `baseline` or `production`. It's easy to add and remove tags in the UI, or filter down to just runs with a specific tag. Any W&B Run used by the integration will have the `dagster_wandb` tag. - -## Use W&B Artifacts - -The integration with W&B Artifact relies on a Dagster IO Manager. - -[IO Managers](https://docs.dagster.io/concepts/io-management/io-managers) are user-provided objects that are responsible for storing the output of an asset or op and loading it as input to downstream assets or ops. For example, an IO Manager might store and load objects from files on a filesystem. - -The integration provides an IO Manager for W&B Artifacts. This allows any Dagster `@op` or `@asset` to create and consume W&B Artifacts natively. Here’s a simple example of an `@asset` producing a W&B Artifact of type dataset containing a Python list. - -```python -@asset( - name="my_artifact", - metadata={ - "wandb_artifact_arguments": { - "type": "dataset", - } - }, - io_manager_key="wandb_artifacts_manager", -) -def create_dataset(): - return [1, 2, 3] # this will be stored in an Artifact -``` - -You can annotate your `@op`, `@asset` and `@multi_asset` with a metadata configuration in order to write Artifacts. Similarly you can also consume W&B Artifacts even if they were created outside Dagster. - -## Write W&B Artifacts -Before continuing, we recommend you to have a good understanding of how to use W&B Artifacts. Consider reading the [Guide on Artifacts]({{< relref "/guides/core/artifacts/" >}}). - -Return an object from a Python function to write a W&B Artifact. The following objects are supported by W&B: -* Python objects (int, dict, list…) -* W&B objects (Table, Image, Graph…) -* W&B Artifact objects - -The proceeding examples demonstrate how to write W&B Artifacts with Dagster assets (`@asset`): - - -{{< tabpane text=true >}} -{{% tab "Python objects" %}} -Anything that can be serialized with the [pickle](https://docs.python.org/3/library/pickle.html) module is pickled and added to an Artifact created by the integration. The content is unpickled when you read that Artifact inside Dagster (see [Read artifacts]({{< relref "#read-wb-artifacts" >}}) for more details). - -```python -@asset( - name="my_artifact", - metadata={ - "wandb_artifact_arguments": { - "type": "dataset", - } - }, - io_manager_key="wandb_artifacts_manager", -) -def create_dataset(): - return [1, 2, 3] -``` - - -W&B supports multiple Pickle-based serialization modules ([pickle](https://docs.python.org/3/library/pickle.html), [dill](https://github.com/uqfoundation/dill), [cloudpickle](https://github.com/cloudpipe/cloudpickle), [joblib](https://github.com/joblib/joblib)). You can also use more advanced serialization like [ONNX](https://onnx.ai/) or [PMML](https://en.wikipedia.org/wiki/Predictive_Model_Markup_Language). Please refer to the [Serialization]({{< relref "#serialization-configuration" >}}) section for more information. -{{% /tab %}} -{{% tab "W&B Object" %}} -Any W&B object, such as a [Table]({{< relref "/ref/python/data-types/table.md" >}}) or [Image]({{< relref "/ref/python/data-types/image.md" >}}), is added to an Artifact created by the integration. This example adds a Table to an Artifact: - -```python -import wandb - -@asset( - name="my_artifact", - metadata={ - "wandb_artifact_arguments": { - "type": "dataset", - } - }, - io_manager_key="wandb_artifacts_manager", -) -def create_dataset_in_table(): - return wandb.Table(columns=["a", "b", "c"], data=[[1, 2, 3]]) -``` - -{{% /tab %}} -{{% tab "W&B Artifact" %}} - -For complex use cases, it might be necessary to build your own Artifact object. The integration still provides useful additional features like augmenting the metadata on both sides of the integration. - -```python -import wandb - -MY_ASSET = "my_asset" - -@asset( - name=MY_ASSET, - io_manager_key="wandb_artifacts_manager", -) -def create_artifact(): - artifact = wandb.Artifact(MY_ASSET, "dataset") - table = wandb.Table(columns=["a", "b", "c"], data=[[1, 2, 3]]) - artifact.add(table, "my_table") - return artifact -``` -{{% /tab %}} -{{< /tabpane >}} - - -### Configuration -A configuration dictionary called wandb_artifact_configuration can be set on an `@op`, `@asset` and `@multi_asset`. This dictionary must be passed in the decorator arguments as metadata. This configuration is required to control the IO Manager reads and writes of W&B Artifacts. - -For `@op`, it’s located in the output metadata through the [Out](https://docs.dagster.io/_apidocs/ops#dagster.Out) metadata argument. -For `@asset`, it’s located in the metadata argument on the asset. -For `@multi_asset`, it’s located in each output metadata through the [AssetOut](https://docs.dagster.io/_apidocs/assets#dagster.AssetOut) metadata arguments. - -The proceeding code examples demonstrate how to configure a dictionary on an `@op`, `@asset` and `@multi_asset` computations: - -{{< tabpane text=true >}} -{{% tab "Example for @op" %}} -Example for `@op`: -```python -@op( - out=Out( - metadata={ - "wandb_artifact_configuration": { - "name": "my_artifact", - "type": "dataset", - } - } - ) -) -def create_dataset(): - return [1, 2, 3] -``` -{{% /tab %}} -{{% tab "Example for @asset" %}} -Example for `@asset`: -```python -@asset( - name="my_artifact", - metadata={ - "wandb_artifact_configuration": { - "type": "dataset", - } - }, - io_manager_key="wandb_artifacts_manager", -) -def create_dataset(): - return [1, 2, 3] -``` - -You do not need to pass a name through the configuration because the @asset already has a name. The integration sets the Artifact name as the asset name. - -{{% /tab %}} -{{% tab "Example for @multi_asset" %}} - -Example for `@multi_asset`: - -```python -@multi_asset( - name="create_datasets", - outs={ - "first_table": AssetOut( - metadata={ - "wandb_artifact_configuration": { - "type": "training_dataset", - } - }, - io_manager_key="wandb_artifacts_manager", - ), - "second_table": AssetOut( - metadata={ - "wandb_artifact_configuration": { - "type": "validation_dataset", - } - }, - io_manager_key="wandb_artifacts_manager", - ), - }, - group_name="my_multi_asset_group", -) -def create_datasets(): - first_table = wandb.Table(columns=["a", "b", "c"], data=[[1, 2, 3]]) - second_table = wandb.Table(columns=["d", "e"], data=[[4, 5]]) - - return first_table, second_table -``` -{{% /tab %}} -{{< /tabpane >}} - - - -Supported properties: -* `name`: (str) human-readable name for this artifact, which is how you can identify this artifact in the UI or reference it in use_artifact calls. Names can contain letters, numbers, underscores, hyphens, and dots. The name must be unique across a project. Required for `@op`. -* `type`: (str) The type of the artifact, which is used to organize and differentiate artifacts. Common types include dataset or model, but you can use any string containing letters, numbers, underscores, hyphens, and dots. Required when the output is not already an Artifact. -* `description`: (str) Free text that offers a description of the artifact. The description is markdown rendered in the UI, so this is a good place to place tables, links, etc. -* `aliases`: (list[str]) An array containing one or more aliases you want to apply on the Artifact. The integration will also add the “latest” tag to that list whether it’s set or not. This is an effective way for you to manage versioning of models and datasets. -* [`add_dirs`]({{< relref "/ref/python/experiments/artifact#add_dir" >}}): (list[dict[str, Any]]): An array containing configuration for each local directory to include in the Artifact. -* [`add_files`]({{< relref "/ref/python/experiments/artifact#add_file" >}}): (list[dict[str, Any]]): An array containing configuration for each local file to include in the Artifact. -* [`add_references`]({{< relref "/ref/python/experiments/artifact#add_reference" >}}): (list[dict[str, Any]]): An array containing configuration for each external reference to include in the Artifact. -* `serialization_module`: (dict) Configuration of the serialization module to be used. Refer to the Serialization section for more information. - * `name`: (str) Name of the serialization module. Accepted values: `pickle`, `dill`, `cloudpickle`, `joblib`. The module needs to be available locally. - * `parameters`: (dict[str, Any]) Optional arguments passed to the serialization function. It accepts the same parameters as the dump method for that module. For example, `{"compress": 3, "protocol": 4}`. - -Advanced example: - -```python -@asset( - name="my_advanced_artifact", - metadata={ - "wandb_artifact_configuration": { - "type": "dataset", - "description": "My *Markdown* description", - "aliases": ["my_first_alias", "my_second_alias"], - "add_dirs": [ - { - "name": "My directory", - "local_path": "path/to/directory", - } - ], - "add_files": [ - { - "name": "validation_dataset", - "local_path": "path/to/data.json", - }, - { - "is_tmp": True, - "local_path": "path/to/temp", - }, - ], - "add_references": [ - { - "uri": "https://picsum.photos/200/300", - "name": "External HTTP reference to an image", - }, - { - "uri": "s3://my-bucket/datasets/mnist", - "name": "External S3 reference", - }, - ], - } - }, - io_manager_key="wandb_artifacts_manager", -) -def create_advanced_artifact(): - return [1, 2, 3] -``` - - - -The asset is materialized with useful metadata on both sides of the integration: -* W&B side: the source integration name and version, the python version used, the pickle protocol version and more. -* Dagster side: - * Dagster Run ID - * W&B Run: ID, name, path, URL - * W&B Artifact: ID, name, type, version, size, URL - * W&B Entity - * W&B Project - -The proceeding image demonstrates the metadata from W&B that was added to the Dagster asset. This information would not be available without the integration. - -{{< img src="/images/integrations/dagster_wb_metadata.png" alt="" >}} - -The following image demonstrates how the provided configuration was enriched with useful metadata on the W&B Artifact. This information should help for reproducibility and maintenance. It would not be available without the integration. - -{{< img src="/images/integrations/dagster_inte_1.png" alt="" >}} -{{< img src="/images/integrations/dagster_inte_2.png" alt="" >}} -{{< img src="/images/integrations/dagster_inte_3.png" alt="" >}} - - -{{% alert %}} -If you use a static type checker like mypy, import the configuration type definition object using: - -```python -from dagster_wandb import WandbArtifactConfiguration -``` -{{% /alert %}} - -### Using partitions - -The integration natively supports [Dagster partitions](https://docs.dagster.io/concepts/partitions-schedules-sensors/partitions). - -The following is an example with a partitioned using `DailyPartitionsDefinition`. -```python -@asset( - partitions_def=DailyPartitionsDefinition(start_date="2023-01-01", end_date="2023-02-01"), - name="my_daily_partitioned_asset", - compute_kind="wandb", - metadata={ - "wandb_artifact_configuration": { - "type": "dataset", - } - }, -) -def create_my_daily_partitioned_asset(context): - partition_key = context.asset_partition_key_for_output() - context.log.info(f"Creating partitioned asset for {partition_key}") - return random.randint(0, 100) -``` -This code will produce one W&B Artifact for each partition. View artifacts in the Artifact panel (UI) under the asset name, which has the partition key appended. For example, `my_daily_partitioned_asset.2023-01-01`, `my_daily_partitioned_asset.2023-01-02`, or`my_daily_partitioned_asset.2023-01-03`. Assets that are partitioned across multiple dimensions shows each dimension in dot-delimited format. For example, `my_asset.car.blue`. - -{{% alert color="secondary" %}} -The integration does not allow for the materialization of multiple partitions within one run. You will need to carry out multiple runs to materialize your assets. This can be executed in Dagit when you're materializing your assets. - -{{< img src="/images/integrations/dagster_multiple_runs.png" alt="" >}} -{{% /alert %}} - -#### Advanced usage -- [Partitioned job](https://github.com/dagster-io/dagster/blob/master/examples/with_wandb/with_wandb/ops/partitioned_job.py) -- [Simple partitioned asset](https://github.com/wandb/dagster/blob/master/examples/with_wandb/with_wandb/assets/simple_partitions_example.py) -- [Multi-partitioned asset](https://github.com/wandb/dagster/blob/master/examples/with_wandb/with_wandb/assets/multi_partitions_example.py) -- [Advanced partitioned usage](https://github.com/wandb/dagster/blob/master/examples/with_wandb/with_wandb/assets/advanced_partitions_example.py) - - -## Read W&B Artifacts -Reading W&B Artifacts is similar to writing them. A configuration dictionary called `wandb_artifact_configuration` can be set on an `@op` or `@asset`. The only difference is that we must set the configuration on the input instead of the output. - -For `@op`, it’s located in the input metadata through the [In](https://docs.dagster.io/_apidocs/ops#dagster.In) metadata argument. You need to -explicitly pass the name of the Artifact. - -For `@asset`, it’s located in the input metadata through the [Asset](https://docs.dagster.io/_apidocs/assets#dagster.AssetIn) In metadata argument. You should not pass an Artifact name because the name of the parent asset should match it. - -If you want to have a dependency on an Artifact created outside the integration you will need to use [SourceAsset](https://docs.dagster.io/_apidocs/assets#dagster.SourceAsset). It will always read the latest version of that asset. - -The following examples demonstrate how to read an Artifact from various ops. - -{{< tabpane text=true >}} -{{% tab "From an @op" %}} -Reading an artifact from an `@op` -```python -@op( - ins={ - "artifact": In( - metadata={ - "wandb_artifact_configuration": { - "name": "my_artifact", - } - } - ) - }, - io_manager_key="wandb_artifacts_manager" -) -def read_artifact(context, artifact): - context.log.info(artifact) -``` -{{% /tab %}} -{{% tab "Created by another @asset" %}} -Reading an artifact created by another `@asset` -```python -@asset( - name="my_asset", - ins={ - "artifact": AssetIn( - # if you don't want to rename the input argument you can remove 'key' - key="parent_dagster_asset_name", - input_manager_key="wandb_artifacts_manager", - ) - }, -) -def read_artifact(context, artifact): - context.log.info(artifact) -``` - -{{% /tab %}} -{{% tab "Artifact created outside Dagster" %}} - -Reading an Artifact created outside Dagster: - -```python -my_artifact = SourceAsset( - key=AssetKey("my_artifact"), # the name of the W&B Artifact - description="Artifact created outside Dagster", - io_manager_key="wandb_artifacts_manager", -) - - -@asset -def read_artifact(context, my_artifact): - context.log.info(my_artifact) -``` -{{% /tab %}} -{{< /tabpane >}} - - -### Configuration -The proceeding configuration is used to indicate what the IO Manager should collect and provide as inputs to the decorated functions. The following read patterns are supported. - -1. To get an named object contained within an Artifact use get: - -```python -@asset( - ins={ - "table": AssetIn( - key="my_artifact_with_table", - metadata={ - "wandb_artifact_configuration": { - "get": "my_table", - } - }, - input_manager_key="wandb_artifacts_manager", - ) - } -) -def get_table(context, table): - context.log.info(table.get_column("a")) -``` - - -2. To get the local path of a downloaded file contained within an Artifact use get_path: - -```python -@asset( - ins={ - "path": AssetIn( - key="my_artifact_with_file", - metadata={ - "wandb_artifact_configuration": { - "get_path": "name_of_file", - } - }, - input_manager_key="wandb_artifacts_manager", - ) - } -) -def get_path(context, path): - context.log.info(path) -``` - -3. To get the entire Artifact object (with the content downloaded locally): -```python -@asset( - ins={ - "artifact": AssetIn( - key="my_artifact", - input_manager_key="wandb_artifacts_manager", - ) - }, -) -def get_artifact(context, artifact): - context.log.info(artifact.name) -``` - - -Supported properties -* `get`: (str) Gets the W&B object located at the artifact relative name. -* `get_path`: (str) Gets the path to the file located at the artifact relative name. - -### Serialization configuration -By default, the integration will use the standard [pickle](https://docs.python.org/3/library/pickle.html) module, but some objects are not compatible with it. For example, functions with yield will raise an error if you try to pickle them. - -We support more Pickle-based serialization modules ([dill](https://github.com/uqfoundation/dill), [cloudpickle](https://github.com/cloudpipe/cloudpickle), [joblib](https://github.com/joblib/joblib)). You can also use more advanced serialization like [ONNX](https://onnx.ai/) or [PMML](https://en.wikipedia.org/wiki/Predictive_Model_Markup_Language) by returning a serialized string or creating an Artifact directly. The right choice will depend on your use case, please refer to the available literature on this subject. - -### Pickle-based serialization modules - -{{% alert color="secondary" %}} -Pickling is known to be insecure. If security is a concern please only use W&B objects. We recommend signing your data and storing the hash keys in your own systems. For more complex use cases don’t hesitate to contact us, we will be happy to help. -{{% /alert %}} - -You can configure the serialization used through the `serialization_module` dictionary in the `wandb_artifact_configuration`. Please make sure the module is available on the machine running Dagster. - -The integration will automatically know which serialization module to use when you read that Artifact. - -The currently supported modules are `pickle`, `dill`, `cloudpickle`, and `joblib`. - -Here’s a simplified example where we create a “model” serialized with joblib and then use it for inference. - -```python -@asset( - name="my_joblib_serialized_model", - compute_kind="Python", - metadata={ - "wandb_artifact_configuration": { - "type": "model", - "serialization_module": { - "name": "joblib" - }, - } - }, - io_manager_key="wandb_artifacts_manager", -) -def create_model_serialized_with_joblib(): - # This is not a real ML model but this would not be possible with the pickle module - return lambda x, y: x + y - -@asset( - name="inference_result_from_joblib_serialized_model", - compute_kind="Python", - ins={ - "my_joblib_serialized_model": AssetIn( - input_manager_key="wandb_artifacts_manager", - ) - }, - metadata={ - "wandb_artifact_configuration": { - "type": "results", - } - }, - io_manager_key="wandb_artifacts_manager", -) -def use_model_serialized_with_joblib( - context: OpExecutionContext, my_joblib_serialized_model -): - inference_result = my_joblib_serialized_model(1, 2) - context.log.info(inference_result) # Prints: 3 - return inference_result -``` - -### Advanced serialization formats (ONNX, PMML) -It’s common to use interchange file formats like ONNX and PMML. The integration supports those formats but it requires a bit more work than for Pickle-based serialization. - -There are two different methods to use those formats. -1. Convert your model to the selected format, then return the string representation of that format as if it were a normal Python objects. The integration will pickle that string. You can then rebuild your model using that string. -2. Create a new local file with your serialized model, then build a custom Artifact with that file using the add_file configuration. - -Here’s an example of a Scikit-learn model being serialized using ONNX. - -```python -import numpy -import onnxruntime as rt -from skl2onnx import convert_sklearn -from skl2onnx.common.data_types import FloatTensorType -from sklearn.datasets import load_iris -from sklearn.ensemble import RandomForestClassifier -from sklearn.model_selection import train_test_split - -from dagster import AssetIn, AssetOut, asset, multi_asset - -@multi_asset( - compute_kind="Python", - outs={ - "my_onnx_model": AssetOut( - metadata={ - "wandb_artifact_configuration": { - "type": "model", - } - }, - io_manager_key="wandb_artifacts_manager", - ), - "my_test_set": AssetOut( - metadata={ - "wandb_artifact_configuration": { - "type": "test_set", - } - }, - io_manager_key="wandb_artifacts_manager", - ), - }, - group_name="onnx_example", -) -def create_onnx_model(): - # Inspired from https://onnx.ai/sklearn-onnx/ - - # Train a model. - iris = load_iris() - X, y = iris.data, iris.target - X_train, X_test, y_train, y_test = train_test_split(X, y) - clr = RandomForestClassifier() - clr.fit(X_train, y_train) - - # Convert into ONNX format - initial_type = [("float_input", FloatTensorType([None, 4]))] - onx = convert_sklearn(clr, initial_types=initial_type) - - # Write artifacts (model + test_set) - return onx.SerializeToString(), {"X_test": X_test, "y_test": y_test} - -@asset( - name="experiment_results", - compute_kind="Python", - ins={ - "my_onnx_model": AssetIn( - input_manager_key="wandb_artifacts_manager", - ), - "my_test_set": AssetIn( - input_manager_key="wandb_artifacts_manager", - ), - }, - group_name="onnx_example", -) -def use_onnx_model(context, my_onnx_model, my_test_set): - # Inspired from https://onnx.ai/sklearn-onnx/ - - # Compute the prediction with ONNX Runtime - sess = rt.InferenceSession(my_onnx_model) - input_name = sess.get_inputs()[0].name - label_name = sess.get_outputs()[0].name - pred_onx = sess.run( - [label_name], {input_name: my_test_set["X_test"].astype(numpy.float32)} - )[0] - context.log.info(pred_onx) - return pred_onx -``` - -### Using partitions - -The integration natively supports [Dagster partitions](https://docs.dagster.io/concepts/partitions-schedules-sensors/partitions). - -You can selectively read one, multiple, or all partitions of an asset. - -All partitions are provided in a dictionary, with the key and value representing the partition key and the Artifact content, respectively. - - -{{< tabpane text=true >}} -{{% tab "Read all partitions" %}} -It reads all partitions of the upstream `@asset`, which are given as a dictionary. In this dictionary, the key and value correlate to the partition key and the Artifact content, respectively. -```python -@asset( - compute_kind="wandb", - ins={"my_daily_partitioned_asset": AssetIn()}, - output_required=False, -) -def read_all_partitions(context, my_daily_partitioned_asset): - for partition, content in my_daily_partitioned_asset.items(): - context.log.info(f"partition={partition}, content={content}") -``` -{{% /tab %}} -{{% tab "Read specific partitions" %}} -The `AssetIn`'s `partition_mapping` configuration allows you to choose specific partitions. In this case, we are employing the `TimeWindowPartitionMapping`. -```python -@asset( - partitions_def=DailyPartitionsDefinition(start_date="2023-01-01", end_date="2023-02-01"), - compute_kind="wandb", - ins={ - "my_daily_partitioned_asset": AssetIn( - partition_mapping=TimeWindowPartitionMapping(start_offset=-1) - ) - }, - output_required=False, -) -def read_specific_partitions(context, my_daily_partitioned_asset): - for partition, content in my_daily_partitioned_asset.items(): - context.log.info(f"partition={partition}, content={content}") -``` -{{% /tab %}} -{{< /tabpane >}} - -The configuration object, `metadata`, configures how W&B interacts with different artifact partitions in your project. - -The object `metadata` contains a key named `wandb_artifact_configuration` which further contains a nested object `partitions`. - -The `partitions` object maps the name of each partition to its configuration. The configuration for each partition can specify how to retrieve data from it. These configurations can contain different keys, namely `get`, `version`, and `alias`, depending on the requirements of each partition. - -**Configuration keys** - -1. `get`: -The `get` key specifies the name of the W&B Object (Table, Image...) where to fetch the data. -2. `version`: -The `version` key is used when you want to fetch a specific version for the Artifact. -3. `alias`: -The `alias` key allows you to get the Artifact by its alias. - -**Wildcard configuration** - -The wildcard `"*"` stands for all non-configured partitions. This provides a default configuration for partitions that are not explicitly mentioned in the `partitions` object. - -For example, - -```python -"*": { - "get": "default_table_name", -}, -``` -This configuration means that for all partitions not explicitly configured, data is fetched from the table named `default_table_name`. - -**Specific partition configuration** - -You can override the wildcard configuration for specific partitions by providing their specific configurations using their keys. - -For example, - -```python -"yellow": { - "get": "custom_table_name", -}, -``` - -This configuration means that for the partition named `yellow`, data will be fetched from the table named `custom_table_name`, overriding the wildcard configuration. - -**Versioning and aliasing** - -For versioning and aliasing purposes, you can provide specific `version` and `alias` keys in your configuration. - -For versions, - -```python -"orange": { - "version": "v0", -}, -``` - -This configuration will fetch data from the version `v0` of the `orange` Artifact partition. - -For aliases, - -```python -"blue": { - "alias": "special_alias", -}, -``` - -This configuration will fetch data from the table `default_table_name` of the Artifact partition with the alias `special_alias` (referred to as `blue` in the configuration). - -### Advanced usage -To view advanced usage of the integration please refer to the following full code examples: -* [Advanced usage example for assets](https://github.com/dagster-io/dagster/blob/master/examples/with_wandb/with_wandb/assets/advanced_example.py) -* [Partitioned job example](https://github.com/dagster-io/dagster/blob/master/examples/with_wandb/with_wandb/ops/partitioned_job.py) -* [Linking a model to the Model Registry](https://github.com/dagster-io/dagster/blob/master/examples/with_wandb/with_wandb/assets/model_registry_example.py) - - -## Using W&B Launch - -{{% alert color="secondary" %}} -Beta product in active development -Interested in Launch? Reach out to your account team to talk about joining the customer pilot program for W&B Launch. -Pilot customers need to use AWS EKS or SageMaker to qualify for the beta program. We ultimately plan to support additional platforms. -{{% /alert %}} - -Before continuing, we recommend you to have a good understanding of how to use W&B Launch. Consider reading the [Guide on Launch]({{< relref "/launch/" >}}). - -The Dagster integration helps with: -* Running one or multiple Launch agents in your Dagster instance. -* Executing local Launch jobs within your Dagster instance. -* Remote Launch jobs on-prem or in a cloud. - -### Launch agents -The integration provides an importable `@op` called `run_launch_agent`. It starts a Launch Agent and runs it as a long running process until stopped manually. - -Agents are processes that poll launch queues and execute the jobs (or dispatch them to external services to be executed) in order. - -Refer to the [Launch page]({{< relref "/launch/" >}}). - -You can also view useful descriptions for all properties in Launchpad. - -{{< img src="/images/integrations/dagster_launch_agents.png" alt="" >}} - -Simple example -```python -# add this to your config.yaml -# alternatively you can set the config in Dagit's Launchpad or JobDefinition.execute_in_process -# Reference: https://docs.dagster.io/concepts/configuration/config-schema#specifying-runtime-configuration -resources: - wandb_config: - config: - entity: my_entity # replace this with your W&B entity - project: my_project # replace this with your W&B project -ops: - run_launch_agent: - config: - max_jobs: -1 - queues: - - my_dagster_queue - -from dagster_wandb.launch.ops import run_launch_agent -from dagster_wandb.resources import wandb_resource - -from dagster import job, make_values_resource - -@job( - resource_defs={ - "wandb_config": make_values_resource( - entity=str, - project=str, - ), - "wandb_resource": wandb_resource.configured( - {"api_key": {"env": "WANDB_API_KEY"}} - ), - }, -) -def run_launch_agent_example(): - run_launch_agent() -``` - -### Launch jobs -The integration provides an importable `@op` called `run_launch_job`. It executes your Launch job. - -A Launch job is assigned to a queue in order to be executed. You can create a queue or use the default one. Make sure you have an active agent listening to that queue. You can run an agent inside your Dagster instance but can also consider using a deployable agent in Kubernetes. - -Refer to the [Launch page]({{< relref "/launch/" >}}). - -You can also view useful descriptions for all properties in Launchpad. - -{{< img src="/images/integrations/dagster_launch_jobs.png" alt="" >}} - - -Simple example -```python -# add this to your config.yaml -# alternatively you can set the config in Dagit's Launchpad or JobDefinition.execute_in_process -# Reference: https://docs.dagster.io/concepts/configuration/config-schema#specifying-runtime-configuration -resources: - wandb_config: - config: - entity: my_entity # replace this with your W&B entity - project: my_project # replace this with your W&B project -ops: - my_launched_job: - config: - entry_point: - - python - - train.py - queue: my_dagster_queue - uri: https://github.com/wandb/example-dagster-integration-with-launch - - -from dagster_wandb.launch.ops import run_launch_job -from dagster_wandb.resources import wandb_resource - -from dagster import job, make_values_resource - - -@job(resource_defs={ - "wandb_config": make_values_resource( - entity=str, - project=str, - ), - "wandb_resource": wandb_resource.configured( - {"api_key": {"env": "WANDB_API_KEY"}} - ), - }, -) -def run_launch_job_example(): - run_launch_job.alias("my_launched_job")() # we rename the job with an alias -``` - -## Best practices - -1. Use the IO Manager to read and write Artifacts. -Avoid using [`Artifact.download()`]({{< relref "/ref/python/experiments/artifact#download" >}}) or [`Run.log_artifact()`]({{< relref "/ref/python/experiments/run#log_artifact" >}}) directly. Those methods are handled by integration. Instead, return the data you want to store in the Artifact and let the integration do the rest. This approach provides better lineage for the Artifact. - -2. Only build an Artifact object yourself for complex use cases. -Python objects and W&B objects should be returned from your ops/assets. The integration handles bundling the Artifact. -For complex use cases, you can build an Artifact directly in a Dagster job. We recommend you pass an Artifact object to the integration for metadata enrichment such as the source integration name and version, the python version used, the pickle protocol version and more. - -3. Add files, directories and external references to your Artifacts through the metadata. -Use the integration `wandb_artifact_configuration` object to add any file, directory or external references (Amazon S3, GCS, HTTP…). See the advanced example in the [Artifact configuration section]({{< relref "#configuration-1" >}}) for more information. - -4. Use an @asset instead of an @op when an Artifact is produced. -Artifacts are assets. It is recommended to use an asset when Dagster maintains that asset. This will provide better observability in the Dagit Asset Catalog. - -5. Use a SourceAsset to consume an Artifact created outside Dagster. -This allows you to take advantage of the integration to read externally created Artifacts. Otherwise, you can only use Artifacts created by the integration. - -6. Use W&B Launch to orchestrate training on dedicated compute for large models. -You can train small models inside your Dagster cluster and you can run Dagster in a Kubernetes cluster with GPU nodes. We recommend using W&B Launch for large model training. This will prevent overloading your instance and provide access to more adequate compute. - -7. When experiment tracking within Dagster, set your W&B Run ID to the value of your Dagster Run ID. -We recommend that you both: make the [Run resumable]({{< relref "/guides/models/track/runs/resuming.md" >}}) and set the W&B Run ID to the Dagster Run ID or to a string of your choice. Following this recommendation ensures your W&B metrics and W&B Artifacts are stored in the same W&B Run when you train models inside of Dagster. - - -Either set the W&B Run ID to the Dagster Run ID. -```python -wandb.init( - id=context.run_id, - resume="allow", - ... -) -``` - - -Or choose your own W&B Run ID and pass it to the IO Manager configuration. -```python -wandb.init( - id="my_resumable_run_id", - resume="allow", - ... -) - -@job( - resource_defs={ - "io_manager": wandb_artifacts_io_manager.configured( - {"wandb_run_id": "my_resumable_run_id"} - ), - } -) -``` - -8. Only collect data you need with get or get_path for large W&B Artifacts. -By default, the integration will download an entire Artifact. If you are using very large artifacts you might want to only collect the specific files or objects you need. This will improve speed and resource utilization. - -9. For Python objects adapt the pickling module to your use case. -By default, the W&B integration will use the standard [pickle](https://docs.python.org/3/library/pickle.html) module. But some objects are not compatible with it. For example, functions with yield will raise an error if you try to pickle them. W&B supports other Pickle-based serialization modules ([dill](https://github.com/uqfoundation/dill), [cloudpickle](https://github.com/cloudpipe/cloudpickle), [joblib](https://github.com/joblib/joblib)). - -You can also use more advanced serialization like [ONNX](https://onnx.ai/) or [PMML](https://en.wikipedia.org/wiki/Predictive_Model_Markup_Language) by returning a serialized string or creating an Artifact directly. The right choice will depend on your use case, refer to the available literature on this subject. diff --git a/content/en/launch/integration-guides/minikube_gpu.md b/content/en/launch/integration-guides/minikube_gpu.md deleted file mode 100644 index 52914a2957..0000000000 --- a/content/en/launch/integration-guides/minikube_gpu.md +++ /dev/null @@ -1,375 +0,0 @@ ---- -menu: - launch: - identifier: minikube_gpu - parent: launch-integration-guides -title: Spin up a single node GPU cluster with Minikube -url: tutorials/minikube_gpu ---- -Set up W&B Launch on a Minikube cluster that can schedule and run GPU workloads. - -{{% alert %}} -This tutorial is intended to guide users with direct access to a machine that has multiple GPUs. This tutorial is not intended for users who rent a cloud machine. - -W&B recommends you create a Kubernetes cluster with GPU support that uses your cloud provider, if you want to set up a minikube cluster on a cloud machine. For example, AWS, GCP, Azure, Coreweave, and other cloud providers have tools to create Kubernetes clusters with GPU support. - -W&B recommends you use a [Launch Docker queue]({{< relref "/launch/set-up-launch/setup-launch-docker" >}}) if you want to set up a minikube cluster for scheduling GPUs on a machine that has a single GPU. You can still follow the tutorial for fun, but the GPU scheduling will not be very useful. -{{% /alert %}} - -## Background - - - -The [NVIDIA container toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/index.html) has made it easy to run GPU-enabled workflows on Docker. One limitation is a lack of native support for scheduling GPU by volume. If you want to use a GPU with the `docker run` command you must either request specific GPU by ID or all GPU present, which makes many distributed GPU enabled workloads impractical. Kubernetes offers support for scheduling by a volume request, but setting up a local Kubernetes cluster with GPU scheduling can take considerable time and effort, until recently. Minikube, one of the most popular tools for running single node Kubernetes clusters, recently released [support for GPU scheduling](https://minikube.sigs.k8s.io/docs/tutorials/nvidia/). In this tutorial, we will create a Minikube cluster on a multi-GPU machine and launch concurrent stable diffusion inference jobs to the cluster using W&B Launch. - -## Prerequisites - -Before getting started, you will need: - -1. A W&B account. -2. Linux machine with the following installed and running: - 1. Docker runtime - 2. Drivers for any GPU you want to use - 3. Nvidia container toolkit - -{{% alert %}} -For testing and creating this tutorial, we used an `n1-standard-16` Google Cloud Compute Engine instance with 4 NVIDIA Tesla T4 GPU connected. -{{% /alert %}} - -## Create a queue for launch jobs - -First, create a launch queue for our launch jobs. - -1. Navigate to [wandb.ai/launch](https://wandb.ai/launch) (or `/launch` if you use a private W&B server). -2. In the top right corner of your screen, click the blue **Create a queue** button. A queue creation drawer will slide out from the right side of your screen. -3. Select an entity, enter a name, and select **Kubernetes** as the type for your queue. -4. The **Config** section of the drawer is where you will enter a [Kubernetes job specification](https://kubernetes.io/docs/concepts/workloads/controllers/job/) for the launch queue. Any runs launched from this queue will be created using this job specification, so you can modify this configuration as needed to customize your jobs. For this tutorial, you can copy and paste the sample config below in your queue config as YAML or JSON: - -{{< tabpane text=true >}} -{{% tab "YAML" %}} -```yaml -spec: - template: - spec: - containers: - - image: ${image_uri} - resources: - limits: - cpu: 4 - memory: 12Gi - nvidia.com/gpu: '{{gpus}}' - restartPolicy: Never - backoffLimit: 0 -``` -{{% /tab %}} -{{% tab "JSON" %}} -```json -{ - "spec": { - "template": { - "spec": { - "containers": [ - { - "image": "${image_uri}", - "resources": { - "limits": { - "cpu": 4, - "memory": "12Gi", - "nvidia.com/gpu": "{{gpus}}" - } - } - } - ], - "restartPolicy": "Never" - } - }, - "backoffLimit": 0 - } -} -``` -{{% /tab %}} -{{< /tabpane >}} - -For more information about queue configurations, see the [Set up Launch on Kubernetes]({{< relref "/launch/set-up-launch/setup-launch-kubernetes.md" >}}) and the [Advanced queue setup guide]({{< relref "/launch/set-up-launch/setup-queue-advanced.md" >}}). - - -The `${image_uri}` and `{{gpus}}` strings are examples of the two kinds of -variable templates that you can use in your queue configuration. The `${image_uri}` -template will be replaced with the image URI of the job you are launching by the -agent. The `{{gpus}}` template will be used to create a template variable that -you can override from the launch UI, CLI, or SDK when submitting a job. These values -are placed in the job specification so that they will modify the correct fields -to control the image and GPU resources used by the job. - -5. Click the **Parse configuration** button to begin customizing your `gpus` template -variable. -6. Set the **Type** to `Integer` and the **Default**, **Min**, and **Max** to values of your choosing. -Attempts to submit a run to this queue which violate the constraints of the template variable will -be rejected. - -{{< img src="/images/tutorials/minikube_gpu/create_queue.png" alt="Queue creation drawer" >}} - -7. Click **Create queue** to create your queue. You will be redirected to the queue page for your new queue. - - -In the next section, we will set up an agent that can pull and execute jobs from the queue you created. - -## Setup Docker + NVIDIA CTK - -If you already have Docker and the Nvidia container toolkit setup on your machine, you can skip this section. - -Refer to [Docker’s documentation](https://docs.docker.com/engine/install/) for instructions on setting up the Docker container engine on your system. - -Once you have Docker installed, install the Nvidia container toolkit [following the instructions in Nvidia’s documentation](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html). - -To validate that your container runtime has access to your GPU, you can run: - -```bash -docker run --gpus all ubuntu nvidia-smi -``` - -You should see `nvidia-smi` output describing the GPU connected to your machine. For example, on our setup the output looks like this: - -``` -Wed Nov 8 23:25:53 2023 -+-----------------------------------------------------------------------------+ -| NVIDIA-SMI 525.105.17 Driver Version: 525.105.17 CUDA Version: 12.0 | -|-------------------------------+----------------------+----------------------+ -| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | -| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | -| | | MIG M. | -|===============================+======================+======================| -| 0 Tesla T4 Off | 00000000:00:04.0 Off | 0 | -| N/A 38C P8 9W / 70W | 2MiB / 15360MiB | 0% Default | -| | | N/A | -+-------------------------------+----------------------+----------------------+ -| 1 Tesla T4 Off | 00000000:00:05.0 Off | 0 | -| N/A 38C P8 9W / 70W | 2MiB / 15360MiB | 0% Default | -| | | N/A | -+-------------------------------+----------------------+----------------------+ -| 2 Tesla T4 Off | 00000000:00:06.0 Off | 0 | -| N/A 40C P8 9W / 70W | 2MiB / 15360MiB | 0% Default | -| | | N/A | -+-------------------------------+----------------------+----------------------+ -| 3 Tesla T4 Off | 00000000:00:07.0 Off | 0 | -| N/A 39C P8 9W / 70W | 2MiB / 15360MiB | 0% Default | -| | | N/A | -+-------------------------------+----------------------+----------------------+ - -+-----------------------------------------------------------------------------+ -| Processes: | -| GPU GI CI PID Type Process name GPU Memory | -| ID ID Usage | -|=============================================================================| -| No running processes found | -+-----------------------------------------------------------------------------+ -``` - -## Setup Minikube - -Minikube’s GPU support requires version `v1.32.0` or later. Refer to [Minikube’s install documentation](https://minikube.sigs.k8s.io/docs/start/) for up to date installation help. For this tutorial, we installed the latest Minikube release using the command: - -```yaml -curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 -sudo install minikube-linux-amd64 /usr/local/bin/minikube -``` - -The next step is to start a minikube cluster using your GPU. On your machine, run: - -```yaml -minikube start --gpus all -``` - -The output of the command above will indicate whether a cluster has been successfully created. - -## Start launch agent - -The launch agent for your new cluster can either be started by invoking `wandb launch-agent` directly or by deploying the launch agent using a [helm chart managed by W&B](https://github.com/wandb/helm-charts/tree/main/charts/launch-agent). - -In this tutorial we will run the agent directly on our host machine. - -{{% alert %}} -Running the agent outside of a container also means we can use the local Docker host to build images for our cluster to run. -{{% /alert %}} - -To run the agent locally, make sure your default Kubernetes API context refers to the Minikube cluster. Then, execute the following: - -```bash -pip install "wandb[launch]" -``` - -to install the agent’s dependencies. To setup authentication for the agent, run `wandb login` or set the `WANDB_API_KEY` environment variable. - -To start the agent, execute this command: - -```bash -wandb launch-agent -j -q -e -``` - -Within your terminal you should see the launch agent start to print polling message. - -Congratulations, you have a launch agent polling your launch queue. When a job is added to your queue, your agent will pick it up and schedule it to run on your Minikube cluster. - -## Launch a job - -Let's send a job to our agent. You can launch a simple "hello world" from a terminal logged into your W&B account with: - -```yaml -wandb launch -d wandb/job_hello_world:main -p -q -e -``` - -You can test with any job or image you like, but make sure your cluster can pull your image. See [Minikube’s documentation](https://minikube.sigs.k8s.io/docs/handbook/registry/) for additional guidance. You can also [test using one of our public jobs](https://wandb.ai/wandb/jobs/jobs?workspace=user-bcanfieldsherman). - -## (Optional) Model and data caching with NFS - -For ML workloads we will often want multiple jobs to have access to the same data. For example, you might want to have a shared cache to avoid repeatedly downloading large assets like datasets or model weights. Kubernetes supports this through [persistent volumes and persistent volume claims](https://kubernetes.io/docs/concepts/storage/persistent-volumes/). Persistent volumes can be used to create `volumeMounts` in our Kubernetes workloads, providing direct filesystem access to the shared cache. - -In this step, we will set up a network file system (NFS) server that can be used as a shared cache for model weights. The first step is to install and configure NFS. This process varies by operating system. Since our VM is running Ubuntu, we installed nfs-kernel-server and configured an export at `/srv/nfs/kubedata`: - -```bash -sudo apt-get install nfs-kernel-server -sudo mkdir -p /srv/nfs/kubedata -sudo chown nobody:nogroup /srv/nfs/kubedata -sudo sh -c 'echo "/srv/nfs/kubedata *(rw,sync,no_subtree_check,no_root_squash,no_all_squash,insecure)" >> /etc/exports' -sudo exportfs -ra -sudo systemctl restart nfs-kernel-server -``` - -Keep note of the export location of the server in your host filesystem, as well as the local IP address of your NFS server. You need this information in the next step. - -Next, you will need to create a persistent volume and persistent volume claim for this NFS. Persistent volumes are highly customizable, but we will use straightforward configuration here for the sake of simplicity. - -Copy the yaml below into a file named `nfs-persistent-volume.yaml` , making sure to fill out your desired volume capacity and claim request. The `PersistentVolume.spec.capcity.storage` field controls the maximum size of the underlying volume. The `PersistentVolumeClaim.spec.resources.requests.stroage` can be used to limit the volume capacity allotted for a particular claim. For our use case, it makes sense to use the same value for each. - -```yaml -apiVersion: v1 -kind: PersistentVolume -metadata: - name: nfs-pv -spec: - capacity: - storage: 100Gi # Set this to your desired capacity. - accessModes: - - ReadWriteMany - nfs: - server: # TODO: Fill this in. - path: '/srv/nfs/kubedata' # Or your custom path ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: nfs-pvc -spec: - accessModes: - - ReadWriteMany - resources: - requests: - storage: 100Gi # Set this to your desired capacity. - storageClassName: '' - volumeName: nfs-pv -``` - -Create the resources in your cluster with: - -```yaml -kubectl apply -f nfs-persistent-volume.yaml -``` - -In order for our runs to make use of this cache, we will need to add `volumes` and `volumeMounts` to our launch queue config. To edit the launch config, head back to [wandb.ai/launch](https://wandb.ai/launch) (or `/launch` for users on wandb server), find your queue, click to the queue page, and then click the **Edit config** tab. The original config can be modified to: - -{{< tabpane text=true >}} -{{% tab "YAML" %}} -```yaml -spec: - template: - spec: - containers: - - image: ${image_uri} - resources: - limits: - cpu: 4 - memory: 12Gi - nvidia.com/gpu: "{{gpus}}" - volumeMounts: - - name: nfs-storage - mountPath: /root/.cache - restartPolicy: Never - volumes: - - name: nfs-storage - persistentVolumeClaim: - claimName: nfs-pvc - backoffLimit: 0 -``` -{{% /tab %}} -{{% tab "JSON" %}} -```json -{ - "spec": { - "template": { - "spec": { - "containers": [ - { - "image": "${image_uri}", - "resources": { - "limits": { - "cpu": 4, - "memory": "12Gi", - "nvidia.com/gpu": "{{gpus}}" - }, - "volumeMounts": [ - { - "name": "nfs-storage", - "mountPath": "/root/.cache" - } - ] - } - } - ], - "restartPolicy": "Never", - "volumes": [ - { - "name": "nfs-storage", - "persistentVolumeClaim": { - "claimName": "nfs-pvc" - } - } - ] - } - }, - "backoffLimit": 0 - } -} -``` -{{% /tab %}} -{{< /tabpane >}} - -Now, our NFS will be mounted at `/root/.cache` in the containers running our jobs. The mount path will require adjustment if your container runs as a user other than `root`. Huggingface’s libraries and W&B Artifacts both make use of `$HOME/.cache/` by default, so downloads should only happen once. - -## Playing with stable diffusion - -To test out our new system, we are going to experiment with stable diffusion’s inference parameters. -To run a simple stable diffusion inference job with a default prompt and sane -parameters, you can run: - -``` -wandb launch -d wandb/job_stable_diffusion_inference:main -p -q -e -``` - -The command above will submit the container image `wandb/job_stable_diffusion_inference:main` to your queue. -Once your agent picks up the job and schedules it for execution on your cluster, -it may take a while for the image to be pulled, depending on your connection. -You can follow the status of the job on the queue page on [wandb.ai/launch](https://wandb.ai/launch) (or \/launch for users on wandb server). - -Once the run has finished, you should have a job artifact in the project you specified. -You can check your project's job page (`/jobs`) to find the job artifact. Its default name should -be `job-wandb_job_stable_diffusion_inference` but you can change that to whatever you like on the job's page -by clicking the pencil icon next to the job name. - -You can now use this job to run more stable diffusion inference on your cluster. -From the job page, we can click the **Launch** button in the top right hand corner -to configure a new inference job and submit it to our queue. The job configuration -page will be pre-populated with the parameters from the original run, but you can -change them to whatever you like by modifying their values in the **Overrides** section -of the launch drawer. - -{{< img src="/images/tutorials/minikube_gpu/sd_launch_drawer.png" alt="Launch UI" >}} \ No newline at end of file diff --git a/content/en/launch/integration-guides/nim.md b/content/en/launch/integration-guides/nim.md deleted file mode 100644 index b8a92d5d60..0000000000 --- a/content/en/launch/integration-guides/nim.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -menu: - launch: - identifier: nim - parent: launch-integration-guides -title: NVIDIA NeMo Inference Microservice Deploy Job -url: guides/integrations/nim ---- -Deploy a model artifact from W&B to a NVIDIA NeMo Inference Microservice. To do this, use W&B Launch. W&B Launch converts model artifacts to NVIDIA NeMo Model and deploys to a running NIM/Triton server. - -W&B Launch currently accepts the following compatible model types: - -1. [Llama2](https://llama.meta.com/llama2/) -2. [StarCoder](https://github.com/bigcode-project/starcoder) -3. NV-GPT (coming soon) - -{{% alert %}} -Deployment time varies by model and machine type. The base Llama2-7b config takes about 1 minute on GCP's `a2-ultragpu-1g`. -{{% /alert %}} - -## Quickstart - -1. [Create a launch queue]({{< relref "../create-and-deploy-jobs/add-job-to-queue.md" >}}) if you don't have one already. See an example queue config below. - - ```yaml - net: host - gpus: all # can be a specific set of GPUs or `all` to use everything - runtime: nvidia # also requires nvidia container runtime - volume: - - model-store:/model-store/ - ``` - - {{< img src="/images/integrations/nim1.png" alt="image" >}} - -2. Create this job in your project: - - ```bash - wandb job create -n "deploy-to-nvidia-nemo-inference-microservice" \ - -e $ENTITY \ - -p $PROJECT \ - -E jobs/deploy_to_nvidia_nemo_inference_microservice/job.py \ - -g andrew/nim-updates \ - git https://github.com/wandb/launch-jobs - ``` - -3. Launch an agent on your GPU machine: - ```bash - wandb launch-agent -e $ENTITY -p $PROJECT -q $QUEUE - ``` -4. Submit the deployment launch job with your desired configs from the [Launch UI](https://wandb.ai/launch) - 1. You can also submit via the CLI: - ```bash - wandb launch -d gcr.io/playground-111/deploy-to-nemo:latest \ - -e $ENTITY \ - -p $PROJECT \ - -q $QUEUE \ - -c $CONFIG_JSON_FNAME - ``` - {{< img src="/images/integrations/nim2.png" alt="image" >}} -5. You can track the deployment process in the Launch UI. - {{< img src="/images/integrations/nim3.png" alt="image" >}} -6. Once complete, you can immediately curl the endpoint to test the model. The model name is always `ensemble`. - ```bash - #!/bin/bash - curl -X POST "http://0.0.0.0:9999/v1/completions" \ - -H "accept: application/json" \ - -H "Content-Type: application/json" \ - -d '{ - "model": "ensemble", - "prompt": "Tell me a joke", - "max_tokens": 256, - "temperature": 0.5, - "n": 1, - "stream": false, - "stop": "string", - "frequency_penalty": 0.0 - }' - ``` \ No newline at end of file diff --git a/content/en/launch/integration-guides/volcano.md b/content/en/launch/integration-guides/volcano.md deleted file mode 100644 index c2650bc55e..0000000000 --- a/content/en/launch/integration-guides/volcano.md +++ /dev/null @@ -1,184 +0,0 @@ ---- -menu: - launch: - identifier: volcano - parent: launch-integration-guides -title: Launch multinode jobs with Volcano -url: tutorials/volcano ---- -This tutorial will guide you through the process of launching multinode training jobs with W&B and Volcano on Kubernetes. - -## Overview - -In this tutorial, you will learn how to use W&B Launch to run multinode jobs on Kubernetes. The steps we will follow are: - -- Ensure that you have a W&B account and a Kubernetes cluster. -- Create a launch queue for our volcano jobs. -- Deploy a Launch agent into our kubernetes cluster. -- Create a distributed training job. -- Launch our distributed training. - -## Prerequisites - -Before you get started, you will need: - -- A W&B account -- A Kubernetes cluster - -## Create a launch queue - -The first step is to create a launch queue. Head to [wandb.ai/launch](https://wandb.ai/launch) and in the top right corner of your screen, hit the blue **Create a queue** button. A queue creation drawer will slide out from the right side of your screen. Select an entity, enter a name, and select **Kubernetes** as the type for your queue. - -In the configuration section, we will enter a [volcano job](https://volcano.sh/en/docs/vcjob/) template. Any runs launched from this queue will be created using this job specification, so you can modify this configuration as needed to customize your jobs. - -This configuration block can accept a Kubernetes job specification, volcano job specification, or any other custom resource definition (CRD) that you are interested in launching. You can make use of [macros in the configuration block]({{< relref "/launch/set-up-launch/" >}}) to dynamically set the contents of this spec. - - -In this tutorial, we will use a configuration for multinode pytorch training that makes use of [volcano's pytorch plugin](https://github.com/volcano-sh/volcano/blob/master/docs/user-guide/how_to_use_pytorch_plugin.md). You can copy and paste the following config as YAML or JSON: - -{{< tabpane text=true >}} -{{% tab "YAML" %}} -```yaml -kind: Job -spec: - tasks: - - name: master - policies: - - event: TaskCompleted - action: CompleteJob - replicas: 1 - template: - spec: - containers: - - name: master - image: ${image_uri} - imagePullPolicy: IfNotPresent - restartPolicy: OnFailure - - name: worker - replicas: 1 - template: - spec: - containers: - - name: worker - image: ${image_uri} - workingDir: /home - imagePullPolicy: IfNotPresent - restartPolicy: OnFailure - plugins: - pytorch: - - --master=master - - --worker=worker - - --port=23456 - minAvailable: 1 - schedulerName: volcano -metadata: - name: wandb-job-${run_id} - labels: - wandb_entity: ${entity_name} - wandb_project: ${project_name} - namespace: wandb -apiVersion: batch.volcano.sh/v1alpha1 -``` -{{% /tab %}} -{{% tab "JSON" %}} -```json -{ - "kind": "Job", - "spec": { - "tasks": [ - { - "name": "master", - "policies": [ - { - "event": "TaskCompleted", - "action": "CompleteJob" - } - ], - "replicas": 1, - "template": { - "spec": { - "containers": [ - { - "name": "master", - "image": "${image_uri}", - "imagePullPolicy": "IfNotPresent" - } - ], - "restartPolicy": "OnFailure" - } - } - }, - { - "name": "worker", - "replicas": 1, - "template": { - "spec": { - "containers": [ - { - "name": "worker", - "image": "${image_uri}", - "workingDir": "/home", - "imagePullPolicy": "IfNotPresent" - } - ], - "restartPolicy": "OnFailure" - } - } - } - ], - "plugins": { - "pytorch": [ - "--master=master", - "--worker=worker", - "--port=23456" - ] - }, - "minAvailable": 1, - "schedulerName": "volcano" - }, - "metadata": { - "name": "wandb-job-${run_id}", - "labels": { - "wandb_entity": "${entity_name}", - "wandb_project": "${project_name}" - }, - "namespace": "wandb" - }, - "apiVersion": "batch.volcano.sh/v1alpha1" -} -``` -{{% /tab %}} -{{< /tabpane >}} - -Click the **Create queue** button at the bottom of the drawer to finish creating your queue. - -## Install Volcano - -To install Volcano in your Kubernetes cluster, you can follow the [official installation guide](https://volcano.sh/en/docs/installation/). - -## Deploy your launch agent - -Now that you have created a queue, you will need to deploy a launch agent to pull and execute jobs from the queue. The easiest way to do this is with the [`launch-agent` chart from W&B's official `helm-charts` repository](https://github.com/wandb/helm-charts/tree/main/charts/launch-agent). Follow the instructions in the README to install the chart into your Kubernetes cluster, and be sure to configure the agent to poll the queue you created earlier. - -## Create a training job - -Volcano's pytorch plugin automatically configures the necessary environment variables for pytorch DPP to work, such as `MASTER_ADDR`, `RANK`, and `WORLD_SIZE`, as long as your pytorch code uses DDP correctly. Refer to [pytorch's documentation](https://pytorch.org/tutorials/intermediate/ddp_tutorial.html) for more details on how to use DDP in your custom python code. - -{{% alert %}} -Volcano's pytorch plugin is also compatible with [multinode training via the PyTorch Lightning `Trainer`](https://lightning.ai/docs/pytorch/stable/common/trainer.html#num-nodes). -{{% /alert %}} - -## Launch - -Now that our queue and cluster are set up, it's time to launch some distributed training. To start off with we will use [a job](https://wandb.ai/wandb/multinodetest/jobs/QXJ0aWZhY3RDb2xsZWN0aW9uOjc3MDcwNTg1/runs/latest) trains a simple multi-layer perceptron on random data using volcano's pytorch plugin. You can find the source code for the job [here](https://github.com/wandb/launch-jobs/tree/main/jobs/distributed_test). - -To launch this job, head to the [job's page](https://wandb.ai/wandb/multinodetest/jobs/QXJ0aWZhY3RDb2xsZWN0aW9uOjc3MDcwNTg1/runs/latest) and click the **Launch** button in the top right corner of the screen. You will be prompted to select a queue to launch the job from. - -{{< img src="/images/launch/launching_multinode_job.png" alt="Multi-node job launch" >}} - -1. Set the jobs parameters however you like, -2. Select the queue you created earlier. -3. Modify the volcano job in the **Resource config** section to modify the parameters of your job. For example, you can change the number of workers by changing the `replicas` field in the `worker` task. -4. Click **Launch**. - -You can monitor the progress and if necessary stop your job from the W&B UI. \ No newline at end of file diff --git a/content/en/launch/launch-faq/_index.md b/content/en/launch/launch-faq/_index.md deleted file mode 100644 index 90e9b54e26..0000000000 --- a/content/en/launch/launch-faq/_index.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -menu: - launch: - identifier: launch-faq - parent: launch -title: Launch FAQ -toc_hide: false -cascade: - toc_hide: true ---- - diff --git a/content/en/launch/launch-faq/best_practices_launch_effectively.md b/content/en/launch/launch-faq/best_practices_launch_effectively.md deleted file mode 100644 index f0f65a627e..0000000000 --- a/content/en/launch/launch-faq/best_practices_launch_effectively.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -menu: - launch: - identifier: best_practices_launch_effectively - parent: launch-faq -title: Are there best practices for using Launch effectively? ---- - -1. Create the queue before starting the agent to enable easy configuration. Failure to do this results in errors that prevent the agent from functioning until a queue is added. - -2. Create a W&B service account to initiate the agent, ensuring it is not linked to an individual user account. - -3. Use `wandb.Run.config` to manage hyperparameters, allowing for overwriting during job re-runs. Refer to the [configuration with argparse guide]({{< relref "/guides/models/track/config/#set-the-configuration-with-argparse" >}}) for details on using argparse. diff --git a/content/en/launch/launch-faq/build_container_launch.md b/content/en/launch/launch-faq/build_container_launch.md deleted file mode 100644 index 923051fb8e..0000000000 --- a/content/en/launch/launch-faq/build_container_launch.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -menu: - launch: - identifier: build_container_launch - parent: launch-faq -title: I do not want W&B to build a container for me, can I still use Launch? ---- - -To launch a pre-built Docker image, execute the following command. Replace the placeholders in the `<>` with your specific information: - -```bash -wandb launch -d -q -E -``` - -This command creates a job and starts a run. - -To create a job from an image, use the following command: - -```bash -wandb job create image -p -e -``` \ No newline at end of file diff --git a/content/en/launch/launch-faq/clicking_launch_without_going_ui.md b/content/en/launch/launch-faq/clicking_launch_without_going_ui.md deleted file mode 100644 index 5c28fb903e..0000000000 --- a/content/en/launch/launch-faq/clicking_launch_without_going_ui.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -menu: - launch: - identifier: clicking_launch_without_going_ui - parent: launch-faq -title: I do not like clicking- can I use Launch without going through the UI? ---- - -Yes. The standard `wandb` CLI includes a `launch` subcommand to launch jobs. For more information, run: - -```bash -wandb launch --help -``` \ No newline at end of file diff --git a/content/en/launch/launch-faq/control_push_queue.md b/content/en/launch/launch-faq/control_push_queue.md deleted file mode 100644 index 337de6f865..0000000000 --- a/content/en/launch/launch-faq/control_push_queue.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -menu: - launch: - identifier: control_push_queue - parent: launch-faq -title: How do I control who can push to a queue? ---- - -Queues are specific to a user team. Define the owning entity during queue creation. To restrict access, modify team membership. \ No newline at end of file diff --git a/content/en/launch/launch-faq/docker_queues_run_multiple_jobs_download_same_artifact_useartifact.md b/content/en/launch/launch-faq/docker_queues_run_multiple_jobs_download_same_artifact_useartifact.md deleted file mode 100644 index 40f28fff97..0000000000 --- a/content/en/launch/launch-faq/docker_queues_run_multiple_jobs_download_same_artifact_useartifact.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -menu: - launch: - identifier: docker_queues_run_multiple_jobs_download_same_artifact_useartifact - parent: launch-faq -title: When multiple jobs in a Docker queue download the same artifact, is any caching - used, or is it re-downloaded every run? ---- - -No caching exists. Each launch job operates independently. Configure the queue or agent to mount a shared cache using Docker arguments in the queue configuration. - -Additionally, mount the W&B artifacts cache as a persistent volume for specific use cases. \ No newline at end of file diff --git a/content/en/launch/launch-faq/dockerfile_let_wb_build_docker_image_me.md b/content/en/launch/launch-faq/dockerfile_let_wb_build_docker_image_me.md deleted file mode 100644 index 148f03bf3e..0000000000 --- a/content/en/launch/launch-faq/dockerfile_let_wb_build_docker_image_me.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -menu: - launch: - identifier: dockerfile_let_wb_build_docker_image_me - parent: launch-faq -title: Can I specify a Dockerfile and let W&B build a Docker image for me? ---- -This feature suits projects with stable requirements but frequently changing codebases. - -{{% alert color="secondary" %}} -Format your Dockerfile to use mounts. For further details, visit the [Mounts documentation on the Docker Docs website](https://docs.docker.com/build/guide/mounts/). -{{% /alert %}} - -After configuring the Dockerfile, specify it in one of three ways to W&B: - -* Use Dockerfile.wandb -* Use W&B CLI -* Use W&B App - -{{< tabpane text=true >}} -{{% tab "Dockerfile.wandb" %}} -Include a `Dockerfile.wandb` file in the same directory as the W&B run's entrypoint. W&B utilizes this file instead of the built-in Dockerfile. -{{% /tab %}} -{{% tab "W&B CLI" %}} -Use the `--dockerfile` flag with the `wandb launch` command to queue a job: - -```bash -wandb launch --dockerfile path/to/Dockerfile -``` -{{% /tab %}} -{{% tab "W&B app" %}} -When adding a job to a queue in the W&B App, provide the Dockerfile path in the **Overrides** section. Enter it as a key-value pair with `"dockerfile"` as the key and the path to the Dockerfile as the value. - -The following JSON demonstrates how to include a Dockerfile in a local directory: - -```json title="Launch job W&B App" -{ - "args": [], - "run_config": { - "lr": 0, - "batch_size": 0, - "epochs": 0 - }, - "entrypoint": [], - "dockerfile": "./Dockerfile" -} -``` -{{% /tab %}} -{{% /tabpane %}} \ No newline at end of file diff --git a/content/en/launch/launch-faq/launch_automatically_provision_spin_compute_resources_target_environment.md b/content/en/launch/launch-faq/launch_automatically_provision_spin_compute_resources_target_environment.md deleted file mode 100644 index 2393f42153..0000000000 --- a/content/en/launch/launch-faq/launch_automatically_provision_spin_compute_resources_target_environment.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -menu: - launch: - identifier: launch_automatically_provision_spin_compute_resources_target_environment - parent: launch-faq -title: Can Launch automatically provision (and spin down) compute resources for me - in the target environment? ---- - -This process depends on the environment. Resources provision in Amazon SageMaker and Vertex. In Kubernetes, autoscalers automatically adjust resources based on demand. Solution Architects at W&B assist in configuring Kubernetes infrastructure to enable retries, autoscaling, and the use of spot instance node pools. For support, contact support@wandb.com or use your shared Slack channel. \ No newline at end of file diff --git a/content/en/launch/launch-faq/launch_build_images.md b/content/en/launch/launch-faq/launch_build_images.md deleted file mode 100644 index 424d0fbd44..0000000000 --- a/content/en/launch/launch-faq/launch_build_images.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -menu: - launch: - identifier: launch_build_images - parent: launch-faq -title: How does W&B Launch build images? ---- - -The steps for building an image depend on the job source and the specified accelerator base image in the resource configuration. - -{{% alert %}} -When configuring a queue or submitting a job, include a base accelerator image in the queue or job resource configuration: -```json -{ - "builder": { - "accelerator": { - "base_image": "image-name" - } - } -} -``` -{{% /alert %}} - -The build process includes the following actions based on the job type and provided accelerator base image: - -| | Install Python using apt | Install Python packages | Create a user and workdir | Copy code into image | Set entrypoint | | \ No newline at end of file diff --git a/content/en/launch/launch-faq/launch_d_wandb_job_create_image_uploading_whole_docker.md b/content/en/launch/launch-faq/launch_d_wandb_job_create_image_uploading_whole_docker.md deleted file mode 100644 index 425d778066..0000000000 --- a/content/en/launch/launch-faq/launch_d_wandb_job_create_image_uploading_whole_docker.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -menu: - launch: - identifier: launch_d_wandb_job_create_image_uploading_whole_docker - parent: launch-faq -title: Is `wandb launch -d` or `wandb job create image` uploading a whole docker artifact - and not pulling from a registry? ---- - -No, the `wandb launch -d` command does not upload images to a registry. Upload images to a registry separately. Follow these steps: - -1. Build an image. -2. Push the image to a registry. - -The workflow is as follows: - -```bash -docker build -t : . -docker push : -wandb launch -d : -``` - -The launch agent then spins up a job pointing to the specified container. See [Advanced agent setup]({{< relref "/launch/set-up-launch/setup-agent-advanced.md#agent-configuration" >}}) for examples on configuring agent access to pull images from a container registry. - -For Kubernetes, ensure that the Kubernetes cluster pods have access to the registry where the image is pushed. \ No newline at end of file diff --git a/content/en/launch/launch-faq/launch_support_parallelization_limit_resources_consumed_job.md b/content/en/launch/launch-faq/launch_support_parallelization_limit_resources_consumed_job.md deleted file mode 100644 index 759ec28526..0000000000 --- a/content/en/launch/launch-faq/launch_support_parallelization_limit_resources_consumed_job.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -menu: - launch: - identifier: launch_support_parallelization_limit_resources_consumed_job - parent: launch-faq -title: Does Launch support parallelization? How can I limit the resources consumed - by a job? ---- - -Launch supports scaling jobs across multiple GPUs and nodes. Refer to the [Volcano integration guide]({{< relref "/launch/integration-guides/volcano.md" >}}) for details. - -Each launch agent is configured with a `max_jobs` parameter, which determines the maximum number of simultaneous jobs it can run. Multiple agents can point to a single queue as long as they connect to an appropriate launching infrastructure. - -You can set limits on CPU, GPU, memory, and other resources at the queue or job run level in the resource configuration. For information on setting up queues with resource limits on Kubernetes, see the [Kubernetes setup guide]({{< relref "/launch/set-up-launch/setup-launch-kubernetes.md" >}}). - -For sweeps, include the following block in the queue configuration to limit the number of concurrent runs: - -```yaml title="queue config" - scheduler: - num_workers: 4 -``` \ No newline at end of file diff --git a/content/en/launch/launch-faq/launch_tensorflow_gpu.md b/content/en/launch/launch-faq/launch_tensorflow_gpu.md deleted file mode 100644 index 3306af2e84..0000000000 --- a/content/en/launch/launch-faq/launch_tensorflow_gpu.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -menu: - launch: - identifier: launch_tensorflow_gpu - parent: launch-faq -title: How do I make W&B Launch work with Tensorflow on GPU? ---- - -For TensorFlow jobs using GPUs, specify a custom base image for the container build. This ensures proper GPU utilization during runs. Add an image tag under the `builder.accelerator.base_image` key in the resource configuration. For example: - -```json -{ - "gpus": "all", - "builder": { - "accelerator": { - "base_image": "tensorflow/tensorflow:latest-gpu" - } - } -} -``` - -In versions prior to W&B 0.15.6, use `cuda` instead of `accelerator` as the parent key for `base_image`. \ No newline at end of file diff --git a/content/en/launch/launch-faq/launcherror_permission_denied.md b/content/en/launch/launch-faq/launcherror_permission_denied.md deleted file mode 100644 index bdd41ce21c..0000000000 --- a/content/en/launch/launch-faq/launcherror_permission_denied.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -menu: - launch: - identifier: launcherror_permission_denied - parent: launch-faq -title: How do I fix a "permission denied" error in Launch? ---- - -If you encounter the error message `Launch Error: Permission denied`, it indicates insufficient permissions to log to the desired project. Possible causes include: - -1. You are not logged in on this machine. Run [`wandb login`]({{< relref "/ref/cli/wandb-login.md" >}}) in the command line. -2. The specified entity does not exist. The entity must be your username or an existing team's name. Create a team if necessary with the [Subscriptions page](https://app.wandb.ai/billing). -3. You lack project permissions. Request the project creator to change the privacy setting to **Open** to allow logging runs to the project. \ No newline at end of file diff --git a/content/en/launch/launch-faq/permissions_agent_require_kubernetes.md b/content/en/launch/launch-faq/permissions_agent_require_kubernetes.md deleted file mode 100644 index bf725c5bbe..0000000000 --- a/content/en/launch/launch-faq/permissions_agent_require_kubernetes.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -menu: - launch: - identifier: permissions_agent_require_kubernetes - parent: launch-faq -title: What permissions does the agent require in Kubernetes? ---- - -The following Kubernetes manifest creates a role named `wandb-launch-agent` in the `wandb` namespace. This role allows the agent to create pods, configmaps, secrets, and access pod logs in the `wandb` namespace. The `wandb-cluster-role` enables the agent to create pods, access pod logs, create secrets, jobs, and check job status across any specified namespace. \ No newline at end of file diff --git a/content/en/launch/launch-faq/requirements_accelerator_base_image.md b/content/en/launch/launch-faq/requirements_accelerator_base_image.md deleted file mode 100644 index 5610760208..0000000000 --- a/content/en/launch/launch-faq/requirements_accelerator_base_image.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -menu: - launch: - identifier: requirements_accelerator_base_image - parent: launch-faq -title: What requirements does the accelerator base image have? ---- - -For jobs utilizing an accelerator, provide a base image that includes the necessary accelerator components. Ensure the following requirements for the accelerator image: - -- Compatibility with Debian (the Launch Dockerfile uses apt-get to install Python) -- Supported CPU and GPU hardware instruction set (confirm the CUDA version compatibility with the intended GPU) -- Compatibility between the supplied accelerator version and the packages in the machine learning algorithm -- Installation of packages that require additional steps for hardware compatibility \ No newline at end of file diff --git a/content/en/launch/launch-faq/restrict_access_modify_example.md b/content/en/launch/launch-faq/restrict_access_modify_example.md deleted file mode 100644 index b0f093e56c..0000000000 --- a/content/en/launch/launch-faq/restrict_access_modify_example.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -menu: - launch: - identifier: restrict_access_modify_example - parent: launch-faq -title: How can admins restrict which users have modify access? ---- - -Control access to certain queue fields for users who are not team administrators through [queue config templates]({{< relref "/launch/set-up-launch/setup-queue-advanced.md" >}}). Team administrators define which fields non-admin users can view, and set the editing limits. Only team administrators have the ability to create or edit queues. \ No newline at end of file diff --git a/content/en/launch/launch-faq/secrets_jobsautomations_instance_api_key_wish_directly_visible.md b/content/en/launch/launch-faq/secrets_jobsautomations_instance_api_key_wish_directly_visible.md deleted file mode 100644 index b660b026b1..0000000000 --- a/content/en/launch/launch-faq/secrets_jobsautomations_instance_api_key_wish_directly_visible.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -menu: - launch: - identifier: secrets_jobsautomations_instance_api_key_wish_directly_visible - parent: launch-faq -title: Can you specify secrets for jobs/automations? For instance, an API key which - you do not wish to be directly visible to users? ---- - -Yes. Follow these steps: - -1. Create a Kubernetes secret in the designated namespace for the runs using the command: - `kubectl create secret -n generic ` - -2. After creating the secret, configure the queue to inject the secret when runs start. Only cluster administrators can view the secret; end users cannot see it. \ No newline at end of file diff --git a/content/en/launch/launch-terminology.md b/content/en/launch/launch-terminology.md deleted file mode 100644 index 340e7640ce..0000000000 --- a/content/en/launch/launch-terminology.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -menu: - launch: - identifier: launch-terminology - parent: launch -title: Launch terms and concepts -url: guides/launch/launch-terminology -weight: 2 ---- - -With W&B Launch, you enqueue [jobs]({{< relref "#launch-job" >}}) onto [queues]({{< relref "#launch-queue" >}}) to create runs. Jobs are python scripts instrumented with W&B. Queues hold a list of jobs to execute on a [target resource]({{< relref "#target-resources" >}}). [Agents]({{< relref "#launch-agent" >}}) pull jobs from queues and execute the jobs on target resources. W&B tracks launch jobs similarly to how W&B tracks [runs]({{< relref "/guides/models/track/runs/" >}}). - -### Launch job -A launch job is a specific type of [W&B Artifact]({{< relref "/guides/core/artifacts/" >}}) that represents a task to complete. For example, common launch jobs include training a model or triggering a model evaluation. Job definitions include: - -- Python code and other file assets, including at least one runnable entrypoint. -- Information about the input (config parameter) and output (metrics logged). -- Information about the environment. (for example, `requirements.txt`, base `Dockerfile`). - -There are three main kinds of job definitions: - -| Job types | Definition | How to run this job type | -| ---------- | --------- | -------------- | -|Artifact-based (or code-based) jobs| Code and other assets are saved as a W&B artifact.| To run artifact-based jobs, Launch agent must be configured with a builder. | -|Git-based jobs| Code and other assets are cloned from a certain commit, branch, or tag in a git repository. | To run git-based jobs, Launch agent must be configured with a builder and git repository credentials. | -|Image-based jobs|Code and other assets are baked into a Docker image. | To run image-based jobs, Launch agent might need to be configured with image repository credentials. | - -{{% alert %}} -While Launch jobs can perform activities not related to model training--for example, deploy a model to a Triton inference server--all jobs must call `wandb.init` to complete successfully. This creates a run for tracking purposes in a W&B workspace. -{{% /alert %}} - -Find jobs you created in the W&B App under the `Jobs` tab of your project workspace. From there, jobs can be configured and sent to a [launch queue]({{< relref "#launch-queue" >}}) to be executed on a variety of [target resources]({{< relref "#target-resources" >}}). - -### Launch queue -Launch *queues* are ordered lists of jobs to execute on a specific target resource. Launch queues are first-in, first-out. (FIFO). There is no practical limit to the number of queues you can have, but a good guideline is one queue per target resource. Jobs can be enqueued with the W&B App UI, W&B CLI or Python SDK. You can then configure one or more Launch agents to pull items from the queue and execute them on the queue's target resource. - -### Target resources -The compute environment that a Launch queue is configured to execute jobs on is called the *target resource*. - -W&B Launch supports the following target resources: - -- [Docker]({{< relref "/launch/set-up-launch/setup-launch-docker.md" >}}) -- [Kubernetes]({{< relref "/launch/set-up-launch/setup-launch-kubernetes.md" >}}) -- [AWS SageMaker]({{< relref "/launch/set-up-launch/setup-launch-sagemaker.md" >}}) -- [GCP Vertex]({{< relref "/launch/set-up-launch/setup-vertex.md" >}}) - -Each target resource accepts a different set of configuration parameters called *resource configurations*. Resource configurations take on default values defined by each Launch queue, but can be overridden independently by each job. See the documentation for each target resource for more details. - -### Launch agent -Launch agents are lightweight, persistent programs that periodically check Launch queues for jobs to execute. When a launch agent receives a job, it first builds or pulls the image from the job definition then runs it on the target resource. - -One agent may poll multiple queues, however the agent must be configured properly to support all of the backing target resources for each queue it is polling. - -### Launch agent environment -The agent environment is the environment where a launch agent is running, polling for jobs. - -{{% alert %}} -The agent's runtime environment is independent of a queue's target resource. In other words, agents can be deployed anywhere as long as they are configured sufficiently to access the required target resources. -{{% /alert %}} \ No newline at end of file diff --git a/content/en/launch/set-up-launch/_index.md b/content/en/launch/set-up-launch/_index.md deleted file mode 100644 index e79aacfb94..0000000000 --- a/content/en/launch/set-up-launch/_index.md +++ /dev/null @@ -1,111 +0,0 @@ ---- -menu: - launch: - identifier: setup-launch - parent: launch -title: Set up Launch -weight: 3 ---- -This page describes the high-level steps required to set up W&B Launch: - -1. **Set up a queue**: Queues are FIFO and possess a queue configuration. A queue's configuration controls where and how jobs are executed on a target resource. -2. **Set up an agent**: Agents run on your machine/infrastructure and poll one or more queues for launch jobs. When a job is pulled, the agent ensures that the image is built and available. The agent then submits the job to the target resource. - - -## Set up a queue -Launch queues must be configured to point to a specific target resource along with any additional configuration specific to that resource. For example, a launch queue that points to a Kubernetes cluster might include environment variables or set a custom namespace its launch queue configuration. When you create a queue, you will specify both the target resource you want to use and the configuration for that resource to use. - -When an agent receives a job from a queue, it also receives the queue configuration. When the agent submits the job to the target resource, it includes the queue configuration along with any overrides from the job itself. For example, you can use a job configuration to specify the Amazon SageMaker instance type for that job instance only. In this case, it is common to use [queue config templates]({{< relref "./setup-queue-advanced.md#configure-queue-template" >}}) as the end user interface. - -### Create a queue -1. Navigate to Launch App at [wandb.ai/launch](https://wandb.ai/launch). -2. Click the **create queue** button on the top right of the screen. - -{{< img src="/images/launch/create-queue.gif" alt="Creating a Launch queue" >}} - -3. From the **Entity** dropdown menu, select the entity the queue will belong to. -4. Provide a name for your queue in the **Queue** field. -5. From the **Resource** dropdown, select the compute resource you want jobs added to this queue to use. -6. Choose whether to allow **Prioritization** for this queue. If prioritization is enabled, a user on your team can define a priority for their launch job when they enqueue them. Higher priority jobs are executed before lower priority jobs. -7. Provide a resource configuration in either JSON or YAML format in the **Configuration** field. The structure and semantics of your configuration document will depend on the resource type that the queue is pointing to. For more details, see the dedicated set up page for your target resource. - -## Set up a launch agent -Launch agents are long running processes that poll one or more launch queues for jobs. Launch agents dequeue jobs in first in, first out (FIFO) order or in priority order depending on the queues they pull from. When an agent dequeues a job from a queue, it optionally builds an image for that job. The agent then submits the job to the target resource along with configuration options specified in the queue configuration. - -{{% alert %}} -Agents are highly flexible and can be configured to support a wide variety of use cases. The required configuration for your agent will depend on your specific use case. See the dedicated page for [Docker]({{< relref "./setup-launch-docker.md" >}}), [Amazon SageMaker]({{< relref "./setup-launch-sagemaker.md" >}}), [Kubernetes]({{< relref "./setup-launch-kubernetes.md" >}}), or [Vertex AI]({{< relref "./setup-vertex.md" >}}). -{{% /alert %}} - -{{% alert %}} -W&B recommends you start agents with a service account's API key, rather than a specific user's API key. There are two benefits to using a service account's API key: -1. The agent isn't dependent on an individual user. -2. The author associated with a run created through Launch is viewed by Launch as the user who submitted the launch job, rather than the user associated with the agent. -{{% /alert %}} - -### Agent configuration -Configure the launch agent with a YAML file named `launch-config.yaml`. By default, W&B checks for the config file in `~/.config/wandb/launch-config.yaml`. You can optionally specify a different directory when you activate the launch agent. - -The contents of your launch agent's configuration file will depend on your launch agent's environment, the launch queue's target resource, Docker builder requirements, cloud registry requirements, and so forth. - -Independent of your use case, there are core configurable options for the launch agent: -* `max_jobs`: maximum number of jobs the agent can execute in parallel -* `entity`: the entity that the queue belongs to -* `queues`: the name of one or more queues for the agent to watch - -{{% alert %}} -You can use the W&B CLI to specify universal configurable options for the launch agent (instead of the config YAML file): maximum number of jobs, W&B entity, and launch queues. See the [`wandb launch-agent`]({{< relref "/ref/cli/wandb-launch-agent.md" >}}) command for more information. -{{% /alert %}} - - -The following YAML snippet shows how to specify core launch agent config keys: - -```yaml title="launch-config.yaml" -# Max number of concurrent runs to perform. -1 = no limit -max_jobs: -1 - -entity: - -# List of queues to poll. -queues: - - -``` - -### Configure a container builder -The launch agent can be configured to build images. You must configure the agent to use a container builder if you intend to use launch jobs created from git repositories or code artifacts. See the [Create a launch job]({{< relref "../create-and-deploy-jobs/create-launch-job.md" >}}) for more information on how to create a launch job. - -W&B Launch supports three builder options: - -* Docker: The Docker builder uses a local Docker daemon to build images. -* [Kaniko](https://github.com/GoogleContainerTools/kaniko): Kaniko is a Google project that enables image building in environments where a Docker daemon is unavailable. -* Noop: The agent will not try to build jobs, and instead only pull pre-built images. - -{{% alert %}} -Use the Kaniko builder if your agent is polling in an environment where a Docker daemon is unavailable (for example, a Kubernetes cluster). - -See the [Set up Kubernetes]({{< relref "./setup-launch-kubernetes.md" >}}) for details about the Kaniko builder. -{{% /alert %}} - -To specify an image builder, include the builder key in your agent configuration. For example, the following code snippet shows a portion of the launch config (`launch-config.yaml`) that specifies to use Docker or Kaniko: - -```yaml title="launch-config.yaml" -builder: - type: docker | kaniko | noop -``` - -### Configure a container registry -In some cases, you might want to connect a launch agent to a cloud registry. Common scenarios where you might want to connect a launch agent to a cloud registry include: - -* You want to run a job in an envirnoment other than where you built it, such as a powerful workstation or cluster. -* You want to use the agent to build images and run these images on Amazon SageMaker or VertexAI. -* You want the launch agent to provide credentials to pull from an image repository. - -To learn more about how to configure the agent to interact with a container registry, see the [Advanced agent set]({{< relref "./setup-agent-advanced.md" >}}) up page. - -## Activate the launch agent -Activate the launch agent with the `launch-agent` W&B CLI command: - -```bash -wandb launch-agent -q -q --max-jobs 5 -``` - -In some use cases, you might want to have a launch agent polling queues from within a Kubernetes cluster. See the [Advanced queue set up page]({{< relref "./setup-queue-advanced.md" >}}) for more information. \ No newline at end of file diff --git a/content/en/launch/set-up-launch/setup-agent-advanced.md b/content/en/launch/set-up-launch/setup-agent-advanced.md deleted file mode 100644 index c81a2a4612..0000000000 --- a/content/en/launch/set-up-launch/setup-agent-advanced.md +++ /dev/null @@ -1,244 +0,0 @@ ---- -menu: - launch: - identifier: setup-agent-advanced - parent: set-up-launch -title: Set up launch agent -url: guides/launch/setup-agent-advanced ---- -# Advanced agent setup - -This guide provides information on how to set up the W&B Launch agent to build container images in different environments. - -{{% alert %}} -Build is only required for git and code artifact jobs. Image jobs do not require build. - -See [Create a launch job]({{< relref "../create-and-deploy-jobs/create-launch-job.md" >}}) for more information on job types. -{{% /alert %}} - -## Builders - -The Launch agent can build images using [Docker](https://docs.docker.com/) or [Kaniko](https://github.com/GoogleContainerTools/kaniko). - -* Kaniko: builds a container image in Kubernetes without running the build as a privileged container. -* Docker: builds a container image by executing a `docker build` command locally. - -The builder type can be controlled by the `builder.type` key in the launch agent config to either `docker`, `kaniko`, or `noop` to turn off build. By default, the agent helm chart sets the `builder.type` to `noop`. Additional keys in the `builder` section will be used to configure the build process. - -If no builder is specified in the agent config and a working `docker` CLI is found, the agent will default to using Docker. If Docker is not available the agent will default to `noop`. - -{{% alert %}} -Use Kaniko for building images in a Kubernetes cluster. Use Docker for all other cases. -{{% /alert %}} - - -## Pushing to a container registry - -The launch agent tags all images it builds with a unique source hash. The agent pushes the image to the registry specified in the `builder.destination` key. - -For example, if the `builder.destination` key is set to `my-registry.example.com/my-repository`, the agent will tag and push the image to `my-registry.example.com/my-repository:`. If the image exists in the registry, the build is skipped. - -### Agent configuration - -If you are deploying the agent via our Helm chart, the agent config should be provided in the `agentConfig` key in the `values.yaml` file. - -If you are invoking the agent yourself with `wandb launch-agent`, you can provide the agent config as a path to a YAML file with the `--config` flag. By default, the config will be loaded from `~/.config/wandb/launch-config.yaml`. - -Within your launch agent config (`launch-config.yaml`), provide the name of the target resource environment and the container registry for the `environment` and `registry` keys, respectively. - -The following tabs demonstrates how to configure the launch agent based on your environment and registry. - -{{< tabpane text=true >}} -{{% tab "AWS" %}} -The AWS environment configuration requires the region key. The region should be the AWS region that the agent runs in. - -```yaml title="launch-config.yaml" -environment: - type: aws - region: -builder: - type: - # URI of the ECR repository where the agent will store images. - # Make sure the region matches what you have configured in your - # environment. - destination: .ecr..amazonaws.com/ - # If using Kaniko, specify the S3 bucket where the agent will store the - # build context. - build-context-store: s3:/// -``` - -The agent uses boto3 to load the default AWS credentials. See the [boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/index.html) for more information on how to configure default AWS credentials. -{{% /tab %}} -{{% tab "GCP" %}} -The Google Cloud environment requires region and project keys. Set `region` to the region that the agent runs in. Set `project` to the Google Cloud project that the agent runs in. The agent uses `google.auth.default()` in Python to load the default credentials. - -```yaml title="launch-config.yaml" -environment: - type: gcp - region: - project: -builder: - type: - # URI of the Artifact Registry repository and image name where the agent - # will store images. Make sure the region and project match what you have - # configured in your environment. - uri: -docker.pkg.dev/// - # If using Kaniko, specify the GCS bucket where the agent will store the - # build context. - build-context-store: gs:/// -``` - -See the [`google-auth` documentation](https://google-auth.readthedocs.io/en/latest/reference/google.auth.html#google.auth.default) for more information on how to configure default GCP credentials so they are available to the agent. - -{{% /tab %}} -{{% tab "Azure" %}} - -The Azure environment does not require any additional keys. When the agent starts, it use `azure.identity.DefaultAzureCredential()` to load the default Azure credentials. - -```yaml title="launch-config.yaml" -environment: - type: azure -builder: - type: - # URI of the Azure Container Registry repository where the agent will store images. - destination: https://.azurecr.io/ - # If using Kaniko, specify the Azure Blob Storage container where the agent - # will store the build context. - build-context-store: https://.blob.core.windows.net/ -``` - -See the [`azure-identity` documentation](https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential?view=azure-python) for more information on how to configure default Azure credentials. -{{% /tab %}} -{{< /tabpane >}} - -## Agent permissions - -The agent permissions required vary by use case. - -### Cloud registry permissions - -Below are the permissions that are generally required by launch agents to interact with cloud registries. - -{{< tabpane text=true >}} -{{% tab "AWS" %}} -```yaml -{ - 'Version': '2012-10-17', - 'Statement': - [ - { - 'Effect': 'Allow', - 'Action': - [ - 'ecr:CreateRepository', - 'ecr:UploadLayerPart', - 'ecr:PutImage', - 'ecr:CompleteLayerUpload', - 'ecr:InitiateLayerUpload', - 'ecr:DescribeRepositories', - 'ecr:DescribeImages', - 'ecr:BatchCheckLayerAvailability', - 'ecr:BatchDeleteImage', - ], - 'Resource': 'arn:aws:ecr:::repository/', - }, - { - 'Effect': 'Allow', - 'Action': 'ecr:GetAuthorizationToken', - 'Resource': '*', - }, - ], -} -``` -{{% /tab %}} -{{% tab "GCP" %}} -```js -artifactregistry.dockerimages.list; -artifactregistry.repositories.downloadArtifacts; -artifactregistry.repositories.list; -artifactregistry.repositories.uploadArtifacts; -``` - -{{% /tab %}} -{{% tab "Azure" %}} - -Add the [`AcrPush` role](https://learn.microsoft.com/azure/role-based-access-control/built-in-roles/containers#acrpush) if you use the Kaniko builder. -{{% /tab %}} -{{< /tabpane >}} - -### Storage permissions for Kaniko - -The launch agent requires permission to push to cloud storage if the agent uses the Kaniko builder. Kaniko uses a context store outside of the pod running the build job. - -{{< tabpane text=true >}} -{{% tab "AWS" %}} -The recommended context store for the Kaniko builder on AWS is Amazon S3. The following policy can be used to give the agent access to an S3 bucket: - -```json -{ - "Version": "2012-10-17", - "Statement": [ - { - "Sid": "ListObjectsInBucket", - "Effect": "Allow", - "Action": ["s3:ListBucket"], - "Resource": ["arn:aws:s3:::"] - }, - { - "Sid": "AllObjectActions", - "Effect": "Allow", - "Action": "s3:*Object", - "Resource": ["arn:aws:s3:::/*"] - } - ] -} -``` -{{% /tab %}} -{{% tab "GCP" %}} -On GCP, the following IAM permissions are required for the agent to upload build contexts to GCS: - -```js -storage.buckets.get; -storage.objects.create; -storage.objects.delete; -storage.objects.get; -``` - -{{% /tab %}} -{{% tab "Azure" %}} - -The [Storage Blob Data Contributor](https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#storage-blob-data-contributor) role is required in order for the agent to upload build contexts to Azure Blob Storage. -{{% /tab %}} -{{< /tabpane >}} - - -## Customizing the Kaniko build - -Specify the Kubernetes Job spec that the Kaniko job uses in the `builder.kaniko-config` key of the agent configuration. For example: - -```yaml title="launch-config.yaml" -builder: - type: kaniko - build-context-store: - destination: - build-job-name: wandb-image-build - kaniko-config: - spec: - template: - spec: - containers: - - args: - - "--cache=false" # Args must be in the format "key=value" - env: - - name: "MY_ENV_VAR" - value: "my-env-var-value" -``` - -## Deploy Launch agent into CoreWeave -Optionally deploy the W&B Launch agent to CoreWeave Cloud infrastructure. CoreWeave is a cloud infrastructure that is purpose built for GPU-accelerated workloads. - -For information on how to deploy the Launch agent to CoreWeave, see the [CoreWeave documentation](https://docs.coreweave.com/partners/weights-and-biases#integration). - -{{% alert %}} -You will need to create a [CoreWeave account](https://cloud.coreweave.com/login) in order to deploy the Launch agent into a CoreWeave infrastructure. -{{% /alert %}} \ No newline at end of file diff --git a/content/en/launch/set-up-launch/setup-launch-docker.md b/content/en/launch/set-up-launch/setup-launch-docker.md deleted file mode 100644 index e1300e7644..0000000000 --- a/content/en/launch/set-up-launch/setup-launch-docker.md +++ /dev/null @@ -1,145 +0,0 @@ ---- -menu: - launch: - identifier: setup-launch-docker - parent: set-up-launch -title: 'Tutorial: Set up W&B Launch with Docker' -url: guides/launch/setup-launch-docker ---- -The following guide describes how to configure W&B Launch to use Docker on a local machine for both the launch agent environment and for the queue's target resource. - -Using Docker to execute jobs and as the launch agent's environment on the same local machine is particularly useful if your compute is installed on a machine that does not have a cluster management system (such as Kubernetes). - -You can also use Docker queues to run workloads on powerful workstations. - -{{% alert %}} -This set up is common for users who perform experiments on their local machine, or that have a remote machine that they SSH in to, to submit launch jobs. -{{% /alert %}} - -When you use Docker with W&B Launch, W&B will first build an image, and then build and run a container from that image. The image is built with the Docker `docker run ` command. The queue configuration is interpreted as additional arguments that are passed to the `docker run` command. - - - -## Configure a Docker queue - - -The launch queue configuration (for a Docker target resource) accepts the same options defined in the [`docker run`]({{< relref "/ref/cli/wandb-docker-run.md" >}}) CLI command. - -The agent receives options defined in the queue configuration. The agent then merges the received options with any overrides from the launch job’s configuration to produce a final `docker run` command that is executed on the target resource (in this case, a local machine). - -There are two syntax transformations that take place: - -1. Repeated options are defined in the queue configuration as a list. -2. Flag options are defined in the queue configuration as a Boolean with the value `true`. - -For example, the following queue configuration: - -```json -{ - "env": ["MY_ENV_VAR=value", "MY_EXISTING_ENV_VAR"], - "volume": "/mnt/datasets:/mnt/datasets", - "rm": true, - "gpus": "all" -} -``` - -Results in the following `docker run` command: - -```bash -docker run \ - --env MY_ENV_VAR=value \ - --env MY_EXISTING_ENV_VAR \ - --volume "/mnt/datasets:/mnt/datasets" \ - --rm \ - --gpus all -``` - -Volumes can be specified either as a list of strings, or a single string. Use a list if you specify multiple volumes. - -Docker automatically passes environment variables, that are not assigned a value, from the launch agent environment. This means that, if the launch agent has an environment variable `MY_EXISTING_ENV_VAR`, that environment variable is available in the container. This is useful if you want to use other config keys without publishing them in the queue configuration. - -The `--gpus` flag of the `docker run` command allows you to specify GPUs that are available to a Docker container. For more information on how to use the `gpus` flag, see the [Docker documentation](https://docs.docker.com/config/containers/resource_constraints/#gpu). - - -{{% alert %}} -* Install the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker) to use GPUs within a Docker container. -* If you build images from a code or artifact-sourced job, you can override the base image used by the [agent]({{< relref "#configure-a-launch-agent-on-a-local-machine" >}}) to include the NVIDIA Container Toolkit. - For example, within your launch queue, you can override the base image to `tensorflow/tensorflow:latest-gpu`: - - ```json - { - "builder": { - "accelerator": { - "base_image": "tensorflow/tensorflow:latest-gpu" - } - } - } - ``` -{{% /alert %}} - - - - -## Create a queue - -Create a queue that uses Docker as compute resource with the W&B CLI: - -1. Navigate to the [Launch page](https://wandb.ai/launch). -2. Click on the **Create Queue** button. -3. Select the **Entity** you would like to create the queue in. -4. Enter a name for your queue in the **Name** field. -5. Select **Docker** as the **Resource**. -6. Define your Docker queue configuration in the **Configuration** field. -7. Click on the **Create Queue** button to create the queue. - -## Configure a launch agent on a local machine - -Configure the launch agent with a YAML config file named `launch-config.yaml`. By default, W&B will check for the config file in `~/.config/wandb/launch-config.yaml`. You can optionally specify a different directory when you activate the launch agent. - -{{% alert %}} -You can use the W&B CLI to specify core configurable options for the launch agent (instead of the config YAML file): maximum number of jobs, W&B entity, and launch queues. See the [`wandb launch-agent`]({{< relref "/ref/cli/wandb-launch-agent.md" >}}) command for more information. -{{% /alert %}} - - -## Core agent config options - -The following tabs demonstrate how to specify the core config agent options with the W&B CLI and with a YAML config file: - -{{< tabpane text=true >}} -{{% tab "W&B CLI" %}} -```bash -wandb launch-agent -q --max-jobs -``` -{{% /tab %}} -{{% tab "Config file" %}} -```yaml title="launch-config.yaml" -max_jobs: -queues: - - -``` -{{% /tab %}} -{{< /tabpane >}} - -## Docker image builders - -The launch agent on your machine can be configured to build Docker images. By default, these images are stored on your machine’s local image repository. To enable your launch agent to build Docker images, set the `builder` key in the launch agent config to `docker`: - -```yaml title="launch-config.yaml" -builder: - type: docker -``` - -If you don't want the agent to build Docker images, and instead use prebuilt images from a registry, set the `builder` key in the launch agent config to `noop` - -```yaml title="launch-config.yaml" -builder: - type: noop -``` - -## Container registries - -Launch uses external container registeries such as Dockerhub, Google Container Registry, Azure Container Registry, and Amazon ECR. -If you want to run a job on a different environment from where you built it, configure your agent to be able to pull from a container registry. - - -To learn more about how connect the launch agent with a cloud registry, see the [Advanced agent setup]({{< relref "./setup-agent-advanced.md#agent-configuration" >}}) page. \ No newline at end of file diff --git a/content/en/launch/set-up-launch/setup-launch-kubernetes.md b/content/en/launch/set-up-launch/setup-launch-kubernetes.md deleted file mode 100644 index 7a96f1ce3f..0000000000 --- a/content/en/launch/set-up-launch/setup-launch-kubernetes.md +++ /dev/null @@ -1,197 +0,0 @@ ---- -menu: - launch: - identifier: setup-launch-kubernetes - parent: set-up-launch -title: 'Tutorial: Set up W&B Launch on Kubernetes' -url: guides/launch/setup-launch-kubernetes ---- -You can use W&B Launch to push ML workloads to a Kubernetes cluster, giving ML engineers a simple interface right in W&B to use the resources you already manage with Kubernetes. - -W&B maintains an [official Launch agent image](https://hub.docker.com/r/wandb/launch-agent) that can be deployed to your cluster with a [Helm chart](https://github.com/wandb/helm-charts/tree/main/charts/launch-agent) that W&B maintains. - -W&B uses the [Kaniko](https://github.com/GoogleContainerTools/kaniko) builder to enable the Launch agent to build Docker images in a Kubernetes cluster. To learn more on how to set up Kaniko for the Launch agent, or how to turn off job building and only use prebuilt Docker images, see [Advanced agent set up]({{< relref "./setup-agent-advanced.md" >}}). - -{{% alert %}} -To install Helm and apply or upgrade W&B's Launch agent Helm chart, you need `kubectl` access to the cluster with sufficient permissions to create, update, and delete Kubernetes resources. Typically, a user with cluster-admin or a custom role with equivalent permissions is required. -{{% /alert %}} - - - -## Configure a queue for Kubernetes - -The Launch queue configuration for a Kubernetes target resource will resemble either a [Kubernetes Job spec](https://kubernetes.io/docs/concepts/workloads/controllers/job/) or a [Kubernetes Custom Resource spec](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/). - -You can control any aspect of the Kubernetes workload resource spec when you create a Launch queue. - -{{< tabpane text=true >}} -{{% tab "Kubernetes job spec" %}} -```yaml -spec: - template: - spec: - containers: - - env: - - name: MY_ENV_VAR - value: some-value - resources: - requests: - cpu: 1000m - memory: 1Gi -metadata: - labels: - queue: k8s-test -namespace: wandb -``` -{{% /tab %}} -{{% tab "Custom resource spec" %}} -In some use cases, you might want to use `CustomResource` definitions. `CustomResource` definitions are useful if, for example, you want to perform multi-node distributed training. See the tutorial for using Launch with multi-node jobs using Volcano for an example application. Another use case might be that you want to use W&B Launch with Kubeflow. - -The following YAML snippet shows a sample Launch queue config that uses Kubeflow: - -```yaml -kubernetes: - kind: PyTorchJob - spec: - pytorchReplicaSpecs: - Master: - replicas: 1 - template: - spec: - containers: - - name: pytorch - image: '${image_uri}' - imagePullPolicy: Always - restartPolicy: Never - Worker: - replicas: 2 - template: - spec: - containers: - - name: pytorch - image: '${image_uri}' - imagePullPolicy: Always - restartPolicy: Never - ttlSecondsAfterFinished: 600 - metadata: - name: '${run_id}-pytorch-job' - apiVersion: kubeflow.org/v1 -``` -{{% /tab %}} -{{< /tabpane >}} - -For security reasons, W&B will inject the following resources into your Launch queue if they are not specified: - -- `securityContext` -- `backOffLimit` -- `ttlSecondsAfterFinished` - -The following YAML snippet demonstrates how these values will appear in your launch queue: - -```yaml title="example-spec.yaml" -spec: - template: - `backOffLimit`: 0 - ttlSecondsAfterFinished: 60 - securityContext: - allowPrivilegeEscalation: False, - capabilities: - drop: - - ALL, - seccompProfile: - type: "RuntimeDefault" -``` - -## Create a queue - -Create a queue in the W&B App that uses Kubernetes as its compute resource: - -1. Navigate to the [Launch page](https://wandb.ai/launch). -2. Click on the **Create Queue** button. -3. Select the **Entity** you would like to create the queue in. -4. Provide a name for your queue in the **Name** field. -5. Select **Kubernetes** as the **Resource**. -6. Within the **Configuration** field, provide the Kubernetes Job workflow spec or Custom Resource spec you [configured in the previous section]({{< relref "#configure-a-queue-for-kubernetes" >}}). - -## Configure a Launch agent with Helm - -Use the [Helm chart](https://github.com/wandb/helm-charts/tree/main/charts/launch-agent) provided by W&B to deploy the Launch agent into your Kubernetes cluster. Control the behavior of the launch agent with the `values.yaml` [file](https://github.com/wandb/helm-charts/blob/main/charts/launch-agent/values.yaml). - -Specify the contents that would normally by defined in your launch agent config file (`~/.config/wandb/launch-config.yaml`) within the `launchConfig` key in the`values.yaml` file. - -For example, suppose you have Launch agent config that enables you to run a Launch agent in EKS that uses the Kaniko Docker image builder: - -```yaml title="launch-config.yaml" -queues: - - -max_jobs: -environment: - type: aws - region: us-east-1 -registry: - type: ecr - uri: -builder: - type: kaniko - build-context-store: -``` - -Within your `values.yaml` file, this might look like: - -```yaml title="values.yaml" -agent: - labels: {} - # W&B API key. - apiKey: '' - # Container image to use for the agent. - image: wandb/launch-agent:latest - # Image pull policy for agent image. - imagePullPolicy: Always - # Resources block for the agent spec. - resources: - limits: - cpu: 1000m - memory: 1Gi - -# Namespace to deploy launch agent into -namespace: wandb - -# W&B api url (Set yours here) -baseUrl: https://api.wandb.ai - -# Additional target namespaces that the launch agent can deploy into -additionalTargetNamespaces: - - default - - wandb - -# This should be set to the literal contents of your launch agent config. -launchConfig: | - queues: - - - max_jobs: - environment: - type: aws - region: - registry: - type: ecr - uri: - builder: - type: kaniko - build-context-store: - -# The contents of a git credentials file. This will be stored in a k8s secret -# and mounted into the agent container. Set this if you want to clone private -# repos. -gitCreds: | - -# Annotations for the wandb service account. Useful when setting up workload identity on gcp. -serviceAccount: - annotations: - iam.gke.io/gcp-service-account: - azure.workload.identity/client-id: - -# Set to access key for azure storage if using kaniko with azure. -azureStorageAccessKey: '' -``` - -For more information on registries, environments, and required agent permissions see [Advanced agent set up]({{< relref "./setup-agent-advanced.md" >}}). \ No newline at end of file diff --git a/content/en/launch/set-up-launch/setup-launch-sagemaker.md b/content/en/launch/set-up-launch/setup-launch-sagemaker.md deleted file mode 100644 index cba2d0b646..0000000000 --- a/content/en/launch/set-up-launch/setup-launch-sagemaker.md +++ /dev/null @@ -1,323 +0,0 @@ ---- -menu: - launch: - identifier: setup-launch-sagemaker - parent: set-up-launch -title: 'Tutorial: Set up W&B Launch on SageMaker' -url: guides/launch/setup-launch-sagemaker ---- -You can use W&B Launch to submit launch jobs to Amazon SageMaker to train machine learning models using provided or custom algorithms on the SageMaker platform. SageMaker takes care of spinning up and releasing compute resources, so it can be a good choice for teams without an EKS cluster. - -Launch jobs sent to a W&B Launch queue connected to Amazon SageMaker are executed as SageMaker Training Jobs with the [CreateTrainingJob API](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateTrainingJob.html). Use the launch queue configuration to control arguments sent to the `CreateTrainingJob` API. - -Amazon SageMaker [uses Docker images to execute training jobs](https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-training-algo-dockerfile.html). Images pulled by SageMaker must be stored in the Amazon Elastic Container Registry (ECR). This means that the image you use for training must be stored on ECR. - -{{% alert %}} -This guide shows how to execute SageMaker Training Jobs. For information on how to deploy to models for inference on Amazon SageMaker, see [this example Launch job](https://github.com/wandb/launch-jobs/tree/main/jobs/deploy_to_sagemaker_endpoints). -{{% /alert %}} - - -## Prerequisites - -Before you get started, ensure you satisfy the following prerequisites: - -* [Decide if you want the Launch agent to build a Docker image for you.]({{< relref "#decide-if-you-want-the-launch-agent-to-build-a-docker-images" >}}) -* [Set up AWS resources and gather information about S3, ECR, and Sagemaker IAM roles.]({{< relref "#set-up-aws-resources" >}}) -* [Create an IAM role for the Launch agent]({{< relref "#create-an-iam-role-for-launch-agent" >}}). - -### Decide if you want the Launch agent to build a Docker images - -Decide if you want the W&B Launch agent to build a Docker image for you. There are two options you can choose from: - -* Permit the launch agent build a Docker image, push the image to Amazon ECR, and submit [SageMaker Training](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateTrainingJob.html) jobs for you. This option can offer some simplicity to ML Engineers rapidly iterating over training code. -* The launch agent uses an existing Docker image that contains your training or inference scripts. This option works well with existing CI systems. If you choose this option, you will need to manually upload your Docker image to your container registry on Amazon ECR. - - -### Set up AWS resources - -Ensure you have the following AWS resources configured in your preferred AWS region: - -1. An [ECR repository](https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-create.html) to store container images. -2. One or more [S3 buckets](https://docs.aws.amazon.com/AmazonS3/latest/userguide/create-bucket-overview.html) to store inputs and outputs for your SageMaker Training jobs. -3. An IAM role for Amazon SageMaker that permits SageMaker to run training jobs and interact with Amazon ECR and Amazon S3. - -Make a note of the ARNs for these resources. You will need the ARNs when you define the [Launch queue configuration]({{< relref "#configure-launch-queue-for-sagemaker" >}}). - -### Create a IAM Policy for Launch agent - -1. From the IAM screen in AWS, create a new policy. -2. Toggle to the JSON policy editor, then paste the following policy based on your use case. Substitute values enclosed with `<>` with your own values: - -{{< tabpane text=true >}} -{{% tab "Agent submits pre-built Docker image" %}} - ```json - { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "logs:DescribeLogStreams", - "SageMaker:AddTags", - "SageMaker:CreateTrainingJob", - "SageMaker:DescribeTrainingJob" - ], - "Resource": "arn:aws:sagemaker:::*" - }, - { - "Effect": "Allow", - "Action": "iam:PassRole", - "Resource": "arn:aws:iam:::role/" - }, - { - "Effect": "Allow", - "Action": "kms:CreateGrant", - "Resource": "", - "Condition": { - "StringEquals": { - "kms:ViaService": "SageMaker..amazonaws.com", - "kms:GrantIsForAWSResource": "true" - } - } - } - ] - } - ``` -{{% /tab %}} -{{% tab "Agent builds and submits Docker image" %}} - ```json - { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "logs:DescribeLogStreams", - "SageMaker:AddTags", - "SageMaker:CreateTrainingJob", - "SageMaker:DescribeTrainingJob" - ], - "Resource": "arn:aws:sagemaker:::*" - }, - { - "Effect": "Allow", - "Action": "iam:PassRole", - "Resource": "arn:aws:iam:::role/" - }, - { - "Effect": "Allow", - "Action": [ - "ecr:CreateRepository", - "ecr:UploadLayerPart", - "ecr:PutImage", - "ecr:CompleteLayerUpload", - "ecr:InitiateLayerUpload", - "ecr:DescribeRepositories", - "ecr:DescribeImages", - "ecr:BatchCheckLayerAvailability", - "ecr:BatchDeleteImage" - ], - "Resource": "arn:aws:ecr:::repository/" - }, - { - "Effect": "Allow", - "Action": "ecr:GetAuthorizationToken", - "Resource": "*" - }, - { - "Effect": "Allow", - "Action": "kms:CreateGrant", - "Resource": "", - "Condition": { - "StringEquals": { - "kms:ViaService": "SageMaker..amazonaws.com", - "kms:GrantIsForAWSResource": "true" - } - } - } - ] - } - ``` -{{% /tab %}} -{{< /tabpane >}} - -3. Click **Next**. -4. Give the policy a name and description. -5. Click **Create policy**. - - -### Create an IAM role for Launch agent - -The Launch agent needs permission to create Amazon SageMaker training jobs. Follow the procedure below to create an IAM role: - -1. From the IAM screen in AWS, create a new role. -2. For **Trusted Entity**, select **AWS Account** (or another option that suits your organization's policies). -3. Scroll through the permissions screen and select the policy name you just created above. -4. Give the role a name and description. -5. Select **Create role**. -6. Note the ARN for the role. You will specify the ARN when you set up the launch agent. - -To create IAM roles, see the [AWS Identity and Access Management Documentation](https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html). - -{{% alert %}} -* If you want the launch agent to build images, see the [Advanced agent set up]({{< relref "./setup-agent-advanced.md" >}}) for additional permissions required. -* The `kms:CreateGrant` permission for SageMaker queues is required only if the associated ResourceConfig has a specified VolumeKmsKeyId and the associated role does not have a policy that permits this action. -{{% /alert %}} - - - -## Configure launch queue for SageMaker - -Next, create a queue in the W&B App that uses SageMaker as its compute resource: - -1. Navigate to the [Launch App](https://wandb.ai/launch). -3. Click on the **Create Queue** button. -4. Select the **Entity** you would like to create the queue in. -5. Provide a name for your queue in the **Name** field. -6. Select **SageMaker** as the **Resource**. -7. Within the **Configuration** field, provide information about your SageMaker job. By default, W&B will populate a YAML and JSON `CreateTrainingJob` request body: -```json -{ - "RoleArn": "", - "ResourceConfig": { - "InstanceType": "ml.m4.xlarge", - "InstanceCount": 1, - "VolumeSizeInGB": 2 - }, - "OutputDataConfig": { - "S3OutputPath": "" - }, - "StoppingCondition": { - "MaxRuntimeInSeconds": 3600 - } -} -``` -You must at minimum specify: - -- `RoleArn` : ARN of the SageMaker execution IAM role (see [prerequisites]({{< relref "#prerequisites" >}})). Not to be confused with the launch **agent** IAM role. -- `OutputDataConfig.S3OutputPath` : An Amazon S3 URI specifying where SageMaker outputs will be stored. -- `ResourceConfig`: Required specification of a resource config. Options for resource config are outlined [here](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ResourceConfig.html). -- `StoppingCondition`: Required specification of the stopping conditions for the training job. Options outlined [here](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_StoppingCondition.html). -7. Click on the **Create Queue** button. - - -## Set up the launch agent - -The following section describes where you can deploy your agent and how to configure your agent based on where it is deployed. - -There are [several options for how the Launch agent is deployed for a Amazon SageMaker]({{< relref "#decide-where-to-run-the-launch-agent" >}}) queue: on a local machine, on an EC2 instance, or in an EKS cluster. [Configure your launch agent appropriately]({{< relref "#configure-a-launch-agent" >}}) based on the where you deploy your agent. - - -### Decide where to run the Launch agent - -For production workloads and for customers who already have an EKS cluster, W&B recommends deploying the Launch agent to the EKS cluster using this Helm chart. - -For production workloads without an current EKS cluster, an EC2 instance is a good option. Though the launch agent instance will keep running all the time, the agent doesn't need more than a `t2.micro` sized EC2 instance which is relatively affordable. - -For experimental or solo use cases, running the Launch agent on your local machine can be a fast way to get started. - -Based on your use case, follow the instructions provided in the following tabs to properly configure up your launch agent: -{{< tabpane text=true >}} -{{% tab "EKS" %}} -W&B strongly encourages that you use the[ W&B managed helm chart](https://github.com/wandb/helm-charts/tree/main/charts/launch-agent) to install the agent in an EKS cluster. -{{% /tab %}} -{{% tab "EC2" %}} -Navigate to the Amazon EC2 Dashboard and complete the following steps: - -1. Click **Launch instance**. -2. Provide a name for the **Name** field. Optionally add a tag. -2. From the **Instance type**, select an instance type for your EC2 container. You do not need more than 1vCPU and 1GiB of memory (for example a t2.micro). -3. Create a key pair for your organization within the **Key pair (login)** field. You will use this key pair to [connect to your EC2 instance](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connect.html) with SSH client at a later step. -2. Within **Network settings**, select an appropriate security group for your organization. -3. Expand **Advanced details**. For **IAM instance profile**, select the launch agent IAM role you created above. -2. Review the **Summary** field. If correct, select **Launch instance**. - -Navigate to **Instances** within the left panel of the EC2 Dashboard on AWS. Ensure that the EC2 instance you created is running (see the **Instance state** column). Once you confirm your EC2 instance is running, navigate to your local machine's terminal and complete the following: - -1. Select **Connect**. -2. Select the **SSH client** tab and following the instructions outlined to connect to your EC2 instance. -3. Within your EC2 instance, install the following packages: -```bash -sudo yum install python311 -y && python3 -m ensurepip --upgrade && pip3 install wandb && pip3 install wandb[launch] -``` -4. Next, install and start Docker within your EC2 instance: -```bash -sudo yum update -y && sudo yum install -y docker python3 && sudo systemctl start docker && sudo systemctl enable docker && sudo usermod -a -G docker ec2-user - -newgrp docker -``` - -Now you can proceed to setting up the Launch agent config. - -{{% /tab %}} -{{% tab "Local machine" %}} - -Use the AWS config files located at `~/.aws/config` and `~/.aws/credentials` to associate a role with an agent that is polling on a local machine. Provide the IAM role ARN that you created for the launch agent in the previous step. - -```yaml title="~/.aws/config" -[profile SageMaker-agent] -role_arn = arn:aws:iam:::role/ -source_profile = default -``` - -```yaml title="~/.aws/credentials" -[default] -aws_access_key_id= -aws_secret_access_key= -aws_session_token= -``` - -Note that session tokens have a [max length](https://docs.aws.amazon.com/cli/latest/reference/sts/get-session-token.html#description) of 1 hour or 3 days depending on the principal they are associated with. -{{% /tab %}} -{{< /tabpane >}} - - -### Configure a launch agent -Configure the launch agent with a YAML config file named `launch-config.yaml`. - -By default, W&B will check for the config file in `~/.config/wandb/launch-config.yaml`. You can optionally specify a different directory when you activate the launch agent with the `-c` flag. - -The following YAML snippet demonstrates how to specify the core config agent options: - -```yaml title="launch-config.yaml" -max_jobs: -1 -queues: - - -environment: - type: aws - region: -registry: - type: ecr - uri: -builder: - type: docker - -``` - -Now start the agent with `wandb launch-agent` - - - ## (Optional) Push your launch job Docker image to Amazon ECR - -{{% alert %}} -This section applies only if your launch agent uses existing Docker images that contain your training or inference logic. [There are two options on how your launch agent behaves.]({{< relref "#decide-if-you-want-the-launch-agent-to-build-a-docker-images" >}}) -{{% /alert %}} - -Upload your Docker image that contains your launch job to your Amazon ECR repo. Your Docker image needs to be in your ECR registry before you submit new launch jobs if you are using image-based jobs. - - - - - - - \ No newline at end of file diff --git a/content/en/launch/set-up-launch/setup-queue-advanced.md b/content/en/launch/set-up-launch/setup-queue-advanced.md deleted file mode 100644 index d308b74c4a..0000000000 --- a/content/en/launch/set-up-launch/setup-queue-advanced.md +++ /dev/null @@ -1,110 +0,0 @@ ---- -menu: - launch: - identifier: setup-queue-advanced - parent: set-up-launch -title: Configure launch queue -url: guides/launch/setup-queue-advanced ---- - -The following page describes how to configure launch queue options. - -## Set up queue config templates -Administer and manage guardrails on compute consumption with Queue Config Templates. Set defaults, minimums, and maximum values for fields such as memory consumption, GPU, and runtime duration. - -After you configure a queue with config templates, members of your team can alter fields you defined only within the specified range you defined. - -### Configure queue template -You can configure a queue template on an existing queue or create a new queue. - -1. Navigate to the [W&B Launch App](https://wandb.ai/launch). -2. Select **View queue** next to the name of the queue you want to add a template to. -3. Select the **Config** tab. This will show information about your queue such as when the queue was created, the queue config, and existing launch-time overrides. -4. Navigate to the **Queue config** section. -5. Identify the config key-values you want to create a template for. -6. Replace the value in the config with a template field. Template fields take the form of `{{variable-name}}`. -7. Click on the **Parse configuration** button. When you parse your configuration, W&B will automatically create tiles below the queue config for each template you created. -8. For each tile generated, you must first specify the data type (string, integer, or float) the queue config can allow. To do this, select the data type from the **Type** dropdown menu. -9. Based on your data type, complete the fields that appear within each tile. -10. Click on **Save config**. - - -For example, suppose you want to create a template that limits which AWS instances your team can use. Before you add a template field, your queue config might look something similar to: - -```yaml title="launch config" -RoleArn: arn:aws:iam:region:account-id:resource-type/resource-id -ResourceConfig: - InstanceType: ml.m4.xlarge - InstanceCount: 1 - VolumeSizeInGB: 2 -OutputDataConfig: - S3OutputPath: s3://bucketname -StoppingCondition: - MaxRuntimeInSeconds: 3600 -``` - -When you add a template field for the `InstanceType`, your config will look like: - -```yaml title="launch config" -RoleArn: arn:aws:iam:region:account-id:resource-type/resource-id -ResourceConfig: - InstanceType: "{{aws_instance}}" - InstanceCount: 1 - VolumeSizeInGB: 2 -OutputDataConfig: - S3OutputPath: s3://bucketname -StoppingCondition: - MaxRuntimeInSeconds: 3600 -``` - - -Next, you click on **Parse configuration**. A new tile labeled `aws-instance` will appear underneath the **Queue config**. - -From there, you select String as the datatype from the **Type** dropdown. This will populate fields where you can specify values a user can choose from. For example, in the following image the admin of the team configured two different AWS instance types that users can choose from (`ml.m4.xlarge` and `ml.p3.xlarge`): - -{{< img src="/images/launch/aws_template_example.png" alt="AWS CloudFormation template" >}} - - - -## Dynamically configure launch jobs -Queue configs can be dynamically configured using macros that are evaluated when the agent dequeues a job from the queue. You can set the following macros: - -| Macro | Description | -|-------------------|-------------------------------------------------------| -| `${project_name}` | The name of the project the run is being launched to. | -| `${entity_name}` | The owner of the project the run being launched to. | -| `${run_id}` | The id of the run being launched. | -| `${run_name}` | The name of the run that is launching. | -| `${image_uri}` | The URI of the container image for this run. | - -{{% alert %}} -Any custom macro not listed in the preceding table (for example `${MY_ENV_VAR}`), is substituted with an environment variable from the agent's environment. -{{% /alert %}} - -## Use the launch agent to build images that execute on accelerators (GPUs) -You might need to specify an accelerator base image if you use launch to build images that are executed in an accelerator environment. - -This accelerator base image must satisfy the following requirements: - -- Debian compatibility (the Launch Dockerfile uses apt-get to fetch python) -- Compatibility CPU & GPU hardware instruction set (Make sure your CUDA version is supported by the GPU you intend on using) -- Compatibility between the accelerator version you provide and the packages installed in your ML algorithm -- Packages installed that require extra steps for setting up compatibility with hardware - -### How to use GPUs with TensorFlow - -Ensure TensorFlow properly utilizes your GPU. To accomplish this, specify a Docker image and its image tag for the `builder.accelerator.base_image` key in the queue resource configuration. - -For example, the `tensorflow/tensorflow:latest-gpu` base image ensures TensorFlow properly uses your GPU. This can be configured using the resource configuration in the queue. - -The following JSON snippet demonstrates how to specify the TensorFlow base image in your queue config: - -```json title="Queue config" -{ - "builder": { - "accelerator": { - "base_image": "tensorflow/tensorflow:latest-gpu" - } - } -} -``` \ No newline at end of file diff --git a/content/en/launch/set-up-launch/setup-vertex.md b/content/en/launch/set-up-launch/setup-vertex.md deleted file mode 100644 index 8160f156c7..0000000000 --- a/content/en/launch/set-up-launch/setup-vertex.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -menu: - launch: - identifier: setup-vertex - parent: set-up-launch -title: 'Tutorial: Set up W&B Launch on Vertex AI' -url: guides/launch/setup-vertex ---- - -You can use W&B Launch to submit jobs for execution as Vertex AI training jobs. With Vertex AI training jobs, you can train machine learning models using either provided, or custom algorithms on the Vertex AI platform. Once a launch job is initiated, Vertex AI manages the underlying infrastructure, scaling, and orchestration. - -W&B Launch works with Vertex AI through the `CustomJob` class in the `google-cloud-aiplatform` SDK. The parameters of a `CustomJob` can be controlled with the launch queue configuration. Vertex AI cannot be configured to pull images from a private registry outside of GCP. This means that you must store container images in GCP or in a public registry if you want to use Vertex AI with W&B Launch. See the Vertex AI documentation for more information on making container images accessible to Vertex jobs. - - - -## Prerequisites - -1. **Create or access a GCP project with the Vertex AI API enabled.** See the [GCP API Console docs](https://support.google.com/googleapi/answer/6158841?hl=en) for more information on enabling an API. -2. **Create a GCP Artifact Registry repository** to store images you want to execute on Vertex. See the [GCP Artifact Registry documentation](https://cloud.google.com/artifact-registry/docs/overview) for more information. -3. **Create a staging GCS bucket** for Vertex AI to store its metadata. Note that this bucket must be in the same region as your Vertex AI workloads in order to be used as a staging bucket. The same bucket can be used for staging and build contexts. -4. **Create a service account** with the necessary permissions to spin up Vertex AI jobs. See the [GCP IAM documentation](https://cloud.google.com/iam/docs/creating-managing-service-accounts) for more information on assigning permissions to service accounts. -5. **Grant your service account permission to manage Vertex jobs** - -| Permission | Resource Scope | Description | -| ------------------------------ | --------------------- | ---------------------------------------------------------------------------------------- | -| `aiplatform.customJobs.create` | Specified GCP Project | Allows creation of new machine learning jobs within the project. | -| `aiplatform.customJobs.list` | Specified GCP Project | Allows listing of machine learning jobs within the project. | -| `aiplatform.customJobs.get` | Specified GCP Project | Allows retrieval of information about specific machine learning jobs within the project. | - -{{% alert %}} -If you want your Vertex AI workloads to assume the identity of a non-standard service account, refer to the Vertex AI documentation for instructions on service account creation and necessary permissions. The `spec.service_account` field of the launch queue configuration can be used to select a custom service account for your W&B runs. -{{% /alert %}} - -## Configure a queue for Vertex AI - -The queue configuration for Vertex AI resources specify inputs to the `CustomJob` constructor in the Vertex AI Python SDK, and the `run` method of the `CustomJob`. Resource configurations are stored under the `spec` and `run` keys: - -- The `spec` key contains values for the named arguments of the [`CustomJob` constructor](https://cloud.google.com/vertex-ai/docs/pipelines/customjob-component) in the Vertex AI Python SDK. -- The `run` key contains values for the named arguments of the `run` method of the `CustomJob` class in the Vertex AI Python SDK. - -Customizations of the execution environment happens primarily in the `spec.worker_pool_specs` list. A worker pool spec defines a group of workers that will run your job. The worker spec in the default config asks for a single `n1-standard-4` machine with no accelerators. You can change the machine type, accelerator type and count to suit your needs. - -For more information on available machine types and accelerator types, see the [Vertex AI documentation](https://cloud.google.com/vertex-ai/docs/reference/rest/v1/MachineSpec). - -## Create a queue - -Create a queue in the W&B App that uses Vertex AI as its compute resource: - -1. Navigate to the [Launch page](https://wandb.ai/launch). -2. Click on the **Create Queue** button. -3. Select the **Entity** you would like to create the queue in. -4. Provide a name for your queue in the **Name** field. -5. Select **GCP Vertex** as the **Resource**. -6. Within the **Configuration** field, provide information about your Vertex AI `CustomJob` you defined in the previous section. By default, W&B will populate a YAML and JSON request body similar to the following: - -```yaml -spec: - worker_pool_specs: - - machine_spec: - machine_type: n1-standard-4 - accelerator_type: ACCELERATOR_TYPE_UNSPECIFIED - accelerator_count: 0 - replica_count: 1 - container_spec: - image_uri: ${image_uri} - staging_bucket: -run: - restart_job_on_worker_restart: false -``` - -7. After you configure your queue, click on the **Create Queue** button. - -You must at minimum specify: - -- `spec.worker_pool_specs` : non-empty list of worker pool specifications. -- `spec.staging_bucket` : GCS bucket to be used for staging Vertex AI assets and metadata. - -{{% alert color="secondary" %}} -Some of the Vertex AI docs show worker pool specifications with all keys in camel case,for example, ` workerPoolSpecs`. The Vertex AI Python SDK uses snake case for these keys, for example `worker_pool_specs`. - -Every key in the launch queue configuration should use snake case. -{{% /alert %}} - -## Configure a launch agent - -The launch agent is configurable through a config file that is, by default, located at `~/.config/wandb/launch-config.yaml`. - -```yaml -max_jobs: -queues: - - -``` - -If you want the launch agent to build images for you that are executed in Vertex AI, see [Advanced agent set up]({{< relref "./setup-agent-advanced.md" >}}). - -## Set up agent permissions - -There are multiple methods to authenticate as this service account. This can be achieved through Workload Identity, a downloaded service account JSON, environment variables, the Google Cloud Platform command-line tool, or a combination of these methods. \ No newline at end of file diff --git a/content/en/launch/sweeps-on-launch.md b/content/en/launch/sweeps-on-launch.md deleted file mode 100644 index e50738b69d..0000000000 --- a/content/en/launch/sweeps-on-launch.md +++ /dev/null @@ -1,239 +0,0 @@ ---- -description: Discover how to automate hyperparamter sweeps on launch. -menu: - launch: - identifier: sweeps-on-launch - parent: launch -title: Create sweeps with W&B Launch -url: guides/launch/sweeps-on-launch ---- -{{< cta-button colabLink="https://colab.research.google.com/drive/1WxLKaJlltThgZyhc7dcZhDQ6cjVQDfil#scrollTo=AFEzIxA6foC7" >}} - -Create a hyperparameter tuning job ([sweeps]({{< relref "/guides/models/sweeps/" >}})) with W&B Launch. With sweeps on launch, a sweep scheduler is pushed to a Launch Queue with the specified hyperparameters to sweep over. The sweep scheduler starts as it is picked up by the agent, launching sweep runs onto the same queue with chosen hyperparameters. This continues until the sweep finishes or is stopped. - -You can use the default W&B Sweep scheduling engine or implement your own custom scheduler: - -1. Standard sweep scheduler: Use the default W&B Sweep scheduling engine that controls [W&B Sweeps]({{< relref "/guides/models/sweeps/" >}}). The familiar `bayes`, `grid`, and `random` methods are available. -2. Custom sweep scheduler: Configure the sweep scheduler to run as a job. This option enables full customization. An example of how to extend the standard sweep scheduler to include more logging can be found in the section below. - -{{% alert %}} -This guide assumes that W&B Launch has been previously configured. If W&B Launch has is not configured, see the [how to get started]({{< relref "./#how-to-get-started" >}}) section of the launch documentation. -{{% /alert %}} - -{{% alert %}} -We recommend you create a sweep on launch using the 'basic' method if you are a first time users of sweeps on launch. Use a custom sweeps on launch scheduler when the standard W&B scheduling engine does not meet your needs. -{{% /alert %}} - -## Create a sweep with a W&B standard scheduler -Create W&B Sweeps with Launch. You can create a sweep interactively with the W&B App or programmatically with the W&B CLI. For advanced configurations of Launch sweeps, including the ability to customize the scheduler, use the CLI. - -{{% alert %}} -Before you create a sweep with W&B Launch, ensure that you first create a job to sweep over. See the [Create a Job]({{< relref "./create-and-deploy-jobs/create-launch-job.md" >}}) page for more information. -{{% /alert %}} - -{{< tabpane text=true >}} -{{% tab "W&B app" %}} - -Create a sweep interactively with the W&B App. - -1. Navigate to your W&B project on the W&B App. -2. Select the sweeps icon on the left panel (broom image). -3. Next, select the **Create Sweep** button. -4. Click the **Configure Launch** button. -5. From the **Job** dropdown menu, select the name of your job and the job version you want to create a sweep from. -6. Select a queue to run the sweep on using the **Queue** dropdown menu. -8. Use the **Job Priority** dropdown to specify the priority of your launch job. A launch job's priority is set to "Medium" if the launch queue does not support prioritization. -8. (Optional) Configure override args for the run or sweep scheduler. For example, using the scheduler overrides, configure the number of concurrent runs the scheduler manages using `num_workers`. -9. (Optional) Select a project to save the sweep to using the **Destination Project** dropdown menu. -10. Click **Save** -11. Select **Launch Sweep**. - -{{< img src="/images/launch/create_sweep_with_launch.png" alt="Launch sweep configuration" >}} - -{{% /tab %}} -{{% tab "CLI" %}} - -Programmatically create a W&B Sweep with Launch with the W&B CLI. - -1. Create a Sweep configuration -2. Specify the full job name within your sweep configuration -3. Initialize a sweep agent. - -{{% alert %}} -Steps 1 and 3 are the same steps you normally take when you create a W&B Sweep. -{{% /alert %}} - -For example, in the following code snippet, we specify `'wandb/jobs/Hello World 2:latest'` for the job value: - -```yaml -# launch-sweep-config.yaml - -job: 'wandb/jobs/Hello World 2:latest' -description: sweep examples using launch jobs - -method: bayes -metric: - goal: minimize - name: loss_metric -parameters: - learning_rate: - max: 0.02 - min: 0 - distribution: uniform - epochs: - max: 20 - min: 0 - distribution: int_uniform - -# Optional scheduler parameters: - -# scheduler: -# num_workers: 1 # concurrent sweep runs -# docker_image: -# resource: -# resource_args: # resource arguments passed to runs -# env: -# - WANDB_API_KEY - -# Optional Launch Params -# launch: -# registry: -``` - -For information on how to create a sweep configuration, see the [Define sweep configuration]({{< relref "/guides/models/sweeps/define-sweep-configuration.md" >}}) page. - -4. Next, initialize a sweep. Provide the path to your config file, the name of your job queue, your W&B entity, and the name of the project. - -```bash -wandb launch-sweep --queue --entity --project -``` - -For more information on W&B Sweeps, see the [Tune Hyperparameters]({{< relref "/guides/models/sweeps/" >}}) chapter. - -{{% /tab %}} -{{< /tabpane >}} - - -## Create a custom sweep scheduler -Create a custom sweep scheduler either with the W&B scheduler or a custom scheduler. - -{{% alert %}} -Using scheduler jobs requires wandb cli version >= `0.15.4` -{{% /alert %}} - -{{< tabpane text=true >}} -{{% tab "W&B scheduler" %}} - Create a launch sweep using the W&B sweep scheduling logic as a job. - - 1. Identify the Wandb scheduler job in the public wandb/sweep-jobs project, or use the job name: - `'wandb/sweep-jobs/job-wandb-sweep-scheduler:latest'` - 2. Construct a configuration yaml with an additional `scheduler` block that includes a `job` key pointing to this name, example below. - 3. Use the `wandb launch-sweep` command with the new config. - - -Example config: -```yaml -# launch-sweep-config.yaml -description: Launch sweep config using a scheduler job -scheduler: - job: wandb/sweep-jobs/job-wandb-sweep-scheduler:latest - num_workers: 8 # allows 8 concurrent sweep runs - -# training/tuning job that the sweep runs will execute -job: wandb/sweep-jobs/job-fashion-MNIST-train:latest -method: grid -parameters: - learning_rate: - min: 0.0001 - max: 0.1 -``` -{{% /tab %}} -{{% tab "Custom scheduler" %}} - Custom schedulers can be created by creating a scheduler-job. For the purposes of this guide we will be modifying the `WandbScheduler` to provide more logging. - - 1. Clone the `wandb/launch-jobs` repo (specifically: `wandb/launch-jobs/jobs/sweep_schedulers`) - 2. Now, we can modify the `wandb_scheduler.py` to achieve our desired increased logging. Example: Add logging to the function `_poll`. This is called once every polling cycle (configurable timing), before we launch new sweep runs. - 3. Run the modified file to create a job, with: `python wandb_scheduler.py --project --entity --name CustomWandbScheduler` - 4. Identify the name of the job created, either in the UI or in the output of the previous call, which will be a code-artifact job (unless otherwise specified). - 5. Now create a sweep configuration where the scheduler points to your new job. - -```yaml -... -scheduler: - job: '//job-CustomWandbScheduler:latest' -... -``` - -{{% /tab %}} -{{% tab "Optuna scheduler" %}} - - Optuna is a hyperparameter optimization framework that uses a variety of algorithms to find the best hyperparameters for a given model (similar to W&B). In addition to the [sampling algorithms](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html), Optuna also provides a variety of [pruning algorithms](https://optuna.readthedocs.io/en/stable/reference/pruners.html) that can be used to terminate poorly performing runs early. This is especially useful when running a large number of runs, as it can save time and resources. The classes are highly configurable, just pass in the expected parameters in the `scheduler.settings.pruner/sampler.args` block of the config file. - - - -Create a launch sweep using Optuna's scheduling logic with a job. - -1. First, create your own job or use a pre-built Optuna scheduler image job. - * See the [`wandb/launch-jobs`](https://github.com/wandb/launch-jobs/blob/main/jobs/sweep_schedulers) repo for examples on how to create your own job. - * To use a pre-built Optuna image, you can either navigate to `job-optuna-sweep-scheduler` in the `wandb/sweep-jobs` project or use can use the job name: `wandb/sweep-jobs/job-optuna-sweep-scheduler:latest`. - - -2. After you create a job, you can now create a sweep. Construct a sweep config that includes a `scheduler` block with a `job` key pointing to the Optuna scheduler job (example below). - -```yaml - # optuna_config_basic.yaml - description: A basic Optuna scheduler - job: wandb/sweep-jobs/job-fashion-MNIST-train:latest - run_cap: 5 - metric: - name: epoch/val_loss - goal: minimize - - scheduler: - job: wandb/sweep-jobs/job-optuna-sweep-scheduler:latest - resource: local-container # required for scheduler jobs sourced from images - num_workers: 2 - - # optuna specific settings - settings: - pruner: - type: PercentilePruner - args: - percentile: 25.0 # kill 75% of runs - n_warmup_steps: 10 # pruning turned off for first x steps - - parameters: - learning_rate: - min: 0.0001 - max: 0.1 - ``` - - - 3. Lastly, launch the sweep to an active queue with the launch-sweep command: - - ```bash - wandb launch-sweep -q -p -e - ``` - - - For the exact implementation of the Optuna sweep scheduler job, see [wandb/launch-jobs](https://github.com/wandb/launch-jobs/blob/main/jobs/sweep_schedulers/optuna_scheduler/optuna_scheduler.py). For more examples of what is possible with the Optuna scheduler, check out [wandb/examples](https://github.com/wandb/examples/tree/master/examples/launch/launch-sweeps/optuna-scheduler). -{{% /tab %}} -{{< /tabpane >}} - - Examples of what is possible with custom sweep scheduler jobs are available in the [wandb/launch-jobs](https://github.com/wandb/launch-jobs) repo under `jobs/sweep_schedulers`. This guide shows how to use the publicly available **Wandb Scheduler Job**, as well demonstrates a process for creating custom sweep scheduler jobs. - - - ## How to resume sweeps on launch - It is also possible to resume a launch-sweep from a previously launched sweep. Although hyperparameters and the training job cannot be changed, scheduler-specific parameters can be, as well as the queue it is pushed to. - -{{% alert %}} -If the initial sweep used a training job with an alias like 'latest', resuming can lead to different results if the latest job version has been changed since the last run. -{{% /alert %}} - - 1. Identify the sweep name/ID for a previously run launch sweep. The sweep ID is an eight character string (for example, `hhd16935`) that you can find in your project on the W&B App. - 2. If you change the scheduler parameters, construct an updated config file. - 3. In your terminal, execute the following command. Replace content wrapped in `<` and `>` with your information: - -```bash -wandb launch-sweep --resume_id --queue -``` \ No newline at end of file diff --git a/content/en/launch/walkthrough.md b/content/en/launch/walkthrough.md deleted file mode 100644 index 1fab0c3a22..0000000000 --- a/content/en/launch/walkthrough.md +++ /dev/null @@ -1,192 +0,0 @@ ---- -description: Getting started guide for W&B Launch. -menu: - launch: - identifier: walkthrough - parent: launch -title: 'Tutorial: W&B Launch basics' -url: guides/launch/walkthrough -weight: 1 ---- -## What is Launch? - -{{< cta-button colabLink="https://colab.research.google.com/drive/1wX0OSVxZJDHRsZaOaOEDx-lLUrO1hHgP" >}} - -Easily scale training [runs]({{< relref "/guides/models/track/runs/" >}}) from your desktop to a compute resource like Amazon SageMaker, Kubernetes and more with W&B Launch. Once W&B Launch is configured, you can quickly run training scripts, model evaluation suites, prepare models for production inference, and more with a few clicks and commands. - -## How it works - -Launch is composed of three fundamental components: **launch jobs**, **queues**, and **agents**. - -A [*launch job*]({{< relref "./launch-terminology.md#launch-job" >}}) is a blueprint for configuring and running tasks in your ML workflow. Once you have a launch job, you can add it to a [*launch queue*]({{< relref "./launch-terminology.md#launch-queue" >}}). A launch queue is a first-in, first-out (FIFO) queue where you can configure and submit your jobs to a particular compute target resource, such as Amazon SageMaker or a Kubernetes cluster. - -As jobs are added to the queue, [*launch agents*]({{< relref "./launch-terminology.md#launch-agent" >}}) poll that queue and execute the job on the system targeted by the queue. - -{{< img src="/images/launch/launch_overview.png" alt="W&B Launch overview diagram" >}} - -Based on your use case, you (or someone on your team) will configure the launch queue according to your chosen [compute resource target]({{< relref "./launch-terminology.md#target-resources" >}}) (for example Amazon SageMaker) and deploy a launch agent on your own infrastructure. - -See the [Terms and concepts]({{< relref "./launch-terminology.md" >}}) page for more information about Launch. - -## How to get started - -Depending on your use case, explore the following resources to get started with W&B Launch: - -* If this is your first time using W&B Launch, we recommend you go through the [Launch walkthrough]({{< relref "#walkthrough" >}}) guide. -* Learn how to set up [W&B Launch]({{< relref "/launch/set-up-launch/" >}}). -* Create a [launch job]({{< relref "./create-and-deploy-jobs/create-launch-job.md" >}}). -* Check out the W&B Launch [public jobs GitHub repository](https://github.com/wandb/launch-jobs) for templates of common tasks like [deploying to Triton](https://github.com/wandb/launch-jobs/tree/main/jobs/deploy_to_nvidia_triton), [evaluating an LLM](https://github.com/wandb/launch-jobs/tree/main/jobs/openai_evals), or more. - * View launch jobs created from this repository in this public [`wandb/jobs` project](https://wandb.ai/wandb/jobs/jobs) W&B project. - -## Walkthrough - -This page walks through the basics of the W&B Launch workflow. - -{{% alert %}} -W&B Launch runs machine learning workloads in containers. Familiarity with containers is not required but may be helpful for this walkthrough. See the [Docker documentation](https://docs.docker.com/guides/docker-concepts/the-basics/what-is-a-container/) for a primer on containers. -{{% /alert %}} - -## Prerequisites - -Before you get started, ensure you have satisfied the following prerequisites: - -1. Sign up for an account at https://wandb.ai/site and then log in to your W&B account. -2. This walkthrough requires terminal access to a machine with a working Docker CLI and engine. See the [Docker installation guide](https://docs.docker.com/engine/install/) for more information. -3. Install W&B Python SDK version `0.17.1` or higher: -```bash -pip install wandb>=0.17.1 -``` -4. Within your terminal, execute `wandb login` or set the `WANDB_API_KEY` environment variable to authenticate with W&B. - -{{< tabpane text=true >}} -{{% tab "Log in to W&B" %}} - Within your terminal execute: - - ```bash - wandb login - ``` -{{% /tab %}} -{{% tab "Environment variable" %}} - - ```bash - WANDB_API_KEY= - ``` - - Replace `` with your W&B API key. -{{% /tab %}} -{{% /tabpane %}} - -## Create a launch job -Create a [launch job]({{< relref "./launch-terminology.md#launch-job" >}}) in one of three ways: with a Docker image, from a git repository or from local source code: - -{{< tabpane text=true >}} -{{% tab "With a Docker image" %}} -To run a pre-made container that logs a message to W&B, open a terminal and run the following command: - -```bash -wandb launch --docker-image wandb/job_hello_world:main --project launch-quickstart -``` - -The preceding command downloads and runs the container image `wandb/job_hello_world:main`. - -Launch configures the container to report everything logged with `wandb` to the `launch-quickstart` project. The container logs a message to W&B and displays a link to the newly created run in W&B. Click the link to view the run in the W&B UI. -{{% /tab %}} -{{% tab "From a git repository" %}} -To launch the same hello-world job from its [source code in the W&B Launch jobs repository](https://github.com/wandb/launch-jobs), run the following command: - -```bash -wandb launch --uri https://github.com/wandb/launch-jobs.git \\ ---job-name hello-world-git --project launch-quickstart \\ ---build-context jobs/hello_world --dockerfile Dockerfile.wandb \\ ---entry-point "python job.py" -``` -The command does the following: -1. Clone the [W&B Launch jobs repository](https://github.com/wandb/launch-jobs) to a temporary directory. -2. Create a job named **hello-world-git** in the **hello** project. This job tracks the exact source code and configuration used to run execute the code. -3. Build a container image from the `jobs/hello_world` directory and the `Dockerfile.wandb`. -4. Start the container and run the `job.py` python script. - -The console output shows the image build and execution. The output of the container should be nearly identical to the previous example. - -{{% /tab %}} -{{% tab "From local source code" %}} - -Code not versioned in a git repository can be launched by specifying a local directory path to the `--uri` argument. - -Create an empty directory and add a Python script named `train.py` with the following content: - -```python -import wandb - -with wandb.init() as run: - run.log({"hello": "world"}) -``` - -Add a file `requirements.txt` with the following content: - -```text -wandb>=0.17.1 -``` - -From within the directory, run the following command: - -```bash -wandb launch --uri . --job-name hello-world-code --project launch-quickstart --entry-point "python train.py" -``` - -The command does the following: -1. Log the contents of the current directory to W&B as a Code Artifact. -2. Create a job named **hello-world-code** in the **launch-quickstart** project. -3. Build a container image by copying `train.py` and `requirements.txt` into a base image and `pip install` the requirements. -4. Start the container and run `python train.py`. -{{% /tab %}} -{{< /tabpane >}} - -## Create a queue - -Launch is designed to help teams build workflows around shared compute. In the examples so far, the `wandb launch` command has executed a container synchronously on the local machine. Launch queues and agents enable asynchronous execution of jobs on shared resources and advanced features like prioritization and hyperparameter optimization. To create a basic queue, follow these steps: - -1. Navigate to [wandb.ai/launch](https://wandb.ai/launch) and click the **Create a queue** button. -2. Select an **Entity** to associate the queue with. -3. Enter a **Queue name**. -4. Select **Docker** as the **Resource**. -5. Leave **Configuration** blank, for now. -6. Click **Create queue** :rocket: - -After clicking the button, the browser will redirect to the **Agents** tab of the queue view. The queue remains in the **Not active** state until an agent starts polling. - -{{< img src="/images/launch/create_docker_queue.gif" alt="Docker queue creation" >}} - -For advanced queue configuration options, see the [advanced queue setup page]({{< relref "/launch/set-up-launch/setup-queue-advanced.md" >}}). - -## Connect an agent to the queue - -The queue view displays an **Add an agent** button in a red banner at the top of the screen if the queue has no polling agents. Click the button to view copy the command to run an agent. The command should look like the following: - -```bash -wandb launch-agent --queue --entity -``` - -Run the command in a terminal to start the agent. The agent polls the specified queue for jobs to run. Once received, the agent downloads or builds and then executes a container image for the job, as if the `wandb launch` command was run locally. - -Navigate back to [the Launch page](https://wandb.ai/launch) and verify that the queue now shows as **Active**. - -## Submit a job to the queue - -Navigate to your new **launch-quickstart** project in your W&B account and open the jobs tab from the navigation on the left side of the screen. - -The **Jobs** page displays a list of W&B Jobs that were created from previously executed runs. Click on your launch job to view source code, dependencies, and any runs created from the job. After completing this walkthrough there should be three jobs in the list. - - -Pick one of the new jobs and follow these instructions to submit it to the queue: - -1. Click the **Launch** button to submit the job to a queue. The **Launch** drawer will appear. -2. Select the **Queue** you created earlier and click **Launch**. - -This submits the job to the queue. The agent polling this queue picks up and executes the job. The progress of the job can be monitored from the W&B UI or by inspecting the output of the agent in the terminal. - -The `wandb launch` command can push jobs to the queue directly by specifying the `--queue` argument. For example, to submit the hello-world container job to the queue, run the following command: - -```bash -wandb launch --docker-image wandb/job_hello_world:main --project launch-quickstart --queue -``` \ No newline at end of file diff --git a/content/en/ref/_index.md b/content/en/ref/_index.md deleted file mode 100644 index 3118863b77..0000000000 --- a/content/en/ref/_index.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: Reference -description: Generated documentation for W&B APIs -menu: - reference: - identifier: reference -type: docs -cascade: - type: docs -no_list: true ---- - -{{< cardpane >}} - {{< card >}} - -

Python SDK

-
-

Train, fine-tune, and manage models from experimentation to production.

- {{< /card >}} - {{< card >}} - -

Command Line Interface

-
-

Log in, run jobs, execute sweeps, and more using shell commands.

- {{< /card >}} -{{< /cardpane >}} - -{{< cardpane >}} - {{< card >}} - -

Query Expression Language

-
-

A beta query language to select and aggregate data.

- {{< /card >}} - {{< card >}} - -

Reports and Workspaces API

-
-

Create web reports to share findings, and customize your workspace.

- {{< /card >}} -{{< /cardpane >}} - -{{< cardpane >}} - {{< card >}} - -

Release notes

-
-

Learn about W&B releases, including new features, performance improvements, and bug fixes.

- {{< /card >}} - {{< card >}} - -

Release policies and processes

-
-

Learn more about W&B releases, including frequency, support policies, and end of life.

- {{< /card >}} -{{< /cardpane >}} - -## Weave reference - - {{< card >}} - -

W&B Weave

-
-

Looking for Weave API? See the W&B Weave Docs.

- {{< /card >}} \ No newline at end of file diff --git a/content/en/ref/cli/_index.md b/content/en/ref/cli/_index.md deleted file mode 100644 index b57f282f03..0000000000 --- a/content/en/ref/cli/_index.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -title: Command Line Interface -weight: 2 ---- - -**Usage** - -`wandb [OPTIONS] COMMAND [ARGS]...` - - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `--version` | Show the version and exit. | - - -**Commands** - -| **Command** | **Description** | -| :--- | :--- | -| agent | Run the W&B agent | -| artifact | Commands for interacting with artifacts | -| beta | Beta versions of wandb CLI commands. | -| controller | Run the W&B local sweep controller | -| disabled | Disable W&B. | -| docker | Run your code in a docker container. | -| docker-run | Wrap `docker run` and adds WANDB_API_KEY and WANDB_DOCKER... | -| enabled | Enable W&B. | -| init | Configure a directory with Weights & Biases | -| job | Commands for managing and viewing W&B jobs | -| launch | Launch or queue a W&B Job. | -| launch-agent | Run a W&B launch agent. | -| launch-sweep | Run a W&B launch sweep (Experimental). | -| login | Login to Weights & Biases | -| offline | Disable W&B sync | -| online | Enable W&B sync | -| pull | Pull files from Weights & Biases | -| restore | Restore code, config and docker state for a run. | -| scheduler | Run a W&B launch sweep scheduler (Experimental) | -| server | Commands for operating a local W&B server | -| status | Show configuration settings | -| sweep | Initialize a hyperparameter sweep. | -| sync | Upload an offline training directory to W&B | -| verify | Checks and verifies local instance of W&B. | - diff --git a/content/en/ref/cli/wandb-agent.md b/content/en/ref/cli/wandb-agent.md deleted file mode 100644 index 7a2aaa5db8..0000000000 --- a/content/en/ref/cli/wandb-agent.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -title: wandb agent ---- - -**Usage** - -`wandb agent [OPTIONS] SWEEP_ID` - -**Summary** - -Run the W&B agent - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `-p, --project` | The name of the project where W&B runs created from the sweep are sent to. If the project is not specified, the run is sent to a project labeled 'Uncategorized'. | -| `-e, --entity` | The username or team name where you want to send W&B runs created by the sweep to. Ensure that the entity you specify already exists. If you don't specify an entity, the run will be sent to your default entity, which is usually your username. | -| `--count` | The max number of runs for this agent. | - - - diff --git a/content/en/ref/cli/wandb-artifact/_index.md b/content/en/ref/cli/wandb-artifact/_index.md deleted file mode 100644 index 55608eeb79..0000000000 --- a/content/en/ref/cli/wandb-artifact/_index.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: wandb artifact ---- - -**Usage** - -`wandb artifact [OPTIONS] COMMAND [ARGS]...` - -**Summary** - -Commands for interacting with artifacts - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | - - -**Commands** - -| **Command** | **Description** | -| :--- | :--- | -| cache | Commands for interacting with the artifact cache | -| get | Download an artifact from wandb | -| ls | List all artifacts in a wandb project | -| put | Upload an artifact to wandb | - diff --git a/content/en/ref/cli/wandb-artifact/wandb-artifact-cache/_index.md b/content/en/ref/cli/wandb-artifact/wandb-artifact-cache/_index.md deleted file mode 100644 index 8902d0c252..0000000000 --- a/content/en/ref/cli/wandb-artifact/wandb-artifact-cache/_index.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: wandb artifact cache ---- - -**Usage** - -`wandb artifact cache [OPTIONS] COMMAND [ARGS]...` - -**Summary** - -Commands for interacting with the artifact cache - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | - - -**Commands** - -| **Command** | **Description** | -| :--- | :--- | -| cleanup | Clean up less frequently used files from the artifacts cache | - diff --git a/content/en/ref/cli/wandb-artifact/wandb-artifact-cache/wandb-artifact-cache-cleanup.md b/content/en/ref/cli/wandb-artifact/wandb-artifact-cache/wandb-artifact-cache-cleanup.md deleted file mode 100644 index 48af537153..0000000000 --- a/content/en/ref/cli/wandb-artifact/wandb-artifact-cache/wandb-artifact-cache-cleanup.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: wandb artifact cache cleanup ---- - -**Usage** - -`wandb artifact cache cleanup [OPTIONS] TARGET_SIZE` - -**Summary** - -Clean up less frequently used files from the artifacts cache - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `--remove-temp / --no-remove-temp` | Remove temp files | - - - diff --git a/content/en/ref/cli/wandb-artifact/wandb-artifact-get.md b/content/en/ref/cli/wandb-artifact/wandb-artifact-get.md deleted file mode 100644 index 7293c253a7..0000000000 --- a/content/en/ref/cli/wandb-artifact/wandb-artifact-get.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: wandb artifact get ---- - -**Usage** - -`wandb artifact get [OPTIONS] PATH` - -**Summary** - -Download an artifact from wandb - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `--root` | The directory you want to download the artifact to | -| `--type` | The type of artifact you are downloading | - - - diff --git a/content/en/ref/cli/wandb-artifact/wandb-artifact-ls.md b/content/en/ref/cli/wandb-artifact/wandb-artifact-ls.md deleted file mode 100644 index 232831af6b..0000000000 --- a/content/en/ref/cli/wandb-artifact/wandb-artifact-ls.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: wandb artifact ls ---- - -**Usage** - -`wandb artifact ls [OPTIONS] PATH` - -**Summary** - -List all artifacts in a wandb project - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `-t, --type` | The type of artifacts to list | - - - diff --git a/content/en/ref/cli/wandb-artifact/wandb-artifact-put.md b/content/en/ref/cli/wandb-artifact/wandb-artifact-put.md deleted file mode 100644 index 8907f09073..0000000000 --- a/content/en/ref/cli/wandb-artifact/wandb-artifact-put.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: wandb artifact put ---- - -**Usage** - -`wandb artifact put [OPTIONS] PATH` - -**Summary** - -Upload an artifact to wandb - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `-n, --name` | The name of the artifact to push: project/artifact_name | -| `-d, --description` | A description of this artifact | -| `-t, --type` | The type of the artifact | -| `-a, --alias` | An alias to apply to this artifact | -| `--id` | The run you want to upload to. | -| `--resume` | Resume the last run from your current directory. | -| `--skip_cache` | Skip caching while uploading artifact files. | -| `--policy [mutable|immutable]` | Set the storage policy while uploading artifact files. | - - - diff --git a/content/en/ref/cli/wandb-beta/_index.md b/content/en/ref/cli/wandb-beta/_index.md deleted file mode 100644 index 7ea8c06397..0000000000 --- a/content/en/ref/cli/wandb-beta/_index.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: wandb beta ---- - -**Usage** - -`wandb beta [OPTIONS] COMMAND [ARGS]...` - -**Summary** - -Beta versions of wandb CLI commands. Requires wandb-core. - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | - - -**Commands** - -| **Command** | **Description** | -| :--- | :--- | -| sync | Upload .wandb files specified by PATHS. | - diff --git a/content/en/ref/cli/wandb-beta/wandb-beta-sync.md b/content/en/ref/cli/wandb-beta/wandb-beta-sync.md deleted file mode 100644 index 64f23b1f95..0000000000 --- a/content/en/ref/cli/wandb-beta/wandb-beta-sync.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: wandb beta sync ---- - -**Usage** - -`wandb beta sync [OPTIONS] WANDB_DIR` - -**Summary** - -Upload .wandb files specified by PATHS. - -PATHS can include .wandb files, run directories containing .wandb files, and -"wandb" directories containing run directories. - -For example, to sync all runs in a directory: -wandb beta sync ./wandb -To sync a specific run: -wandb beta sync ./wandb/run-20250813_124246-n67z9ude -Or equivalently: -wandb beta sync ./wandb/run-20250813_124246-n67z9ude/run-n67z9ude.wandb - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `--skip-synced / --no-skip-synced` | Skip runs that have already been synced with this command. | -| `--dry-run` | Print what would happen without uploading anything. | -| `-v, --verbose` | Print more information. | -| `-n` | Max number of runs to sync at a time. | - - - diff --git a/content/en/ref/cli/wandb-controller.md b/content/en/ref/cli/wandb-controller.md deleted file mode 100644 index 211c6d7052..0000000000 --- a/content/en/ref/cli/wandb-controller.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: wandb controller ---- - -**Usage** - -`wandb controller [OPTIONS] SWEEP_ID` - -**Summary** - -Run the W&B local sweep controller - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `--verbose` | Display verbose output | - - - diff --git a/content/en/ref/cli/wandb-disabled.md b/content/en/ref/cli/wandb-disabled.md deleted file mode 100644 index 0904e76081..0000000000 --- a/content/en/ref/cli/wandb-disabled.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: wandb disabled ---- - -**Usage** - -`wandb disabled [OPTIONS]` - -**Summary** - -Disable W&B. - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `--service` | Disable W&B service [default: True] | - - - diff --git a/content/en/ref/cli/wandb-docker-run.md b/content/en/ref/cli/wandb-docker-run.md deleted file mode 100644 index 46dcc6bb7a..0000000000 --- a/content/en/ref/cli/wandb-docker-run.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: wandb docker-run ---- - -**Usage** - -`wandb docker-run [OPTIONS] [DOCKER_RUN_ARGS]...` - -**Summary** - -Wrap `docker run` and adds WANDB_API_KEY and WANDB_DOCKER environment -variables. - -This will also set the runtime to nvidia if the nvidia-docker executable is -present on the system and --runtime wasn't set. - -See `docker run --help` for more details. - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | - - - diff --git a/content/en/ref/cli/wandb-docker.md b/content/en/ref/cli/wandb-docker.md deleted file mode 100644 index b3f49e9151..0000000000 --- a/content/en/ref/cli/wandb-docker.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: wandb docker ---- - -**Usage** - -`wandb docker [OPTIONS] [DOCKER_RUN_ARGS]... [DOCKER_IMAGE]` - -**Summary** - -Run your code in a docker container. - -W&B docker lets you run your code in a docker image ensuring wandb is -configured. It adds the WANDB_DOCKER and WANDB_API_KEY environment variables -to your container and mounts the current directory in /app by default. You -can pass additional args which will be added to `docker run` before the -image name is declared, we'll choose a default image for you if one isn't -passed: - - wandb docker -v /mnt/dataset:/app/data - wandb docker gcr.io/kubeflow-images-public/tensorflow-1.12.0-notebook-cpu:v0.4.0 --jupyter - wandb docker - wandb/deepo:keras-gpu --no-tty --cmd "python train.py --epochs=5" - -By default, we override the entrypoint to check for the existence of wandb -and install it if not present. If you pass the --jupyter flag we will -ensure jupyter is installed and start jupyter lab on port 8888. If we -detect nvidia-docker on your system we will use the nvidia runtime. If you -just want wandb to set environment variable to an existing docker run -command, see the wandb docker-run command. - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `--nvidia / --no-nvidia` | Use the nvidia runtime, defaults to nvidia if nvidia-docker is present | -| `--digest` | Output the image digest and exit | -| `--jupyter / --no-jupyter` | Run jupyter lab in the container | -| `--dir` | Which directory to mount the code in the container | -| `--no-dir` | Don't mount the current directory | -| `--shell` | The shell to start the container with | -| `--port` | The host port to bind jupyter on | -| `--cmd` | The command to run in the container | -| `--no-tty` | Run the command without a tty | - - - diff --git a/content/en/ref/cli/wandb-enabled.md b/content/en/ref/cli/wandb-enabled.md deleted file mode 100644 index 82135af8e5..0000000000 --- a/content/en/ref/cli/wandb-enabled.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: wandb enabled ---- - -**Usage** - -`wandb enabled [OPTIONS]` - -**Summary** - -Enable W&B. - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `--service` | Enable W&B service [default: True] | - - - diff --git a/content/en/ref/cli/wandb-init.md b/content/en/ref/cli/wandb-init.md deleted file mode 100644 index 254efc8101..0000000000 --- a/content/en/ref/cli/wandb-init.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: wandb init ---- - -**Usage** - -`wandb init [OPTIONS]` - -**Summary** - -Configure a directory with Weights & Biases - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `-p, --project` | The project to use. | -| `-e, --entity` | The entity to scope the project to. | -| `--reset` | Reset settings | -| `-m, --mode` | Can be "online", "offline" or "disabled". Defaults to online. | - - - diff --git a/content/en/ref/cli/wandb-job/_index.md b/content/en/ref/cli/wandb-job/_index.md deleted file mode 100644 index 9e3e4ee232..0000000000 --- a/content/en/ref/cli/wandb-job/_index.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: wandb job ---- - -**Usage** - -`wandb job [OPTIONS] COMMAND [ARGS]...` - -**Summary** - -Commands for managing and viewing W&B jobs - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | - - -**Commands** - -| **Command** | **Description** | -| :--- | :--- | -| create | Create a job from a source, without a wandb run. | -| describe | Describe a launch job. | -| list | List jobs in a project | - diff --git a/content/en/ref/cli/wandb-job/wandb-job-create.md b/content/en/ref/cli/wandb-job/wandb-job-create.md deleted file mode 100644 index e531775941..0000000000 --- a/content/en/ref/cli/wandb-job/wandb-job-create.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: wandb job create ---- - -**Usage** - -`wandb job create [OPTIONS] {git|code|image} PATH` - -**Summary** - -Create a job from a source, without a wandb run. - -Jobs can be of three types, git, code, or image. - -git: A git source, with an entrypoint either in the path or provided -explicitly pointing to the main python executable. code: A code path, -containing a requirements.txt file. image: A docker image. - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `-p, --project` | The project you want to list jobs from. | -| `-e, --entity` | The entity the jobs belong to | -| `-n, --name` | Name for the job | -| `-d, --description` | Description for the job | -| `-a, --alias` | Alias for the job | -| `--entry-point` | Entrypoint to the script, including an executable and an entrypoint file. Required for code or repo jobs. If --build-context is provided, paths in the entrypoint command will be relative to the build context. | -| `-g, --git-hash` | Commit reference to use as the source for git jobs | -| `-r, --runtime` | Python runtime to execute the job | -| `-b, --build-context` | Path to the build context from the root of the job source code. If provided, this is used as the base path for the Dockerfile and entrypoint. | -| `--base-image` | Base image to use for the job. Incompatible with image jobs. | -| `--dockerfile` | Path to the Dockerfile for the job. If --build- context is provided, the Dockerfile path will be relative to the build context. | - - - diff --git a/content/en/ref/cli/wandb-job/wandb-job-describe.md b/content/en/ref/cli/wandb-job/wandb-job-describe.md deleted file mode 100644 index ba284d26ab..0000000000 --- a/content/en/ref/cli/wandb-job/wandb-job-describe.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: wandb job describe ---- - -**Usage** - -`wandb job describe [OPTIONS] JOB` - -**Summary** - -Describe a launch job. Provide the launch job in the form of: -entity/project/job-name:alias-or-version - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | - - - diff --git a/content/en/ref/cli/wandb-job/wandb-job-list.md b/content/en/ref/cli/wandb-job/wandb-job-list.md deleted file mode 100644 index b8992f022b..0000000000 --- a/content/en/ref/cli/wandb-job/wandb-job-list.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: wandb job list ---- - -**Usage** - -`wandb job list [OPTIONS]` - -**Summary** - -List jobs in a project - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `-p, --project` | The project you want to list jobs from. | -| `-e, --entity` | The entity the jobs belong to | - - - diff --git a/content/en/ref/cli/wandb-launch-agent.md b/content/en/ref/cli/wandb-launch-agent.md deleted file mode 100644 index 09ee9f9810..0000000000 --- a/content/en/ref/cli/wandb-launch-agent.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: wandb launch-agent ---- - -**Usage** - -`wandb launch-agent [OPTIONS]` - -**Summary** - -Run a W&B launch agent. - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `-q, --queue` | The name of a queue for the agent to watch. Multiple -q flags supported. | -| `-e, --entity` | The entity to use. Defaults to current logged-in user | -| `-l, --log-file` | Destination for internal agent logs. Use - for stdout. By default all agents logs will go to debug.log in your wandb/ subdirectory or WANDB_DIR if set. | -| `-j, --max-jobs` | The maximum number of launch jobs this agent can run in parallel. Defaults to 1. Set to -1 for no upper limit | -| `-c, --config` | path to the agent config yaml to use | -| `-v, --verbose` | Display verbose output | - - - diff --git a/content/en/ref/cli/wandb-launch-sweep.md b/content/en/ref/cli/wandb-launch-sweep.md deleted file mode 100644 index 79941b4153..0000000000 --- a/content/en/ref/cli/wandb-launch-sweep.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: wandb launch-sweep ---- - -**Usage** - -`wandb launch-sweep [OPTIONS] [CONFIG]` - -**Summary** - -Run a W&B launch sweep (Experimental). - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `-q, --queue` | The name of a queue to push the sweep to | -| `-p, --project` | Name of the project which the agent will watch. If passed in, will override the project value passed in using a config file | -| `-e, --entity` | The entity to use. Defaults to current logged-in user | -| `-r, --resume_id` | Resume a launch sweep by passing an 8-char sweep id. Queue required | -| `--prior_run` | ID of an existing run to add to this sweep | - - - diff --git a/content/en/ref/cli/wandb-launch.md b/content/en/ref/cli/wandb-launch.md deleted file mode 100644 index c8d17755ff..0000000000 --- a/content/en/ref/cli/wandb-launch.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: wandb launch ---- - -**Usage** - -`wandb launch [OPTIONS]` - -**Summary** - -Launch or queue a W&B Job. See https://wandb.me/launch - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `-u, --uri (str)` | Local path or git repo uri to launch. If provided this command will create a job from the specified uri. | -| `-j, --job (str)` | Name of the job to launch. If passed in, launch does not require a uri. | -| `--entry-point` | Entry point within project. [default: main]. If the entry point is not found, attempts to run the project file with the specified name as a script, using 'python' to run .py files and the default shell (specified by environment variable $SHELL) to run .sh files. If passed in, will override the entrypoint value passed in using a config file. | -| `--build-context (str)` | Path to the build context within the source code. Defaults to the root of the source code. Compatible only with -u. | -| `--name` | Name of the run under which to launch the run. If not specified, a random run name will be used to launch run. If passed in, will override the name passed in using a config file. | -| `-e, --entity (str)` | Name of the target entity which the new run will be sent to. Defaults to using the entity set by local wandb/settings folder. If passed in, will override the entity value passed in using a config file. | -| `-p, --project (str)` | Name of the target project which the new run will be sent to. Defaults to using the project name given by the source uri or for github runs, the git repo name. If passed in, will override the project value passed in using a config file. | -| `-r, --resource` | Execution resource to use for run. Supported values: 'local-process', 'local-container', 'kubernetes', 'sagemaker', 'gcp-vertex'. This is now a required parameter if pushing to a queue with no resource configuration. If passed in, will override the resource value passed in using a config file. | -| `-d, --docker-image` | Specific docker image you'd like to use. In the form name:tag. If passed in, will override the docker image value passed in using a config file. | -| `--base-image` | Docker image to run job code in. Incompatible with --docker-image. | -| `-c, --config` | Path to JSON file (must end in '.json') or JSON string which will be passed as a launch config. Dictation how the launched run will be configured. | -| `-v, --set-var` | Set template variable values for queues with allow listing enabled, as key-value pairs e.g. `--set-var key1=value1 --set-var key2=value2` | -| `-q, --queue` | Name of run queue to push to. If none, launches single run directly. If supplied without an argument (`--queue`), defaults to queue 'default'. Else, if name supplied, specified run queue must exist under the project and entity supplied. | -| `--async` | Flag to run the job asynchronously. Defaults to false, i.e. unless --async is set, wandb launch will wait for the job to finish. This option is incompatible with --queue; asynchronous options when running with an agent should be set on wandb launch-agent. | -| `--resource-args` | Path to JSON file (must end in '.json') or JSON string which will be passed as resource args to the compute resource. The exact content which should be provided is different for each execution backend. See documentation for layout of this file. | -| `--dockerfile` | Path to the Dockerfile used to build the job, relative to the job's root | -| `--priority [critical|high|medium|low]` | When --queue is passed, set the priority of the job. Launch jobs with higher priority are served first. The order, from highest to lowest priority, is: critical, high, medium, low | - - - diff --git a/content/en/ref/cli/wandb-login.md b/content/en/ref/cli/wandb-login.md deleted file mode 100644 index 9b64f733e6..0000000000 --- a/content/en/ref/cli/wandb-login.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: wandb login ---- - -**Usage** - -`wandb login [OPTIONS] [KEY]...` - -**Summary** - -Login to Weights & Biases - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `--cloud` | Login to the cloud instead of local | -| `--host, --base-url` | Login to a specific instance of W&B | -| `--relogin` | Force relogin if already logged in. | -| `--anonymously` | Log in anonymously | -| `--verify / --no-verify` | Verify login credentials | - - - diff --git a/content/en/ref/cli/wandb-offline.md b/content/en/ref/cli/wandb-offline.md deleted file mode 100644 index 91d8357e7c..0000000000 --- a/content/en/ref/cli/wandb-offline.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: wandb offline ---- - -**Usage** - -`wandb offline [OPTIONS]` - -**Summary** - -Disable W&B sync - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | - - - diff --git a/content/en/ref/cli/wandb-online.md b/content/en/ref/cli/wandb-online.md deleted file mode 100644 index 7dea72436e..0000000000 --- a/content/en/ref/cli/wandb-online.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: wandb online ---- - -**Usage** - -`wandb online [OPTIONS]` - -**Summary** - -Enable W&B sync - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | - - - diff --git a/content/en/ref/cli/wandb-pull.md b/content/en/ref/cli/wandb-pull.md deleted file mode 100644 index 8d45079ec8..0000000000 --- a/content/en/ref/cli/wandb-pull.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: wandb pull ---- - -**Usage** - -`wandb pull [OPTIONS] RUN` - -**Summary** - -Pull files from Weights & Biases - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `-p, --project` | The project you want to download. | -| `-e, --entity` | The entity to scope the listing to. | - - - diff --git a/content/en/ref/cli/wandb-restore.md b/content/en/ref/cli/wandb-restore.md deleted file mode 100644 index 18206a6eda..0000000000 --- a/content/en/ref/cli/wandb-restore.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: wandb restore ---- - -**Usage** - -`wandb restore [OPTIONS] RUN` - -**Summary** - -Restore code, config and docker state for a run. Retrieves code from latest -commit if code was not saved with `wandb.save()` or -`wandb.init(save_code=True)`. - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `--no-git` | Don't restore git state | -| `--branch / --no-branch` | Whether to create a branch or checkout detached | -| `-p, --project` | The project you wish to upload to. | -| `-e, --entity` | The entity to scope the listing to. | - - - diff --git a/content/en/ref/cli/wandb-scheduler.md b/content/en/ref/cli/wandb-scheduler.md deleted file mode 100644 index 159be4b9f7..0000000000 --- a/content/en/ref/cli/wandb-scheduler.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: wandb scheduler ---- - -**Usage** - -`wandb scheduler [OPTIONS] SWEEP_ID` - -**Summary** - -Run a W&B launch sweep scheduler (Experimental) - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | - - - diff --git a/content/en/ref/cli/wandb-server/_index.md b/content/en/ref/cli/wandb-server/_index.md deleted file mode 100644 index 1d73df40e4..0000000000 --- a/content/en/ref/cli/wandb-server/_index.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: wandb server ---- - -**Usage** - -`wandb server [OPTIONS] COMMAND [ARGS]...` - -**Summary** - -Commands for operating a local W&B server - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | - - -**Commands** - -| **Command** | **Description** | -| :--- | :--- | -| start | Start a local W&B server | -| stop | Stop a local W&B server | - diff --git a/content/en/ref/cli/wandb-server/wandb-server-start.md b/content/en/ref/cli/wandb-server/wandb-server-start.md deleted file mode 100644 index 15d1eed1b0..0000000000 --- a/content/en/ref/cli/wandb-server/wandb-server-start.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -title: wandb server start ---- - -**Usage** - -`wandb server start [OPTIONS]` - -**Summary** - -Start a local W&B server - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `-p, --port` | The host port to bind W&B server on | -| `-e, --env` | Env vars to pass to wandb/local | -| `--daemon / --no-daemon` | Run or don't run in daemon mode | - - - diff --git a/content/en/ref/cli/wandb-server/wandb-server-stop.md b/content/en/ref/cli/wandb-server/wandb-server-stop.md deleted file mode 100644 index 24ed18d527..0000000000 --- a/content/en/ref/cli/wandb-server/wandb-server-stop.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: wandb server stop ---- - -**Usage** - -`wandb server stop [OPTIONS]` - -**Summary** - -Stop a local W&B server - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | - - - diff --git a/content/en/ref/cli/wandb-status.md b/content/en/ref/cli/wandb-status.md deleted file mode 100644 index 304599f952..0000000000 --- a/content/en/ref/cli/wandb-status.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: wandb status ---- - -**Usage** - -`wandb status [OPTIONS]` - -**Summary** - -Show configuration settings - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `--settings / --no-settings` | Show the current settings | - - - diff --git a/content/en/ref/cli/wandb-sweep.md b/content/en/ref/cli/wandb-sweep.md deleted file mode 100644 index 36ea1fe985..0000000000 --- a/content/en/ref/cli/wandb-sweep.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: wandb sweep ---- - -**Usage** - -`wandb sweep [OPTIONS] CONFIG_YAML_OR_SWEEP_ID` - -**Summary** - -Initialize a hyperparameter sweep. Search for hyperparameters that optimizes -a cost function of a machine learning model by testing various combinations. - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `-p, --project` | The name of the project where W&B runs created from the sweep are sent to. If the project is not specified, the run is sent to a project labeled Uncategorized. | -| `-e, --entity` | The username or team name where you want to send W&B runs created by the sweep to. Ensure that the entity you specify already exists. If you don't specify an entity, the run will be sent to your default entity, which is usually your username. | -| `--controller` | Run local controller | -| `--verbose` | Display verbose output | -| `--name` | The name of the sweep. The sweep ID is used if no name is specified. | -| `--program` | Set sweep program | -| `--update` | Update pending sweep | -| `--stop` | Finish a sweep to stop running new runs and let currently running runs finish. | -| `--cancel` | Cancel a sweep to kill all running runs and stop running new runs. | -| `--pause` | Pause a sweep to temporarily stop running new runs. | -| `--resume` | Resume a sweep to continue running new runs. | -| `--prior_run` | ID of an existing run to add to this sweep | - - - diff --git a/content/en/ref/cli/wandb-sync.md b/content/en/ref/cli/wandb-sync.md deleted file mode 100644 index 598c8c8d82..0000000000 --- a/content/en/ref/cli/wandb-sync.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: wandb sync ---- - -**Usage** - -`wandb sync [OPTIONS] [PATH]...` - -**Summary** - -Upload an offline training directory to W&B - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `--id` | The run you want to upload to. | -| `-p, --project` | The project you want to upload to. | -| `-e, --entity` | The entity to scope to. | -| `--job_type` | Specifies the type of run for grouping related runs together. | -| `--sync-tensorboard / --no-sync-tensorboard` | Stream tfevent files to wandb. | -| `--include-globs` | Comma separated list of globs to include. | -| `--exclude-globs` | Comma separated list of globs to exclude. | -| `--include-online / --no-include-online` | Include online runs | -| `--include-offline / --no-include-offline` | Include offline runs | -| `--include-synced / --no-include-synced` | Include synced runs | -| `--mark-synced / --no-mark-synced` | Mark runs as synced | -| `--sync-all` | Sync all runs | -| `--clean` | Delete synced runs | -| `--clean-old-hours` | Delete runs created before this many hours. To be used alongside --clean flag. | -| `--clean-force` | Clean without confirmation prompt. | -| `--show` | Number of runs to show | -| `--append` | Append run | -| `--skip-console` | Skip console logs | -| `--replace-tags` | Replace tags in the format 'old_tag1=new_tag1,old_tag2=new_tag2' | - - - diff --git a/content/en/ref/cli/wandb-verify.md b/content/en/ref/cli/wandb-verify.md deleted file mode 100644 index 4efee5ec5b..0000000000 --- a/content/en/ref/cli/wandb-verify.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: wandb verify ---- - -**Usage** - -`wandb verify [OPTIONS]` - -**Summary** - -Checks and verifies local instance of W&B. W&B checks for: - -Checks that the host is not `api.wandb.ai` (host check). - -Verifies if the user is logged in correctly using the provided API key -(login check). - -Checks that requests are made over HTTPS (secure requests). - -Validates the CORS (Cross-Origin Resource Sharing) configuration of the -object store (CORS configuration). - -Logs metrics, saves, and downloads files to check if runs are correctly -recorded and accessible (run check). - -Saves and downloads artifacts to verify that the artifact storage and -retrieval system is working as expected (artifact check). - -Tests the GraphQL endpoint by uploading a file to ensure it can handle -signed URL uploads (GraphQL PUT check). - -Checks the ability to send large payloads through the proxy (large payload -check). - -Verifies that the installed version of the W&B package is up-to-date and -compatible with the server (W&B version check). - -Creates and executes a sweep to ensure that sweep functionality is working -correctly (sweeps check). - - -**Options** - -| **Option** | **Description** | -| :--- | :--- | -| `--host` | Test a specific instance of W&B | - - - diff --git a/content/en/ref/python/_index.md b/content/en/ref/python/_index.md deleted file mode 100644 index a319ec8405..0000000000 --- a/content/en/ref/python/_index.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: Python SDK 0.22.0 -module: -weight: 1 ---- -The W&B Python SDK, accessible at `wandb`, enables you to train and fine-tune models, and manage models from experimentation to production. - -> After performing your training and fine-tuning operations with this SDK, you can use [the Public API]({{< relref "/ref/python/public-api" >}}) to query and analyze the data that was logged, and [the Reports and Workspaces API]({{< relref "/ref/wandb_workspaces" >}}) to generate a web-publishable [report]({{< relref "/guides/core/reports" >}}) summarizing your work. - -## Installation and setup - -### Sign up and create an API key - -To authenticate your machine with W&B, you must first generate an API key at https://wandb.ai/authorize. - -### Install and import packages - -Install the W&B library. - -``` -pip install wandb -``` - -### Import W&B Python SDK: - -```python -import wandb - -# Specify your team entity -entity = "" - -# Project that the run is recorded to -project = "my-awesome-project" - -with wandb.init(entity=entity, project=project) as run: - run.log({"accuracy": 0.9, "loss": 0.1}) -```` diff --git a/content/en/ref/python/automations/_index.md b/content/en/ref/python/automations/_index.md deleted file mode 100644 index 1f0a41e9df..0000000000 --- a/content/en/ref/python/automations/_index.md +++ /dev/null @@ -1,96 +0,0 @@ ---- -title: Automations -module: wandb.automations -weight: 4 -no_list: true ---- - -The W&B Automations API enables programmatic creation and management of automated workflows that respond to events in your ML pipeline. Configure actions to trigger when specific conditions are met, such as model performance thresholds or artifact creation. - - -### Core Classes - -| Class | Description | -|-------|-------------| -| [`Automation`](./automation/) | Represents a saved automation instance with its configuration. | -| [`NewAutomation`](./newautomation/) | Builder class for creating new automations. | - -### Events (Triggers) - -| Event | Description | -|-------|-------------| -| [`OnRunMetric`](./onrunmetric/) | Trigger when a run metric satisfies a defined condition (threshold, change, etc.). | -| [`OnCreateArtifact`](./oncreateartifact/) | Trigger when a new artifact is created in a collection. | -| [`OnLinkArtifact`](./onlinkartifact/) | Trigger when an artifact is linked to a registry. | -| [`OnAddArtifactAlias`](./onaddartifactalias/) | Trigger when an alias is added to an artifact. | - -### Actions - -| Action | Description | -|--------|-------------| -| [`SendNotification`](./sendnotification/) | Send notifications via Slack or other integrated channels. | -| [`SendWebhook`](./sendwebhook/) | Send HTTP webhook requests to external services. | -| [`DoNothing`](./donothing/) | Placeholder action for testing automation configurations. | - -### Filters - -| Filter | Description | -|--------|-------------| -| [`MetricThresholdFilter`](./metricthresholdfilter/) | Filter runs based on metric value comparisons against thresholds. | -| [`MetricChangeFilter`](./metricchangefilter/) | Filter runs based on metric value changes over time. | - -## Common Use Cases - -### Model Performance Monitoring -- Alert when model accuracy drops below a threshold -- Notify team when training loss plateaus -- Trigger retraining pipelines based on performance metrics - -### Artifact Management -- Send notifications when new model versions are created -- Trigger deployment workflows when artifacts are tagged -- Automate downstream processing when datasets are updated - -### Experiment Tracking -- Alert on failed or crashed runs -- Notify when long-running experiments complete -- Send daily summaries of experiment metrics - -### Integration Workflows -- Update external tracking systems via webhooks -- Sync model registry with deployment platforms -- Trigger CI/CD pipelines based on W&B events - -## Example Usage - -The following example creates an automation that sends a Slack notification whenever a metric called `custom-metric` exceeds 10. `custom-metric` is expected to be logged during training using `wandb.Run.log({"custom-metric": value })`. - -```python -import wandb -from wandb.automations import OnRunMetric, RunEvent, SendNotification - -api = wandb.Api() - -project = api.project("", entity="") - -# Use the first Slack integration for the team -slack_hook = next(api.slack_integrations(entity="")) - -# Create a trigger event -event = OnRunMetric( - scope=project, - filter=RunEvent.metric("custom-metric") > 10, -) - -# Create an action that responds to the event -action = SendNotification.from_integration(slack_hook) - -# Create the automation -automation = api.create_automation( - event >> action, - name="my-automation", - description="Send a Slack message whenever 'custom-metric' exceeds 10.", -) -``` - -For more information about using the Automations API, see the [Automations Guide]({{< relref "/guides/core/automations" >}}). \ No newline at end of file diff --git a/content/en/ref/python/automations/automation.md b/content/en/ref/python/automations/automation.md deleted file mode 100644 index df2566ebe1..0000000000 --- a/content/en/ref/python/automations/automation.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: Automation -namespace: automations_namespace -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/automations/automations.py >}} - - - -## class `Automation` -A local instance of a saved W&B automation. - - -### method `Automation.__init__` - -```python -__init__( - typename__: 'Literal['Trigger']' = 'Trigger', - id: 'str', - created_at: 'datetime', - updated_at: 'datetime | None' = None, - name: 'str', - description: 'str | None', - enabled: 'bool', - scope: '_ArtifactSequenceScope | _ArtifactPortfolioScope | ProjectScope', - event: 'SavedEvent', - action: 'SavedLaunchJobAction | SavedNotificationAction | SavedWebhookAction | SavedNoOpAction' -) → None -``` - -**Args:** - - - `typename__` (Literal['Trigger']): - - `id` (str): - - `created_at` (datetime): The date and time when this automation was created. - - `updated_at` (Optional[datetime]): The date and time when this automation was last updated, if applicable. - - `name` (str): The name of this automation. - - `description` (Optional[str]): An optional description of this automation. - - `enabled` (bool): Whether this automation is enabled. Only enabled automations will trigger. - - `scope` (Union[_ArtifactSequenceScope, _ArtifactPortfolioScope, ProjectScope]): The scope in which the triggering event must occur. - - `event` (SavedEvent): The event that will trigger this automation. - - `action` (Union[SavedLaunchJobAction, SavedNotificationAction, SavedWebhookAction, SavedNoOpAction]): The action that will execute when this automation is triggered. - -**Returns:** - An `Automation` object. diff --git a/content/en/ref/python/automations/donothing.md b/content/en/ref/python/automations/donothing.md deleted file mode 100644 index 08324b59f7..0000000000 --- a/content/en/ref/python/automations/donothing.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: DoNothing -namespace: automations_namespace -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/automations/actions.py >}} - - - -## class `DoNothing` -Defines an automation action that intentionally does nothing. - - -### method `DoNothing.__init__` - -```python -__init__( - no_op: 'bool' = True, - action_type: 'Literal[NO_OP]' = NO_OP -) → None -``` - -**Args:** - - - `no_op` (bool): Placeholder field which exists only to satisfy backend schema requirements. - There should never be a need to set this field explicitly, as its value is ignored. - - `action_type` (Literal[NO_OP]): - -**Returns:** - An `DoNothing` object. diff --git a/content/en/ref/python/automations/metricchangefilter.md b/content/en/ref/python/automations/metricchangefilter.md deleted file mode 100644 index b12cf5669b..0000000000 --- a/content/en/ref/python/automations/metricchangefilter.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: MetricChangeFilter -namespace: automations_namespace -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/automations/_filters/run_metrics.py >}} - - - -## class `MetricChangeFilter` -Defines a filter that compares a change in a run metric against a user-defined threshold. - -The change is calculated over "tumbling" windows, i.e. the difference -between the current window and the non-overlapping prior window. - - -### method `MetricChangeFilter.__init__` - -```python -__init__( - name: 'str', - agg: 'Agg | None' = None, - window: 'int' = 1, - cmp: 'None' = None, - threshold: 'Annotated | Annotated', - prior_window: 'int' = None, - change_type: 'ChangeType', - change_dir: 'ChangeDir' -) → None -``` - -**Args:** - - - `name` (str): - - `agg` (Optional[Agg]): - - `window` (int): - - `cmp` (None): Ignored. - - `threshold` (Union[Annotated, Annotated]): - - `prior_window` (int): Size of the prior window over which the metric is aggregated (ignored if `agg is None`). - If omitted, defaults to the size of the current window. - - `change_type` (ChangeType): - - `change_dir` (ChangeDir): - -**Returns:** - An `MetricChangeFilter` object. diff --git a/content/en/ref/python/automations/metricthresholdfilter.md b/content/en/ref/python/automations/metricthresholdfilter.md deleted file mode 100644 index f46217d0cf..0000000000 --- a/content/en/ref/python/automations/metricthresholdfilter.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: MetricThresholdFilter -namespace: automations_namespace -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/automations/_filters/run_metrics.py >}} - - - -## class `MetricThresholdFilter` -Defines a filter that compares a run metric against a user-defined threshold value. - - -### method `MetricThresholdFilter.__init__` - -```python -__init__( - name: 'str', - agg: 'Agg | None' = None, - window: 'int' = 1, - cmp: 'Literal['$gte', '$gt', '$lt', '$lte']', - threshold: 'Annotated | Annotated' -) → None -``` - -**Args:** - - - `name` (str): - - `agg` (Optional[Agg]): - - `window` (int): - - `cmp` (Literal['$gte', '$gt', '$lt', '$lte']): Comparison operator used to compare the metric value (left) vs. the threshold value (right). - - `threshold` (Union[Annotated, Annotated]): - -**Returns:** - An `MetricThresholdFilter` object. diff --git a/content/en/ref/python/automations/newautomation.md b/content/en/ref/python/automations/newautomation.md deleted file mode 100644 index d15f7cfc74..0000000000 --- a/content/en/ref/python/automations/newautomation.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: NewAutomation -namespace: automations_namespace -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/automations/automations.py >}} - - - -## class `NewAutomation` -A new automation to be created. - - -### method `NewAutomation.__init__` - -```python -__init__( - name: 'str | None' = None, - description: 'str | None' = None, - enabled: 'bool | None' = None, - event: 'Annotated | None' = None, - action: 'Annotated | None' = None -) → None -``` - -**Args:** - - - `name` (Optional[str]): The name of this automation. - - `description` (Optional[str]): An optional description of this automation. - - `enabled` (Optional[bool]): Whether this automation is enabled. Only enabled automations will trigger. - - `event` (Optional[Annotated]): The event that will trigger this automation. - - `action` (Optional[Annotated]): The action that will execute when this automation is triggered. - -**Returns:** - An `NewAutomation` object. - -### property `NewAutomation.scope` - -The scope in which the triggering event must occur. - -**Returns:** - - `Optional[AutomationScope]`: The scope property value. diff --git a/content/en/ref/python/automations/onaddartifactalias.md b/content/en/ref/python/automations/onaddartifactalias.md deleted file mode 100644 index 076403b555..0000000000 --- a/content/en/ref/python/automations/onaddartifactalias.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: OnAddArtifactAlias -namespace: automations_namespace -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/automations/events.py >}} - - - -## class `OnAddArtifactAlias` -A new alias is assigned to an artifact. - - -### method `OnAddArtifactAlias.__init__` - -```python -__init__( - event_type: 'Literal[ADD_ARTIFACT_ALIAS]' = ADD_ARTIFACT_ALIAS, - scope: '_ArtifactSequenceScope | _ArtifactPortfolioScope | ProjectScope', - filter: 'And | Or | Nor | Not | Lt | Gt | Lte | Gte | Eq | Ne | In | NotIn | Exists | Regex | Contains | dict[str, Any] | FilterExpr' = And([]) -) → None -``` - -**Args:** - - - `event_type` (Literal[ADD_ARTIFACT_ALIAS]): - - `scope` (Union[_ArtifactSequenceScope, _ArtifactPortfolioScope, ProjectScope]): The scope of the event. - - `filter` (Union[And, Or, Nor, Not, Lt, Gt, Lte, Gte, Eq, Ne, In, NotIn, Exists, Regex, Contains, Dict[str, Any], FilterExpr]): Additional condition(s), if any, that must be met for this event to trigger an automation. - -**Returns:** - An `OnAddArtifactAlias` object. diff --git a/content/en/ref/python/automations/oncreateartifact.md b/content/en/ref/python/automations/oncreateartifact.md deleted file mode 100644 index 7a2e82ca19..0000000000 --- a/content/en/ref/python/automations/oncreateartifact.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: OnCreateArtifact -namespace: automations_namespace -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/automations/events.py >}} - - - -## class `OnCreateArtifact` -A new artifact is created. - - -### method `OnCreateArtifact.__init__` - -```python -__init__( - event_type: 'Literal[CREATE_ARTIFACT]' = CREATE_ARTIFACT, - scope: '_ArtifactSequenceScope | _ArtifactPortfolioScope', - filter: 'And | Or | Nor | Not | Lt | Gt | Lte | Gte | Eq | Ne | In | NotIn | Exists | Regex | Contains | dict[str, Any] | FilterExpr' = And([]) -) → None -``` - -**Args:** - - - `event_type` (Literal[CREATE_ARTIFACT]): - - `scope` (Union[_ArtifactSequenceScope, _ArtifactPortfolioScope]): The scope of the event: only artifact collections are valid scopes for this event. - - `filter` (Union[And, Or, Nor, Not, Lt, Gt, Lte, Gte, Eq, Ne, In, NotIn, Exists, Regex, Contains, Dict[str, Any], FilterExpr]): Additional condition(s), if any, that must be met for this event to trigger an automation. - -**Returns:** - An `OnCreateArtifact` object. diff --git a/content/en/ref/python/automations/onlinkartifact.md b/content/en/ref/python/automations/onlinkartifact.md deleted file mode 100644 index 19f82b57a0..0000000000 --- a/content/en/ref/python/automations/onlinkartifact.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: OnLinkArtifact -namespace: automations_namespace -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/automations/events.py >}} - - - -## class `OnLinkArtifact` -A new artifact is linked to a collection. - - -### method `OnLinkArtifact.__init__` - -```python -__init__( - event_type: 'Literal[LINK_ARTIFACT]' = LINK_ARTIFACT, - scope: '_ArtifactSequenceScope | _ArtifactPortfolioScope | ProjectScope', - filter: 'And | Or | Nor | Not | Lt | Gt | Lte | Gte | Eq | Ne | In | NotIn | Exists | Regex | Contains | dict[str, Any] | FilterExpr' = And([]) -) → None -``` - -**Args:** - - - `event_type` (Literal[LINK_ARTIFACT]): - - `scope` (Union[_ArtifactSequenceScope, _ArtifactPortfolioScope, ProjectScope]): The scope of the event. - - `filter` (Union[And, Or, Nor, Not, Lt, Gt, Lte, Gte, Eq, Ne, In, NotIn, Exists, Regex, Contains, Dict[str, Any], FilterExpr]): Additional condition(s), if any, that must be met for this event to trigger an automation. - -**Returns:** - An `OnLinkArtifact` object. diff --git a/content/en/ref/python/automations/onrunmetric.md b/content/en/ref/python/automations/onrunmetric.md deleted file mode 100644 index 7ac4d1a2d6..0000000000 --- a/content/en/ref/python/automations/onrunmetric.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: OnRunMetric -namespace: automations_namespace -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/automations/events.py >}} - - - -## class `OnRunMetric` -A run metric satisfies a user-defined condition. - - -### method `OnRunMetric.__init__` - -```python -__init__( - event_type: 'Literal[RUN_METRIC_THRESHOLD, RUN_METRIC_CHANGE]', - scope: 'ProjectScope', - filter: 'RunMetricFilter' -) → None -``` - -**Args:** - - - `event_type` (Literal[RUN_METRIC_THRESHOLD, RUN_METRIC_CHANGE]): - - `scope` (ProjectScope): The scope of the event: only projects are valid scopes for this event. - - `filter` (RunMetricFilter): Run and/or metric condition(s) that must be satisfied for this event to trigger an automation. - -**Returns:** - An `OnRunMetric` object. diff --git a/content/en/ref/python/automations/sendnotification.md b/content/en/ref/python/automations/sendnotification.md deleted file mode 100644 index 3bb281fb43..0000000000 --- a/content/en/ref/python/automations/sendnotification.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: SendNotification -namespace: automations_namespace -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/automations/actions.py >}} - - - -## class `SendNotification` -Defines an automation action that sends a (Slack) notification. - - -### method `SendNotification.__init__` - -```python -__init__( - integration_id: 'str', - title: 'str' = '', - message: 'str' = '', - severity: 'AlertSeverity' = , - action_type: 'Literal[NOTIFICATION]' = NOTIFICATION -) → None -``` - -**Args:** - - - `integration_id` (str): The ID of the Slack integration that will be used to send the notification. - - `title` (str): The title of the sent notification. - - `message` (str): The message body of the sent notification. - - `severity` (AlertSeverity): The severity (`INFO`, `WARN`, `ERROR`) of the sent notification. - - `action_type` (Literal[NOTIFICATION]): - -**Returns:** - An `SendNotification` object. - -### classmethod `SendNotification.from_integration` - -```python -from_integration( - integration: 'SlackIntegration', - title: 'str' = '', - text: 'str' = '', - level: 'AlertSeverity' = -) → Self -``` - -Define a notification action that sends to the given (Slack) integration. diff --git a/content/en/ref/python/automations/sendwebhook.md b/content/en/ref/python/automations/sendwebhook.md deleted file mode 100644 index a34f5c7593..0000000000 --- a/content/en/ref/python/automations/sendwebhook.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: SendWebhook -namespace: automations_namespace -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/automations/actions.py >}} - - - -## class `SendWebhook` -Defines an automation action that sends a webhook request. - - -### method `SendWebhook.__init__` - -```python -__init__( - integration_id: 'str', - request_payload: 'Annotated | None' = None, - action_type: 'Literal[GENERIC_WEBHOOK]' = GENERIC_WEBHOOK -) → None -``` - -**Args:** - - - `integration_id` (str): The ID of the webhook integration that will be used to send the request. - - `request_payload` (Optional[Annotated]): The payload, possibly with template variables, to send in the webhook request. - - `action_type` (Literal[GENERIC_WEBHOOK]): - -**Returns:** - An `SendWebhook` object. - -### classmethod `SendWebhook.from_integration` - -```python -from_integration( - integration: 'WebhookIntegration', - payload: 'Optional[SerializedToJson[dict[str, Any]]]' = None -) → Self -``` - -Define a webhook action that sends to the given (webhook) integration. diff --git a/content/en/ref/python/custom-charts/Histogram.md b/content/en/ref/python/custom-charts/Histogram.md deleted file mode 100644 index a8d8dbd1d1..0000000000 --- a/content/en/ref/python/custom-charts/Histogram.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -title: histogram -namespace: python_sdk_custom_charts -python_object_type: function ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/plot/histogram.py >}} - - - - -### function `histogram` - -```python -histogram( - table: 'wandb.Table', - value: 'str', - title: 'str' = '', - split_table: 'bool' = False -) → CustomChart -``` - -Constructs a histogram chart from a W&B Table. - - - -**Args:** - - - `table`: The W&B Table containing the data for the histogram. - - `value`: The label for the bin axis (x-axis). - - `title`: The title of the histogram plot. - - `split_table`: Whether the table should be split into a separate section in the W&B UI. If `True`, the table will be displayed in a section named "Custom Chart Tables". Default is `False`. - - - -**Returns:** - - - `CustomChart`: A custom chart object that can be logged to W&B. To log the chart, pass it to `wandb.log()`. - - - -**Example:** - - -```python -import math -import random -import wandb - -# Generate random data -data = [[i, random.random() + math.sin(i / 10)] for i in range(100)] - -# Create a W&B Table -table = wandb.Table( - data=data, - columns=["step", "height"], -) - -# Create a histogram plot -histogram = wandb.plot.histogram( - table, - value="height", - title="My Histogram", -) - -# Log the histogram plot to W&B -with wandb.init(...) as run: - run.log({"histogram-plot1": histogram}) -``` diff --git a/content/en/ref/python/custom-charts/_index.md b/content/en/ref/python/custom-charts/_index.md deleted file mode 100644 index 05b325e36c..0000000000 --- a/content/en/ref/python/custom-charts/_index.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -title: Custom Charts -module: wandb.plot -weight: 5 -no_list: true ---- - -Custom charts in W&B are programmable through a group of functions in the `wandb.plot` namespace. These functions create interactive visualizations in W&B project dashboards, and support common ML visualizations such as confusion matrices, ROC curves, and distribution plots. - -## Available Chart Functions - -| Function | Description | -|----------|-------------| -| [`confusion_matrix()`](./confusion_matrix/) | Generate confusion matrices for classification performance visualization. | -| [`roc_curve()`](./roc_curve/) | Create Receiver Operating Characteristic curves for binary and multi-class classifiers. | -| [`pr_curve()`](./pr_curve/) | Build Precision-Recall curves for classifier evaluation. | -| [`line()`](./line/) | Construct line charts from tabular data. | -| [`scatter()`](./scatter/) | Create scatter plots for variable relationships. | -| [`bar()`](./bar/) | Generate bar charts for categorical data. | -| [`histogram()`](./Histogram/) | Build histograms for data distribution analysis. | -| [`line_series()`](./line_series/) | Plot multiple line series on a single chart. | -| [`plot_table()`](./plot_table/) | Create custom charts using Vega-Lite specifications. | - -## Common Use Cases - -### Model Evaluation -- **Classification**: `confusion_matrix()`, `roc_curve()`, and `pr_curve()` for classifier evaluation -- **Regression**: `scatter()` for prediction vs. actual plots and `histogram()` for residual analysis -- **Vega-Lite Charts**: `plot_table()` for domain-specific visualizations - -### Training Monitoring -- **Learning Curves**: `line()` or `line_series()` for tracking metrics over epochs -- **Hyperparameter Comparison**: `bar()` charts for comparing configurations - -### Data Analysis -- **Distribution Analysis**: `histogram()` for feature distributions -- **Correlation Analysis**: `scatter()` plots for variable relationships - -## Getting Started - -### Log a confusion matrix - -```python -import wandb - -y_true = [0, 1, 2, 0, 1, 2] -y_pred = [0, 2, 2, 0, 1, 1] -class_names = ["class_0", "class_1", "class_2"] - -# Initialize a run -with wandb.init(project="custom-charts-demo") as run: - run.log({ - "conf_mat": wandb.plot.confusion_matrix( - y_true=y_true, - preds=y_pred, - class_names=class_names - ) - }) -``` - - -### Build a scatter plot for feature analysis -```python -import numpy as np - -# Generate synthetic data -data_table = wandb.Table(columns=["feature_1", "feature_2", "label"]) - -with wandb.init(project="custom-charts-demo") as run: - - for _ in range(100): - data_table.add_data( - np.random.randn(), - np.random.randn(), - np.random.choice(["A", "B"]) - ) - - run.log({ - "feature_scatter": wandb.plot.scatter( - data_table, x="feature_1", y="feature_2", - title="Feature Distribution" - ) - }) - -``` diff --git a/content/en/ref/python/custom-charts/bar.md b/content/en/ref/python/custom-charts/bar.md deleted file mode 100644 index 56d60fc3b0..0000000000 --- a/content/en/ref/python/custom-charts/bar.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: bar() -namespace: python_sdk_custom_charts -python_object_type: function ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/plot/bar.py >}} - - - - -### function `bar` - -```python -bar( - table: 'wandb.Table', - label: 'str', - value: 'str', - title: 'str' = '', - split_table: 'bool' = False -) → CustomChart -``` - -Constructs a bar chart from a wandb.Table of data. - - - -**Args:** - - - `table`: A table containing the data for the bar chart. - - `label`: The name of the column to use for the labels of each bar. - - `value`: The name of the column to use for the values of each bar. - - `title`: The title of the bar chart. - - `split_table`: Whether the table should be split into a separate section in the W&B UI. If `True`, the table will be displayed in a section named "Custom Chart Tables". Default is `False`. - - - -**Returns:** - - - `CustomChart`: A custom chart object that can be logged to W&B. To log the chart, pass it to `wandb.log()`. - - - -**Example:** - - -```python -import random -import wandb - -# Generate random data for the table -data = [ - ["car", random.uniform(0, 1)], - ["bus", random.uniform(0, 1)], - ["road", random.uniform(0, 1)], - ["person", random.uniform(0, 1)], -] - -# Create a table with the data -table = wandb.Table(data=data, columns=["class", "accuracy"]) - -# Initialize a W&B run and log the bar plot -with wandb.init(project="bar_chart") as run: - # Create a bar plot from the table - bar_plot = wandb.plot.bar( - table=table, - label="class", - value="accuracy", - title="Object Classification Accuracy", - ) - - # Log the bar chart to W&B - run.log({"bar_plot": bar_plot}) -``` diff --git a/content/en/ref/python/custom-charts/confusion_matrix.md b/content/en/ref/python/custom-charts/confusion_matrix.md deleted file mode 100644 index eee6c3e818..0000000000 --- a/content/en/ref/python/custom-charts/confusion_matrix.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -title: confusion_matrix() -namespace: python_sdk_custom_charts -python_object_type: function ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/plot/confusion_matrix.py >}} - - - - -### function `confusion_matrix` - -```python -confusion_matrix( - probs: 'Sequence[Sequence[float]] | None' = None, - y_true: 'Sequence[T] | None' = None, - preds: 'Sequence[T] | None' = None, - class_names: 'Sequence[str] | None' = None, - title: 'str' = 'Confusion Matrix Curve', - split_table: 'bool' = False -) → CustomChart -``` - -Constructs a confusion matrix from a sequence of probabilities or predictions. - - - -**Args:** - - - `probs`: A sequence of predicted probabilities for each class. The sequence shape should be (N, K) where N is the number of samples and K is the number of classes. If provided, `preds` should not be provided. - - `y_true`: A sequence of true labels. - - `preds`: A sequence of predicted class labels. If provided, `probs` should not be provided. - - `class_names`: Sequence of class names. If not provided, class names will be defined as "Class_1", "Class_2", etc. - - `title`: Title of the confusion matrix chart. - - `split_table`: Whether the table should be split into a separate section in the W&B UI. If `True`, the table will be displayed in a section named "Custom Chart Tables". Default is `False`. - - - -**Returns:** - - - `CustomChart`: A custom chart object that can be logged to W&B. To log the chart, pass it to `wandb.log()`. - - - -**Raises:** - - - `ValueError`: If both `probs` and `preds` are provided or if the number of predictions and true labels are not equal. If the number of unique predicted classes exceeds the number of class names or if the number of unique true labels exceeds the number of class names. - - `wandb.Error`: If numpy is not installed. - - - -**Examples:** - Logging a confusion matrix with random probabilities for wildlife classification: - -```python -import numpy as np -import wandb - -# Define class names for wildlife -wildlife_class_names = ["Lion", "Tiger", "Elephant", "Zebra"] - -# Generate random true labels (0 to 3 for 10 samples) -wildlife_y_true = np.random.randint(0, 4, size=10) - -# Generate random probabilities for each class (10 samples x 4 classes) -wildlife_probs = np.random.rand(10, 4) -wildlife_probs = np.exp(wildlife_probs) / np.sum( - np.exp(wildlife_probs), - axis=1, - keepdims=True, -) - -# Initialize W&B run and log confusion matrix -with wandb.init(project="wildlife_classification") as run: - confusion_matrix = wandb.plot.confusion_matrix( - probs=wildlife_probs, - y_true=wildlife_y_true, - class_names=wildlife_class_names, - title="Wildlife Classification Confusion Matrix", - ) - run.log({"wildlife_confusion_matrix": confusion_matrix}) -``` - -In this example, random probabilities are used to generate a confusion matrix. - -Logging a confusion matrix with simulated model predictions and 85% accuracy: - -```python -import numpy as np -import wandb - -# Define class names for wildlife -wildlife_class_names = ["Lion", "Tiger", "Elephant", "Zebra"] - -# Simulate true labels for 200 animal images (imbalanced distribution) -wildlife_y_true = np.random.choice( - [0, 1, 2, 3], - size=200, - p=[0.2, 0.3, 0.25, 0.25], -) - -# Simulate model predictions with 85% accuracy -wildlife_preds = [ - y_t - if np.random.rand() < 0.85 - else np.random.choice([x for x in range(4) if x != y_t]) - for y_t in wildlife_y_true -] - -# Initialize W&B run and log confusion matrix -with wandb.init(project="wildlife_classification") as run: - confusion_matrix = wandb.plot.confusion_matrix( - preds=wildlife_preds, - y_true=wildlife_y_true, - class_names=wildlife_class_names, - title="Simulated Wildlife Classification Confusion Matrix", - ) - run.log({"wildlife_confusion_matrix": confusion_matrix}) -``` - -In this example, predictions are simulated with 85% accuracy to generate a confusion matrix. diff --git a/content/en/ref/python/custom-charts/line.md b/content/en/ref/python/custom-charts/line.md deleted file mode 100644 index 4609fdfc3f..0000000000 --- a/content/en/ref/python/custom-charts/line.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -title: line() -namespace: python_sdk_custom_charts -python_object_type: function ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/plot/line.py >}} - - - - -### function `line` - -```python -line( - table: 'wandb.Table', - x: 'str', - y: 'str', - stroke: 'str | None' = None, - title: 'str' = '', - split_table: 'bool' = False -) → CustomChart -``` - -Constructs a customizable line chart. - - - -**Args:** - - - `table`: The table containing data for the chart. - - `x`: Column name for the x-axis values. - - `y`: Column name for the y-axis values. - - `stroke`: Column name to differentiate line strokes (e.g., for grouping lines). - - `title`: Title of the chart. - - `split_table`: Whether the table should be split into a separate section in the W&B UI. If `True`, the table will be displayed in a section named "Custom Chart Tables". Default is `False`. - - - -**Returns:** - - - `CustomChart`: A custom chart object that can be logged to W&B. To log the chart, pass it to `wandb.log()`. - - - -**Example:** - - -```python -import math -import random -import wandb - -# Create multiple series of data with different patterns -data = [] -for i in range(100): - # Series 1: Sinusoidal pattern with random noise - data.append([i, math.sin(i / 10) + random.uniform(-0.1, 0.1), "series_1"]) - # Series 2: Cosine pattern with random noise - data.append([i, math.cos(i / 10) + random.uniform(-0.1, 0.1), "series_2"]) - # Series 3: Linear increase with random noise - data.append([i, i / 10 + random.uniform(-0.5, 0.5), "series_3"]) - -# Define the columns for the table -table = wandb.Table(data=data, columns=["step", "value", "series"]) - -# Initialize wandb run and log the line chart -with wandb.init(project="line_chart_example") as run: - line_chart = wandb.plot.line( - table=table, - x="step", - y="value", - stroke="series", # Group by the "series" column - title="Multi-Series Line Plot", - ) - run.log({"line-chart": line_chart}) -``` diff --git a/content/en/ref/python/custom-charts/line_series.md b/content/en/ref/python/custom-charts/line_series.md deleted file mode 100644 index f3834d62a5..0000000000 --- a/content/en/ref/python/custom-charts/line_series.md +++ /dev/null @@ -1,134 +0,0 @@ ---- -title: line_series() -namespace: python_sdk_custom_charts -python_object_type: function ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/plot/line_series.py >}} - - - - -### function `line_series` - -```python -line_series( - xs: 'Iterable[Iterable[Any]] | Iterable[Any]', - ys: 'Iterable[Iterable[Any]]', - keys: 'Iterable[str] | None' = None, - title: 'str' = '', - xname: 'str' = 'x', - split_table: 'bool' = False -) → CustomChart -``` - -Constructs a line series chart. - - - -**Args:** - - - `xs`: Sequence of x values. If a singular array is provided, all y values are plotted against that x array. If an array of arrays is provided, each y value is plotted against the corresponding x array. - - `ys`: Sequence of y values, where each iterable represents a separate line series. - - `keys`: Sequence of keys for labeling each line series. If not provided, keys will be automatically generated as "line_1", "line_2", etc. - - `title`: Title of the chart. - - `xname`: Label for the x-axis. - - `split_table`: Whether the table should be split into a separate section in the W&B UI. If `True`, the table will be displayed in a section named "Custom Chart Tables". Default is `False`. - - - -**Returns:** - - - `CustomChart`: A custom chart object that can be logged to W&B. To log the chart, pass it to `wandb.log()`. - - - -**Examples:** - Logging a single x array where all y series are plotted against the same x values: - -```python -import wandb - -# Initialize W&B run -with wandb.init(project="line_series_example") as run: - # x values shared across all y series - xs = list(range(10)) - - # Multiple y series to plot - ys = [ - [i for i in range(10)], # y = x - [i**2 for i in range(10)], # y = x^2 - [i**3 for i in range(10)], # y = x^3 - ] - - # Generate and log the line series chart - line_series_chart = wandb.plot.line_series( - xs, - ys, - title="title", - xname="step", - ) - run.log({"line-series-single-x": line_series_chart}) -``` - -In this example, a single `xs` series (shared x-values) is used for all `ys` series. This results in each y-series being plotted against the same x-values (0-9). - -Logging multiple x arrays where each y series is plotted against its corresponding x array: - -```python -import wandb - -# Initialize W&B run -with wandb.init(project="line_series_example") as run: - # Separate x values for each y series - xs = [ - [i for i in range(10)], # x for first series - [2 * i for i in range(10)], # x for second series (stretched) - [3 * i for i in range(10)], # x for third series (stretched more) - ] - - # Corresponding y series - ys = [ - [i for i in range(10)], # y = x - [i**2 for i in range(10)], # y = x^2 - [i**3 for i in range(10)], # y = x^3 - ] - - # Generate and log the line series chart - line_series_chart = wandb.plot.line_series( - xs, ys, title="Multiple X Arrays Example", xname="Step" - ) - run.log({"line-series-multiple-x": line_series_chart}) -``` - -In this example, each y series is plotted against its own unique x series. This allows for more flexibility when the x values are not uniform across the data series. - -Customizing line labels using `keys`: - -```python -import wandb - -# Initialize W&B run -with wandb.init(project="line_series_example") as run: - xs = list(range(10)) # Single x array - ys = [ - [i for i in range(10)], # y = x - [i**2 for i in range(10)], # y = x^2 - [i**3 for i in range(10)], # y = x^3 - ] - - # Custom labels for each line - keys = ["Linear", "Quadratic", "Cubic"] - - # Generate and log the line series chart - line_series_chart = wandb.plot.line_series( - xs, - ys, - keys=keys, # Custom keys (line labels) - title="Custom Line Labels Example", - xname="Step", - ) - run.log({"line-series-custom-keys": line_series_chart}) -``` - -This example shows how to provide custom labels for the lines using the `keys` argument. The keys will appear in the legend as "Linear", "Quadratic", and "Cubic". diff --git a/content/en/ref/python/custom-charts/plot_table.md b/content/en/ref/python/custom-charts/plot_table.md deleted file mode 100644 index 5f39911689..0000000000 --- a/content/en/ref/python/custom-charts/plot_table.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: plot_table() -namespace: python_sdk_custom_charts -python_object_type: function ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/plot/custom_chart.py >}} - - - - -### function `plot_table` - -```python -plot_table( - vega_spec_name: 'str', - data_table: 'wandb.Table', - fields: 'dict[str, Any]', - string_fields: 'dict[str, Any] | None' = None, - split_table: 'bool' = False -) → CustomChart -``` - -Creates a custom charts using a Vega-Lite specification and a `wandb.Table`. - -This function creates a custom chart based on a Vega-Lite specification and a data table represented by a `wandb.Table` object. The specification needs to be predefined and stored in the W&B backend. The function returns a custom chart object that can be logged to W&B using `wandb.Run.log()`. - - - -**Args:** - - - `vega_spec_name`: The name or identifier of the Vega-Lite spec that defines the visualization structure. - - `data_table`: A `wandb.Table` object containing the data to be visualized. - - `fields`: A mapping between the fields in the Vega-Lite spec and the corresponding columns in the data table to be visualized. - - `string_fields`: A dictionary for providing values for any string constants required by the custom visualization. - - `split_table`: Whether the table should be split into a separate section in the W&B UI. If `True`, the table will be displayed in a section named "Custom Chart Tables". Default is `False`. - - - -**Returns:** - - - `CustomChart`: A custom chart object that can be logged to W&B. To log the chart, pass the chart object as argument to `wandb.Run.log()`. - - - -**Raises:** - - - `wandb.Error`: If `data_table` is not a `wandb.Table` object. - - - -**Example:** - ```python -# Create a custom chart using a Vega-Lite spec and the data table. -import wandb - -data = [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5]] -table = wandb.Table(data=data, columns=["x", "y"]) -fields = {"x": "x", "y": "y", "title": "MY TITLE"} - -with wandb.init() as run: - # Training code goes here - - # Create a custom title with `string_fields`. - my_custom_chart = wandb.plot_table( - vega_spec_name="wandb/line/v0", - data_table=table, - fields=fields, - string_fields={"title": "Title"}, - ) - - run.log({"custom_chart": my_custom_chart}) -``` diff --git a/content/en/ref/python/custom-charts/pr_curve.md b/content/en/ref/python/custom-charts/pr_curve.md deleted file mode 100644 index 6913846219..0000000000 --- a/content/en/ref/python/custom-charts/pr_curve.md +++ /dev/null @@ -1,84 +0,0 @@ ---- -title: pr_curve() -namespace: python_sdk_custom_charts -python_object_type: function ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/plot/pr_curve.py >}} - - - - -### function `pr_curve` - -```python -pr_curve( - y_true: 'Iterable[T] | None' = None, - y_probas: 'Iterable[numbers.Number] | None' = None, - labels: 'list[str] | None' = None, - classes_to_plot: 'list[T] | None' = None, - interp_size: 'int' = 21, - title: 'str' = 'Precision-Recall Curve', - split_table: 'bool' = False -) → CustomChart -``` - -Constructs a Precision-Recall (PR) curve. - -The Precision-Recall curve is particularly useful for evaluating classifiers on imbalanced datasets. A high area under the PR curve signifies both high precision (a low false positive rate) and high recall (a low false negative rate). The curve provides insights into the balance between false positives and false negatives at various threshold levels, aiding in the assessment of a model's performance. - - - -**Args:** - - - `y_true`: True binary labels. The shape should be (`num_samples`,). - - `y_probas`: Predicted scores or probabilities for each class. These can be probability estimates, confidence scores, or non-thresholded decision values. The shape should be (`num_samples`, `num_classes`). - - `labels`: Optional list of class names to replace numeric values in `y_true` for easier plot interpretation. For example, `labels = ['dog', 'cat', 'owl']` will replace 0 with 'dog', 1 with 'cat', and 2 with 'owl' in the plot. If not provided, numeric values from `y_true` will be used. - - `classes_to_plot`: Optional list of unique class values from y_true to be included in the plot. If not specified, all unique classes in y_true will be plotted. - - `interp_size`: Number of points to interpolate recall values. The recall values will be fixed to `interp_size` uniformly distributed points in the range [0, 1], and the precision will be interpolated accordingly. - - `title`: Title of the plot. Defaults to "Precision-Recall Curve". - - `split_table`: Whether the table should be split into a separate section in the W&B UI. If `True`, the table will be displayed in a section named "Custom Chart Tables". Default is `False`. - - - -**Returns:** - - - `CustomChart`: A custom chart object that can be logged to W&B. To log the chart, pass it to `wandb.log()`. - - - -**Raises:** - - - `wandb.Error`: If NumPy, pandas, or scikit-learn is not installed. - - - - - -**Example:** - - -```python -import wandb - -# Example for spam detection (binary classification) -y_true = [0, 1, 1, 0, 1] # 0 = not spam, 1 = spam -y_probas = [ - [0.9, 0.1], # Predicted probabilities for the first sample (not spam) - [0.2, 0.8], # Second sample (spam), and so on - [0.1, 0.9], - [0.8, 0.2], - [0.3, 0.7], -] - -labels = ["not spam", "spam"] # Optional class names for readability - -with wandb.init(project="spam-detection") as run: - pr_curve = wandb.plot.pr_curve( - y_true=y_true, - y_probas=y_probas, - labels=labels, - title="Precision-Recall Curve for Spam Detection", - ) - run.log({"pr-curve": pr_curve}) -``` diff --git a/content/en/ref/python/custom-charts/roc_curve.md b/content/en/ref/python/custom-charts/roc_curve.md deleted file mode 100644 index 31c102a61a..0000000000 --- a/content/en/ref/python/custom-charts/roc_curve.md +++ /dev/null @@ -1,84 +0,0 @@ ---- -title: roc_curve() -namespace: python_sdk_custom_charts -python_object_type: function ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/plot/roc_curve.py >}} - - - - -### function `roc_curve` - -```python -roc_curve( - y_true: 'Sequence[numbers.Number]', - y_probas: 'Sequence[Sequence[float]] | None' = None, - labels: 'list[str] | None' = None, - classes_to_plot: 'list[numbers.Number] | None' = None, - title: 'str' = 'ROC Curve', - split_table: 'bool' = False -) → CustomChart -``` - -Constructs Receiver Operating Characteristic (ROC) curve chart. - - - -**Args:** - - - `y_true`: The true class labels (ground truth) for the target variable. Shape should be (num_samples,). - - `y_probas`: The predicted probabilities or decision scores for each class. Shape should be (num_samples, num_classes). - - `labels`: Human-readable labels corresponding to the class indices in `y_true`. For example, if `labels=['dog', 'cat']`, class 0 will be displayed as 'dog' and class 1 as 'cat' in the plot. If None, the raw class indices from `y_true` will be used. Default is None. - - `classes_to_plot`: A subset of unique class labels to include in the ROC curve. If None, all classes in `y_true` will be plotted. Default is None. - - `title`: Title of the ROC curve plot. Default is "ROC Curve". - - `split_table`: Whether the table should be split into a separate section in the W&B UI. If `True`, the table will be displayed in a section named "Custom Chart Tables". Default is `False`. - - - -**Returns:** - - - `CustomChart`: A custom chart object that can be logged to W&B. To log the chart, pass it to `wandb.log()`. - - - -**Raises:** - - - `wandb.Error`: If numpy, pandas, or scikit-learn are not found. - - - -**Example:** - ```python -import numpy as np -import wandb - -# Simulate a medical diagnosis classification problem with three diseases -n_samples = 200 -n_classes = 3 - -# True labels: assign "Diabetes", "Hypertension", or "Heart Disease" to -# each sample -disease_labels = ["Diabetes", "Hypertension", "Heart Disease"] -# 0: Diabetes, 1: Hypertension, 2: Heart Disease -y_true = np.random.choice([0, 1, 2], size=n_samples) - -# Predicted probabilities: simulate predictions, ensuring they sum to 1 -# for each sample -y_probas = np.random.dirichlet(np.ones(n_classes), size=n_samples) - -# Specify classes to plot (plotting all three diseases) -classes_to_plot = [0, 1, 2] - -# Initialize a W&B run and log a ROC curve plot for disease classification -with wandb.init(project="medical_diagnosis") as run: - roc_plot = wandb.plot.roc_curve( - y_true=y_true, - y_probas=y_probas, - labels=disease_labels, - classes_to_plot=classes_to_plot, - title="ROC Curve for Disease Classification", - ) - run.log({"roc-curve": roc_plot}) -``` diff --git a/content/en/ref/python/custom-charts/scatter.md b/content/en/ref/python/custom-charts/scatter.md deleted file mode 100644 index dafc61fef2..0000000000 --- a/content/en/ref/python/custom-charts/scatter.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -title: scatter() -namespace: python_sdk_custom_charts -python_object_type: function ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/plot/scatter.py >}} - - - - -### function `scatter` - -```python -scatter( - table: 'wandb.Table', - x: 'str', - y: 'str', - title: 'str' = '', - split_table: 'bool' = False -) → CustomChart -``` - -Constructs a scatter plot from a wandb.Table of data. - - - -**Args:** - - - `table`: The W&B Table containing the data to visualize. - - `x`: The name of the column used for the x-axis. - - `y`: The name of the column used for the y-axis. - - `title`: The title of the scatter chart. - - `split_table`: Whether the table should be split into a separate section in the W&B UI. If `True`, the table will be displayed in a section named "Custom Chart Tables". Default is `False`. - - - -**Returns:** - - - `CustomChart`: A custom chart object that can be logged to W&B. To log the chart, pass it to `wandb.log()`. - -**Example:** - ```python -import math -import random -import wandb - -# Simulate temperature variations at different altitudes over time -data = [ - [i, random.uniform(-10, 20) - 0.005 * i + 5 * math.sin(i / 50)] - for i in range(300) -] - -# Create W&B table with altitude (m) and temperature (°C) columns -table = wandb.Table(data=data, columns=["altitude (m)", "temperature (°C)"]) - -# Initialize W&B run and log the scatter plot -with wandb.init(project="temperature-altitude-scatter") as run: - # Create and log the scatter plot - scatter_plot = wandb.plot.scatter( - table=table, - x="altitude (m)", - y="temperature (°C)", - title="Altitude vs Temperature", - ) - run.log({"altitude-temperature-scatter": scatter_plot}) -``` diff --git a/content/en/ref/python/data-types/Audio.md b/content/en/ref/python/data-types/Audio.md deleted file mode 100644 index ee56c01426..0000000000 --- a/content/en/ref/python/data-types/Audio.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: Audio -namespace: python_sdk_data_type -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/sdk/data_types/audio.py >}} - - - - -## class `Audio` -W&B class for audio clips. - -### method `Audio.__init__` - -```python -__init__( - data_or_path: Union[str, pathlib.Path, list, ForwardRef('np.ndarray')], - sample_rate: Optional[int] = None, - caption: Optional[str] = None -) -``` - -Accept a path to an audio file or a numpy array of audio data. - - - -**Args:** - - - `data_or_path`: A path to an audio file or a NumPy array of audio data. - - `sample_rate`: Sample rate, required when passing in raw NumPy array of audio data. - - `caption`: Caption to display with audio. - - - - ---- - - - -### classmethod `Audio.durations` - -```python -durations(audio_list) -``` - -Calculate the duration of the audio files. - ---- - - - -### classmethod `Audio.sample_rates` - -```python -sample_rates(audio_list) -``` - -Get sample rates of the audio files. - ---- - diff --git a/content/en/ref/python/data-types/Histogram.md b/content/en/ref/python/data-types/Histogram.md deleted file mode 100644 index b33a48b5e5..0000000000 --- a/content/en/ref/python/data-types/Histogram.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: Histogram -namespace: python_sdk_data_type -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/sdk/data_types/histogram.py >}} - - - - -## class `Histogram` -W&B class for histograms. - -This object works just like numpy's histogram function https://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram.html - - - -**Attributes:** - - - `bins` ([float]): Edges of bins - - `histogram` ([int]): Number of elements falling in each bin. - -### method `Histogram.__init__` - -```python -__init__( - sequence: Optional[Sequence] = None, - np_histogram: Optional[ForwardRef('NumpyHistogram')] = None, - num_bins: int = 64 -) → None -``` - -Initialize a Histogram object. - - - -**Args:** - sequence: Input data for histogram. np_histogram: Alternative input of a precomputed histogram. num_bins: Number of bins for the histogram. The default number of bins is 64. The maximum number of bins is 512. - - - -**Examples:** - Generate histogram from a sequence. - -```python -import wandb - -wandb.Histogram([1, 2, 3]) -``` - -Efficiently initialize from np.histogram. - -```python -import numpy as np -import wandb - -hist = np.histogram(data) -wandb.Histogram(np_histogram=hist) -``` - - - - ---- - diff --git a/content/en/ref/python/data-types/Html.md b/content/en/ref/python/data-types/Html.md deleted file mode 100644 index aa7bf0927c..0000000000 --- a/content/en/ref/python/data-types/Html.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: Html -namespace: python_sdk_data_type -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/sdk/data_types/html.py >}} - - - - -## class `Html` -W&B class for logging HTML content to W&B. - -### method `Html.__init__` - -```python -__init__( - data: Union[str, pathlib.Path, ForwardRef('TextIO')], - inject: bool = True, - data_is_not_path: bool = False -) → None -``` - -Creates a W&B HTML object. - - - -**Args:** - data: A string that is a path to a file with the extension ".html", or a string or IO object containing literal HTML. - - `inject`: Add a stylesheet to the HTML object. If set to False the HTML will pass through unchanged. - - `data_is_not_path`: If set to False, the data will be treated as a path to a file. - - - -**Examples:** - It can be initialized by providing a path to a file: - -```python -with wandb.init() as run: - run.log({"html": wandb.Html("./index.html")}) -``` - -Alternatively, it can be initialized by providing literal HTML, in either a string or IO object: - -```python -with wandb.init() as run: - run.log({"html": wandb.Html("

Hello, world!

")}) -``` - - - - ---- - - - diff --git a/content/en/ref/python/data-types/Image.md b/content/en/ref/python/data-types/Image.md deleted file mode 100644 index ab3f3823b7..0000000000 --- a/content/en/ref/python/data-types/Image.md +++ /dev/null @@ -1,123 +0,0 @@ ---- -title: Image -namespace: python_sdk_data_type -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/sdk/data_types/image.py >}} - - - - -## class `Image` -A class for logging images to W&B. - -### method `Image.__init__` - -```python -__init__( - data_or_path: 'ImageDataOrPathType', - mode: Optional[str] = None, - caption: Optional[str] = None, - grouping: Optional[int] = None, - classes: Optional[ForwardRef('Classes'), Sequence[dict]] = None, - boxes: Optional[Dict[str, ForwardRef('BoundingBoxes2D')], Dict[str, dict]] = None, - masks: Optional[Dict[str, ForwardRef('ImageMask')], Dict[str, dict]] = None, - file_type: Optional[str] = None, - normalize: bool = True -) → None -``` - -Initialize a `wandb.Image` object. - - - -**Args:** - - - `data_or_path`: Accepts NumPy array/pytorch tensor of image data, a PIL image object, or a path to an image file. If a NumPy array or pytorch tensor is provided, the image data will be saved to the given file type. If the values are not in the range [0, 255] or all values are in the range [0, 1], the image pixel values will be normalized to the range [0, 255] unless `normalize` is set to False. - - pytorch tensor should be in the format (channel, height, width) - - NumPy array should be in the format (height, width, channel) - - `mode`: The PIL mode for an image. Most common are "L", "RGB", - - `"RGBA". Full explanation at https`: //pillow.readthedocs.io/en/stable/handbook/concepts.html#modes - - `caption`: Label for display of image. - - `grouping`: The grouping number for the image. - - `classes`: A list of class information for the image, used for labeling bounding boxes, and image masks. - - `boxes`: A dictionary containing bounding box information for the image. - - `see`: https://docs.wandb.ai/ref/python/data-types/boundingboxes2d/ - - `masks`: A dictionary containing mask information for the image. - - `see`: https://docs.wandb.ai/ref/python/data-types/imagemask/ - - `file_type`: The file type to save the image as. This parameter has no effect if data_or_path is a path to an image file. - - `normalize`: If True, normalize the image pixel values to fall within the range of [0, 255]. Normalize is only applied if data_or_path is a numpy array or pytorch tensor. - - - -**Examples:** - Create a wandb.Image from a numpy array - -```python -import numpy as np -import wandb - -with wandb.init() as run: - examples = [] - for i in range(3): - pixels = np.random.randint(low=0, high=256, size=(100, 100, 3)) - image = wandb.Image(pixels, caption=f"random field {i}") - examples.append(image) - run.log({"examples": examples}) -``` - -Create a wandb.Image from a PILImage - -```python -import numpy as np -from PIL import Image as PILImage -import wandb - -with wandb.init() as run: - examples = [] - for i in range(3): - pixels = np.random.randint( - low=0, high=256, size=(100, 100, 3), dtype=np.uint8 - ) - pil_image = PILImage.fromarray(pixels, mode="RGB") - image = wandb.Image(pil_image, caption=f"random field {i}") - examples.append(image) - run.log({"examples": examples}) -``` - -Log .jpg rather than .png (default) - -```python -import numpy as np -import wandb - -with wandb.init() as run: - examples = [] - for i in range(3): - pixels = np.random.randint(low=0, high=256, size=(100, 100, 3)) - image = wandb.Image( - pixels, caption=f"random field {i}", file_type="jpg" - ) - examples.append(image) - run.log({"examples": examples}) -``` - - ---- - -### property Image.image - - - - - - - ---- - - - - - - diff --git a/content/en/ref/python/data-types/Molecule.md b/content/en/ref/python/data-types/Molecule.md deleted file mode 100644 index 6a74ef56f7..0000000000 --- a/content/en/ref/python/data-types/Molecule.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: Molecule -namespace: python_sdk_data_type -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/sdk/data_types/molecule.py >}} - - - - -## class `Molecule` -W&B class for 3D Molecular data. - -### method `Molecule.__init__` - -```python -__init__( - data_or_path: Union[str, pathlib.Path, ForwardRef('TextIO')], - caption: Optional[str] = None, - **kwargs: str -) → None -``` - -Initialize a Molecule object. - - - -**Args:** - - - `data_or_path`: Molecule can be initialized from a file name or an io object. - - `caption`: Caption associated with the molecule for display. - - - - ---- - - - - diff --git a/content/en/ref/python/data-types/Object3D.md b/content/en/ref/python/data-types/Object3D.md deleted file mode 100644 index 920ca3757a..0000000000 --- a/content/en/ref/python/data-types/Object3D.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: Object3D -namespace: python_sdk_data_type -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/sdk/data_types/object_3d.py >}} - - - - -## class `Object3D` -W&B class for 3D point clouds. - -### method `Object3D.__init__` - -```python -__init__( - data_or_path: Union[ForwardRef('np.ndarray'), str, pathlib.Path, ForwardRef('TextIO'), dict], - caption: Optional[str] = None, - **kwargs: Optional[str, ForwardRef('FileFormat3D')] -) → None -``` - -Creates a W&B Object3D object. - - - -**Args:** - - - `data_or_path`: Object3D can be initialized from a file or a numpy array. - - `caption`: Caption associated with the object for display. - - - -**Examples:** - The shape of the numpy array must be one of either - -```text -[[x y z], ...] nx3 -[[x y z c], ...] nx4 where c is a category with supported range [1, 14] -[[x y z r g b], ...] nx6 where is rgb is color -``` - - - - ---- - - - - - diff --git a/content/en/ref/python/data-types/Plotly.md b/content/en/ref/python/data-types/Plotly.md deleted file mode 100644 index cb3efb1034..0000000000 --- a/content/en/ref/python/data-types/Plotly.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: Plotly -namespace: python_sdk_data_type -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/sdk/data_types/plotly.py >}} - - - - -## class `Plotly` -W&B class for Plotly plots. - -### method `Plotly.__init__` - -```python -__init__( - val: Union[ForwardRef('plotly.Figure'), ForwardRef('matplotlib.artist.Artist')] -) -``` - -Initialize a Plotly object. - - - -**Args:** - - - `val`: Matplotlib or Plotly figure. - - - - ---- - - diff --git a/content/en/ref/python/data-types/Table.md b/content/en/ref/python/data-types/Table.md deleted file mode 100644 index 4be0cddd62..0000000000 --- a/content/en/ref/python/data-types/Table.md +++ /dev/null @@ -1,179 +0,0 @@ ---- -title: Table -namespace: python_sdk_data_type -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/sdk/data_types/table.py >}} - - - - -## class `Table` -The Table class used to display and analyze tabular data. - -Unlike traditional spreadsheets, Tables support numerous types of data: scalar values, strings, numpy arrays, and most subclasses of `wandb.data_types.Media`. This means you can embed `Images`, `Video`, `Audio`, and other sorts of rich, annotated media directly in Tables, alongside other traditional scalar values. - -This class is the primary class used to generate W&B Tables https://docs.wandb.ai/guides/models/tables/. - -### method `Table.__init__` - -```python -__init__( - columns=None, - data=None, - rows=None, - dataframe=None, - dtype=None, - optional=True, - allow_mixed_types=False, - log_mode: Optional[Literal['IMMUTABLE', 'MUTABLE', 'INCREMENTAL']] = 'IMMUTABLE' -) -``` - -Initializes a Table object. - -The rows is available for legacy reasons and should not be used. The Table class uses data to mimic the Pandas API. - - - -**Args:** - - - `columns`: (List[str]) Names of the columns in the table. Defaults to ["Input", "Output", "Expected"]. - - `data`: (List[List[any]]) 2D row-oriented array of values. - - `dataframe`: (pandas.DataFrame) DataFrame object used to create the table. When set, `data` and `columns` arguments are ignored. - - `rows`: (List[List[any]]) 2D row-oriented array of values. - - `optional`: (Union[bool,List[bool]]) Determines if `None` values are allowed. Default to True - - If a singular bool value, then the optionality is enforced for all columns specified at construction time - - If a list of bool values, then the optionality is applied to each column - should be the same length as `columns` applies to all columns. A list of bool values applies to each respective column. - - `allow_mixed_types`: (bool) Determines if columns are allowed to have mixed types (disables type validation). Defaults to False - - `log_mode`: Optional[str] Controls how the Table is logged when mutations occur. Options: - - "IMMUTABLE" (default): Table can only be logged once; subsequent logging attempts after the table has been mutated will be no-ops. - - "MUTABLE": Table can be re-logged after mutations, creating a new artifact version each time it's logged. - - "INCREMENTAL": Table data is logged incrementally, with each log creating a new artifact entry containing the new data since the last log. - - - - ---- - -### method `Table.add_column` - -```python -add_column(name, data, optional=False) -``` - -Adds a column of data to the table. - - - -**Args:** - - - `name`: (str) - the unique name of the column - - `data`: (list | np.array) - a column of homogeneous data - - `optional`: (bool) - if null-like values are permitted - ---- - -### method `Table.add_computed_columns` - -```python -add_computed_columns(fn) -``` - -Adds one or more computed columns based on existing data. - - - -**Args:** - - - `fn`: A function which accepts one or two parameters, ndx (int) and row (dict), which is expected to return a dict representing new columns for that row, keyed by the new column names. - - `ndx` is an integer representing the index of the row. Only included if `include_ndx` is set to `True`. - - `row` is a dictionary keyed by existing columns - ---- - -### method `Table.add_data` - -```python -add_data(*data) -``` - -Adds a new row of data to the table. - -The maximum amount ofrows in a table is determined by `wandb.Table.MAX_ARTIFACT_ROWS`. - -The length of the data should match the length of the table column. - ---- - -### method `Table.add_row` - -```python -add_row(*row) -``` - -Deprecated. Use `Table.add_data` method instead. - ---- - - -### method `Table.cast` - -```python -cast(col_name, dtype, optional=False) -``` - -Casts a column to a specific data type. - -This can be one of the normal python classes, an internal W&B type, or an example object, like an instance of wandb.Image or wandb.Classes. - - - -**Args:** - - - `col_name` (str): The name of the column to cast. - - `dtype` (class, wandb.wandb_sdk.interface._dtypes.Type, any): The target dtype. - - `optional` (bool): If the column should allow Nones. - ---- - - -### method `Table.get_column` - -```python -get_column(name, convert_to=None) -``` - -Retrieves a column from the table and optionally converts it to a NumPy object. - - - -**Args:** - - - `name`: (str) - the name of the column - - `convert_to`: (str, optional) - - "numpy": will convert the underlying data to numpy object - ---- - -### method `Table.get_dataframe` - -```python -get_dataframe() -``` - -Returns a `pandas.DataFrame` of the table. - ---- - -### method `Table.get_index` - -```python -get_index() -``` - -Returns an array of row indexes for use in other tables to create links. - ---- - diff --git a/content/en/ref/python/data-types/Video.md b/content/en/ref/python/data-types/Video.md deleted file mode 100644 index f7f7fc3b1e..0000000000 --- a/content/en/ref/python/data-types/Video.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -title: Video -namespace: python_sdk_data_type -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/sdk/data_types/video.py >}} - - - - -## class `Video` -A class for logging videos to W&B. - -### method `Video.__init__` - -```python -__init__( - data_or_path: Union[str, pathlib.Path, ForwardRef('np.ndarray'), ForwardRef('TextIO'), ForwardRef('BytesIO')], - caption: Optional[str] = None, - fps: Optional[int] = None, - format: Optional[Literal['gif', 'mp4', 'webm', 'ogg']] = None -) -``` - -Initialize a W&B Video object. - - - -**Args:** - - - `data_or_path`: Video can be initialized with a path to a file or an io object. Video can be initialized with a numpy tensor. The numpy tensor must be either 4 dimensional or 5 dimensional. The dimensions should be (number of frames, channel, height, width) or (batch, number of frames, channel, height, width) The format parameter must be specified with the format argument when initializing with a numpy array or io object. - - `caption`: Caption associated with the video for display. - - `fps`: The frame rate to use when encoding raw video frames. Default value is 4. This parameter has no effect when data_or_path is a string, or bytes. - - `format`: Format of video, necessary if initializing with a numpy array or io object. This parameter will be used to determine the format to use when encoding the video data. Accepted values are "gif", "mp4", "webm", or "ogg". If no value is provided, the default format will be "gif". - - - -**Examples:** - Log a numpy array as a video - -```python -import numpy as np -import wandb - -with wandb.init() as run: - # axes are (number of frames, channel, height, width) - frames = np.random.randint( - low=0, high=256, size=(10, 3, 100, 100), dtype=np.uint8 - ) - run.log({"video": wandb.Video(frames, format="mp4", fps=4)}) -``` - - - - ---- - - - diff --git a/content/en/ref/python/data-types/_index.md b/content/en/ref/python/data-types/_index.md deleted file mode 100644 index b973d670f4..0000000000 --- a/content/en/ref/python/data-types/_index.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -title: Data Types -module: wandb.sdk.data_types -weight: 2 -no_list: true ---- - -Data Types in W&B are classes that wrap media and structured data for logging to runs. They include visualization components in the W&B UI and handle data serialization, storage, and retrieval. - -## Available Data Types - -| Data Type | Description | -|-----------|-------------| -| [`Image`](./Image/) | Log images with support for masks, bounding boxes, and segmentation. | -| [`Video`](./Video/) | Track video data for model outputs or dataset samples. | -| [`Audio`](./Audio/) | Log audio samples for audio processing tasks. | -| [`Table`](./Table/) | Create tables that can contain mixed media types. | -| [`Plotly`](./Plotly/) | Log Plotly charts for data visualization. | -| [`Html`](./Html/) | Embed custom HTML content. | -| [`Object3D`](./Object3D/) | Visualize 3D point clouds and meshes. | -| [`Molecule`](./Molecule/) | Log molecular structures for computational chemistry. | - -## Examples - -This example uses an `Image`: - -```python -import wandb -import matplotlib.pyplot as plt - -# Generate an image for demonstration purposes -path_to_img = "/path/to/cafe.png" -im = plt.imread(path_to_img) - -# Initialize a new run -with wandb.init(project="awesome-project") as run: - - # Log the image - run.log({"img": [wandb.Image(im, caption="Cafe")]}) -``` - -This example uses a `Table` to log a table with mixed text and labels: - -```python -import wandb - -# Initialize a new run -with wandb.init(project="visualize-predictions", name="tables") as run: - - # Create tabular data, using a list of lists - data = [["Cat", "1", "1"],["Dog", "0", "-1"]] - run.log({"Table 1": wandb.Table(data=data, columns=["Text", "Predicted Label", "True Label"])}) - - # Create tabular data, using `wandb.Table.add_data()` method - table = wandb.Table(columns=["Text", "Predicted Label", "True Label"]) - table.add_data("Cat", "1", "1") - table.add_data("Dog", "0", "-1") - run.log({"Table 2": table}) -``` \ No newline at end of file diff --git a/content/en/ref/python/data-types/box3d.md b/content/en/ref/python/data-types/box3d.md deleted file mode 100644 index cb8bba5e91..0000000000 --- a/content/en/ref/python/data-types/box3d.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -title: box3d() -namespace: python_sdk_data_type -python_object_type: function ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/sdk/data_types/object_3d.py >}} - - - - -### function `box3d` - -```python -box3d( - center: 'npt.ArrayLike', - size: 'npt.ArrayLike', - orientation: 'npt.ArrayLike', - color: 'RGBColor', - label: 'Optional[str]' = None, - score: 'Optional[numeric]' = None -) → Box3D -``` - -A 3D bounding box. The box is specified by its center, size and orientation. - - - -**Args:** - - - `center`: The center point of the box as a length-3 ndarray. - - `size`: The box's X, Y and Z dimensions as a length-3 ndarray. - - `orientation`: The rotation transforming global XYZ coordinates into the box's local XYZ coordinates, given as a length-4 ndarray [r, x, y, z] corresponding to the non-zero quaternion r + xi + yj + zk. - - `color`: The box's color as an (r, g, b) tuple with 0 <= r,g,b <= 1. - - `label`: An optional label for the box. - - `score`: An optional score for the box. Typically used to indicate the confidence of a detection. - - - -**Returns:** - A Box3D object. - - - -**Example:** - The following example creates a point cloud with 60 boxes rotating around the X, Y and Z axes. - -```python -import wandb - -import math -import numpy as np -from scipy.spatial.transform import Rotation - - -with wandb.init() as run: - run.log( - { - "points": wandb.Object3D.from_point_cloud( - points=np.random.uniform(-5, 5, size=(100, 3)), - boxes=[ - wandb.box3d( - center=(0.3 * t - 3, 0, 0), - size=(0.1, 0.1, 0.1), - orientation=Rotation.from_euler( - "xyz", [t * math.pi / 10, 0, 0] - ).as_quat(), - color=(0.5 + t / 40, 0.5, 0.5), - label=f"box {t}", - score=0.9, - ) - for t in range(20) - ] - + [ - wandb.box3d( - center=(0, 0.3 * t - 3, 0.3), - size=(0.1, 0.1, 0.1), - orientation=Rotation.from_euler( - "xyz", [0, t * math.pi / 10, 0] - ).as_quat(), - color=(0.5, 0.5 + t / 40, 0.5), - label=f"box {t}", - score=0.9, - ) - for t in range(20) - ] - + [ - wandb.box3d( - center=(0.3, 0.3, 0.3 * t - 3), - size=(0.1, 0.1, 0.1), - orientation=Rotation.from_euler( - "xyz", [0, 0, t * math.pi / 10] - ).as_quat(), - color=(0.5, 0.5, 0.5 + t / 40), - label=f"box {t}", - score=0.9, - ) - for t in range(20) - ], - ), - } - ) -``` diff --git a/content/en/ref/python/experiments/Artifact.md b/content/en/ref/python/experiments/Artifact.md deleted file mode 100644 index 42385b4521..0000000000 --- a/content/en/ref/python/experiments/Artifact.md +++ /dev/null @@ -1,1116 +0,0 @@ ---- -title: Artifact -namespace: python_sdk_actions -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/sdk/artifacts/artifact.py >}} - - - - -## class `Artifact` -Flexible and lightweight building block for dataset and model versioning. - -Construct an empty W&B Artifact. Populate an artifacts contents with methods that begin with `add`. Once the artifact has all the desired files, you can call `run.log_artifact()` to log it. - -### method `Artifact.__init__` - -```python -__init__( - name: 'str', - type: 'str', - description: 'str | None' = None, - metadata: 'dict[str, Any] | None' = None, - incremental: 'bool' = False, - use_as: 'str | None' = None -) → None -``` - -**Args:** - - - `name` (str): A human-readable name for the artifact. Use the name to identify a specific artifact in the W&B App UI or programmatically. You can interactively reference an artifact with the `use_artifact` Public API. A name can contain letters, numbers, underscores, hyphens, and dots. The name must be unique across a project. - - `type` (str): The artifact's type. Use the type of an artifact to both organize and differentiate artifacts. You can use any string that contains letters, numbers, underscores, hyphens, and dots. Common types include `dataset` or `model`. Include `model` within your type string if you want to link the artifact to the W&B Model Registry. Note that some types reserved for internal use and cannot be set by users. Such types include `job` and types that start with `wandb-`. - - `description (str | None) = None`: A description of the artifact. For Model or Dataset Artifacts, add documentation for your standardized team model or dataset card. View an artifact's description programmatically with the `Artifact.description` attribute or programmatically with the W&B App UI. W&B renders the description as markdown in the W&B App. - - `metadata (dict[str, Any] | None) = None`: Additional information about an artifact. Specify metadata as a dictionary of key-value pairs. You can specify no more than 100 total keys. - - `incremental`: Use `Artifact.new_draft()` method instead to modify an existing artifact. - - `use_as`: Deprecated. - - `is_link`: Boolean indication of if the artifact is a linked artifact(`True`) or source artifact(`False`). - - - -**Returns:** - An `Artifact` object. - - - - - - - ---- - -### property Artifact.aliases - -List of one or more semantically-friendly references or - -identifying "nicknames" assigned to an artifact version. - -Aliases are mutable references that you can programmatically reference. Change an artifact's alias with the W&B App UI or programmatically. See [Create new artifact versions](https://docs.wandb.ai/guides/artifacts/create-a-new-artifact-version) for more information. - - - -**Returns:** - - `list[str]`: The aliases property value. ---- - -### property Artifact.collection - -The collection this artifact was retrieved from. - -A collection is an ordered group of artifact versions. If this artifact was retrieved from a portfolio / linked collection, that collection will be returned rather than the collection that an artifact version originated from. The collection that an artifact originates from is known as the source sequence. - - - -**Returns:** - - `ArtifactCollection`: The collection property value. ---- - -### property Artifact.commit_hash - -The hash returned when this artifact was committed. - - - -**Returns:** - - `str`: The commit_hash property value. ---- - -### property Artifact.created_at - -Timestamp when the artifact was created. - - - -**Returns:** - - `str`: The created_at property value. ---- - -### property Artifact.description - -A description of the artifact. - - - -**Returns:** - - `str | None`: The description property value. ---- - -### property Artifact.digest - -The logical digest of the artifact. - -The digest is the checksum of the artifact's contents. If an artifact has the same digest as the current `latest` version, then `log_artifact` is a no-op. - - - -**Returns:** - - `str`: The digest property value. ---- - - -### property Artifact.entity - -The name of the entity that the artifact collection belongs to. - -If the artifact is a link, the entity will be the entity of the linked artifact. - - - -**Returns:** - - `str`: The entity property value. ---- - -### property Artifact.file_count - -The number of files (including references). - - - -**Returns:** - - `int`: The file_count property value. ---- - -### property Artifact.history_step - -The nearest step at which history metrics were logged for the source run of the artifact. - - - -**Examples:** - ```python -run = artifact.logged_by() -if run and (artifact.history_step is not None): - history = run.sample_history( - min_step=artifact.history_step, - max_step=artifact.history_step + 1, - keys=["my_metric"], - ) -``` - - - -**Returns:** - - `int | None`: The history_step property value. ---- - -### property Artifact.id - -The artifact's ID. - - - -**Returns:** - - `str | None`: The id property value. ---- - - -### property Artifact.is_link - -Boolean flag indicating if the artifact is a link artifact. - -True: The artifact is a link artifact to a source artifact. False: The artifact is a source artifact. - - - -**Returns:** - - `bool`: The is_link property value. ---- - -### property Artifact.linked_artifacts - -Returns a list of all the linked artifacts of a source artifact. - -If the artifact is a link artifact (`artifact.is_link == True`), it will return an empty list. Limited to 500 results. - - - -**Returns:** - - `list[Artifact]`: The linked_artifacts property value. ---- - -### property Artifact.manifest - -The artifact's manifest. - -The manifest lists all of its contents, and can't be changed once the artifact has been logged. - - - -**Returns:** - - `ArtifactManifest`: The manifest property value. ---- - -### property Artifact.metadata - -User-defined artifact metadata. - -Structured data associated with the artifact. - - - -**Returns:** - - `dict`: The metadata property value. ---- - -### property Artifact.name - -The artifact name and version of the artifact. - -A string with the format `{collection}:{alias}`. If fetched before an artifact is logged/saved, the name won't contain the alias. If the artifact is a link, the name will be the name of the linked artifact. - - - -**Returns:** - - `str`: The name property value. ---- - -### property Artifact.project - -The name of the project that the artifact collection belongs to. - -If the artifact is a link, the project will be the project of the linked artifact. - - - -**Returns:** - - `str`: The project property value. ---- - -### property Artifact.qualified_name - -The entity/project/name of the artifact. - -If the artifact is a link, the qualified name will be the qualified name of the linked artifact path. - - - -**Returns:** - - `str`: The qualified_name property value. ---- - -### property Artifact.size - -The total size of the artifact in bytes. - -Includes any references tracked by this artifact. - - - -**Returns:** - - `int`: The size property value. ---- - -### property Artifact.source_artifact - -Returns the source artifact. The source artifact is the original logged artifact. - -If the artifact itself is a source artifact (`artifact.is_link == False`), it will return itself. - - - -**Returns:** - - `Artifact`: The source_artifact property value. ---- - -### property Artifact.source_collection - -The artifact's source collection. - -The source collection is the collection that the artifact was logged from. - - - -**Returns:** - - `ArtifactCollection`: The source_collection property value. ---- - -### property Artifact.source_entity - -The name of the entity of the source artifact. - - - -**Returns:** - - `str`: The source_entity property value. ---- - -### property Artifact.source_name - -The artifact name and version of the source artifact. - -A string with the format `{source_collection}:{alias}`. Before the artifact is saved, contains only the name since the version is not yet known. - - - -**Returns:** - - `str`: The source_name property value. ---- - -### property Artifact.source_project - -The name of the project of the source artifact. - - - -**Returns:** - - `str`: The source_project property value. ---- - -### property Artifact.source_qualified_name - -The source_entity/source_project/source_name of the source artifact. - - - -**Returns:** - - `str`: The source_qualified_name property value. ---- - -### property Artifact.source_version - -The source artifact's version. - -A string with the format `v{number}`. - - - -**Returns:** - - `str`: The source_version property value. ---- - -### property Artifact.state - -The status of the artifact. One of: "PENDING", "COMMITTED", or "DELETED". - - - -**Returns:** - - `str`: The state property value. ---- - -### property Artifact.tags - -List of one or more tags assigned to this artifact version. - - - -**Returns:** - - `list[str]`: The tags property value. ---- - -### property Artifact.ttl - -The time-to-live (TTL) policy of an artifact. - -Artifacts are deleted shortly after a TTL policy's duration passes. If set to `None`, the artifact deactivates TTL policies and will be not scheduled for deletion, even if there is a team default TTL. An artifact inherits a TTL policy from the team default if the team administrator defines a default TTL and there is no custom policy set on an artifact. - - - -**Raises:** - - - `ArtifactNotLoggedError`: Unable to fetch inherited TTL if the artifact has not been logged or saved. - - - -**Returns:** - - `timedelta | None`: The ttl property value. ---- - -### property Artifact.type - -The artifact's type. Common types include `dataset` or `model`. - - - -**Returns:** - - `str`: The type property value. ---- - -### property Artifact.updated_at - -The time when the artifact was last updated. - - - -**Returns:** - - `str`: The updated_at property value. ---- - -### property Artifact.url - -Constructs the URL of the artifact. - - - -**Returns:** - - - `str`: The URL of the artifact. - - - -**Returns:** - - `str`: The url property value. ---- - -### property Artifact.use_as - -Deprecated. - - - -**Returns:** - - `str | None`: The use_as property value. ---- - -### property Artifact.version - -The artifact's version. - -A string with the format `v{number}`. If the artifact is a link artifact, the version will be from the linked collection. - - - - - -**Returns:** - - `str`: The version property value. ---- - -### method `Artifact.add` - -```python -add( - obj: 'WBValue', - name: 'StrPath', - overwrite: 'bool' = False -) → ArtifactManifestEntry -``` - -Add wandb.WBValue `obj` to the artifact. - - - -**Args:** - - - `obj`: The object to add. Currently support one of Bokeh, JoinedTable, PartitionedTable, Table, Classes, ImageMask, BoundingBoxes2D, Audio, Image, Video, Html, Object3D - - `name`: The path within the artifact to add the object. - - `overwrite`: If True, overwrite existing objects with the same file path if applicable. - - - -**Returns:** - The added manifest entry - - - -**Raises:** - - - `ArtifactFinalizedError`: You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead. - ---- - -### method `Artifact.add_dir` - -```python -add_dir( - local_path: 'str', - name: 'str | None' = None, - skip_cache: 'bool | None' = False, - policy: "Literal['mutable', 'immutable'] | None" = 'mutable', - merge: 'bool' = False -) → None -``` - -Add a local directory to the artifact. - - - -**Args:** - - - `local_path`: The path of the local directory. - - `name`: The subdirectory name within an artifact. The name you specify appears in the W&B App UI nested by artifact's `type`. Defaults to the root of the artifact. - - `skip_cache`: If set to `True`, W&B will not copy/move files to the cache while uploading - - `policy`: By default, "mutable". - - mutable: Create a temporary copy of the file to prevent corruption during upload. - - immutable: Disable protection, rely on the user not to delete or change the file. - - `merge`: If `False` (default), throws ValueError if a file was already added in a previous add_dir call and its content has changed. If `True`, overwrites existing files with changed content. Always adds new files and never removes files. To replace an entire directory, pass a name when adding the directory using `add_dir(local_path, name=my_prefix)` and call `remove(my_prefix)` to remove the directory, then add it again. - - - -**Raises:** - - - `ArtifactFinalizedError`: You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead. - - `ValueError`: Policy must be "mutable" or "immutable" - ---- - -### method `Artifact.add_file` - -```python -add_file( - local_path: 'str', - name: 'str | None' = None, - is_tmp: 'bool | None' = False, - skip_cache: 'bool | None' = False, - policy: "Literal['mutable', 'immutable'] | None" = 'mutable', - overwrite: 'bool' = False -) → ArtifactManifestEntry -``` - -Add a local file to the artifact. - - - -**Args:** - - - `local_path`: The path to the file being added. - - `name`: The path within the artifact to use for the file being added. Defaults to the basename of the file. - - `is_tmp`: If true, then the file is renamed deterministically to avoid collisions. - - `skip_cache`: If `True`, do not copy files to the cache after uploading. - - `policy`: By default, set to "mutable". If set to "mutable", create a temporary copy of the file to prevent corruption during upload. If set to "immutable", disable protection and rely on the user not to delete or change the file. - - `overwrite`: If `True`, overwrite the file if it already exists. - - - -**Returns:** - The added manifest entry. - - - -**Raises:** - - - `ArtifactFinalizedError`: You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead. - - `ValueError`: Policy must be "mutable" or "immutable" - ---- - -### method `Artifact.add_reference` - -```python -add_reference( - uri: 'ArtifactManifestEntry | str', - name: 'StrPath | None' = None, - checksum: 'bool' = True, - max_objects: 'int | None' = None -) → Sequence[ArtifactManifestEntry] -``` - -Add a reference denoted by a URI to the artifact. - -Unlike files or directories that you add to an artifact, references are not uploaded to W&B. For more information, see [Track external files](https://docs.wandb.ai/guides/artifacts/track-external-files). - -By default, the following schemes are supported: - - -- http(s): The size and digest of the file will be inferred by the `Content-Length` and the `ETag` response headers returned by the server. -- s3: The checksum and size are pulled from the object metadata. If bucket versioning is enabled, then the version ID is also tracked. -- gs: The checksum and size are pulled from the object metadata. If bucket versioning is enabled, then the version ID is also tracked. -- https, domain matching `*.blob.core.windows.net` -- Azure: The checksum and size are be pulled from the blob metadata. If storage account versioning is enabled, then the version ID is also tracked. -- file: The checksum and size are pulled from the file system. This scheme is useful if you have an NFS share or other externally mounted volume containing files you wish to track but not necessarily upload. - -For any other scheme, the digest is just a hash of the URI and the size is left blank. - - - -**Args:** - - - `uri`: The URI path of the reference to add. The URI path can be an object returned from `Artifact.get_entry` to store a reference to another artifact's entry. - - `name`: The path within the artifact to place the contents of this reference. - - `checksum`: Whether or not to checksum the resource(s) located at the reference URI. Checksumming is strongly recommended as it enables automatic integrity validation. Disabling checksumming will speed up artifact creation but reference directories will not iterated through so the objects in the directory will not be saved to the artifact. We recommend setting `checksum=False` when adding reference objects, in which case a new version will only be created if the reference URI changes. - - `max_objects`: The maximum number of objects to consider when adding a reference that points to directory or bucket store prefix. By default, the maximum number of objects allowed for Amazon S3, GCS, Azure, and local files is 10,000,000. Other URI schemas do not have a maximum. - - - -**Returns:** - The added manifest entries. - - - -**Raises:** - - - `ArtifactFinalizedError`: You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead. - ---- - -### method `Artifact.checkout` - -```python -checkout(root: 'str | None' = None) → str -``` - -Replace the specified root directory with the contents of the artifact. - -WARNING: This will delete all files in `root` that are not included in the artifact. - - - -**Args:** - - - `root`: The directory to replace with this artifact's files. - - - -**Returns:** - The path of the checked out contents. - - - -**Raises:** - - - `ArtifactNotLoggedError`: If the artifact is not logged. - ---- - -### method `Artifact.delete` - -```python -delete(delete_aliases: 'bool' = False) → None -``` - -Delete an artifact and its files. - -If called on a linked artifact, only the link is deleted, and the source artifact is unaffected. - -Use `artifact.unlink()` instead of `artifact.delete()` to remove a link between a source artifact and a linked artifact. - - - -**Args:** - - - `delete_aliases`: If set to `True`, deletes all aliases associated with the artifact. Otherwise, this raises an exception if the artifact has existing aliases. This parameter is ignored if the artifact is linked (a member of a portfolio collection). - - - -**Raises:** - - - `ArtifactNotLoggedError`: If the artifact is not logged. - ---- - -### method `Artifact.download` - -```python -download( - root: 'StrPath | None' = None, - allow_missing_references: 'bool' = False, - skip_cache: 'bool | None' = None, - path_prefix: 'StrPath | None' = None, - multipart: 'bool | None' = None -) → FilePathStr -``` - -Download the contents of the artifact to the specified root directory. - -Existing files located within `root` are not modified. Explicitly delete `root` before you call `download` if you want the contents of `root` to exactly match the artifact. - - - -**Args:** - - - `root`: The directory W&B stores the artifact's files. - - `allow_missing_references`: If set to `True`, any invalid reference paths will be ignored while downloading referenced files. - - `skip_cache`: If set to `True`, the artifact cache will be skipped when downloading and W&B will download each file into the default root or specified download directory. - - `path_prefix`: If specified, only files with a path that starts with the given prefix will be downloaded. Uses unix format (forward slashes). - - `multipart`: If set to `None` (default), the artifact will be downloaded in parallel using multipart download if individual file size is greater than 2GB. If set to `True` or `False`, the artifact will be downloaded in parallel or serially regardless of the file size. - - - -**Returns:** - The path to the downloaded contents. - - - -**Raises:** - - - `ArtifactNotLoggedError`: If the artifact is not logged. - ---- - -### method `Artifact.file` - -```python -file(root: 'str | None' = None) → StrPath -``` - -Download a single file artifact to the directory you specify with `root`. - - - -**Args:** - - - `root`: The root directory to store the file. Defaults to `./artifacts/self.name/`. - - - -**Returns:** - The full path of the downloaded file. - - - -**Raises:** - - - `ArtifactNotLoggedError`: If the artifact is not logged. - - `ValueError`: If the artifact contains more than one file. - ---- - -### method `Artifact.files` - -```python -files(names: 'list[str] | None' = None, per_page: 'int' = 50) → ArtifactFiles -``` - -Iterate over all files stored in this artifact. - - - -**Args:** - - - `names`: The filename paths relative to the root of the artifact you wish to list. - - `per_page`: The number of files to return per request. - - - -**Returns:** - An iterator containing `File` objects. - - - -**Raises:** - - - `ArtifactNotLoggedError`: If the artifact is not logged. - ---- - -### method `Artifact.finalize` - -```python -finalize() → None -``` - -Finalize the artifact version. - -You cannot modify an artifact version once it is finalized because the artifact is logged as a specific artifact version. Create a new artifact version to log more data to an artifact. An artifact is automatically finalized when you log the artifact with `log_artifact`. - ---- - -### method `Artifact.get` - -```python -get(name: 'str') → WBValue | None -``` - -Get the WBValue object located at the artifact relative `name`. - - - -**Args:** - - - `name`: The artifact relative name to retrieve. - - - -**Returns:** - W&B object that can be logged with `run.log()` and visualized in the W&B UI. - - - -**Raises:** - - - `ArtifactNotLoggedError`: if the artifact isn't logged or the run is offline. - ---- - -### method `Artifact.get_added_local_path_name` - -```python -get_added_local_path_name(local_path: 'str') → str | None -``` - -Get the artifact relative name of a file added by a local filesystem path. - - - -**Args:** - - - `local_path`: The local path to resolve into an artifact relative name. - - - -**Returns:** - The artifact relative name. - ---- - -### method `Artifact.get_entry` - -```python -get_entry(name: 'StrPath') → ArtifactManifestEntry -``` - -Get the entry with the given name. - - - -**Args:** - - - `name`: The artifact relative name to get - - - -**Returns:** - A `W&B` object. - - - -**Raises:** - - - `ArtifactNotLoggedError`: if the artifact isn't logged or the run is offline. - - `KeyError`: if the artifact doesn't contain an entry with the given name. - ---- - -### method `Artifact.get_path` - -```python -get_path(name: 'StrPath') → ArtifactManifestEntry -``` - -Deprecated. Use `get_entry(name)`. - ---- - -### method `Artifact.is_draft` - -```python -is_draft() → bool -``` - -Check if artifact is not saved. - - - -**Returns:** - Boolean. `False` if artifact is saved. `True` if artifact is not saved. - ---- - -### method `Artifact.json_encode` - -```python -json_encode() → dict[str, Any] -``` - -Returns the artifact encoded to the JSON format. - - - -**Returns:** - A `dict` with `string` keys representing attributes of the artifact. - ---- - -### method `Artifact.link` - -```python -link(target_path: 'str', aliases: 'list[str] | None' = None) → Artifact -``` - -Link this artifact to a portfolio (a promoted collection of artifacts). - - - -**Args:** - - - `target_path`: The path to the portfolio inside a project. The target path must adhere to one of the following schemas `{portfolio}`, `{project}/{portfolio}` or `{entity}/{project}/{portfolio}`. To link the artifact to the Model Registry, rather than to a generic portfolio inside a project, set `target_path` to the following schema `{"model-registry"}/{Registered Model Name}` or `{entity}/{"model-registry"}/{Registered Model Name}`. - - `aliases`: A list of strings that uniquely identifies the artifact inside the specified portfolio. - - - -**Raises:** - - - `ArtifactNotLoggedError`: If the artifact is not logged. - - - -**Returns:** - The linked artifact. - ---- - -### method `Artifact.logged_by` - -```python -logged_by() → Run | None -``` - -Get the W&B run that originally logged the artifact. - - - -**Returns:** - The name of the W&B run that originally logged the artifact. - - - -**Raises:** - - - `ArtifactNotLoggedError`: If the artifact is not logged. - ---- - -### method `Artifact.new_draft` - -```python -new_draft() → Artifact -``` - -Create a new draft artifact with the same content as this committed artifact. - -Modifying an existing artifact creates a new artifact version known as an "incremental artifact". The artifact returned can be extended or modified and logged as a new version. - - - -**Returns:** - An `Artifact` object. - - - -**Raises:** - - - `ArtifactNotLoggedError`: If the artifact is not logged. - ---- - -### method `Artifact.new_file` - -```python -new_file( - name: 'str', - mode: 'str' = 'x', - encoding: 'str | None' = None -) → Iterator[IO] -``` - -Open a new temporary file and add it to the artifact. - - - -**Args:** - - - `name`: The name of the new file to add to the artifact. - - `mode`: The file access mode to use to open the new file. - - `encoding`: The encoding used to open the new file. - - - -**Returns:** - A new file object that can be written to. Upon closing, the file is automatically added to the artifact. - - - -**Raises:** - - - `ArtifactFinalizedError`: You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead. - ---- - -### method `Artifact.remove` - -```python -remove(item: 'StrPath | ArtifactManifestEntry') → None -``` - -Remove an item from the artifact. - - - -**Args:** - - - `item`: The item to remove. Can be a specific manifest entry or the name of an artifact-relative path. If the item matches a directory all items in that directory will be removed. - - - -**Raises:** - - - `ArtifactFinalizedError`: You cannot make changes to the current artifact version because it is finalized. Log a new artifact version instead. - - `FileNotFoundError`: If the item isn't found in the artifact. - ---- - -### method `Artifact.save` - -```python -save( - project: 'str | None' = None, - settings: 'wandb.Settings | None' = None -) → None -``` - -Persist any changes made to the artifact. - -If currently in a run, that run will log this artifact. If not currently in a run, a run of type "auto" is created to track this artifact. - - - -**Args:** - - - `project`: A project to use for the artifact in the case that a run is not already in context. - - `settings`: A settings object to use when initializing an automatic run. Most commonly used in testing harness. - ---- - -### method `Artifact.unlink` - -```python -unlink() → None -``` - -Unlink this artifact if it is currently a member of a promoted collection of artifacts. - - - -**Raises:** - - - `ArtifactNotLoggedError`: If the artifact is not logged. - - `ValueError`: If the artifact is not linked, in other words, it is not a member of a portfolio collection. - ---- - -### method `Artifact.used_by` - -```python -used_by() → list[Run] -``` - -Get a list of the runs that have used this artifact and its linked artifacts. - - - -**Returns:** - A list of `Run` objects. - - - -**Raises:** - - - `ArtifactNotLoggedError`: If the artifact is not logged. - ---- - -### method `Artifact.verify` - -```python -verify(root: 'str | None' = None) → None -``` - -Verify that the contents of an artifact match the manifest. - -All files in the directory are checksummed and the checksums are then cross-referenced against the artifact's manifest. References are not verified. - - - -**Args:** - - - `root`: The directory to verify. If None artifact will be downloaded to './artifacts/self.name/'. - - - -**Raises:** - - - `ArtifactNotLoggedError`: If the artifact is not logged. - - `ValueError`: If the verification fails. - ---- - -### method `Artifact.wait` - -```python -wait(timeout: 'int | None' = None) → Artifact -``` - -If needed, wait for this artifact to finish logging. - - - -**Args:** - - - `timeout`: The time, in seconds, to wait. - - - -**Returns:** - An `Artifact` object. - diff --git a/content/en/ref/python/experiments/Run.md b/content/en/ref/python/experiments/Run.md deleted file mode 100644 index d2dc6b1849..0000000000 --- a/content/en/ref/python/experiments/Run.md +++ /dev/null @@ -1,1165 +0,0 @@ ---- -title: Run -namespace: python_sdk_actions -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/sdk/wandb_run.py >}} - - - - -## class `Run` -A unit of computation logged by W&B. Typically, this is an ML experiment. - -Call [`wandb.init()`](https://docs.wandb.ai/ref/python/init/) to create a new run. `wandb.init()` starts a new run and returns a `wandb.Run` object. Each run is associated with a unique ID (run ID). W&B recommends using a context (`with` statement) manager to automatically finish the run. - -For distributed training experiments, you can either track each process separately using one run per process or track all processes to a single run. See [Log distributed training experiments](https://docs.wandb.ai/guides/track/log/distributed-training) for more information. - -You can log data to a run with `wandb.Run.log()`. Anything you log using `wandb.Run.log()` is sent to that run. See [Create an experiment](https://docs.wandb.ai/guides/track/launch) or [`wandb.init`](https://docs.wandb.ai/ref/python/init/) API reference page or more information. - -There is a another `Run` object in the [`wandb.apis.public`](https://docs.wandb.ai/ref/python/public-api/api/) namespace. Use this object is to interact with runs that have already been created. - - - -**Attributes:** - - - `summary`: (Summary) A summary of the run, which is a dictionary-like object. For more information, see - - `[Log summary metrics](https`: //docs.wandb.ai/guides/track/log/log-summary/). - - - -**Examples:** - Create a run with `wandb.init()`: - -```python -import wandb - -# Start a new run and log some data -# Use context manager (`with` statement) to automatically finish the run -with wandb.init(entity="entity", project="project") as run: - run.log({"accuracy": acc, "loss": loss}) -``` - - -### property Run.config - -Config object associated with this run. - - - -**Returns:** - - `wandb_config.Config`: The config property value. ---- - -### property Run.config_static - -Static config object associated with this run. - - - -**Returns:** - - `wandb_config.ConfigStatic`: The config_static property value. ---- - -### property Run.dir - -The directory where files associated with the run are saved. - - - -**Returns:** - - `str`: The dir property value. ---- - -### property Run.disabled - -True if the run is disabled, False otherwise. - - - -**Returns:** - - `bool`: The disabled property value. ---- - -### property Run.entity - -The name of the W&B entity associated with the run. - -Entity can be a username or the name of a team or organization. - - - -**Returns:** - - `str`: The entity property value. ---- - -### property Run.group - -Returns the name of the group associated with this run. - -Grouping runs together allows related experiments to be organized and visualized collectively in the W&B UI. This is especially useful for scenarios such as distributed training or cross-validation, where multiple runs should be viewed and managed as a unified experiment. - -In shared mode, where all processes share the same run object, setting a group is usually unnecessary, since there is only one run and no grouping is required. - - - -**Returns:** - - `str`: The group property value. ---- - -### property Run.id - -Identifier for this run. - - - -**Returns:** - - `str`: The id property value. ---- - -### property Run.job_type - -Name of the job type associated with the run. - -View a run's job type in the run's Overview page in the W&B App. - -You can use this to categorize runs by their job type, such as "training", "evaluation", or "inference". This is useful for organizing and filtering runs in the W&B UI, especially when you have multiple runs with different job types in the same project. For more information, see [Organize runs](https://docs.wandb.ai/guides/runs/#organize-runs). - - - -**Returns:** - - `str`: The job_type property value. ---- - -### property Run.name - -Display name of the run. - -Display names are not guaranteed to be unique and may be descriptive. By default, they are randomly generated. - - - -**Returns:** - - `str | None`: The name property value. ---- - -### property Run.notes - -Notes associated with the run, if there are any. - -Notes can be a multiline string and can also use markdown and latex equations inside `$$`, like `$x + 3$`. - - - -**Returns:** - - `str | None`: The notes property value. ---- - -### property Run.offline - -True if the run is offline, False otherwise. - - - -**Returns:** - - `bool`: The offline property value. ---- - -### property Run.path - -Path to the run. - -Run paths include entity, project, and run ID, in the format `entity/project/run_id`. - - - -**Returns:** - - `str`: The path property value. ---- - -### property Run.project - -Name of the W&B project associated with the run. - - - -**Returns:** - - `str`: The project property value. ---- - -### property Run.project_url - -URL of the W&B project associated with the run, if there is one. - -Offline runs do not have a project URL. - - - -**Returns:** - - `str | None`: The project_url property value. ---- - -### property Run.resumed - -True if the run was resumed, False otherwise. - - - -**Returns:** - - `bool`: The resumed property value. ---- - -### property Run.settings - -A frozen copy of run's Settings object. - - - -**Returns:** - - `Settings`: The settings property value. ---- - -### property Run.start_time - -Unix timestamp (in seconds) of when the run started. - - - -**Returns:** - - `float`: The start_time property value. ---- - - - -### property Run.sweep_id - -Identifier for the sweep associated with the run, if there is one. - - - -**Returns:** - - `str | None`: The sweep_id property value. ---- - -### property Run.sweep_url - -URL of the sweep associated with the run, if there is one. - -Offline runs do not have a sweep URL. - - - -**Returns:** - - `str | None`: The sweep_url property value. ---- - -### property Run.tags - -Tags associated with the run, if there are any. - - - -**Returns:** - - `tuple | None`: The tags property value. ---- - -### property Run.url - -The url for the W&B run, if there is one. - -Offline runs will not have a url. - - - - - -**Returns:** - - `str | None`: The url property value. ---- - -### method `Run.alert` - -```python -alert( - title: 'str', - text: 'str', - level: 'str | AlertLevel | None' = None, - wait_duration: 'int | float | timedelta | None' = None -) → None -``` - -Create an alert with the given title and text. - - - -**Args:** - - - `title`: The title of the alert, must be less than 64 characters long. - - `text`: The text body of the alert. - - `level`: The alert level to use, either: `INFO`, `WARN`, or `ERROR`. - - `wait_duration`: The time to wait (in seconds) before sending another alert with this title. - ---- - -### method `Run.define_metric` - -```python -define_metric( - name: 'str', - step_metric: 'str | wandb_metric.Metric | None' = None, - step_sync: 'bool | None' = None, - hidden: 'bool | None' = None, - summary: 'str | None' = None, - goal: 'str | None' = None, - overwrite: 'bool | None' = None -) → wandb_metric.Metric -``` - -Customize metrics logged with `wandb.Run.log()`. - - - -**Args:** - - - `name`: The name of the metric to customize. - - `step_metric`: The name of another metric to serve as the X-axis for this metric in automatically generated charts. - - `step_sync`: Automatically insert the last value of step_metric into `wandb.Run.log()` if it is not provided explicitly. Defaults to True if step_metric is specified. - - `hidden`: Hide this metric from automatic plots. - - `summary`: Specify aggregate metrics added to summary. Supported aggregations include "min", "max", "mean", "last", "first", "best", "copy" and "none". "none" prevents a summary from being generated. "best" is used together with the goal parameter, "best" is deprecated and should not be used, use "min" or "max" instead. "copy" is deprecated and should not be used. - - `goal`: Specify how to interpret the "best" summary type. Supported options are "minimize" and "maximize". "goal" is deprecated and should not be used, use "min" or "max" instead. - - `overwrite`: If false, then this call is merged with previous `define_metric` calls for the same metric by using their values for any unspecified parameters. If true, then unspecified parameters overwrite values specified by previous calls. - - - -**Returns:** - An object that represents this call but can otherwise be discarded. - ---- - -### method `Run.display` - -```python -display(height: 'int' = 420, hidden: 'bool' = False) → bool -``` - -Display this run in Jupyter. - ---- - -### method `Run.finish` - -```python -finish(exit_code: 'int | None' = None, quiet: 'bool | None' = None) → None -``` - -Finish a run and upload any remaining data. - -Marks the completion of a W&B run and ensures all data is synced to the server. The run's final state is determined by its exit conditions and sync status. - -Run States: -- Running: Active run that is logging data and/or sending heartbeats. -- Crashed: Run that stopped sending heartbeats unexpectedly. -- Finished: Run completed successfully (`exit_code=0`) with all data synced. -- Failed: Run completed with errors (`exit_code!=0`). -- Killed: Run was forcibly stopped before it could finish. - - - -**Args:** - - - `exit_code`: Integer indicating the run's exit status. Use 0 for success, any other value marks the run as failed. - - `quiet`: Deprecated. Configure logging verbosity using `wandb.Settings(quiet=...)`. - ---- - -### method `Run.finish_artifact` - -```python -finish_artifact( - artifact_or_path: 'Artifact | str', - name: 'str | None' = None, - type: 'str | None' = None, - aliases: 'list[str] | None' = None, - distributed_id: 'str | None' = None -) → Artifact -``` - -Finishes a non-finalized artifact as output of a run. - -Subsequent "upserts" with the same distributed ID will result in a new version. - - - -**Args:** - - - `artifact_or_path`: A path to the contents of this artifact, can be in the following forms: - - `/local/directory` - - `/local/directory/file.txt` - - `s3://bucket/path` You can also pass an Artifact object created by calling `wandb.Artifact`. - - `name`: An artifact name. May be prefixed with entity/project. Valid names can be in the following forms: - - name:version - - name:alias - - digest This will default to the basename of the path prepended with the current run id if not specified. - - `type`: The type of artifact to log, examples include `dataset`, `model` - - `aliases`: Aliases to apply to this artifact, defaults to `["latest"]` - - `distributed_id`: Unique string that all distributed jobs share. If None, defaults to the run's group name. - - - -**Returns:** - An `Artifact` object. - ---- - - - - -### method `Run.link_artifact` - -```python -link_artifact( - artifact: 'Artifact', - target_path: 'str', - aliases: 'list[str] | None' = None -) → Artifact -``` - -Link the given artifact to a portfolio (a promoted collection of artifacts). - -Linked artifacts are visible in the UI for the specified portfolio. - - - -**Args:** - - - `artifact`: the (public or local) artifact which will be linked - - `target_path`: `str` - takes the following forms: `{portfolio}`, `{project}/{portfolio}`, or `{entity}/{project}/{portfolio}` - - `aliases`: `List[str]` - optional alias(es) that will only be applied on this linked artifact inside the portfolio. The alias "latest" will always be applied to the latest version of an artifact that is linked. - - - -**Returns:** - The linked artifact. - ---- - -### method `Run.link_model` - -```python -link_model( - path: 'StrPath', - registered_model_name: 'str', - name: 'str | None' = None, - aliases: 'list[str] | None' = None -) → Artifact | None -``` - -Log a model artifact version and link it to a registered model in the model registry. - -Linked model versions are visible in the UI for the specified registered model. - -This method will: -- Check if 'name' model artifact has been logged. If so, use the artifact version that matches the files located at 'path' or log a new version. Otherwise log files under 'path' as a new model artifact, 'name' of type 'model'. -- Check if registered model with name 'registered_model_name' exists in the 'model-registry' project. If not, create a new registered model with name 'registered_model_name'. -- Link version of model artifact 'name' to registered model, 'registered_model_name'. -- Attach aliases from 'aliases' list to the newly linked model artifact version. - - - -**Args:** - - - `path`: (str) A path to the contents of this model, can be in the following forms: - - `/local/directory` - - `/local/directory/file.txt` - - `s3://bucket/path` - - `registered_model_name`: The name of the registered model that the model is to be linked to. A registered model is a collection of model versions linked to the model registry, typically representing a team's specific ML Task. The entity that this registered model belongs to will be derived from the run. - - `name`: The name of the model artifact that files in 'path' will be logged to. This will default to the basename of the path prepended with the current run id if not specified. - - `aliases`: Aliases that will only be applied on this linked artifact inside the registered model. The alias "latest" will always be applied to the latest version of an artifact that is linked. - - - -**Raises:** - - - `AssertionError`: If registered_model_name is a path or if model artifact 'name' is of a type that does not contain the substring 'model'. - - `ValueError`: If name has invalid special characters. - - - -**Returns:** - The linked artifact if linking was successful, otherwise `None`. - ---- - -### method `Run.log` - -```python -log( - data: 'dict[str, Any]', - step: 'int | None' = None, - commit: 'bool | None' = None -) → None -``` - -Upload run data. - -Use `log` to log data from runs, such as scalars, images, video, histograms, plots, and tables. See [Log objects and media](https://docs.wandb.ai/guides/track/log) for code snippets, best practices, and more. - -Basic usage: - -```python -import wandb - -with wandb.init() as run: - run.log({"train-loss": 0.5, "accuracy": 0.9}) -``` - -The previous code snippet saves the loss and accuracy to the run's history and updates the summary values for these metrics. - -Visualize logged data in a workspace at [wandb.ai](https://wandb.ai), or locally on a [self-hosted instance](https://docs.wandb.ai/guides/hosting) of the W&B app, or export data to visualize and explore locally, such as in a Jupyter notebook, with the [Public API](https://docs.wandb.ai/guides/track/public-api-guide). - -Logged values don't have to be scalars. You can log any [W&B supported Data Type](https://docs.wandb.ai/ref/python/data-types/) such as images, audio, video, and more. For example, you can use `wandb.Table` to log structured data. See [Log tables, visualize and query data](https://docs.wandb.ai/guides/models/tables/tables-walkthrough) tutorial for more details. - -W&B organizes metrics with a forward slash (`/`) in their name into sections named using the text before the final slash. For example, the following results in two sections named "train" and "validate": - -```python -with wandb.init() as run: - # Log metrics in the "train" section. - run.log( - { - "train/accuracy": 0.9, - "train/loss": 30, - "validate/accuracy": 0.8, - "validate/loss": 20, - } - ) -``` - -Only one level of nesting is supported; `run.log({"a/b/c": 1})` produces a section named "a/b". - -`run.log()` is not intended to be called more than a few times per second. For optimal performance, limit your logging to once every N iterations, or collect data over multiple iterations and log it in a single step. - -By default, each call to `log` creates a new "step". The step must always increase, and it is not possible to log to a previous step. You can use any metric as the X axis in charts. See [Custom log axes](https://docs.wandb.ai/guides/track/log/customize-logging-axes/) for more details. - -In many cases, it is better to treat the W&B step like you'd treat a timestamp rather than a training step. - -```python -with wandb.init() as run: - # Example: log an "epoch" metric for use as an X axis. - run.log({"epoch": 40, "train-loss": 0.5}) -``` - -It is possible to use multiple `wandb.Run.log()` invocations to log to the same step with the `step` and `commit` parameters. The following are all equivalent: - -```python -with wandb.init() as run: - # Normal usage: - run.log({"train-loss": 0.5, "accuracy": 0.8}) - run.log({"train-loss": 0.4, "accuracy": 0.9}) - - # Implicit step without auto-incrementing: - run.log({"train-loss": 0.5}, commit=False) - run.log({"accuracy": 0.8}) - run.log({"train-loss": 0.4}, commit=False) - run.log({"accuracy": 0.9}) - - # Explicit step: - run.log({"train-loss": 0.5}, step=current_step) - run.log({"accuracy": 0.8}, step=current_step) - current_step += 1 - run.log({"train-loss": 0.4}, step=current_step) - run.log({"accuracy": 0.9}, step=current_step) -``` - - - -**Args:** - - - `data`: A `dict` with `str` keys and values that are serializable - - `Python objects including`: `int`, `float` and `string`; any of the `wandb.data_types`; lists, tuples and NumPy arrays of serializable Python objects; other `dict`s of this structure. - - `step`: The step number to log. If `None`, then an implicit auto-incrementing step is used. See the notes in the description. - - `commit`: If true, finalize and upload the step. If false, then accumulate data for the step. See the notes in the description. If `step` is `None`, then the default is `commit=True`; otherwise, the default is `commit=False`. - - - -**Examples:** - For more and more detailed examples, see [our guides to logging](https://docs.wandb.com/guides/track/log). - -Basic usage - -```python -import wandb - -with wandb.init() as run: - run.log({"train-loss": 0.5, "accuracy": 0.9 -``` - -Incremental logging - -```python -import wandb - -with wandb.init() as run: - run.log({"loss": 0.2}, commit=False) - # Somewhere else when I'm ready to report this step: - run.log({"accuracy": 0.8}) -``` - -Histogram - -```python -import numpy as np -import wandb - -# sample gradients at random from normal distribution -gradients = np.random.randn(100, 100) -with wandb.init() as run: - run.log({"gradients": wandb.Histogram(gradients)}) -``` - -Image from NumPy - -```python -import numpy as np -import wandb - -with wandb.init() as run: - examples = [] - for i in range(3): - pixels = np.random.randint(low=0, high=256, size=(100, 100, 3)) - image = wandb.Image(pixels, caption=f"random field {i}") - examples.append(image) - run.log({"examples": examples}) -``` - -Image from PIL - -```python -import numpy as np -from PIL import Image as PILImage -import wandb - -with wandb.init() as run: - examples = [] - for i in range(3): - pixels = np.random.randint( - low=0, - high=256, - size=(100, 100, 3), - dtype=np.uint8, - ) - pil_image = PILImage.fromarray(pixels, mode="RGB") - image = wandb.Image(pil_image, caption=f"random field {i}") - examples.append(image) - run.log({"examples": examples}) -``` - -Video from NumPy - -```python -import numpy as np -import wandb - -with wandb.init() as run: - # axes are (time, channel, height, width) - frames = np.random.randint( - low=0, - high=256, - size=(10, 3, 100, 100), - dtype=np.uint8, - ) - run.log({"video": wandb.Video(frames, fps=4)}) -``` - -Matplotlib plot - -```python -from matplotlib import pyplot as plt -import numpy as np -import wandb - -with wandb.init() as run: - fig, ax = plt.subplots() - x = np.linspace(0, 10) - y = x * x - ax.plot(x, y) # plot y = x^2 - run.log({"chart": fig}) -``` - -PR Curve - -```python -import wandb - -with wandb.init() as run: - run.log({"pr": wandb.plot.pr_curve(y_test, y_probas, labels)}) -``` - -3D Object - -```python -import wandb - -with wandb.init() as run: - run.log( - { - "generated_samples": [ - wandb.Object3D(open("sample.obj")), - wandb.Object3D(open("sample.gltf")), - wandb.Object3D(open("sample.glb")), - ] - } - ) -``` - - - -**Raises:** - - - `wandb.Error`: If called before `wandb.init()`. - - `ValueError`: If invalid data is passed. - ---- - -### method `Run.log_artifact` - -```python -log_artifact( - artifact_or_path: 'Artifact | StrPath', - name: 'str | None' = None, - type: 'str | None' = None, - aliases: 'list[str] | None' = None, - tags: 'list[str] | None' = None -) → Artifact -``` - -Declare an artifact as an output of a run. - - - -**Args:** - - - `artifact_or_path`: (str or Artifact) A path to the contents of this artifact, can be in the following forms: - - `/local/directory` - - `/local/directory/file.txt` - - `s3://bucket/path` You can also pass an Artifact object created by calling `wandb.Artifact`. - - `name`: (str, optional) An artifact name. Valid names can be in the following forms: - - name:version - - name:alias - - digest This will default to the basename of the path prepended with the current run id if not specified. - - `type`: (str) The type of artifact to log, examples include `dataset`, `model` - - `aliases`: (list, optional) Aliases to apply to this artifact, defaults to `["latest"]` - - `tags`: (list, optional) Tags to apply to this artifact, if any. - - - -**Returns:** - An `Artifact` object. - ---- - -### method `Run.log_code` - -```python -log_code( - root: 'str | None' = '.', - name: 'str | None' = None, - include_fn: 'Callable[[str, str], bool] | Callable[[str], bool]' = , - exclude_fn: 'Callable[[str, str], bool] | Callable[[str], bool]' = -) → Artifact | None -``` - -Save the current state of your code to a W&B Artifact. - -By default, it walks the current directory and logs all files that end with `.py`. - - - -**Args:** - - - `root`: The relative (to `os.getcwd()`) or absolute path to recursively find code from. - - `name`: (str, optional) The name of our code artifact. By default, we'll name the artifact `source-$PROJECT_ID-$ENTRYPOINT_RELPATH`. There may be scenarios where you want many runs to share the same artifact. Specifying name allows you to achieve that. - - `include_fn`: A callable that accepts a file path and (optionally) root path and returns True when it should be included and False otherwise. This - - `defaults to `lambda path, root`: path.endswith(".py")`. - - `exclude_fn`: A callable that accepts a file path and (optionally) root path and returns `True` when it should be excluded and `False` otherwise. This defaults to a function that excludes all files within `/.wandb/` and `/wandb/` directories. - - - -**Examples:** - Basic usage - -```python -import wandb - -with wandb.init() as run: - run.log_code() -``` - -Advanced usage - -```python -import wandb - -with wandb.init() as run: - run.log_code( - root="../", - include_fn=lambda path: path.endswith(".py") or path.endswith(".ipynb"), - exclude_fn=lambda path, root: os.path.relpath(path, root).startswith( - "cache/" - ), - ) -``` - - - -**Returns:** - An `Artifact` object if code was logged - ---- - -### method `Run.log_model` - -```python -log_model( - path: 'StrPath', - name: 'str | None' = None, - aliases: 'list[str] | None' = None -) → None -``` - -Logs a model artifact containing the contents inside the 'path' to a run and marks it as an output to this run. - -The name of model artifact can only contain alphanumeric characters, underscores, and hyphens. - - - -**Args:** - - - `path`: (str) A path to the contents of this model, can be in the following forms: - - `/local/directory` - - `/local/directory/file.txt` - - `s3://bucket/path` - - `name`: A name to assign to the model artifact that the file contents will be added to. This will default to the basename of the path prepended with the current run id if not specified. - - `aliases`: Aliases to apply to the created model artifact, defaults to `["latest"]` - - - -**Raises:** - - - `ValueError`: If name has invalid special characters. - - - -**Returns:** - None - ---- - -### method `Run.mark_preempting` - -```python -mark_preempting() → None -``` - -Mark this run as preempting. - -Also tells the internal process to immediately report this to server. - ---- - - -### method `Run.restore` - -```python -restore( - name: 'str', - run_path: 'str | None' = None, - replace: 'bool' = False, - root: 'str | None' = None -) → None | TextIO -``` - -Download the specified file from cloud storage. - -File is placed into the current directory or run directory. By default, will only download the file if it doesn't already exist. - - - -**Args:** - - - `name`: The name of the file. - - `run_path`: Optional path to a run to pull files from, i.e. `username/project_name/run_id` if wandb.init has not been called, this is required. - - `replace`: Whether to download the file even if it already exists locally - - `root`: The directory to download the file to. Defaults to the current directory or the run directory if wandb.init was called. - - - -**Returns:** - None if it can't find the file, otherwise a file object open for reading. - - - -**Raises:** - - - `CommError`: If W&B can't connect to the W&B backend. - - `ValueError`: If the file is not found or can't find run_path. - ---- - -### method `Run.save` - -```python -save( - glob_str: 'str | os.PathLike', - base_path: 'str | os.PathLike | None' = None, - policy: 'PolicyName' = 'live' -) → bool | list[str] -``` - -Sync one or more files to W&B. - -Relative paths are relative to the current working directory. - -A Unix glob, such as "myfiles/*", is expanded at the time `save` is called regardless of the `policy`. In particular, new files are not picked up automatically. - -A `base_path` may be provided to control the directory structure of uploaded files. It should be a prefix of `glob_str`, and the directory structure beneath it is preserved. - -When given an absolute path or glob and no `base_path`, one directory level is preserved as in the example above. - - - -**Args:** - - - `glob_str`: A relative or absolute path or Unix glob. - - `base_path`: A path to use to infer a directory structure; see examples. - - `policy`: One of `live`, `now`, or `end`. - - live: upload the file as it changes, overwriting the previous version - - now: upload the file once now - - end: upload file when the run ends - - - -**Returns:** - Paths to the symlinks created for the matched files. - -For historical reasons, this may return a boolean in legacy code. - -```python -import wandb - -run = wandb.init() - -run.save("these/are/myfiles/*") -# => Saves files in a "these/are/myfiles/" folder in the run. - -run.save("these/are/myfiles/*", base_path="these") -# => Saves files in an "are/myfiles/" folder in the run. - -run.save("/User/username/Documents/run123/*.txt") -# => Saves files in a "run123/" folder in the run. See note below. - -run.save("/User/username/Documents/run123/*.txt", base_path="/User") -# => Saves files in a "username/Documents/run123/" folder in the run. - -run.save("files/*/saveme.txt") -# => Saves each "saveme.txt" file in an appropriate subdirectory -# of "files/". - -# Explicitly finish the run since a context manager is not used. -run.finish() -``` - ---- - -### method `Run.status` - -```python -status() → RunStatus -``` - -Get sync info from the internal backend, about the current run's sync status. - ---- - - -### method `Run.unwatch` - -```python -unwatch( - models: 'torch.nn.Module | Sequence[torch.nn.Module] | None' = None -) → None -``` - -Remove pytorch model topology, gradient and parameter hooks. - - - -**Args:** - - - `models`: Optional list of pytorch models that have had watch called on them. - ---- - -### method `Run.upsert_artifact` - -```python -upsert_artifact( - artifact_or_path: 'Artifact | str', - name: 'str | None' = None, - type: 'str | None' = None, - aliases: 'list[str] | None' = None, - distributed_id: 'str | None' = None -) → Artifact -``` - -Declare (or append to) a non-finalized artifact as output of a run. - -Note that you must call run.finish_artifact() to finalize the artifact. This is useful when distributed jobs need to all contribute to the same artifact. - - - -**Args:** - - - `artifact_or_path`: A path to the contents of this artifact, can be in the following forms: - - `/local/directory` - - `/local/directory/file.txt` - - `s3://bucket/path` - - `name`: An artifact name. May be prefixed with "entity/project". Defaults to the basename of the path prepended with the current run ID if not specified. Valid names can be in the following forms: - - name:version - - name:alias - - digest - - `type`: The type of artifact to log. Common examples include `dataset`, `model`. - - `aliases`: Aliases to apply to this artifact, defaults to `["latest"]`. - - `distributed_id`: Unique string that all distributed jobs share. If None, defaults to the run's group name. - - - -**Returns:** - An `Artifact` object. - ---- - -### method `Run.use_artifact` - -```python -use_artifact( - artifact_or_name: 'str | Artifact', - type: 'str | None' = None, - aliases: 'list[str] | None' = None, - use_as: 'str | None' = None -) → Artifact -``` - -Declare an artifact as an input to a run. - -Call `download` or `file` on the returned object to get the contents locally. - - - -**Args:** - - - `artifact_or_name`: The name of the artifact to use. May be prefixed with the name of the project the artifact was logged to ("" or "/"). If no entity is specified in the name, the Run or API setting's entity is used. Valid names can be in the following forms - - name:version - - name:alias - - `type`: The type of artifact to use. - - `aliases`: Aliases to apply to this artifact - - `use_as`: This argument is deprecated and does nothing. - - - -**Returns:** - An `Artifact` object. - - - -**Examples:** - ```python -import wandb - -run = wandb.init(project="") - -# Use an artifact by name and alias -artifact_a = run.use_artifact(artifact_or_name=":") - -# Use an artifact by name and version -artifact_b = run.use_artifact(artifact_or_name=":v") - -# Use an artifact by entity/project/name:alias -artifact_c = run.use_artifact( - artifact_or_name="//:" -) - -# Use an artifact by entity/project/name:version -artifact_d = run.use_artifact( - artifact_or_name="//:v" -) - -# Explicitly finish the run since a context manager is not used. -run.finish() -``` - ---- - -### method `Run.use_model` - -```python -use_model(name: 'str') → FilePathStr -``` - -Download the files logged in a model artifact 'name'. - - - -**Args:** - - - `name`: A model artifact name. 'name' must match the name of an existing logged model artifact. May be prefixed with `entity/project/`. Valid names can be in the following forms - - model_artifact_name:version - - model_artifact_name:alias - - - -**Returns:** - - - `path` (str): Path to downloaded model artifact file(s). - - - -**Raises:** - - - `AssertionError`: If model artifact 'name' is of a type that does not contain the substring 'model'. - ---- - -### method `Run.watch` - -```python -watch( - models: 'torch.nn.Module | Sequence[torch.nn.Module]', - criterion: 'torch.F | None' = None, - log: "Literal['gradients', 'parameters', 'all'] | None" = 'gradients', - log_freq: 'int' = 1000, - idx: 'int | None' = None, - log_graph: 'bool' = False -) → None -``` - -Hook into given PyTorch model to monitor gradients and the model's computational graph. - -This function can track parameters, gradients, or both during training. - - - -**Args:** - - - `models`: A single model or a sequence of models to be monitored. - - `criterion`: The loss function being optimized (optional). - - `log`: Specifies whether to log "gradients", "parameters", or "all". Set to None to disable logging. (default="gradients"). - - `log_freq`: Frequency (in batches) to log gradients and parameters. (default=1000) - - `idx`: Index used when tracking multiple models with `wandb.watch`. (default=None) - - `log_graph`: Whether to log the model's computational graph. (default=False) - - - -**Raises:** - ValueError: If `wandb.init()` has not been called or if any of the models are not instances of `torch.nn.Module`. - diff --git a/content/en/ref/python/experiments/Settings.md b/content/en/ref/python/experiments/Settings.md deleted file mode 100644 index adaff54f9c..0000000000 --- a/content/en/ref/python/experiments/Settings.md +++ /dev/null @@ -1,673 +0,0 @@ ---- -title: Settings -namespace: python_sdk_actions -python_object_type: class ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/sdk/wandb_settings.py >}} - - - -## class `Settings` -Settings for the W&B SDK. - -This class manages configuration settings for the W&B SDK, -ensuring type safety and validation of all settings. Settings are accessible -as attributes and can be initialized programmatically, through environment -variables (`WANDB_ prefix`), and with configuration files. - -The settings are organized into three categories: -1. Public settings: Core configuration options that users can safely modify to customize - W&B's behavior for their specific needs. -2. Internal settings: Settings prefixed with 'x_' that handle low-level SDK behavior. - These settings are primarily for internal use and debugging. While they can be modified, - they are not considered part of the public API and may change without notice in future - versions. -3. Computed settings: Read-only settings that are automatically derived from other settings or - the environment. - - -### method `Settings.__init__` - -```python -__init__( - allow_offline_artifacts: 'bool' = True, - allow_val_change: 'bool' = False, - anonymous: 'Literal['must', 'allow', 'never'] | None' = None, - api_key: 'str | None' = None, - azure_account_url_to_access_key: 'dict[str, str] | None' = None, - base_url: 'str' = 'https://api.wandb.ai', - code_dir: 'str | None' = None, - config_paths: 'Sequence | None' = None, - console: 'Literal['auto', 'off', 'wrap', 'redirect', 'wrap_raw', 'wrap_emu']' = 'auto', - console_multipart: 'bool' = False, - credentials_file: 'str' = None, - disable_code: 'bool' = False, - disable_git: 'bool' = False, - disable_job_creation: 'bool' = True, - docker: 'str | None' = None, - email: 'str | None' = None, - entity: 'str | None' = None, - organization: 'str | None' = None, - force: 'bool' = False, - fork_from: 'RunMoment | None' = None, - git_commit: 'str | None' = None, - git_remote: 'str' = 'origin', - git_remote_url: 'str | None' = None, - git_root: 'str | None' = None, - heartbeat_seconds: 'int' = 30, - host: 'str | None' = None, - http_proxy: 'str | None' = None, - https_proxy: 'str | None' = None, - identity_token_file: 'str | None' = None, - ignore_globs: 'Sequence' = (), - init_timeout: 'float' = 90.0, - insecure_disable_ssl: 'bool' = False, - job_name: 'str | None' = None, - job_source: 'Literal['repo', 'artifact', 'image'] | None' = None, - label_disable: 'bool' = False, - launch: 'bool' = False, - launch_config_path: 'str | None' = None, - login_timeout: 'float | None' = None, - mode: 'Literal['online', 'offline', 'shared', 'disabled', 'dryrun', 'run']' = 'online', - notebook_name: 'str | None' = None, - program: 'str | None' = None, - program_abspath: 'str | None' = None, - program_relpath: 'str | None' = None, - project: 'str | None' = None, - quiet: 'bool' = False, - reinit: 'Literal['default', 'return_previous', 'finish_previous', 'create_new'] | bool' = 'default', - relogin: 'bool' = False, - resume: 'Literal['allow', 'must', 'never', 'auto'] | None' = None, - resume_from: 'RunMoment | None' = None, - resumed: 'bool' = False, - root_dir: 'str' = None, - run_group: 'str | None' = None, - run_id: 'str | None' = None, - run_job_type: 'str | None' = None, - run_name: 'str | None' = None, - run_notes: 'str | None' = None, - run_tags: 'tuple[str, Ellipsis] | None' = None, - sagemaker_disable: 'bool' = False, - save_code: 'bool | None' = None, - settings_system: 'str | None' = None, - max_end_of_run_history_metrics: 'int' = 10, - max_end_of_run_summary_metrics: 'int' = 10, - show_colors: 'bool | None' = None, - show_emoji: 'bool | None' = None, - show_errors: 'bool' = True, - show_info: 'bool' = True, - show_warnings: 'bool' = True, - silent: 'bool' = False, - start_method: 'str | None' = None, - strict: 'bool | None' = None, - summary_timeout: 'int' = 60, - summary_warnings: 'int' = 5, - sweep_id: 'str | None' = None, - sweep_param_path: 'str | None' = None, - symlink: 'bool' = None, - sync_tensorboard: 'bool | None' = None, - table_raise_on_max_row_limit_exceeded: 'bool' = False, - username: 'str | None' = None, - x_cli_only_mode: 'bool' = False, - x_disable_meta: 'bool' = False, - x_disable_stats: 'bool' = False, - x_disable_viewer: 'bool' = False, - x_disable_machine_info: 'bool' = False, - x_executable: 'str | None' = None, - x_extra_http_headers: 'dict[str, str] | None' = None, - x_file_stream_max_bytes: 'int | None' = None, - x_file_stream_max_line_bytes: 'int | None' = None, - x_file_stream_transmit_interval: 'float | None' = None, - x_file_stream_retry_max: 'int | None' = None, - x_file_stream_retry_wait_min_seconds: 'float | None' = None, - x_file_stream_retry_wait_max_seconds: 'float | None' = None, - x_file_stream_timeout_seconds: 'float | None' = None, - x_file_transfer_retry_max: 'int | None' = None, - x_file_transfer_retry_wait_min_seconds: 'float | None' = None, - x_file_transfer_retry_wait_max_seconds: 'float | None' = None, - x_file_transfer_timeout_seconds: 'float | None' = None, - x_files_dir: 'str | None' = None, - x_flow_control_custom: 'bool | None' = None, - x_flow_control_disabled: 'bool | None' = None, - x_graphql_retry_max: 'int | None' = None, - x_graphql_retry_wait_min_seconds: 'float | None' = None, - x_graphql_retry_wait_max_seconds: 'float | None' = None, - x_graphql_timeout_seconds: 'float | None' = None, - x_internal_check_process: 'float' = 8.0, - x_jupyter_name: 'str | None' = None, - x_jupyter_path: 'str | None' = None, - x_jupyter_root: 'str | None' = None, - x_label: 'str | None' = None, - x_live_policy_rate_limit: 'int | None' = None, - x_live_policy_wait_time: 'int | None' = None, - x_log_level: 'int' = 20, - x_network_buffer: 'int | None' = None, - x_primary: 'bool' = True, - x_proxies: 'dict[str, str] | None' = None, - x_runqueue_item_id: 'str | None' = None, - x_save_requirements: 'bool' = True, - x_server_side_derived_summary: 'bool' = False, - x_server_side_expand_glob_metrics: 'bool' = True, - x_service_transport: 'str | None' = None, - x_service_wait: 'float' = 30.0, - x_skip_transaction_log: 'bool' = False, - x_start_time: 'float | None' = None, - x_stats_pid: 'int' = 16976, - x_stats_sampling_interval: 'float' = 15.0, - x_stats_neuron_monitor_config_path: 'str | None' = None, - x_stats_dcgm_exporter: 'str | None' = None, - x_stats_open_metrics_endpoints: 'dict[str, str] | None' = None, - x_stats_open_metrics_filters: 'dict[str, dict[str, str]] | Sequence | None' = None, - x_stats_open_metrics_http_headers: 'dict[str, str] | None' = None, - x_stats_disk_paths: 'Sequence | None' = ('/',), - x_stats_cpu_count: 'int | None' = None, - x_stats_cpu_logical_count: 'int | None' = None, - x_stats_gpu_count: 'int | None' = None, - x_stats_gpu_type: 'str | None' = None, - x_stats_gpu_device_ids: 'Sequence | None' = None, - x_stats_buffer_size: 'int' = 0, - x_stats_coreweave_metadata_base_url: 'str' = 'http://169.254.169.254', - x_stats_coreweave_metadata_endpoint: 'str' = '/api/v2/cloud-init/meta-data', - x_stats_track_process_tree: 'bool' = False, - x_sync: 'bool' = False, - x_update_finish_state: 'bool' = True -) → None -``` - -**Args:** - - - `allow_offline_artifacts` (bool): Flag to allow table artifacts to be synced in offline mode. - To revert to the old behavior, set this to False. - - `allow_val_change` (bool): Flag to allow modification of `Config` values after they've been set. - - `anonymous` (Optional[Literal['must', 'allow', 'never']]): Controls anonymous data logging. - Possible values are: - - "never": requires you to link your W&B account before - tracking the run, so you don't accidentally create an anonymous - run. - - "allow": lets a logged-in user track runs with their account, but - lets someone who is running the script without a W&B account see - the charts in the UI. - - "must": sends the run to an anonymous account instead of to a - signed-up user account. - - `api_key` (Optional[str]): The W&B API key. - - `azure_account_url_to_access_key` (Optional[Dict[str, str]]): Mapping of Azure account URLs to their corresponding access keys for Azure integration. - - `base_url` (str): The URL of the W&B backend for data synchronization. - - `code_dir` (Optional[str]): Directory containing the code to be tracked by W&B. - - `config_paths` (Optional[Sequence]): Paths to files to load configuration from into the `Config` object. - - `console` (Literal['auto', 'off', 'wrap', 'redirect', 'wrap_raw', 'wrap_emu']): The type of console capture to be applied. - Possible values are: - "auto" - Automatically selects the console capture method based on the - system environment and settings. - "off" - Disables console capture. - "redirect" - Redirects low-level file descriptors for capturing output. - "wrap" - Overrides the write methods of sys.stdout/sys.stderr. Will be - mapped to either "wrap_raw" or "wrap_emu" based on the state of the system. - "wrap_raw" - Same as "wrap" but captures raw output directly instead of - through an emulator. Derived from the `wrap` setting and should not be set manually. - "wrap_emu" - Same as "wrap" but captures output through an emulator. - Derived from the `wrap` setting and should not be set manually. - - `console_multipart` (bool): Whether to produce multipart console log files. - - `credentials_file` (str): Path to file for writing temporary access tokens. - - `disable_code` (bool): Whether to disable capturing the code. - - `disable_git` (bool): Whether to disable capturing the git state. - - `disable_job_creation` (bool): Whether to disable the creation of a job artifact for W&B Launch. - - `docker` (Optional[str]): The Docker image used to execute the script. - - `email` (Optional[str]): The email address of the user. - - `entity` (Optional[str]): The W&B entity, such as a user or a team. - - `organization` (Optional[str]): The W&B organization. - - `force` (bool): Whether to pass the `force` flag to `wandb.login()`. - - `fork_from` (Optional[RunMoment]): Specifies a point in a previous execution of a run to fork from. - The point is defined by the run ID, a metric, and its value. - Currently, only the metric '_step' is supported. - - `git_commit` (Optional[str]): The git commit hash to associate with the run. - - `git_remote` (str): The git remote to associate with the run. - - `git_remote_url` (Optional[str]): The URL of the git remote repository. - - `git_root` (Optional[str]): Root directory of the git repository. - - - `host` (Optional[str]): Hostname of the machine running the script. - - `http_proxy` (Optional[str]): Custom proxy servers for http requests to W&B. - - `https_proxy` (Optional[str]): Custom proxy servers for https requests to W&B. - - `identity_token_file` (Optional[str]): Path to file containing an identity token (JWT) for authentication. - - `ignore_globs` (Sequence): Unix glob patterns relative to `files_dir` specifying files to exclude from upload. - - `init_timeout` (float): Time in seconds to wait for the `wandb.init` call to complete before timing out. - - `insecure_disable_ssl` (bool): Whether to insecurely disable SSL verification. - - `job_name` (Optional[str]): Name of the Launch job running the script. - - `job_source` (Optional[Literal['repo', 'artifact', 'image']]): Source type for Launch. - - `label_disable` (bool): Whether to disable automatic labeling features. - - - `launch_config_path` (Optional[str]): Path to the launch configuration file. - - `login_timeout` (Optional[float]): Time in seconds to wait for login operations before timing out. - - `mode` (Literal['online', 'offline', 'shared', 'disabled', 'dryrun', 'run']): The operating mode for W&B logging and synchronization. - - `notebook_name` (Optional[str]): Name of the notebook if running in a Jupyter-like environment. - - `program` (Optional[str]): Path to the script that created the run, if available. - - `program_abspath` (Optional[str]): The absolute path from the root repository directory to the script that - created the run. - Root repository directory is defined as the directory containing the - .git directory, if it exists. Otherwise, it's the current working directory. - - `program_relpath` (Optional[str]): The relative path to the script that created the run. - - `project` (Optional[str]): The W&B project ID. - - `quiet` (bool): Flag to suppress non-essential output. - - `reinit` (Union[Literal['default', 'return_previous', 'finish_previous', 'create_new'], bool]): What to do when `wandb.init()` is called while a run is active. - Options: - - "default": Use "finish_previous" in notebooks and "return_previous" - otherwise. - - "return_previous": Return the most recently created run - that is not yet finished. This does not update `wandb.run`; see - the "create_new" option. - - "finish_previous": Finish all active runs, then return a new run. - - "create_new": Create a new run without modifying other active runs. - Does not update `wandb.run` and top-level functions like `wandb.log`. - Because of this, some older integrations that rely on the global run - will not work. - Can also be a boolean, but this is deprecated. False is the same as - "return_previous", and True is the same as "finish_previous". - - `relogin` (bool): Flag to force a new login attempt. - - `resume` (Optional[Literal['allow', 'must', 'never', 'auto']]): Specifies the resume behavior for the run. - Options: - - "must": Resumes from an existing run with the same ID. If no such run exists, - it will result in failure. - - "allow": Attempts to resume from an existing run with the same ID. If none is - found, a new run will be created. - - "never": Always starts a new run. If a run with the same ID already exists, - it will result in failure. - - "auto": Automatically resumes from the most recent failed run on the same - machine. - - `resume_from` (Optional[RunMoment]): Specifies a point in a previous execution of a run to resume from. - The point is defined by the run ID, a metric, and its value. - Currently, only the metric '_step' is supported. - - - `root_dir` (str): The root directory to use as the base for all run-related paths. - In particular, this is used to derive the wandb directory and the run directory. - - `run_group` (Optional[str]): Group identifier for related runs. - Used for grouping runs in the UI. - - `run_id` (Optional[str]): The ID of the run. - - `run_job_type` (Optional[str]): Type of job being run (e.g., training, evaluation). - - `run_name` (Optional[str]): Human-readable name for the run. - - `run_notes` (Optional[str]): Additional notes or description for the run. - - `run_tags` (Optional[Tuple[str, Ellipsis]]): Tags to associate with the run for organization and filtering. - - `sagemaker_disable` (bool): Flag to disable SageMaker-specific functionality. - - `save_code` (Optional[bool]): Whether to save the code associated with the run. - - `settings_system` (Optional[str]): Path to the system-wide settings file. - - `max_end_of_run_history_metrics` (int): Maximum number of history sparklines to display at the end of a run. - - `max_end_of_run_summary_metrics` (int): Maximum number of summary metrics to display at the end of a run. - - - - `show_errors` (bool): Whether to display error messages. - - `show_info` (bool): Whether to display informational messages. - - `show_warnings` (bool): Whether to display warning messages. - - `silent` (bool): Flag to suppress all output. - - - `strict` (Optional[bool]): Whether to enable strict mode for validation and error checking. - - `summary_timeout` (int): Time in seconds to wait for summary operations before timing out. - - - `sweep_id` (Optional[str]): Identifier of the sweep this run belongs to. - - `sweep_param_path` (Optional[str]): Path to the sweep parameters configuration. - - `symlink` (bool): Whether to use symlinks (True by default except on Windows). - - `sync_tensorboard` (Optional[bool]): Whether to synchronize TensorBoard logs with W&B. - - `table_raise_on_max_row_limit_exceeded` (bool): Whether to raise an exception when table row limits are exceeded. - - `username` (Optional[str]): Username. - - - `x_disable_meta` (bool): Flag to disable the collection of system metadata. - - `x_disable_stats` (bool): Flag to disable the collection of system metrics. - - - - - `x_extra_http_headers` (Optional[Dict[str, str]]): Additional headers to add to all outgoing HTTP requests. - - - - - - - - - - - - - - - - - - - - - - - - `x_label` (Optional[str]): Label to assign to system metrics and console logs collected for the run. - This is used to group data by on the frontend and can be used to distinguish data - from different processes in a distributed training job. - - - - - - `x_primary` (bool): Determines whether to save internal wandb files and metadata. - In a distributed setting, this is useful for avoiding file overwrites - from secondary processes when only system metrics and logs are needed, - as the primary process handles the main logging. - - - - `x_save_requirements` (bool): Flag to save the requirements file. - - `x_server_side_derived_summary` (bool): Flag to delegate automatic computation of summary from history to the server. - This does not disable user-provided summary updates. - - - - `x_service_wait` (float): Time in seconds to wait for the wandb-core internal service to start. - - `x_skip_transaction_log` (bool): Whether to skip saving the run events to the transaction log. - This is only relevant for online runs. Can be used to reduce the amount of - data written to disk. - Should be used with caution, as it removes the gurantees about - recoverability. - - - - `x_stats_sampling_interval` (float): Sampling interval for the system monitor in seconds. - - - `x_stats_dcgm_exporter` (Optional[str]): Endpoint to extract Nvidia DCGM metrics from. - Options: - - Extract DCGM-related metrics from a query to the Prometheus `/api/v1/query` endpoint. - It is a common practice to aggregate metrics reported by the instances of the DCGM Exporter - running on different nodes in a cluster using Prometheus. - - TODO: Parse metrics directly from the `/metrics` endpoint of the DCGM Exporter. - Examples: - - `http://localhost:9400/api/v1/query?query=DCGM_FI_DEV_GPU_TEMP{node="l1337", cluster="globular"}`. - - - `x_stats_open_metrics_endpoints` (Optional[Dict[str, str]]): OpenMetrics `/metrics` endpoints to monitor for system metrics. - - `x_stats_open_metrics_filters` (Union[Dict[str, Dict[str, str]], Sequence, None]): Filter to apply to metrics collected from OpenMetrics `/metrics` endpoints. - Supports two formats: - - {"metric regex pattern, including endpoint name as prefix": {"label": "label value regex pattern"}} - - ("metric regex pattern 1", "metric regex pattern 2", ...) - - `x_stats_open_metrics_http_headers` (Optional[Dict[str, str]]): HTTP headers to add to OpenMetrics requests. - - `x_stats_disk_paths` (Optional[Sequence]): System paths to monitor for disk usage. - - `x_stats_cpu_count` (Optional[int]): System CPU count. - If set, overrides the auto-detected value in the run metadata. - - `x_stats_cpu_logical_count` (Optional[int]): Logical CPU count. - If set, overrides the auto-detected value in the run metadata. - - `x_stats_gpu_count` (Optional[int]): GPU device count. - If set, overrides the auto-detected value in the run metadata. - - `x_stats_gpu_type` (Optional[str]): GPU device type. - If set, overrides the auto-detected value in the run metadata. - - `x_stats_gpu_device_ids` (Optional[Sequence]): GPU device indices to monitor. - If not set, the system monitor captures metrics for all GPUs. - Assumes 0-based indexing matching CUDA/ROCm device enumeration. - - - - - `x_stats_track_process_tree` (bool): Monitor the entire process tree for resource usage, starting from `x_stats_pid`. - When `True`, the system monitor aggregates the RSS, CPU%, and thread count - from the process with PID `x_stats_pid` and all of its descendants. - This can have a performance overhead and is disabled by default. - - - `x_update_finish_state` (bool): Flag to indicate whether this process can update the run's final state on the server. - Set to False in distributed training when only the main process should determine the final state. - -**Returns:** - An `Settings` object. - -### classmethod `Settings.catch_private_settings` - -```python -catch_private_settings( - values -) → None -``` - -Check if a private field is provided and assign to the corresponding public one. - -This is a compatibility layer to handle previous versions of the settings. - - -### method `Settings.validate_skip_transaction_log` - -```python -validate_skip_transaction_log() → None -``` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -### classmethod `Settings.validate_run_tags` - -```python -validate_run_tags( - value -) → None -``` - -Validate run tags. - -Validates that each tag: -- Is between 1 and 64 characters in length (inclusive) -- Converts single string values to tuple format -- Preserves None values - -**Args:** - - - `value`: A string, list, tuple, or None representing tags - -**Returns:** - - tuple: A tuple of validated tags, or None - -**Raises:** - - `ValueError`: If any tag is empty or exceeds 64 characters - - ` - - -### property `Settings.colab_url` - -The URL to the Colab notebook, if running in Colab. - -**Returns:** - - `Optional[str]`: The colab_url property value. - -### property `Settings.deployment` - -### property `Settings.files_dir` - -Absolute path to the local directory where the run's files are stored. - -**Returns:** - - `str`: The files_dir property value. - -### property `Settings.is_local` - -### property `Settings.log_dir` - -The directory for storing log files. - -**Returns:** - - `str`: The log_dir property value. - -### property `Settings.log_internal` - -The path to the file to use for internal logs. - -**Returns:** - - `str`: The log_internal property value. - -### property `Settings.log_symlink_internal` - -The path to the symlink to the internal log file of the most recent run. - -**Returns:** - - `str`: The log_symlink_internal property value. - -### property `Settings.log_symlink_user` - -The path to the symlink to the user-process log file of the most recent run. - -**Returns:** - - `str`: The log_symlink_user property value. - -### property `Settings.log_user` - -The path to the file to use for user-process logs. - -**Returns:** - - `str`: The log_user property value. - -### property `Settings.project_url` - -The W&B URL where the project can be viewed. - -**Returns:** - - `str`: The project_url property value. - -### property `Settings.resume_fname` - -The path to the resume file. - -**Returns:** - - `str`: The resume_fname property value. - -### property `Settings.run_mode` - -The mode of the run. Can be either "run" or "offline-run". - -**Returns:** - - `Literal['run', 'offline-run']`: The run_mode property value. - -### property `Settings.run_url` - -The W&B URL where the run can be viewed. - -**Returns:** - - `str`: The run_url property value. - -### property `Settings.settings_workspace` - -The path to the workspace settings file. - -**Returns:** - - `str`: The settings_workspace property value. - -### property `Settings.sweep_url` - -The W&B URL where the sweep can be viewed. - -**Returns:** - - `str`: The sweep_url property value. - -### property `Settings.sync_dir` - -The directory for storing the run's files. - -**Returns:** - - `str`: The sync_dir property value. - -### property `Settings.sync_file` - -Path to the append-only binary transaction log file. - -**Returns:** - - `str`: The sync_file property value. - -### property `Settings.sync_symlink_latest` - -Path to the symlink to the most recent run's transaction log file. - -**Returns:** - - `str`: The sync_symlink_latest property value. - -### property `Settings.timespec` - -The time specification for the run. - -**Returns:** - - `str`: The timespec property value. - -### property `Settings.wandb_dir` - -Full path to the wandb directory. - -**Returns:** - - `str`: The wandb_dir property value. - -### method `Settings.update_from_system_config_file` - -```python -update_from_system_config_file() → None -``` - -Update settings from the system config file. - -### method `Settings.update_from_workspace_config_file` - -```python -update_from_workspace_config_file() → None -``` - -Update settings from the workspace config file. - -### method `Settings.update_from_env_vars` - -```python -update_from_env_vars( - environ: 'Dict[str, Any]' -) → None -``` - -Update settings from environment variables. - -### method `Settings.update_from_system_environment` - -```python -update_from_system_environment() → None -``` - -Update settings from the system environment. - -### method `Settings.update_from_dict` - -```python -update_from_dict( - settings: 'Dict[str, Any]' -) → None -``` - -Update settings from a dictionary. - -### method `Settings.update_from_settings` - -```python -update_from_settings( - settings: 'Settings' -) → None -``` - -Update settings from another instance of `Settings`. - -### method `Settings.to_proto` - -```python -to_proto() → wandb_settings_pb2.Settings -``` - -Generate a protobuf representation of the settings. diff --git a/content/en/ref/python/experiments/_index.md b/content/en/ref/python/experiments/_index.md deleted file mode 100644 index 5ab334ecfb..0000000000 --- a/content/en/ref/python/experiments/_index.md +++ /dev/null @@ -1,128 +0,0 @@ ---- -title: Experiments -module: wandb -weight: 2 -no_list: true ---- - -These classes comprise the core building blocks for tracking machine learning experiments, managing artifacts, and configuring SDK behavior. These foundational classes enable you to log metrics, store model checkpoints, version datasets, and manage experiment configurations with full reproducibility and collaboration features. - -> For more details on using these classes in ML experiments, consult the [Experiments]({{< relref "/guides/models/track/" >}}) and [Artifacts]({{< relref "/guides/core/artifacts/" >}}) docs. - -## Core Classes - -| Class | Description | -|-------|-------------| -| [`Run`](./run/) | The primary unit of computation logged by W&B, representing a single ML experiment with metrics, configurations, and outputs. | -| [`Artifact`](./artifact/) | Flexible and lightweight building block for dataset and model versioning with automatic deduplication and lineage tracking. | -| [`Settings`](./settings/) | Configuration management for the W&B SDK, controlling behavior from logging to API interactions. | - -## Getting Started - -### Track an experiment - -Create and track a machine learning experiment with metrics logging: - -```python -import wandb - -# Initialize a new run -with wandb.init(project="my-experiments", config={"learning_rate": 0.001}) as run: - # Access configuration - config = run.config - - # Log metrics during training - for epoch in range(10): - metrics = train_one_epoch() # Your training logic - run.log({ - "loss": metrics["loss"], - "accuracy": metrics["accuracy"], - "epoch": epoch - }) - - # Log summary metrics - run.summary["best_accuracy"] = max_accuracy -``` - -### Version a model artifact - -Create and log a versioned model artifact with metadata: - -```python -import wandb - -with wandb.init(project="my-models") as run: - # Train your model - model = train_model() - - # Create an artifact for the model - model_artifact = wandb.Artifact( - name="my-model", - type="model", - description="ResNet-50 trained on ImageNet subset", - metadata={ - "architecture": "ResNet-50", - "dataset": "ImageNet-1K", - "accuracy": 0.95 - } - ) - - # Add model files to the artifact - model_artifact.add_file("model.pt") - model_artifact.add_dir("model_configs/") - - # Log the artifact to W&B - run.log_artifact(model_artifact) -``` - -### Configure SDK settings - -Customize W&B SDK behavior for your specific requirements: - -```python -import wandb - -# Configure settings programmatically -wandb.Settings( - project="production-runs", - entity="my-team", - mode="offline", # Run offline, sync later - save_code=True, # Save source code - quiet=True # Reduce console output -) - -# Or use environment variables -# export WANDB_PROJECT=production-runs -# export WANDB_MODE=offline - -# Initialize with custom settings -with wandb.init() as run: - # Your experiment code here - pass -``` - -### Link artifacts for lineage tracking - -Track relationships between datasets, models, and evaluations: - -```python -import wandb - -with wandb.init(project="ml-pipeline") as run: - # Use a dataset artifact - dataset = run.use_artifact("dataset:v1") - dataset_dir = dataset.download() - - # Train model using the dataset - model = train_on_dataset(dataset_dir) - - # Create model artifact with dataset lineage - model_artifact = wandb.Artifact( - name="trained-model", - type="model" - ) - model_artifact.add_file("model.pt") - - # Log with automatic lineage tracking - run.log_artifact(model_artifact) -``` diff --git a/content/en/ref/python/experiments/system-metrics.md b/content/en/ref/python/experiments/system-metrics.md deleted file mode 100644 index 1ea2ca7db3..0000000000 --- a/content/en/ref/python/experiments/system-metrics.md +++ /dev/null @@ -1,320 +0,0 @@ ---- -description: Metrics automatically logged by W&B. -title: System Metrics Reference -aliases: -- /guides/models/app/settings-page/system-metrics/ -- /guides/ref/system-metrics ---- - -This page provides detailed information about the system metrics that are tracked by the W&B SDK. - -{{% alert %}} -`wandb` automatically logs system metrics every 15 seconds. -{{% /alert %}} - -## CPU - -### Process CPU Percent (CPU) -Percentage of CPU usage by the process, normalized by the number of available CPUs. - -W&B assigns a `cpu` tag to this metric. - -### Process CPU Threads -The number of threads utilized by the process. - -W&B assigns a `proc.cpu.threads` tag to this metric. - - - -## Disk - -By default, the usage metrics are collected for the `/` path. To configure the paths to be monitored, use the following setting: - -```python -run = wandb.init( - settings=wandb.Settings( - x_stats_disk_paths=("/System/Volumes/Data", "/home", "/mnt/data"), - ), -) -``` - -### Disk Usage Percent -Represents the total system disk usage in percentage for specified paths. - -W&B assigns a `disk.{path}.usagePercent` tag to this metric. - -### Disk Usage -Represents the total system disk usage in gigabytes (GB) for specified paths. -The paths that are accessible are sampled, and the disk usage (in GB) for each path is appended to the samples. - -W&B assigns a `disk.{path}.usageGB` tag to this metric. - -### Disk In -Indicates the total system disk read in megabytes (MB). -The initial disk read bytes are recorded when the first sample is taken. Subsequent samples calculate the difference between the current read bytes and the initial value. - -W&B assigns a `disk.in` tag to this metric. - -### Disk Out -Represents the total system disk write in megabytes (MB). -Similar to [Disk In]({{< relref "#disk-in" >}}), the initial disk write bytes are recorded when the first sample is taken. Subsequent samples calculate the difference between the current write bytes and the initial value. - -W&B assigns a `disk.out` tag to this metric. - - - -## Memory - -### Process Memory RSS -Represents the Memory Resident Set Size (RSS) in megabytes (MB) for the process. RSS is the portion of memory occupied by a process that is held in main memory (RAM). - -W&B assigns a `proc.memory.rssMB` tag to this metric. - -### Process Memory Percent -Indicates the memory usage of the process as a percentage of the total available memory. - -W&B assigns a `proc.memory.percent` tag to this metric. - -### Memory Percent -Represents the total system memory usage as a percentage of the total available memory. - -W&B assigns a `memory_percent` tag to this metric. - -### Memory Available -Indicates the total available system memory in megabytes (MB). - -W&B assigns a `proc.memory.availableMB` tag to this metric. - - -## Network - -### Network Sent -Represents the total bytes sent over the network. -The initial bytes sent are recorded when the metric is first initialized. Subsequent samples calculate the difference between the current bytes sent and the initial value. - -W&B assigns a `network.sent` tag to this metric. - -### Network Received - -Indicates the total bytes received over the network. -Similar to [Network Sent]({{< relref "#network-sent" >}}), the initial bytes received are recorded when the metric is first initialized. Subsequent samples calculate the difference between the current bytes received and the initial value. - -W&B assigns a `network.recv` tag to this metric. - - -## NVIDIA GPU - -In addition to the metrics described below, if the process and/or its descendants use a particular GPU, W&B captures the corresponding metrics as `gpu.process.{gpu_index}.{metric_name}` - -### GPU Memory Utilization -Represents the GPU memory utilization in percent for each GPU. - -W&B assigns a `gpu.{gpu_index}.memory` tag to this metric. - -### GPU Memory Allocated -Indicates the GPU memory allocated as a percentage of the total available memory for each GPU. - -W&B assigns a `gpu.{gpu_index}.memoryAllocated` tag to this metric. - -### GPU Memory Allocated Bytes -Specifies the GPU memory allocated in bytes for each GPU. - -W&B assigns a `gpu.{gpu_index}.memoryAllocatedBytes` tag to this metric. - -### GPU Utilization -Reflects the GPU utilization in percent for each GPU. - -W&B assigns a `gpu.{gpu_index}.gpu` tag to this metric. - -### GPU Temperature -The GPU temperature in Celsius for each GPU. - -W&B assigns a `gpu.{gpu_index}.temp` tag to this metric. - -### GPU Power Usage Watts -Indicates the GPU power usage in Watts for each GPU. - -W&B assigns a `gpu.{gpu_index}.powerWatts` tag to this metric. - -### GPU Power Usage Percent - -Reflects the GPU power usage as a percentage of its power capacity for each GPU. - -W&B assigns a `gpu.{gpu_index}.powerPercent` tag to this metric. - -### GPU SM Clock Speed -Represents the clock speed of the Streaming Multiprocessor (SM) on the GPU in MHz. This metric is indicative of the processing speed within the GPU cores responsible for computation tasks. - -W&B assigns a `gpu.{gpu_index}.smClock` tag to this metric. - -### GPU Memory Clock Speed -Represents the clock speed of the GPU memory in MHz, which influences the rate of data transfer between the GPU memory and processing cores. - -W&B assigns a `gpu.{gpu_index}.memoryClock` tag to this metric. - -### GPU Graphics Clock Speed - -Represents the base clock speed for graphics rendering operations on the GPU, expressed in MHz. This metric often reflects performance during visualization or rendering tasks. - -W&B assigns a `gpu.{gpu_index}.graphicsClock` tag to this metric. - -### GPU Corrected Memory Errors - -Tracks the count of memory errors on the GPU that W&B automatically corrects by error-checking protocols, indicating recoverable hardware issues. - -W&B assigns a `gpu.{gpu_index}.correctedMemoryErrors` tag to this metric. - -### GPU Uncorrected Memory Errors -Tracks the count of memory errors on the GPU that W&B uncorrected, indicating non-recoverable errors which can impact processing reliability. - -W&B assigns a `gpu.{gpu_index}.unCorrectedMemoryErrors` tag to this metric. - -### GPU Encoder Utilization - -Represents the percentage utilization of the GPU's video encoder, indicating its load when encoding tasks (for example, video rendering) are running. - -W&B assigns a `gpu.{gpu_index}.encoderUtilization` tag to this metric. - - -## AMD GPU -W&B extracts metrics from the output of the `rocm-smi` tool supplied by AMD (`rocm-smi -a --json`). - -ROCm [6.x (latest)](https://rocm.docs.amd.com/en/latest/) and [5.x](https://rocm.docs.amd.com/en/docs-5.6.0/) formats are supported. Learn more about ROCm formats in the [AMD ROCm documentation](https://rocm.docs.amd.com/en/latest/compatibility/compatibility-matrix.html). The newer format includes more details. - -### AMD GPU Utilization -Represents the GPU utilization in percent for each AMD GPU device. - -W&B assigns a `gpu.{gpu_index}.gpu` tag to this metric. - -### AMD GPU Memory Allocated -Indicates the GPU memory allocated as a percentage of the total available memory for each AMD GPU device. - -W&B assigns a `gpu.{gpu_index}.memoryAllocated` tag to this metric. - -### AMD GPU Temperature -The GPU temperature in Celsius for each AMD GPU device. - -W&B assigns a `gpu.{gpu_index}.temp` tag to this metric. - -### AMD GPU Power Usage Watts -The GPU power usage in Watts for each AMD GPU device. - -W&B assigns a `gpu.{gpu_index}.powerWatts` tag to this metric. - -### AMD GPU Power Usage Percent -Reflects the GPU power usage as a percentage of its power capacity for each AMD GPU device. - -W&B assigns a `gpu.{gpu_index}.powerPercent` to this metric. - - -## Apple ARM Mac GPU - -### Apple GPU Utilization -Indicates the GPU utilization in percent for Apple GPU devices, specifically on ARM Macs. - -W&B assigns a `gpu.0.gpu` tag to this metric. - -### Apple GPU Memory Allocated -The GPU memory allocated as a percentage of the total available memory for Apple GPU devices on ARM Macs. - -W&B assigns a `gpu.0.memoryAllocated` tag to this metric. - -### Apple GPU Temperature -The GPU temperature in Celsius for Apple GPU devices on ARM Macs. - -W&B assigns a `gpu.0.temp` tag to this metric. - -### Apple GPU Power Usage Watts -The GPU power usage in Watts for Apple GPU devices on ARM Macs. - -W&B assigns a `gpu.0.powerWatts` tag to this metric. - -### Apple GPU Power Usage Percent -The GPU power usage as a percentage of its power capacity for Apple GPU devices on ARM Macs. - -W&B assigns a `gpu.0.powerPercent` tag to this metric. - - -## Graphcore IPU -Graphcore IPUs (Intelligence Processing Units) are unique hardware accelerators designed specifically for machine intelligence tasks. - -### IPU Device Metrics -These metrics represent various statistics for a specific IPU device. Each metric has a device ID (`device_id`) and a metric key (`metric_key`) to identify it. W&B assigns a `ipu.{device_id}.{metric_key}` tag to this metric. - -Metrics are extracted using the proprietary `gcipuinfo` library, which interacts with Graphcore's `gcipuinfo` binary. The `sample` method fetches these metrics for each IPU device associated with the process ID (`pid`). Only the metrics that change over time, or the first time a device's metrics are fetched, are logged to avoid logging redundant data. - -For each metric, the method `parse_metric` is used to extract the metric's value from its raw string representation. The metrics are then aggregated across multiple samples using the `aggregate` method. - -The following lists available metrics and their units: - -- **Average Board Temperature** (`average board temp (C)`): Temperature of the IPU board in Celsius. -- **Average Die Temperature** (`average die temp (C)`): Temperature of the IPU die in Celsius. -- **Clock Speed** (`clock (MHz)`): The clock speed of the IPU in MHz. -- **IPU Power** (`ipu power (W)`): Power consumption of the IPU in Watts. -- **IPU Utilization** (`ipu utilisation (%)`): Percentage of IPU utilization. -- **IPU Session Utilization** (`ipu utilisation (session) (%)`): IPU utilization percentage specific to the current session. -- **Data Link Speed** (`speed (GT/s)`): Speed of data transmission in Giga-transfers per second. - - - -## Google Cloud TPU -Tensor Processing Units (TPUs) are Google's custom-developed ASICs (Application Specific Integrated Circuits) used to accelerate machine learning workloads. - - -### TPU Memory usage -The current High Bandwidth Memory usage in bytes per TPU core. - -W&B assigns a `tpu.{tpu_index}.memoryUsageBytes` tag to this metric. - -### TPU Memory usage percentage -The current High Bandwidth Memory usage in percent per TPU core. - -W&B assigns a `tpu.{tpu_index}.memoryUsageBytes` tag to this metric. - -### TPU Duty cycle -TensorCore duty cycle percentage per TPU device. Tracks the percentage of time over the sample period during which the accelerator TensorCore was actively processing. A larger value means better TensorCore utilization. - -W&B assigns a `tpu.{tpu_index}.dutyCycle` tag to this metric. - - - -## AWS Trainium -[AWS Trainium](https://aws.amazon.com/machine-learning/trainium/) is a specialized hardware platform offered by AWS that focuses on accelerating machine learning workloads. The `neuron-monitor` tool from AWS is used to capture the AWS Trainium metrics. - -### Trainium Neuron Core Utilization -The utilization percentage of each NeuronCore, reported on a per-core basis. - -W&B assigns a `trn.{core_index}.neuroncore_utilization` tag to this metric. - -### Trainium Host Memory Usage, Total -The total memory consumption on the host in bytes. - -W&B assigns a `trn.host_total_memory_usage` tag to this metric. - -### Trainium Neuron Device Total Memory Usage -The total memory usage on the Neuron device in bytes. - -W&B assigns a `trn.neuron_device_total_memory_usage)` tag to this metric. - -### Trainium Host Memory Usage Breakdown: - -The following is a breakdown of memory usage on the host: - -- **Application Memory** (`trn.host_total_memory_usage.application_memory`): Memory used by the application. -- **Constants** (`trn.host_total_memory_usage.constants`): Memory used for constants. -- **DMA Buffers** (`trn.host_total_memory_usage.dma_buffers`): Memory used for Direct Memory Access buffers. -- **Tensors** (`trn.host_total_memory_usage.tensors`): Memory used for tensors. - -### Trainium Neuron Core Memory Usage Breakdown -Detailed memory usage information for each NeuronCore: - -- **Constants** (`trn.{core_index}.neuroncore_memory_usage.constants`) -- **Model Code** (`trn.{core_index}.neuroncore_memory_usage.model_code`) -- **Model Shared Scratchpad** (`trn.{core_index}.neuroncore_memory_usage.model_shared_scratchpad`) -- **Runtime Memory** (`trn.{core_index}.neuroncore_memory_usage.runtime_memory`) -- **Tensors** (`trn.{core_index}.neuroncore_memory_usage.tensors`) - -## OpenMetrics -Capture and log metrics from external endpoints that expose OpenMetrics / Prometheus-compatible data with support for custom regex-based metric filters to be applied to the consumed endpoints. - -Refer to [Monitoring GPU cluster performance in W&B](https://wandb.ai/dimaduev/dcgm/reports/Monitoring-GPU-cluster-performance-with-NVIDIA-DCGM-Exporter-and-Weights-Biases--Vmlldzo0MDYxMTA1) for a detailed example of how to use this feature in a particular case of monitoring GPU cluster performance with the [NVIDIA DCGM-Exporter](https://docs.nvidia.com/datacenter/cloud-native/gpu-telemetry/latest/dcgm-exporter.html). \ No newline at end of file diff --git a/content/en/ref/python/functions/_index.md b/content/en/ref/python/functions/_index.md deleted file mode 100644 index 46d48ba2a3..0000000000 --- a/content/en/ref/python/functions/_index.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: Global Functions -module: -weight: 1 -no_list: true ---- - -Global functions in W&B are top-level functions that you call directly, such as `wandb.init()` or `wandb.login()`. Unlike methods that belong to specific classes, these functions provide direct access to W&B's core functionality without needing to instantiate objects first. - -## Available Functions - -| Function | Description | -|----------|-------------| -| [`init()`](./init/) | Start a new run to track and log to W&B. This is typically the first function you'll call in your ML training pipeline. | -| [`login()`](./login/) | Set up W&B login credentials to authenticate your machine with the platform. | -| [`setup()`](./setup/) | Prepare W&B for use in the current process and its children. Useful for multi-process applications. | -| [`teardown()`](./teardown/) | Clean up W&B resources and shut down the backend process. | -| [`sweep()`](./sweep/) | Initialize a hyperparameter sweep to search for optimal model configurations. | -| [`agent()`](./agent/) | Create a sweep agent to run hyperparameter optimization experiments. | -| [`controller()`](./controller/) | Manage and control sweep agents and their execution. | -| [`restore()`](./restore/) | Restore a previous run or experiment state for resuming work. | - -## Example - -The most common workflow begins with authenticating with W&B, initializing a run, and logging values (such as accuracy and loss) from your training loop. The first steps are to import `wandb` and use the global functions `login()` and `init()`: - -```python -import wandb - -# Authenticate with W&B -wandb.login() - -# Hyperparameters and metadata -config = { - "learning_rate": 0.01, - "epochs": 10, -} - -# Project that the run is recorded to -project = "my-awesome-project" - -# Initialize a new run -with wandb.init(project=project, config=config) as run: - # Your training code here... - - # Log values to W&B - run.log({"accuracy": 0.9, "loss": 0.1}) -``` \ No newline at end of file diff --git a/content/en/ref/python/functions/agent.md b/content/en/ref/python/functions/agent.md deleted file mode 100644 index 17a2aa38c1..0000000000 --- a/content/en/ref/python/functions/agent.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: agent() -namespace: python_sdk_actions -python_object_type: function ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/wandb_agent.py >}} - - - - -### function `agent` - -```python -agent( - sweep_id: str, - function: Optional[Callable] = None, - entity: Optional[str] = None, - project: Optional[str] = None, - count: Optional[int] = None -) → None -``` - -Start one or more sweep agents. - -The sweep agent uses the `sweep_id` to know which sweep it is a part of, what function to execute, and (optionally) how many agents to run. - - - -**Args:** - - - `sweep_id`: The unique identifier for a sweep. A sweep ID is generated by W&B CLI or Python SDK. - - `function`: A function to call instead of the "program" specified in the sweep config. - - `entity`: The username or team name where you want to send W&B runs created by the sweep to. Ensure that the entity you specify already exists. If you don't specify an entity, the run will be sent to your default entity, which is usually your username. - - `project`: The name of the project where W&B runs created from the sweep are sent to. If the project is not specified, the run is sent to a project labeled "Uncategorized". - - `count`: The number of sweep config trials to try. diff --git a/content/en/ref/python/functions/controller.md b/content/en/ref/python/functions/controller.md deleted file mode 100644 index 93a011815b..0000000000 --- a/content/en/ref/python/functions/controller.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: controller() -namespace: python_sdk_actions -python_object_type: function ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/sdk/wandb_sweep.py >}} - - - - -### function `controller` - -```python -controller( - sweep_id_or_config: Optional[str, Dict] = None, - entity: Optional[str] = None, - project: Optional[str] = None -) → _WandbController -``` - -Public sweep controller constructor. - - - -**Examples:** - ```python -import wandb - -tuner = wandb.controller(...) -print(tuner.sweep_config) -print(tuner.sweep_id) -tuner.configure_search(...) -tuner.configure_stopping(...) -``` diff --git a/content/en/ref/python/functions/finish.md b/content/en/ref/python/functions/finish.md deleted file mode 100644 index 5049b29c3e..0000000000 --- a/content/en/ref/python/functions/finish.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: finish() -namespace: python_sdk_actions -python_object_type: function ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/sdk/wandb_run.py >}} - - - - -### function `finish` - -```python -finish(exit_code: 'int | None' = None, quiet: 'bool | None' = None) → None -``` - -Finish a run and upload any remaining data. - -Marks the completion of a W&B run and ensures all data is synced to the server. The run's final state is determined by its exit conditions and sync status. - -Run States: -- Running: Active run that is logging data and/or sending heartbeats. -- Crashed: Run that stopped sending heartbeats unexpectedly. -- Finished: Run completed successfully (`exit_code=0`) with all data synced. -- Failed: Run completed with errors (`exit_code!=0`). - - - -**Args:** - - - `exit_code`: Integer indicating the run's exit status. Use 0 for success, any other value marks the run as failed. - - `quiet`: Deprecated. Configure logging verbosity using `wandb.Settings(quiet=...)`. diff --git a/content/en/ref/python/functions/init.md b/content/en/ref/python/functions/init.md deleted file mode 100644 index 4b412af4e2..0000000000 --- a/content/en/ref/python/functions/init.md +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: init() -namespace: python_sdk_actions -python_object_type: function ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/sdk/wandb_init.py >}} - - - - -### function `init` - -```python -init( - entity: 'str | None' = None, - project: 'str | None' = None, - dir: 'StrPath | None' = None, - id: 'str | None' = None, - name: 'str | None' = None, - notes: 'str | None' = None, - tags: 'Sequence[str] | None' = None, - config: 'dict[str, Any] | str | None' = None, - config_exclude_keys: 'list[str] | None' = None, - config_include_keys: 'list[str] | None' = None, - allow_val_change: 'bool | None' = None, - group: 'str | None' = None, - job_type: 'str | None' = None, - mode: "Literal['online', 'offline', 'disabled', 'shared'] | None" = None, - force: 'bool | None' = None, - anonymous: "Literal['never', 'allow', 'must'] | None" = None, - reinit: "bool | Literal[None, 'default', 'return_previous', 'finish_previous', 'create_new']" = None, - resume: "bool | Literal['allow', 'never', 'must', 'auto'] | None" = None, - resume_from: 'str | None' = None, - fork_from: 'str | None' = None, - save_code: 'bool | None' = None, - tensorboard: 'bool | None' = None, - sync_tensorboard: 'bool | None' = None, - monitor_gym: 'bool | None' = None, - settings: 'Settings | dict[str, Any] | None' = None -) → Run -``` - -Start a new run to track and log to W&B. - -In an ML training pipeline, you could add `wandb.init()` to the beginning of your training script as well as your evaluation script, and each piece would be tracked as a run in W&B. - -`wandb.init()` spawns a new background process to log data to a run, and it also syncs data to https://wandb.ai by default, so you can see your results in real-time. When you're done logging data, call `wandb.Run.finish()` to end the run. If you don't call `run.finish()`, the run will end when your script exits. - -Run IDs must not contain any of the following special characters `/ \ # ? % :` - - - -**Args:** - - - `entity`: The username or team name the runs are logged to. The entity must already exist, so ensure you create your account or team in the UI before starting to log runs. If not specified, the run will default your default entity. To change the default entity, go to your settings and update the "Default location to create new projects" under "Default team". - - `project`: The name of the project under which this run will be logged. If not specified, we use a heuristic to infer the project name based on the system, such as checking the git root or the current program file. If we can't infer the project name, the project will default to `"uncategorized"`. - - `dir`: The absolute path to the directory where experiment logs and metadata files are stored. If not specified, this defaults to the `./wandb` directory. Note that this does not affect the location where artifacts are stored when calling `download()`. - - `id`: A unique identifier for this run, used for resuming. It must be unique within the project and cannot be reused once a run is deleted. For a short descriptive name, use the `name` field, or for saving hyperparameters to compare across runs, use `config`. - - `name`: A short display name for this run, which appears in the UI to help you identify it. By default, we generate a random two-word name allowing easy cross-reference runs from table to charts. Keeping these run names brief enhances readability in chart legends and tables. For saving hyperparameters, we recommend using the `config` field. - - `notes`: A detailed description of the run, similar to a commit message in Git. Use this argument to capture any context or details that may help you recall the purpose or setup of this run in the future. - - `tags`: A list of tags to label this run in the UI. Tags are helpful for organizing runs or adding temporary identifiers like "baseline" or "production." You can easily add, remove tags, or filter by tags in the UI. If resuming a run, the tags provided here will replace any existing tags. To add tags to a resumed run without overwriting the current tags, use `run.tags += ("new_tag",)` after calling `run = wandb.init()`. - - `config`: Sets `wandb.config`, a dictionary-like object for storing input parameters to your run, such as model hyperparameters or data preprocessing settings. The config appears in the UI in an overview page, allowing you to group, filter, and sort runs based on these parameters. Keys should not contain periods (`.`), and values should be smaller than 10 MB. If a dictionary, `argparse.Namespace`, or `absl.flags.FLAGS` is provided, the key-value pairs will be loaded directly into `wandb.config`. If a string is provided, it is interpreted as a path to a YAML file, from which configuration values will be loaded into `wandb.config`. - - `config_exclude_keys`: A list of specific keys to exclude from `wandb.config`. - - `config_include_keys`: A list of specific keys to include in `wandb.config`. - - `allow_val_change`: Controls whether config values can be modified after their initial set. By default, an exception is raised if a config value is overwritten. For tracking variables that change during training, such as a learning rate, consider using `wandb.log()` instead. By default, this is `False` in scripts and `True` in Notebook environments. - - `group`: Specify a group name to organize individual runs as part of a larger experiment. This is useful for cases like cross-validation or running multiple jobs that train and evaluate a model on different test sets. Grouping allows you to manage related runs collectively in the UI, making it easy to toggle and review results as a unified experiment. - - `job_type`: Specify the type of run, especially helpful when organizing runs within a group as part of a larger experiment. For example, in a group, you might label runs with job types such as "train" and "eval". Defining job types enables you to easily filter and group similar runs in the UI, facilitating direct comparisons. - - `mode`: Specifies how run data is managed, with the following options: - - `"online"` (default): Enables live syncing with W&B when a network connection is available, with real-time updates to visualizations. - - `"offline"`: Suitable for air-gapped or offline environments; data is saved locally and can be synced later. Ensure the run folder is preserved to enable future syncing. - - `"disabled"`: Disables all W&B functionality, making the run’s methods no-ops. Typically used in testing to bypass W&B operations. - - `"shared"`: (This is an experimental feature). Allows multiple processes, possibly on different machines, to simultaneously log to the same run. In this approach you use a primary node and one or more worker nodes to log data to the same run. Within the primary node you initialize a run. For each worker node, initialize a run using the run ID used by the primary node. - - `force`: Determines if a W&B login is required to run the script. If `True`, the user must be logged in to W&B; otherwise, the script will not proceed. If `False` (default), the script can proceed without a login, switching to offline mode if the user is not logged in. - - `anonymous`: Specifies the level of control over anonymous data logging. Available options are: - - `"never"` (default): Requires you to link your W&B account before tracking the run. This prevents unintentional creation of anonymous runs by ensuring each run is associated with an account. - - `"allow"`: Enables a logged-in user to track runs with their account, but also allows someone running the script without a W&B account to view the charts and data in the UI. - - `"must"`: Forces the run to be logged to an anonymous account, even if the user is logged in. - - `reinit`: Shorthand for the "reinit" setting. Determines the behavior of `wandb.init()` when a run is active. - - `resume`: Controls the behavior when resuming a run with the specified `id`. Available options are: - - `"allow"`: If a run with the specified `id` exists, it will resume from the last step; otherwise, a new run will be created. - - `"never"`: If a run with the specified `id` exists, an error will be raised. If no such run is found, a new run will be created. - - `"must"`: If a run with the specified `id` exists, it will resume from the last step. If no run is found, an error will be raised. - - `"auto"`: Automatically resumes the previous run if it crashed on this machine; otherwise, starts a new run. - - `True`: Deprecated. Use `"auto"` instead. - - `False`: Deprecated. Use the default behavior (leaving `resume` unset) to always start a new run. If `resume` is set, `fork_from` and `resume_from` cannot be used. When `resume` is unset, the system will always start a new run. - - `resume_from`: Specifies a moment in a previous run to resume a run from, using the format `{run_id}?_step={step}`. This allows users to truncate the history logged to a run at an intermediate step and resume logging from that step. The target run must be in the same project. If an `id` argument is also provided, the `resume_from` argument will take precedence. `resume`, `resume_from` and `fork_from` cannot be used together, only one of them can be used at a time. Note that this feature is in beta and may change in the future. - - `fork_from`: Specifies a point in a previous run from which to fork a new run, using the format `{id}?_step={step}`. This creates a new run that resumes logging from the specified step in the target run’s history. The target run must be part of the current project. If an `id` argument is also provided, it must be different from the `fork_from` argument, an error will be raised if they are the same. `resume`, `resume_from` and `fork_from` cannot be used together, only one of them can be used at a time. Note that this feature is in beta and may change in the future. - - `save_code`: Enables saving the main script or notebook to W&B, aiding in experiment reproducibility and allowing code comparisons across runs in the UI. By default, this is disabled, but you can change the default to enable on your settings page. - - `tensorboard`: Deprecated. Use `sync_tensorboard` instead. - - `sync_tensorboard`: Enables automatic syncing of W&B logs from TensorBoard or TensorBoardX, saving relevant event files for viewing in the W&B UI. - - `monitor_gym`: Enables automatic logging of videos of the environment when using OpenAI Gym. - - `settings`: Specifies a dictionary or `wandb.Settings` object with advanced settings for the run. - - - -**Returns:** - A `Run` object. - - - -**Raises:** - - - `Error`: If some unknown or internal error happened during the run initialization. - - `AuthenticationError`: If the user failed to provide valid credentials. - - `CommError`: If there was a problem communicating with the WandB server. - - `UsageError`: If the user provided invalid arguments. - - `KeyboardInterrupt`: If user interrupts the run. - - - -**Examples:** - `wandb.init()` returns a `Run` object. Use the run object to log data, save artifacts, and manage the run lifecycle. - -```python -import wandb - -config = {"lr": 0.01, "batch_size": 32} -with wandb.init(config=config) as run: - # Log accuracy and loss to the run - acc = 0.95 # Example accuracy - loss = 0.05 # Example loss - run.log({"accuracy": acc, "loss": loss}) -``` diff --git a/content/en/ref/python/functions/login.md b/content/en/ref/python/functions/login.md deleted file mode 100644 index 2cb245a5a6..0000000000 --- a/content/en/ref/python/functions/login.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: login() -namespace: python_sdk_actions -python_object_type: function ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/sdk/wandb_login.py >}} - - - - -### function `login` - -```python -login( - anonymous: Optional[Literal['must', 'allow', 'never']] = None, - key: Optional[str] = None, - relogin: Optional[bool] = None, - host: Optional[str] = None, - force: Optional[bool] = None, - timeout: Optional[int] = None, - verify: bool = False, - referrer: Optional[str] = None -) → bool -``` - -Set up W&B login credentials. - -By default, this will only store credentials locally without verifying them with the W&B server. To verify credentials, pass `verify=True`. - - - -**Args:** - - - `anonymous`: Set to "must", "allow", or "never". If set to "must", always log a user in anonymously. If set to "allow", only create an anonymous user if the user isn't already logged in. If set to "never", never log a user anonymously. Default set to "never". Defaults to `None`. - - `key`: The API key to use. - - `relogin`: If true, will re-prompt for API key. - - `host`: The host to connect to. - - `force`: If true, will force a relogin. - - `timeout`: Number of seconds to wait for user input. - - `verify`: Verify the credentials with the W&B server. - - `referrer`: The referrer to use in the URL login request. - - - - - -**Returns:** - - - `bool`: If `key` is configured. - - - -**Raises:** - - - `AuthenticationError`: If `api_key` fails verification with the server. - - `UsageError`: If `api_key` cannot be configured and no tty. diff --git a/content/en/ref/python/functions/restore.md b/content/en/ref/python/functions/restore.md deleted file mode 100644 index 426f50921a..0000000000 --- a/content/en/ref/python/functions/restore.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: restore() -namespace: python_sdk_actions -python_object_type: function ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/sdk/wandb_run.py >}} - - - - -### function `restore` - -```python -restore( - name: 'str', - run_path: 'str | None' = None, - replace: 'bool' = False, - root: 'str | None' = None -) → None | TextIO -``` - -Download the specified file from cloud storage. - -File is placed into the current directory or run directory. By default, will only download the file if it doesn't already exist. - - - -**Args:** - - - `name`: The name of the file. - - `run_path`: Optional path to a run to pull files from, i.e. `username/project_name/run_id` if wandb.init has not been called, this is required. - - `replace`: Whether to download the file even if it already exists locally - - `root`: The directory to download the file to. Defaults to the current directory or the run directory if wandb.init was called. - - - -**Returns:** - None if it can't find the file, otherwise a file object open for reading. - - - -**Raises:** - - - `CommError`: If W&B can't connect to the W&B backend. - - `ValueError`: If the file is not found or can't find run_path. diff --git a/content/en/ref/python/functions/setup.md b/content/en/ref/python/functions/setup.md deleted file mode 100644 index 67336fbc62..0000000000 --- a/content/en/ref/python/functions/setup.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: setup() -namespace: python_sdk_actions -python_object_type: function ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/sdk/wandb_setup.py >}} - - - - -### function `setup` - -```python -setup(settings: 'Settings | None' = None) → _WandbSetup -``` - -Prepares W&B for use in the current process and its children. - -You can usually ignore this as it is implicitly called by `wandb.init()`. - -When using wandb in multiple processes, calling `wandb.setup()` in the parent process before starting child processes may improve performance and resource utilization. - -Note that `wandb.setup()` modifies `os.environ`, and it is important that child processes inherit the modified environment variables. - -See also `wandb.teardown()`. - - - -**Args:** - - - `settings`: Configuration settings to apply globally. These can be overridden by subsequent `wandb.init()` calls. - - - -**Example:** - ```python -import multiprocessing - -import wandb - - -def run_experiment(params): - with wandb.init(config=params): - # Run experiment - pass - - -if __name__ == "__main__": - # Start backend and set global config - wandb.setup(settings={"project": "my_project"}) - - # Define experiment parameters - experiment_params = [ - {"learning_rate": 0.01, "epochs": 10}, - {"learning_rate": 0.001, "epochs": 20}, - ] - - # Start multiple processes, each running a separate experiment - processes = [] - for params in experiment_params: - p = multiprocessing.Process(target=run_experiment, args=(params,)) - p.start() - processes.append(p) - - # Wait for all processes to complete - for p in processes: - p.join() - - # Optional: Explicitly shut down the backend - wandb.teardown() -``` diff --git a/content/en/ref/python/functions/sweep.md b/content/en/ref/python/functions/sweep.md deleted file mode 100644 index a4aa14c9cc..0000000000 --- a/content/en/ref/python/functions/sweep.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: sweep() -namespace: python_sdk_actions -python_object_type: function ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/sdk/wandb_sweep.py >}} - - - - -### function `sweep` - -```python -sweep( - sweep: Union[dict, Callable], - entity: Optional[str] = None, - project: Optional[str] = None, - prior_runs: Optional[List[str]] = None -) → str -``` - -Initialize a hyperparameter sweep. - -Search for hyperparameters that optimizes a cost function of a machine learning model by testing various combinations. - -Make note the unique identifier, `sweep_id`, that is returned. At a later step provide the `sweep_id` to a sweep agent. - -See [Sweep configuration structure](https://docs.wandb.ai/guides/sweeps/define-sweep-configuration) for information on how to define your sweep. - - - -**Args:** - - - `sweep`: The configuration of a hyperparameter search. (or configuration generator). If you provide a callable, ensure that the callable does not take arguments and that it returns a dictionary that conforms to the W&B sweep config spec. - - `entity`: The username or team name where you want to send W&B runs created by the sweep to. Ensure that the entity you specify already exists. If you don't specify an entity, the run will be sent to your default entity, which is usually your username. - - `project`: The name of the project where W&B runs created from the sweep are sent to. If the project is not specified, the run is sent to a project labeled 'Uncategorized'. - - `prior_runs`: The run IDs of existing runs to add to this sweep. - - - -**Returns:** - - - `str`: A unique identifier for the sweep. diff --git a/content/en/ref/python/functions/teardown.md b/content/en/ref/python/functions/teardown.md deleted file mode 100644 index 6ee9214244..0000000000 --- a/content/en/ref/python/functions/teardown.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: teardown() -namespace: python_sdk_actions -python_object_type: function ---- - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/ >}} - - - - -### function `teardown` - -```python -teardown(exit_code: 'int | None' = None) → None -``` - -Waits for W&B to finish and frees resources. - -Completes any runs that were not explicitly finished using `run.finish()` and waits for all data to be uploaded. - -It is recommended to call this at the end of a session that used `wandb.setup()`. It is invoked automatically in an `atexit` hook, but this is not reliable in certain setups such as when using Python's `multiprocessing` module. diff --git a/content/en/ref/python/public-api/ArtifactCollection.md b/content/en/ref/python/public-api/ArtifactCollection.md deleted file mode 100644 index 4e50c2e3ed..0000000000 --- a/content/en/ref/python/public-api/ArtifactCollection.md +++ /dev/null @@ -1,146 +0,0 @@ ---- -title: ArtifactCollection -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/artifacts.py >}} - - - - -## class `ArtifactCollection` -An artifact collection that represents a group of related artifacts. - - - -**Args:** - - - `client`: The client instance to use for querying W&B. - - `entity`: The entity (user or team) that owns the project. - - `project`: The name of the project to query for artifact collections. - - `name`: The name of the artifact collection. - - `type`: The type of the artifact collection (e.g., "dataset", "model"). - - `organization`: Optional organization name if applicable. - - `attrs`: Optional mapping of attributes to initialize the artifact collection. If not provided, the object will load its attributes from W&B upon initialization. - - -### property ArtifactCollection.aliases - -Artifact Collection Aliases. - - - -**Returns:** - - `list[str]`: The aliases property value. ---- - -### property ArtifactCollection.created_at - -The creation date of the artifact collection. - - - -**Returns:** - - `str`: The created_at property value. ---- - -### property ArtifactCollection.description - -A description of the artifact collection. - - - -**Returns:** - - `str`: The description property value. ---- - -### property ArtifactCollection.id - -The unique identifier of the artifact collection. - - - -**Returns:** - - `str`: The id property value. ---- - -### property ArtifactCollection.name - -The name of the artifact collection. - - - -**Returns:** - - `str`: The name property value. ---- - -### property ArtifactCollection.tags - -The tags associated with the artifact collection. - - - -**Returns:** - - `list[str]`: The tags property value. ---- - -### property ArtifactCollection.type - -Returns the type of the artifact collection. - - - ---- - -### method `ArtifactCollection.artifacts` - -```python -artifacts(per_page: 'int' = 50) → Artifacts -``` - -Get all artifacts in the collection. - ---- - -### method `ArtifactCollection.change_type` - -```python -change_type(new_type: 'str') → None -``` - -Deprecated, change type directly with `save` instead. - ---- - -### method `ArtifactCollection.delete` - -```python -delete() → None -``` - -Delete the entire artifact collection. - ---- - -### method `ArtifactCollection.is_sequence` - -```python -is_sequence() → bool -``` - -Return whether the artifact collection is a sequence. - ---- - - -### method `ArtifactCollection.save` - -```python -save() → None -``` - -Persist any changes made to the artifact collection. - diff --git a/content/en/ref/python/public-api/ArtifactCollections.md b/content/en/ref/python/public-api/ArtifactCollections.md deleted file mode 100644 index 70c952f81c..0000000000 --- a/content/en/ref/python/public-api/ArtifactCollections.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: ArtifactCollections -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/artifacts.py >}} - - - - -## class `ArtifactCollections` -Artifact collections of a specific type in a project. - - - -**Args:** - - - `client`: The client instance to use for querying W&B. - - `entity`: The entity (user or team) that owns the project. - - `project`: The name of the project to query for artifact collections. - - `type_name`: The name of the artifact type for which to fetch collections. - - `per_page`: The number of artifact collections to fetch per page. Default is 50. - - -### property ArtifactCollections.length - - - - - ---- - - - diff --git a/content/en/ref/python/public-api/ArtifactFiles.md b/content/en/ref/python/public-api/ArtifactFiles.md deleted file mode 100644 index c0744fbe16..0000000000 --- a/content/en/ref/python/public-api/ArtifactFiles.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: ArtifactFiles -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/artifacts.py >}} - - - - -## class `ArtifactFiles` -A paginator for files in an artifact. - - -### property ArtifactFiles.length - - - - - ---- - - -### property ArtifactFiles.path - -Returns the path of the artifact. - - - - - -**Returns:** - - `list[str]`: The path property value. ---- - - diff --git a/content/en/ref/python/public-api/ArtifactType.md b/content/en/ref/python/public-api/ArtifactType.md deleted file mode 100644 index 5aa6d98412..0000000000 --- a/content/en/ref/python/public-api/ArtifactType.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -title: ArtifactType -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/artifacts.py >}} - - - - -## class `ArtifactType` -An artifact object that satisfies query based on the specified type. - - - -**Args:** - - - `client`: The client instance to use for querying W&B. - - `entity`: The entity (user or team) that owns the project. - - `project`: The name of the project to query for artifact types. - - `type_name`: The name of the artifact type. - - `attrs`: Optional mapping of attributes to initialize the artifact type. If not provided, the object will load its attributes from W&B upon initialization. - - -### property ArtifactType.id - -The unique identifier of the artifact type. - - - -**Returns:** - - `str`: The id property value. ---- - -### property ArtifactType.name - -The name of the artifact type. - - - - - -**Returns:** - - `str`: The name property value. ---- - -### method `ArtifactType.collection` - -```python -collection(name: 'str') → ArtifactCollection -``` - -Get a specific artifact collection by name. - - - -**Args:** - - - `name` (str): The name of the artifact collection to retrieve. - ---- - -### method `ArtifactType.collections` - -```python -collections(per_page: 'int' = 50) → ArtifactCollections -``` - -Get all artifact collections associated with this artifact type. - - - -**Args:** - - - `per_page` (int): The number of artifact collections to fetch per page. Default is 50. - ---- - diff --git a/content/en/ref/python/public-api/ArtifactTypes.md b/content/en/ref/python/public-api/ArtifactTypes.md deleted file mode 100644 index a063a6fcb6..0000000000 --- a/content/en/ref/python/public-api/ArtifactTypes.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: ArtifactTypes -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/artifacts.py >}} - - - - -## class `ArtifactTypes` -An lazy iterator of `ArtifactType` objects for a specific project. - diff --git a/content/en/ref/python/public-api/BetaReport.md b/content/en/ref/python/public-api/BetaReport.md deleted file mode 100644 index 50ceeaa933..0000000000 --- a/content/en/ref/python/public-api/BetaReport.md +++ /dev/null @@ -1,143 +0,0 @@ ---- -title: BetaReport -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/reports.py >}} - - - - -## class `BetaReport` -BetaReport is a class associated with reports created in W&B. - -Provides access to report attributes (name, description, user, spec, timestamps) and methods for retrieving associated runs, sections, and for rendering the report as HTML. - - - -**Attributes:** - - - `id` (string): Unique identifier of the report. - - `display_name` (string): Human-readable display name of the report. - - `name` (string): The name of the report. Use `display_name` for a more user-friendly name. - - `description` (string): Description of the report. - - `user` (User): Dictionary containing user info (username, email) who created the report. - - `spec` (dict): The spec of the report. - - `url` (string): The URL of the report. - - `updated_at` (string): Timestamp of last update. - - `created_at` (string): Timestamp when the report was created. - -### method `BetaReport.__init__` - -```python -__init__(client, attrs, entity=None, project=None) -``` - - - - - - ---- - -### property BetaReport.created_at - - - - - ---- - -### property BetaReport.description - - - - - ---- - -### property BetaReport.display_name - - - - - ---- - -### property BetaReport.id - - - - - ---- - -### property BetaReport.name - - - - - ---- - -### property BetaReport.sections - -Get the panel sections (groups) from the report. - ---- - -### property BetaReport.spec - - - - - ---- - -### property BetaReport.updated_at - - - - - ---- - -### property BetaReport.url - - - - - ---- - -### property BetaReport.user - - - - - - - ---- - -### method `BetaReport.runs` - -```python -runs(section, per_page=50, only_selected=True) -``` - -Get runs associated with a section of the report. - ---- - -### method `BetaReport.to_html` - -```python -to_html(height=1024, hidden=False) -``` - -Generate HTML containing an iframe displaying this report. - diff --git a/content/en/ref/python/public-api/File.md b/content/en/ref/python/public-api/File.md deleted file mode 100644 index ccb9b66480..0000000000 --- a/content/en/ref/python/public-api/File.md +++ /dev/null @@ -1,101 +0,0 @@ ---- -title: File -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/files.py >}} - - - - -## class `File` -File saved to W&B. - -Represents a single file stored in W&B. Includes access to file metadata. Files are associated with a specific run and can include text files, model weights, datasets, visualizations, and other artifacts. You can download the file, delete the file, and access file properties. - -Specify one or more attributes in a dictionary to fine a specific file logged to a specific run. You can search using the following keys: - - -- id (str): The ID of the run that contains the file -- name (str): Name of the file -- url (str): path to file -- direct_url (str): path to file in the bucket -- sizeBytes (int): size of file in bytes -- md5 (str): md5 of file -- mimetype (str): mimetype of file -- updated_at (str): timestamp of last update -- path_uri (str): path to file in the bucket, currently only available for S3 objects and reference files - - - -**Args:** - - - `client`: The run object that contains the file - - `attrs` (dict): A dictionary of attributes that define the file - - `run`: The run object that contains the file - - -### property File.path_uri - -Returns the URI path to the file in the storage bucket. - - - -**Returns:** - - - `str`: The S3 URI (e.g., 's3://bucket/path/to/file') if the file is stored in S3, the direct URL if it's a reference file, or an empty string if unavailable. - - - -**Returns:** - - `str`: The path_uri property value. ---- - -### property File.size - -Returns the size of the file in bytes. - - - ---- - -### method `File.delete` - -```python -delete() -``` - -Delete the file from the W&B server. - ---- - -### method `File.download` - -```python -download( - root: 'str' = '.', - replace: 'bool' = False, - exist_ok: 'bool' = False, - api: 'Api | None' = None -) → io.TextIOWrapper -``` - -Downloads a file previously saved by a run from the wandb server. - - - -**Args:** - - - `root`: Local directory to save the file. Defaults to the current working directory ("."). - - `replace`: If `True`, download will overwrite a local file if it exists. Defaults to `False`. - - `exist_ok`: If `True`, will not raise ValueError if file already exists and will not re-download unless replace=True. Defaults to `False`. - - `api`: If specified, the `Api` instance used to download the file. - - - -**Raises:** - `ValueError` if file already exists, `replace=False` and `exist_ok=False`. - diff --git a/content/en/ref/python/public-api/Member.md b/content/en/ref/python/public-api/Member.md deleted file mode 100644 index d84be7c202..0000000000 --- a/content/en/ref/python/public-api/Member.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: Member -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/teams.py >}} - - - - -## class `Member` -A member of a team. - -### method `Member.__init__` - -```python -__init__(client, team, attrs) -``` - -**Args:** - - - `client` (`wandb.apis.internal.Api`): The client instance to use - - `team` (str): The name of the team this member belongs to - - `attrs` (dict): The member attributes - - - - - - - - - ---- - -### method `Member.delete` - -```python -delete() -``` - -Remove a member from a team. - - - -**Returns:** - Boolean indicating success - diff --git a/content/en/ref/python/public-api/Project.md b/content/en/ref/python/public-api/Project.md deleted file mode 100644 index 3f7c552db9..0000000000 --- a/content/en/ref/python/public-api/Project.md +++ /dev/null @@ -1,101 +0,0 @@ ---- -title: Project -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/projects.py >}} - - - - -## class `Project` -A project is a namespace for runs. - -### method `Project.__init__` - -```python -__init__( - client: wandb.apis.public.api.RetryingClient, - entity: str, - project: str, - attrs: dict -) → Project -``` - -**Args:** - - - `client`: W&B API client instance. - - `name` (str): The name of the project. - - `entity` (str): The entity name that owns the project. - - -A single project associated with an entity. - - - -**Args:** - - - `client`: The API client used to query W&B. - - `entity`: The entity which owns the project. - - `project`: The name of the project to query. - - `attrs`: The attributes of the project. - - ---- - -### property Project.id - - - - - ---- - -### property Project.path - -Returns the path of the project. The path is a list containing the entity and project name. - ---- - -### property Project.url - -Returns the URL of the project. - - - ---- - -### method `Project.artifacts_types` - -```python -artifacts_types(per_page=50) -``` - -Returns all artifact types associated with this project. - ---- - -### method `Project.sweeps` - -```python -sweeps(per_page=50) -``` - -Return a paginated collection of sweeps in this project. - - - -**Args:** - - - `per_page`: The number of sweeps to fetch per request to the API. - - - -**Returns:** - A `Sweeps` object, which is an iterable collection of `Sweep` objects. - ---- - diff --git a/content/en/ref/python/public-api/Registry.md b/content/en/ref/python/public-api/Registry.md deleted file mode 100644 index bc64a54227..0000000000 --- a/content/en/ref/python/public-api/Registry.md +++ /dev/null @@ -1,263 +0,0 @@ ---- -title: Registry -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/registries/registry.py >}} - - - - -## class `Registry` -A single registry in the Registry. - -### method `Registry.__init__` - -```python -__init__( - client: 'Client', - organization: str, - entity: str, - name: str, - attrs: Optional[Dict[str, Any]] = None -) -``` - - - - - - ---- - -### property Registry.allow_all_artifact_types - -Returns whether all artifact types are allowed in the registry. - -If `True` then artifacts of any type can be added to this registry. If `False` then artifacts are restricted to the types in `artifact_types` for this registry. - ---- - -### property Registry.artifact_types - -Returns the artifact types allowed in the registry. - -If `allow_all_artifact_types` is `True` then `artifact_types` reflects the types previously saved or currently used in the registry. If `allow_all_artifact_types` is `False` then artifacts are restricted to the types in `artifact_types`. - - - -**Note:** - -> Previously saved artifact types cannot be removed. -> - -**Example:** - ```python -import wandb - -registry = wandb.Api().create_registry() -registry.artifact_types.append("model") -registry.save() # once saved, the artifact type `model` cannot be removed -registry.artifact_types.append("accidentally_added") -registry.artifact_types.remove( - "accidentally_added" -) # Types can only be removed if it has not been saved yet -``` - - - -**Returns:** - - `AddOnlyArtifactTypesList`: The artifact_types property value. ---- - -### property Registry.created_at - -Timestamp of when the registry was created. - - - -**Returns:** - - `str`: The created_at property value. ---- - -### property Registry.description - -Description of the registry. - - - -**Returns:** - - `str`: The description property value. ---- - -### property Registry.entity - -Organization entity of the registry. - - - -**Returns:** - - `str`: The entity property value. ---- - -### property Registry.full_name - -Full name of the registry including the `wandb-registry-` prefix. - - - -**Returns:** - - `str`: The full_name property value. ---- - -### property Registry.name - -Name of the registry without the `wandb-registry-` prefix. - - - -**Returns:** - - `str`: The name property value. ---- - -### property Registry.organization - -Organization name of the registry. - - - -**Returns:** - - `str`: The organization property value. ---- - -### property Registry.path - - - - - ---- - -### property Registry.updated_at - -Timestamp of when the registry was last updated. - - - -**Returns:** - - `str`: The updated_at property value. ---- - -### property Registry.visibility - -Visibility of the registry. - - - -**Returns:** - - - `Literal["organization", "restricted"]`: The visibility level. - - "organization": Anyone in the organization can view this registry. You can edit their roles later from the settings in the UI. - - "restricted": Only invited members via the UI can access this registry. Public sharing is disabled. - - - - - -**Returns:** - - `Literal`: The visibility property value. ---- - -### method `Registry.collections` - -```python -collections(filter: Optional[Dict[str, Any]] = None) → Collections -``` - -Returns the collections belonging to the registry. - ---- - -### classmethod `Registry.create` - -```python -create( - client: 'Client', - organization: str, - name: str, - visibility: Literal['organization', 'restricted'], - description: Optional[str] = None, - artifact_types: Optional[List[str]] = None -) -``` - -Create a new registry. - -The registry name must be unique within the organization. This function should be called using `api.create_registry()` - - - -**Args:** - - - `client`: The GraphQL client. - - `organization`: The name of the organization. - - `name`: The name of the registry (without the `wandb-registry-` prefix). - - `visibility`: The visibility level ('organization' or 'restricted'). - - `description`: An optional description for the registry. - - `artifact_types`: An optional list of allowed artifact types. - - - -**Returns:** - - - `Registry`: The newly created Registry object. - - - -**Raises:** - - - `ValueError`: If a registry with the same name already exists in the organization or if the creation fails. - ---- - -### method `Registry.delete` - -```python -delete() → None -``` - -Delete the registry. This is irreversible. - ---- - -### method `Registry.load` - -```python -load() → None -``` - -Load the registry attributes from the backend to reflect the latest saved state. - ---- - -### method `Registry.save` - -```python -save() → None -``` - -Save registry attributes to the backend. - ---- - -### method `Registry.versions` - -```python -versions(filter: Optional[Dict[str, Any]] = None) → Versions -``` - -Returns the versions belonging to the registry. - diff --git a/content/en/ref/python/public-api/Run.md b/content/en/ref/python/public-api/Run.md deleted file mode 100644 index 2eba4d7936..0000000000 --- a/content/en/ref/python/public-api/Run.md +++ /dev/null @@ -1,497 +0,0 @@ ---- -title: Run -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/runs.py >}} - - - - -## class `Run` -A single run associated with an entity and project. - -### method `Run.__init__` - -```python -__init__( - client: 'RetryingClient', - entity: 'str', - project: 'str', - run_id: 'str', - attrs: 'Mapping | None' = None, - include_sweeps: 'bool' = True -) -``` - -**Args:** - - - `client`: The W&B API client. - - `entity`: The entity associated with the run. - - `project`: The project associated with the run. - - `run_id`: The unique identifier for the run. - - `attrs`: The attributes of the run. - - `include_sweeps`: Whether to include sweeps in the run. - - - -**Attributes:** - - - `tags` ([str]): a list of tags associated with the run - - `url` (str): the url of this run - - `id` (str): unique identifier for the run (defaults to eight characters) - - `name` (str): the name of the run - - `state` (str): one of: running, finished, crashed, killed, preempting, preempted - - `config` (dict): a dict of hyperparameters associated with the run - - `created_at` (str): ISO timestamp when the run was started - - `system_metrics` (dict): the latest system metrics recorded for the run - - `summary` (dict): A mutable dict-like property that holds the current summary. Calling update will persist any changes. - - `project` (str): the project associated with the run - - `entity` (str): the name of the entity associated with the run - - `project_internal_id` (int): the internal id of the project - - `user` (str): the name of the user who created the run - - `path` (str): Unique identifier [entity]/[project]/[run_id] - - `notes` (str): Notes about the run - - `read_only` (boolean): Whether the run is editable - - `history_keys` (str): Keys of the history metrics that have been logged - - `with `wandb.log({key`: value})` - - `metadata` (str): Metadata about the run from wandb-metadata.json - - -Initialize a Run object. - -Run is always initialized by calling api.runs() where api is an instance of wandb.Api. - - ---- - -### property Run.entity - -The entity associated with the run. - ---- - -### property Run.id - -The unique identifier for the run. - ---- - - -### property Run.lastHistoryStep - -Returns the last step logged in the run's history. - ---- - -### property Run.metadata - -Metadata about the run from wandb-metadata.json. - -Metadata includes the run's description, tags, start time, memory usage and more. - ---- - -### property Run.name - -The name of the run. - ---- - -### property Run.path - -The path of the run. The path is a list containing the entity, project, and run_id. - ---- - -### property Run.state - -The state of the run. Can be one of: Finished, Failed, Crashed, or Running. - ---- - -### property Run.storage_id - -The unique storage identifier for the run. - ---- - -### property Run.summary - -A mutable dict-like property that holds summary values associated with the run. - ---- - -### property Run.url - -The URL of the run. - -The run URL is generated from the entity, project, and run_id. For SaaS users, it takes the form of `https://wandb.ai/entity/project/run_id`. - ---- - -### property Run.username - -This API is deprecated. Use `entity` instead. - - - ---- - -### classmethod `Run.create` - -```python -create( - api: 'public.Api', - run_id: 'str | None' = None, - project: 'str | None' = None, - entity: 'str | None' = None, - state: "Literal['running', 'pending']" = 'running' -) -``` - -Create a run for the given project. - ---- - -### method `Run.delete` - -```python -delete(delete_artifacts=False) -``` - -Delete the given run from the wandb backend. - - - -**Args:** - - - `delete_artifacts` (bool, optional): Whether to delete the artifacts associated with the run. - ---- - -### method `Run.file` - -```python -file(name) -``` - -Return the path of a file with a given name in the artifact. - - - -**Args:** - - - `name` (str): name of requested file. - - - -**Returns:** - A `File` matching the name argument. - ---- - -### method `Run.files` - -```python -files( - names: 'list[str] | None' = None, - pattern: 'str | None' = None, - per_page: 'int' = 50 -) -``` - -Returns a `Files` object for all files in the run which match the given criteria. - -You can specify a list of exact file names to match, or a pattern to match against. If both are provided, the pattern will be ignored. - - - -**Args:** - - - `names` (list): names of the requested files, if empty returns all files - - `pattern` (str, optional): Pattern to match when returning files from W&B. This pattern uses mySQL's LIKE syntax, so matching all files that end with .json would be "%.json". If both names and pattern are provided, a ValueError will be raised. - - `per_page` (int): number of results per page. - - - -**Returns:** - A `Files` object, which is an iterator over `File` objects. - ---- - -### method `Run.history` - -```python -history(samples=500, keys=None, x_axis='_step', pandas=True, stream='default') -``` - -Return sampled history metrics for a run. - -This is simpler and faster if you are ok with the history records being sampled. - - - -**Args:** - - - `samples `: (int, optional) The number of samples to return - - `pandas `: (bool, optional) Return a pandas dataframe - - `keys `: (list, optional) Only return metrics for specific keys - - `x_axis `: (str, optional) Use this metric as the xAxis defaults to _step - - `stream `: (str, optional) "default" for metrics, "system" for machine metrics - - - -**Returns:** - - - `pandas.DataFrame`: If pandas=True returns a `pandas.DataFrame` of history metrics. - - `list of dicts`: If pandas=False returns a list of dicts of history metrics. - ---- - -### method `Run.load` - -```python -load(force=False) -``` - - - - - ---- - -### method `Run.log_artifact` - -```python -log_artifact( - artifact: 'wandb.Artifact', - aliases: 'Collection[str] | None' = None, - tags: 'Collection[str] | None' = None -) -``` - -Declare an artifact as output of a run. - - - -**Args:** - - - `artifact` (`Artifact`): An artifact returned from `wandb.Api().artifact(name)`. - - `aliases` (list, optional): Aliases to apply to this artifact. - - `tags`: (list, optional) Tags to apply to this artifact, if any. - - - -**Returns:** - A `Artifact` object. - ---- - -### method `Run.logged_artifacts` - -```python -logged_artifacts(per_page: 'int' = 100) → public.RunArtifacts -``` - -Fetches all artifacts logged by this run. - -Retrieves all output artifacts that were logged during the run. Returns a paginated result that can be iterated over or collected into a single list. - - - -**Args:** - - - `per_page`: Number of artifacts to fetch per API request. - - - -**Returns:** - An iterable collection of all Artifact objects logged as outputs during this run. - - - -**Example:** - ```python -import wandb -import tempfile - -with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".txt") as tmp: - tmp.write("This is a test artifact") - tmp_path = tmp.name -run = wandb.init(project="artifact-example") -artifact = wandb.Artifact("test_artifact", type="dataset") -artifact.add_file(tmp_path) -run.log_artifact(artifact) -run.finish() - -api = wandb.Api() - -finished_run = api.run(f"{run.entity}/{run.project}/{run.id}") - -for logged_artifact in finished_run.logged_artifacts(): - print(logged_artifact.name) -``` - ---- - -### method `Run.save` - -```python -save() -``` - -Persist changes to the run object to the W&B backend. - ---- - -### method `Run.scan_history` - -```python -scan_history(keys=None, page_size=1000, min_step=None, max_step=None) -``` - -Returns an iterable collection of all history records for a run. - - - -**Args:** - - - `keys` ([str], optional): only fetch these keys, and only fetch rows that have all of keys defined. - - `page_size` (int, optional): size of pages to fetch from the api. - - `min_step` (int, optional): the minimum number of pages to scan at a time. - - `max_step` (int, optional): the maximum number of pages to scan at a time. - - - -**Returns:** - An iterable collection over history records (dict). - - - -**Example:** - Export all the loss values for an example run - -```python -run = api.run("entity/project-name/run-id") -history = run.scan_history(keys=["Loss"]) -losses = [row["Loss"] for row in history] -``` - ---- - -### method `Run.to_html` - -```python -to_html(height=420, hidden=False) -``` - -Generate HTML containing an iframe displaying this run. - ---- - -### method `Run.update` - -```python -update() -``` - -Persist changes to the run object to the wandb backend. - ---- - -### method `Run.upload_file` - -```python -upload_file(path, root='.') -``` - -Upload a local file to W&B, associating it with this run. - - - -**Args:** - - - `path` (str): Path to the file to upload. Can be absolute or relative. - - `root` (str): The root path to save the file relative to. For example, if you want to have the file saved in the run as "my_dir/file.txt" and you're currently in "my_dir" you would set root to "../". Defaults to current directory ("."). - - - -**Returns:** - A `File` object representing the uploaded file. - ---- - -### method `Run.use_artifact` - -```python -use_artifact(artifact, use_as=None) -``` - -Declare an artifact as an input to a run. - - - -**Args:** - - - `artifact` (`Artifact`): An artifact returned from `wandb.Api().artifact(name)` - - `use_as` (string, optional): A string identifying how the artifact is used in the script. Used to easily differentiate artifacts used in a run, when using the beta wandb launch feature's artifact swapping functionality. - - - -**Returns:** - An `Artifact` object. - ---- - -### method `Run.used_artifacts` - -```python -used_artifacts(per_page: 'int' = 100) → public.RunArtifacts -``` - -Fetches artifacts explicitly used by this run. - -Retrieves only the input artifacts that were explicitly declared as used during the run, typically via `run.use_artifact()`. Returns a paginated result that can be iterated over or collected into a single list. - - - -**Args:** - - - `per_page`: Number of artifacts to fetch per API request. - - - -**Returns:** - An iterable collection of Artifact objects explicitly used as inputs in this run. - - - -**Example:** - ```python -import wandb - -run = wandb.init(project="artifact-example") -run.use_artifact("test_artifact:latest") -run.finish() - -api = wandb.Api() -finished_run = api.run(f"{run.entity}/{run.project}/{run.id}") -for used_artifact in finished_run.used_artifacts(): - print(used_artifact.name) -test_artifact -``` - ---- - -### method `Run.wait_until_finished` - -```python -wait_until_finished() -``` - -Check the state of the run until it is finished. - diff --git a/content/en/ref/python/public-api/RunArtifacts.md b/content/en/ref/python/public-api/RunArtifacts.md deleted file mode 100644 index f10085c738..0000000000 --- a/content/en/ref/python/public-api/RunArtifacts.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: RunArtifacts -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/artifacts.py >}} - - - - -## class `RunArtifacts` -An iterable collection of artifacts associated with a specific run. - - -### property RunArtifacts.length - - - - - ---- - - diff --git a/content/en/ref/python/public-api/Sweep.md b/content/en/ref/python/public-api/Sweep.md deleted file mode 100644 index 9e28429dfb..0000000000 --- a/content/en/ref/python/public-api/Sweep.md +++ /dev/null @@ -1,151 +0,0 @@ ---- -title: Sweep -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/sweeps.py >}} - - - - -## class `Sweep` -The set of runs associated with the sweep. - - - -**Attributes:** - - - `runs` (Runs): List of runs - - `id` (str): Sweep ID - - `project` (str): The name of the project the sweep belongs to - - `config` (dict): Dictionary containing the sweep configuration - - `state` (str): The state of the sweep. Can be "Finished", "Failed", "Crashed", or "Running". - - `expected_run_count` (int): The number of expected runs for the sweep - -### method `Sweep.__init__` - -```python -__init__(client, entity, project, sweep_id, attrs=None) -``` - - - - - - ---- - -### property Sweep.config - -The sweep configuration used for the sweep. - ---- - -### property Sweep.entity - -The entity associated with the sweep. - ---- - -### property Sweep.expected_run_count - -Return the number of expected runs in the sweep or None for infinite runs. - - - -**Returns:** - - `int | None`: The expected_run_count property value. ---- - -### property Sweep.name - -The name of the sweep. - -Returns the first name that exists in the following priority order: - -1. User-edited display name 2. Name configured at creation time 3. Sweep ID - ---- - -### property Sweep.order - -Return the order key for the sweep. - ---- - -### property Sweep.path - -Returns the path of the project. - -The path is a list containing the entity, project name, and sweep ID. - ---- - -### property Sweep.url - -The URL of the sweep. - -The sweep URL is generated from the entity, project, the term "sweeps", and the sweep ID.run_id. For SaaS users, it takes the form of `https://wandb.ai/entity/project/sweeps/sweeps_ID`. - ---- - -### property Sweep.username - -Deprecated. Use `Sweep.entity` instead. - - - ---- - -### method `Sweep.best_run` - -```python -best_run(order=None) -``` - -Return the best run sorted by the metric defined in config or the order passed in. - ---- - -### classmethod `Sweep.get` - -```python -get( - client: 'RetryingClient', - entity: Optional[str] = None, - project: Optional[str] = None, - sid: Optional[str] = None, - order: Optional[str] = None, - query: Optional[str] = None, - **kwargs -) -``` - -Execute a query against the cloud backend. - - - -**Args:** - - - `client`: The client to use to execute the query. - - `entity`: The entity (username or team) that owns the project. - - `project`: The name of the project to fetch sweep from. - - `sid`: The sweep ID to query. - - `order`: The order in which the sweep's runs are returned. - - `query`: The query to use to execute the query. - - `**kwargs`: Additional keyword arguments to pass to the query. - ---- - - -### method `Sweep.to_html` - -```python -to_html(height=420, hidden=False) -``` - -Generate HTML containing an iframe displaying this sweep. - diff --git a/content/en/ref/python/public-api/Team.md b/content/en/ref/python/public-api/Team.md deleted file mode 100644 index 7e8592a2bf..0000000000 --- a/content/en/ref/python/public-api/Team.md +++ /dev/null @@ -1,112 +0,0 @@ ---- -title: Team -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/teams.py >}} - - - - -## class `Team` -A class that represents a W&B team. - -This class provides methods to manage W&B teams, including creating teams, inviting members, and managing service accounts. It inherits from Attrs to handle team attributes. - -### method `Team.__init__` - -```python -__init__(client, name, attrs=None) -``` - -**Args:** - - - `client` (`wandb.apis.public.Api`): The api instance to use - - `name` (str): The name of the team - - `attrs` (dict): Optional dictionary of team attributes - - - -**Note:** - -> Team management requires appropriate permissions. - - - - - - - - - ---- - -### classmethod `Team.create` - -```python -create(api, team, admin_username=None) -``` - -Create a new team. - - - -**Args:** - - - `api`: (`Api`) The api instance to use - - `team`: (str) The name of the team - - `admin_username`: (str) optional username of the admin user of the team, defaults to the current user. - - - -**Returns:** - A `Team` object - ---- - -### method `Team.create_service_account` - -```python -create_service_account(description) -``` - -Create a service account for the team. - - - -**Args:** - - - `description`: (str) A description for this service account - - - -**Returns:** - The service account `Member` object, or None on failure - ---- - -### method `Team.invite` - -```python -invite(username_or_email, admin=False) -``` - -Invite a user to a team. - - - -**Args:** - - - `username_or_email`: (str) The username or email address of the user you want to invite. - - `admin`: (bool) Whether to make this user a team admin. Defaults to `False`. - - - -**Returns:** - `True` on success, `False` if user was already invited or didn't exist. - ---- - diff --git a/content/en/ref/python/public-api/User.md b/content/en/ref/python/public-api/User.md deleted file mode 100644 index 0213e14114..0000000000 --- a/content/en/ref/python/public-api/User.md +++ /dev/null @@ -1,143 +0,0 @@ ---- -title: User -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/users.py >}} - - - - -## class `User` -A class representing a W&B user with authentication and management capabilities. - -This class provides methods to manage W&B users, including creating users, managing API keys, and accessing team memberships. It inherits from Attrs to handle user attributes. - -### method `User.__init__` - -```python -__init__(client, attrs) -``` - -**Args:** - - - `client`: (`wandb.apis.internal.Api`) The client instance to use - - `attrs`: (dict) The user attributes - - - -**Note:** - -> Some operations require admin privileges - - - - - - - ---- - -### property User.api_keys - -List of API key names associated with the user. - - - -**Returns:** - - - `list[str]`: Names of API keys associated with the user. Empty list if user has no API keys or if API key data hasn't been loaded. - ---- - -### property User.teams - -List of team names that the user is a member of. - - - -**Returns:** - - - `list` (list): Names of teams the user belongs to. Empty list if user has no team memberships or if teams data hasn't been loaded. - ---- - -### property User.user_api - -An instance of the api using credentials from the user. - - - ---- - -### classmethod `User.create` - -```python -create(api, email, admin=False) -``` - -Create a new user. - - - -**Args:** - - - `api` (`Api`): The api instance to use - - `email` (str): The name of the team - - `admin` (bool): Whether this user should be a global instance admin - - - -**Returns:** - A `User` object - ---- - -### method `User.delete_api_key` - -```python -delete_api_key(api_key) -``` - -Delete a user's api key. - - - -**Args:** - - - `api_key` (str): The name of the API key to delete. This should be one of the names returned by the `api_keys` property. - - - -**Returns:** - Boolean indicating success - - - -**Raises:** - ValueError if the api_key couldn't be found - ---- - -### method `User.generate_api_key` - -```python -generate_api_key(description=None) -``` - -Generate a new api key. - - - -**Args:** - - - `description` (str, optional): A description for the new API key. This can be used to identify the purpose of the API key. - - - -**Returns:** - The new api key, or None on failure - diff --git a/content/en/ref/python/public-api/_index.md b/content/en/ref/python/public-api/_index.md deleted file mode 100644 index a7084d8f44..0000000000 --- a/content/en/ref/python/public-api/_index.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -title: Public API -module: wandb.apis.public -weight: 6 -no_list: true ---- - -The W&B Public API provides programmatic access to query, export, and update data stored in W&B. Use this API for post-hoc analysis, data export, and programmatic management of runs, artifacts, and sweeps. While the main SDK handles real-time logging during training, the Public API enables you to retrieve historical data, update metadata, manage artifacts, and perform analysis on completed experiments. The main `Api` class serves as the entry point to most functionality. - -{{< readfile file="/_includes/public-api-use.md" >}} - -## Available Components - -| Component | Description | -|-----------|-------------| -| [`Api`](./api/) | Main entry point for the Public API. Query runs, projects, and artifacts across your organization. | -| [`Runs`](./runs/) | Access and manage individual training runs, including history, logs, and metrics. | -| [`Artifacts`](./artifacts/) | Query and download model artifacts, datasets, and other versioned files. | -| [`Sweeps`](./sweeps/) | Access hyperparameter sweep data and analyze optimization results. | -| [`Projects`](./projects/) | Manage projects and access project-level metadata and settings. | -| [`Reports`](./reports/) | Programmatically access and manage W&B Reports. | -| [`Teams`](./teams/) | Query team information and manage team-level resources. | -| [`Users`](./users/) | Access user profiles and user-specific data. | -| [`Files`](./files/) | Download and manage files associated with runs. | -| [`History`](./history/) | Access detailed time-series metrics logged during training. | -| [`Automations`](./automations/) | Manage automated workflows and actions. | -| [`Integrations`](./integrations/) | Configure and manage third-party integrations. | - -## Common Use Cases - -### Data Export and Analysis -- Export run history as DataFrames for analysis in Jupyter notebooks -- Download metrics for custom visualization or reporting -- Aggregate results across multiple experiments - -### Post-Hoc Updates -- Update run metadata after completion -- Add tags or notes to completed experiments -- Modify run configurations or summaries - -### Artifact Management -- Query artifacts by version or alias -- Download model checkpoints programmatically -- Track artifact lineage and dependencies - -### Sweep Analysis -- Access sweep results and best performing runs -- Export hyperparameter search results -- Analyze parameter importance - -## Authentication - -The Public API uses the same authentication mechanism as the Python SDK. You can authenticate in several ways: - -Use the `WANDB_API_KEY` environment variable to set your API key: - -```bash -export WANDB_API_KEY=your_api_key -``` - -Pass the API key directly when initializing the `Api` class: - -```python -api = Api(api_key="your_api_key") -``` - -Or use `wandb.login()` to authenticate the current session: -```python -import wandb - -wandb.login() -api = Api() -``` - - -## Example Usage - - -### Download an Artifact by name and alias - -The following example shows how to retrieve an artifact logged to W&B by its name and alias, and then download its contents. - -```python -import wandb - -api = wandb.Api() -artifact = api.artifact("entity/project/artifact:alias") -artifact.download() -``` - -### Download an Artifact from a registry - -The following example shows how to retrieve a linked artifact from a W&B Registry - -```python -import wandb - -REGISTRY = "" -COLLECTION = "" -VERSION = "" - -api = wandb.Api() -artifact_name = f"wandb-registry-{REGISTRY}/{COLLECTION}:{VERSION}" - -# Fetch the artifact -fetched_artifact = api.artifact(name = artifact_name) - -# Download artifact. Returns path to downloaded contents -downloaded_path = fetched_artifact.download() -``` - -### Query W&B Registry - -Use Mongo-like filters to query W&B Registries, Collections, and Artifacts. The following example demonstrates how to filter collections by name using a regular expression. - -```python -import wandb - -# Initialize wandb API -api = wandb.Api() - -# Filter all collections, independent of registry, that -# contains the string `yolo` in the collection name -collection_filters = { - "name": {"$regex": "yolo"} -} - -# Returns an iterable of all collections that match the filters -collections = api.registries().collections(filter=collection_filters) -``` - -For more information on how to query a registry, collection, or artifact, see the [Find registry items](/guides/registry/search-registry). \ No newline at end of file diff --git a/content/en/ref/python/public-api/api.md b/content/en/ref/python/public-api/api.md deleted file mode 100644 index 3d1c1111f7..0000000000 --- a/content/en/ref/python/public-api/api.md +++ /dev/null @@ -1,1572 +0,0 @@ ---- -title: Api -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/api.py >}} - - - - -## class `Api` -Used for querying the W&B server. - - - -**Examples:** - ```python -import wandb - -wandb.Api() -``` - -### method `Api.__init__` - -```python -__init__( - overrides: Optional[Dict[str, Any]] = None, - timeout: Optional[int] = None, - api_key: Optional[str] = None -) → None -``` - -Initialize the API. - - - -**Args:** - - - `overrides`: You can set `base_url` if you are - - `using a W&B server other than `https`: //api.wandb.ai`. You can also set defaults for `entity`, `project`, and `run`. - - `timeout`: HTTP timeout in seconds for API requests. If not specified, the default timeout will be used. - - `api_key`: API key to use for authentication. If not provided, the API key from the current environment or configuration will be used. - - ---- - -### property Api.api_key - -Returns W&B API key. - - - -**Returns:** - - `str | None`: The api_key property value. ---- - -### property Api.client - -Returns the client object. - - - -**Returns:** - - `RetryingClient`: The client property value. ---- - -### property Api.default_entity - -Returns the default W&B entity. - - - -**Returns:** - - `str | None`: The default_entity property value. ---- - -### property Api.user_agent - -Returns W&B public user agent. - - - -**Returns:** - - `str`: The user_agent property value. ---- - -### property Api.viewer - -Returns the viewer object. - - - -**Raises:** - - - `ValueError`: If viewer data is not able to be fetched from W&B. - - `requests.RequestException`: If an error occurs while making the graphql request. - - - - - -**Returns:** - - `public.User`: The viewer property value. ---- - -### method `Api.artifact` - -```python -artifact(name: str, type: Optional[str] = None) -``` - -Returns a single artifact. - - - -**Args:** - - - `name`: The artifact's name. The name of an artifact resembles a filepath that consists, at a minimum, the name of the project the artifact was logged to, the name of the artifact, and the artifact's version or alias. Optionally append the entity that logged the artifact as a prefix followed by a forward slash. If no entity is specified in the name, the Run or API setting's entity is used. - - `type`: The type of artifact to fetch. - - - -**Returns:** - An `Artifact` object. - - - -**Raises:** - - - `ValueError`: If the artifact name is not specified. - - `ValueError`: If the artifact type is specified but does not match the type of the fetched artifact. - - - -**Examples:** - In the proceeding code snippets "entity", "project", "artifact", "version", and "alias" are placeholders for your W&B entity, name of the project the artifact is in, the name of the artifact, and artifact's version, respectively. - -```python -import wandb - -# Specify the project, artifact's name, and the artifact's alias -wandb.Api().artifact(name="project/artifact:alias") - -# Specify the project, artifact's name, and a specific artifact version -wandb.Api().artifact(name="project/artifact:version") - -# Specify the entity, project, artifact's name, and the artifact's alias -wandb.Api().artifact(name="entity/project/artifact:alias") - -# Specify the entity, project, artifact's name, and a specific artifact version -wandb.Api().artifact(name="entity/project/artifact:version") -``` - - - -**Note:** - -> This method is intended for external use only. Do not call `api.artifact()` within the wandb repository code. - ---- - -### method `Api.artifact_collection` - -```python -artifact_collection(type_name: str, name: str) → public.ArtifactCollection -``` - -Returns a single artifact collection by type. - -You can use the returned `ArtifactCollection` object to retrieve information about specific artifacts in that collection, and more. - - - -**Args:** - - - `type_name`: The type of artifact collection to fetch. - - `name`: An artifact collection name. Optionally append the entity that logged the artifact as a prefix followed by a forward slash. - - - -**Returns:** - An `ArtifactCollection` object. - - - -**Examples:** - In the proceeding code snippet "type", "entity", "project", and "artifact_name" are placeholders for the collection type, your W&B entity, name of the project the artifact is in, and the name of the artifact, respectively. - -```python -import wandb - -collections = wandb.Api().artifact_collection( - type_name="type", name="entity/project/artifact_name" -) - -# Get the first artifact in the collection -artifact_example = collections.artifacts()[0] - -# Download the contents of the artifact to the specified root directory. -artifact_example.download() -``` - ---- - -### method `Api.artifact_collection_exists` - -```python -artifact_collection_exists(name: str, type: str) → bool -``` - -Whether an artifact collection exists within a specified project and entity. - - - -**Args:** - - - `name`: An artifact collection name. Optionally append the entity that logged the artifact as a prefix followed by a forward slash. If entity or project is not specified, infer the collection from the override params if they exist. Otherwise, entity is pulled from the user settings and project will default to "uncategorized". - - `type`: The type of artifact collection. - - - -**Returns:** - True if the artifact collection exists, False otherwise. - - - -**Examples:** - In the proceeding code snippet "type", and "collection_name" refer to the type of the artifact collection and the name of the collection, respectively. - -```python -import wandb - -wandb.Api.artifact_collection_exists(type="type", name="collection_name") -``` - ---- - -### method `Api.artifact_collections` - -```python -artifact_collections( - project_name: str, - type_name: str, - per_page: int = 50 -) → public.ArtifactCollections -``` - -Returns a collection of matching artifact collections. - - - -**Args:** - - - `project_name`: The name of the project to filter on. - - `type_name`: The name of the artifact type to filter on. - - `per_page`: Sets the page size for query pagination. None will use the default size. Usually there is no reason to change this. - - - -**Returns:** - An iterable `ArtifactCollections` object. - ---- - -### method `Api.artifact_exists` - -```python -artifact_exists(name: str, type: Optional[str] = None) → bool -``` - -Whether an artifact version exists within the specified project and entity. - - - -**Args:** - - - `name`: The name of artifact. Add the artifact's entity and project as a prefix. Append the version or the alias of the artifact with a colon. If the entity or project is not specified, W&B uses override parameters if populated. Otherwise, the entity is pulled from the user settings and the project is set to "Uncategorized". - - `type`: The type of artifact. - - - -**Returns:** - True if the artifact version exists, False otherwise. - - - -**Examples:** - In the proceeding code snippets "entity", "project", "artifact", "version", and "alias" are placeholders for your W&B entity, name of the project the artifact is in, the name of the artifact, and artifact's version, respectively. - -```python -import wandb - -wandb.Api().artifact_exists("entity/project/artifact:version") -wandb.Api().artifact_exists("entity/project/artifact:alias") -``` - ---- - -### method `Api.artifact_type` - -```python -artifact_type( - type_name: str, - project: Optional[str] = None -) → public.ArtifactType -``` - -Returns the matching `ArtifactType`. - - - -**Args:** - - - `type_name`: The name of the artifact type to retrieve. - - `project`: If given, a project name or path to filter on. - - - -**Returns:** - An `ArtifactType` object. - ---- - -### method `Api.artifact_types` - -```python -artifact_types(project: Optional[str] = None) → public.ArtifactTypes -``` - -Returns a collection of matching artifact types. - - - -**Args:** - - - `project`: The project name or path to filter on. - - - -**Returns:** - An iterable `ArtifactTypes` object. - ---- - -### method `Api.artifact_versions` - -```python -artifact_versions(type_name, name, per_page=50) -``` - -Deprecated. Use `Api.artifacts(type_name, name)` method instead. - ---- - -### method `Api.artifacts` - -```python -artifacts( - type_name: str, - name: str, - per_page: int = 50, - tags: Optional[List[str]] = None -) → public.Artifacts -``` - -Return an `Artifacts` collection. - - - -**Args:** - type_name: The type of artifacts to fetch. name: The artifact's collection name. Optionally append the entity that logged the artifact as a prefix followed by a forward slash. per_page: Sets the page size for query pagination. If set to `None`, use the default size. Usually there is no reason to change this. tags: Only return artifacts with all of these tags. - - - -**Returns:** - An iterable `Artifacts` object. - - - -**Examples:** - In the proceeding code snippet, "type", "entity", "project", and "artifact_name" are placeholders for the artifact type, W&B entity, name of the project the artifact was logged to, and the name of the artifact, respectively. - -```python -import wandb - -wandb.Api().artifacts(type_name="type", name="entity/project/artifact_name") -``` - ---- - -### method `Api.automation` - -```python -automation(name: str, entity: Optional[str] = None) → Automation -``` - -Returns the only Automation matching the parameters. - - - -**Args:** - - - `name`: The name of the automation to fetch. - - `entity`: The entity to fetch the automation for. - - - -**Raises:** - - - `ValueError`: If zero or multiple Automations match the search criteria. - - - -**Examples:** - Get an existing automation named "my-automation": - -```python -import wandb - -api = wandb.Api() -automation = api.automation(name="my-automation") -``` - -Get an existing automation named "other-automation", from the entity "my-team": - -```python -automation = api.automation(name="other-automation", entity="my-team") -``` - ---- - -### method `Api.automations` - -```python -automations( - entity: Optional[str] = None, - name: Optional[str] = None, - per_page: int = 50 -) → Iterator[ForwardRef('Automation')] -``` - -Returns an iterator over all Automations that match the given parameters. - -If no parameters are provided, the returned iterator will contain all Automations that the user has access to. - - - -**Args:** - - - `entity`: The entity to fetch the automations for. - - `name`: The name of the automation to fetch. - - `per_page`: The number of automations to fetch per page. Defaults to 50. Usually there is no reason to change this. - - - -**Returns:** - A list of automations. - - - -**Examples:** - Fetch all existing automations for the entity "my-team": - -```python -import wandb - -api = wandb.Api() -automations = api.automations(entity="my-team") -``` - ---- - -### method `Api.create_automation` - -```python -create_automation( - obj: 'NewAutomation', - fetch_existing: bool = False, - **kwargs: typing_extensions.Unpack[ForwardRef('WriteAutomationsKwargs')] -) → Automation -``` - -Create a new Automation. - - - -**Args:** - obj: The automation to create. fetch_existing: If True, and a conflicting automation already exists, attempt to fetch the existing automation instead of raising an error. **kwargs: Any additional values to assign to the automation before creating it. If given, these will override any values that may already be set on the automation: - - `name`: The name of the automation. - - `description`: The description of the automation. - - `enabled`: Whether the automation is enabled. - - `scope`: The scope of the automation. - - `event`: The event that triggers the automation. - - `action`: The action that is triggered by the automation. - - - -**Returns:** - The saved Automation. - - - -**Examples:** - Create a new automation named "my-automation" that sends a Slack notification when a run within a specific project logs a metric exceeding a custom threshold: - -```python -import wandb -from wandb.automations import OnRunMetric, RunEvent, SendNotification - -api = wandb.Api() - -project = api.project("my-project", entity="my-team") - -# Use the first Slack integration for the team -slack_hook = next(api.slack_integrations(entity="my-team")) - -event = OnRunMetric( - scope=project, - filter=RunEvent.metric("custom-metric") > 10, -) -action = SendNotification.from_integration(slack_hook) - -automation = api.create_automation( - event >> action, - name="my-automation", - description="Send a Slack message whenever 'custom-metric' exceeds 10.", -) -``` - ---- - -### method `Api.create_custom_chart` - -```python -create_custom_chart( - entity: str, - name: str, - display_name: str, - spec_type: Literal['vega2'], - access: Literal['private', 'public'], - spec: Union[str, dict] -) → str -``` - -Create a custom chart preset and return its id. - - - -**Args:** - - - `entity`: The entity (user or team) that owns the chart - - `name`: Unique identifier for the chart preset - - `display_name`: Human-readable name shown in the UI - - `spec_type`: Type of specification. Must be "vega2" for Vega-Lite v2 specifications. - - `access`: Access level for the chart: - - "private": Chart is only accessible to the entity that created it - - "public": Chart is publicly accessible - - `spec`: The Vega/Vega-Lite specification as a dictionary or JSON string - - - -**Returns:** - The ID of the created chart preset in the format "entity/name" - - - -**Raises:** - - - `wandb.Error`: If chart creation fails - - `UnsupportedError`: If the server doesn't support custom charts - - - -**Example:** - ```python - import wandb - - api = wandb.Api() - - # Define a simple bar chart specification - vega_spec = { - "$schema": "https://vega.github.io/schema/vega-lite/v6.json", - "mark": "bar", - "data": {"name": "wandb"}, - "encoding": { - "x": {"field": "${field:x}", "type": "ordinal"}, - "y": {"field": "${field:y}", "type": "quantitative"}, - }, - } - - # Create the custom chart - chart_id = api.create_custom_chart( - entity="my-team", - name="my-bar-chart", - display_name="My Custom Bar Chart", - spec_type="vega2", - access="private", - spec=vega_spec, - ) - - # Use with wandb.plot_table() - chart = wandb.plot_table( - vega_spec_name=chart_id, - data_table=my_table, - fields={"x": "category", "y": "value"}, - ) - ``` - ---- - -### method `Api.create_project` - -```python -create_project(name: str, entity: str) → None -``` - -Create a new project. - - - -**Args:** - - - `name`: The name of the new project. - - `entity`: The entity of the new project. - ---- - -### method `Api.create_registry` - -```python -create_registry( - name: str, - visibility: Literal['organization', 'restricted'], - organization: Optional[str] = None, - description: Optional[str] = None, - artifact_types: Optional[List[str]] = None -) → Registry -``` - -Create a new registry. - - - -**Args:** - - - `name`: The name of the registry. Name must be unique within the organization. - - `visibility`: The visibility of the registry. - - `organization`: Anyone in the organization can view this registry. You can edit their roles later from the settings in the UI. - - `restricted`: Only invited members via the UI can access this registry. Public sharing is disabled. - - `organization`: The organization of the registry. If no organization is set in the settings, the organization will be fetched from the entity if the entity only belongs to one organization. - - `description`: The description of the registry. - - `artifact_types`: The accepted artifact types of the registry. A type is no - - `more than 128 characters and do not include characters `/` or ``: `. If not specified, all types are accepted. Allowed types added to the registry cannot be removed later. - - - -**Returns:** - A registry object. - - - -**Examples:** - ```python -import wandb - -api = wandb.Api() -registry = api.create_registry( - name="my-registry", - visibility="restricted", - organization="my-org", - description="This is a test registry", - artifact_types=["model"], -) -``` - ---- - -### method `Api.create_run` - -```python -create_run( - run_id: Optional[str] = None, - project: Optional[str] = None, - entity: Optional[str] = None -) → public.Run -``` - -Create a new run. - - - -**Args:** - - - `run_id`: The ID to assign to the run. If not specified, W&B creates a random ID. - - `project`: The project where to log the run to. If no project is specified, log the run to a project called "Uncategorized". - - `entity`: The entity that owns the project. If no entity is specified, log the run to the default entity. - - - -**Returns:** - The newly created `Run`. - ---- - -### method `Api.create_run_queue` - -```python -create_run_queue( - name: str, - type: 'public.RunQueueResourceType', - entity: Optional[str] = None, - prioritization_mode: Optional[ForwardRef('public.RunQueuePrioritizationMode')] = None, - config: Optional[dict] = None, - template_variables: Optional[dict] = None -) → public.RunQueue -``` - -Create a new run queue in W&B Launch. - - - -**Args:** - - - `name`: Name of the queue to create - - `type`: Type of resource to be used for the queue. One of "local-container", "local-process", "kubernetes","sagemaker", or "gcp-vertex". - - `entity`: Name of the entity to create the queue. If `None`, use the configured or default entity. - - `prioritization_mode`: Version of prioritization to use. Either "V0" or `None`. - - `config`: Default resource configuration to be used for the queue. Use handlebars (eg. `{{var}}`) to specify template variables. - - `template_variables`: A dictionary of template variable schemas to use with the config. - - - -**Returns:** - The newly created `RunQueue`. - - - -**Raises:** - `ValueError` if any of the parameters are invalid `wandb.Error` on wandb API errors - ---- - -### method `Api.create_team` - -```python -create_team(team: str, admin_username: Optional[str] = None) → public.Team -``` - -Create a new team. - - - -**Args:** - - - `team`: The name of the team - - `admin_username`: Username of the admin user of the team. Defaults to the current user. - - - -**Returns:** - A `Team` object. - ---- - -### method `Api.create_user` - -```python -create_user(email: str, admin: Optional[bool] = False) -``` - -Create a new user. - - - -**Args:** - - - `email`: The email address of the user. - - `admin`: Set user as a global instance administrator. - - - -**Returns:** - A `User` object. - ---- - -### method `Api.delete_automation` - -```python -delete_automation(obj: Union[ForwardRef('Automation'), str]) → Literal[True] -``` - -Delete an automation. - - - -**Args:** - - - `obj`: The automation to delete, or its ID. - - - -**Returns:** - True if the automation was deleted successfully. - ---- - -### method `Api.flush` - -```python -flush() -``` - -Flush the local cache. - -The api object keeps a local cache of runs, so if the state of the run may change while executing your script you must clear the local cache with `api.flush()` to get the latest values associated with the run. - ---- - -### method `Api.from_path` - -```python -from_path(path: str) -``` - -Return a run, sweep, project or report from a path. - - - -**Args:** - - - `path`: The path to the project, run, sweep or report - - - -**Returns:** - A `Project`, `Run`, `Sweep`, or `BetaReport` instance. - - - -**Raises:** - `wandb.Error` if path is invalid or the object doesn't exist. - - - -**Examples:** - In the proceeding code snippets "project", "team", "run_id", "sweep_id", and "report_name" are placeholders for the project, team, run ID, sweep ID, and the name of a specific report, respectively. - -```python -import wandb - -api = wandb.Api() - -project = api.from_path("project") -team_project = api.from_path("team/project") -run = api.from_path("team/project/runs/run_id") -sweep = api.from_path("team/project/sweeps/sweep_id") -report = api.from_path("team/project/reports/report_name") -``` - ---- - -### method `Api.integrations` - -```python -integrations( - entity: Optional[str] = None, - per_page: int = 50 -) → Iterator[ForwardRef('Integration')] -``` - -Return an iterator of all integrations for an entity. - - - -**Args:** - - - `entity`: The entity (e.g. team name) for which to fetch integrations. If not provided, the user's default entity will be used. - - `per_page`: Number of integrations to fetch per page. Defaults to 50. Usually there is no reason to change this. - - - -**Yields:** - - - `Iterator[SlackIntegration | WebhookIntegration]`: An iterator of any supported integrations. - ---- - -### method `Api.job` - -```python -job(name: Optional[str], path: Optional[str] = None) → public.Job -``` - -Return a `Job` object. - - - -**Args:** - - - `name`: The name of the job. - - `path`: The root path to download the job artifact. - - - -**Returns:** - A `Job` object. - ---- - -### method `Api.list_jobs` - -```python -list_jobs(entity: str, project: str) → List[Dict[str, Any]] -``` - -Return a list of jobs, if any, for the given entity and project. - - - -**Args:** - - - `entity`: The entity for the listed jobs. - - `project`: The project for the listed jobs. - - - -**Returns:** - A list of matching jobs. - ---- - -### method `Api.project` - -```python -project(name: str, entity: Optional[str] = None) → public.Project -``` - -Return the `Project` with the given name (and entity, if given). - - - -**Args:** - - - `name`: The project name. - - `entity`: Name of the entity requested. If None, will fall back to the default entity passed to `Api`. If no default entity, will raise a `ValueError`. - - - -**Returns:** - A `Project` object. - ---- - -### method `Api.projects` - -```python -projects(entity: Optional[str] = None, per_page: int = 200) → public.Projects -``` - -Get projects for a given entity. - - - -**Args:** - - - `entity`: Name of the entity requested. If None, will fall back to the default entity passed to `Api`. If no default entity, will raise a `ValueError`. - - `per_page`: Sets the page size for query pagination. If set to `None`, use the default size. Usually there is no reason to change this. - - - -**Returns:** - A `Projects` object which is an iterable collection of `Project`objects. - ---- - -### method `Api.queued_run` - -```python -queued_run( - entity: str, - project: str, - queue_name: str, - run_queue_item_id: str, - project_queue=None, - priority=None -) -``` - -Return a single queued run based on the path. - -Parses paths of the form `entity/project/queue_id/run_queue_item_id`. - ---- - -### method `Api.registries` - -```python -registries( - organization: Optional[str] = None, - filter: Optional[Dict[str, Any]] = None -) → Registries -``` - -Returns a lazy iterator of `Registry` objects. - -Use the iterator to search and filter registries, collections, or artifact versions across your organization's registry. - - - -**Args:** - - - `organization`: (str, optional) The organization of the registry to fetch. If not specified, use the organization specified in the user's settings. - - `filter`: (dict, optional) MongoDB-style filter to apply to each object in the lazy registry iterator. Fields available to filter for registries are `name`, `description`, `created_at`, `updated_at`. Fields available to filter for collections are `name`, `tag`, `description`, `created_at`, `updated_at` Fields available to filter for versions are `tag`, `alias`, `created_at`, `updated_at`, `metadata` - - - -**Returns:** - A lazy iterator of `Registry` objects. - - - -**Examples:** - Find all registries with the names that contain "model" - -```python -import wandb - -api = wandb.Api() # specify an org if your entity belongs to multiple orgs -api.registries(filter={"name": {"$regex": "model"}}) -``` - -Find all collections in the registries with the name "my_collection" and the tag "my_tag" - -```python -api.registries().collections(filter={"name": "my_collection", "tag": "my_tag"}) -``` - -Find all artifact versions in the registries with a collection name that contains "my_collection" and a version that has the alias "best" - -```python -api.registries().collections( - filter={"name": {"$regex": "my_collection"}} -).versions(filter={"alias": "best"}) -``` - -Find all artifact versions in the registries that contain "model" and have the tag "prod" or alias "best" - -```python -api.registries(filter={"name": {"$regex": "model"}}).versions( - filter={"$or": [{"tag": "prod"}, {"alias": "best"}]} -) -``` - ---- - -### method `Api.registry` - -```python -registry(name: str, organization: Optional[str] = None) → Registry -``` - -Return a registry given a registry name. - - - -**Args:** - - - `name`: The name of the registry. This is without the `wandb-registry-` prefix. - - `organization`: The organization of the registry. If no organization is set in the settings, the organization will be fetched from the entity if the entity only belongs to one organization. - - - -**Returns:** - A registry object. - - - -**Examples:** - Fetch and update a registry - -```python -import wandb - -api = wandb.Api() -registry = api.registry(name="my-registry", organization="my-org") -registry.description = "This is an updated description" -registry.save() -``` - ---- - -### method `Api.reports` - -```python -reports( - path: str = '', - name: Optional[str] = None, - per_page: int = 50 -) → public.Reports -``` - -Get reports for a given project path. - -Note: `wandb.Api.reports()` API is in beta and will likely change in future releases. - - - -**Args:** - - - `path`: The path to the project the report resides in. Specify the entity that created the project as a prefix followed by a forward slash. - - `name`: Name of the report requested. - - `per_page`: Sets the page size for query pagination. If set to `None`, use the default size. Usually there is no reason to change this. - - - -**Returns:** - A `Reports` object which is an iterable collection of `BetaReport` objects. - - - -**Examples:** - ```python -import wandb - -wandb.Api.reports("entity/project") -``` - ---- - -### method `Api.run` - -```python -run(path='') -``` - -Return a single run by parsing path in the form `entity/project/run_id`. - - - -**Args:** - - - `path`: Path to run in the form `entity/project/run_id`. If `api.entity` is set, this can be in the form `project/run_id` and if `api.project` is set this can just be the run_id. - - - -**Returns:** - A `Run` object. - ---- - -### method `Api.run_queue` - -```python -run_queue(entity: str, name: str) -``` - -Return the named `RunQueue` for entity. - -See `Api.create_run_queue` for more information on how to create a run queue. - ---- - -### method `Api.runs` - -```python -runs( - path: Optional[str] = None, - filters: Optional[Dict[str, Any]] = None, - order: str = '+created_at', - per_page: int = 50, - include_sweeps: bool = True -) -``` - -Returns a `Runs` object, which lazily iterates over `Run` objects. - -Fields you can filter by include: -- `createdAt`: The timestamp when the run was created. (in ISO 8601 format, e.g. "2023-01-01T12:00:00Z") -- `displayName`: The human-readable display name of the run. (e.g. "eager-fox-1") -- `duration`: The total runtime of the run in seconds. -- `group`: The group name used to organize related runs together. -- `host`: The hostname where the run was executed. -- `jobType`: The type of job or purpose of the run. -- `name`: The unique identifier of the run. (e.g. "a1b2cdef") -- `state`: The current state of the run. -- `tags`: The tags associated with the run. -- `username`: The username of the user who initiated the run - -Additionally, you can filter by items in the run config or summary metrics. Such as `config.experiment_name`, `summary_metrics.loss`, etc. - -For more complex filtering, you can use MongoDB query operators. For details, see: https://docs.mongodb.com/manual/reference/operator/query The following operations are supported: -- `$and` -- `$or` -- `$nor` -- `$eq` -- `$ne` -- `$gt` -- `$gte` -- `$lt` -- `$lte` -- `$in` -- `$nin` -- `$exists` -- `$regex` - - - - - - - -**Args:** - - - `path`: (str) path to project, should be in the form: "entity/project" - - `filters`: (dict) queries for specific runs using the MongoDB query language. You can filter by run properties such as config.key, summary_metrics.key, state, entity, createdAt, etc. - - `For example`: `{"config.experiment_name": "foo"}` would find runs with a config entry of experiment name set to "foo" - - `order`: (str) Order can be `created_at`, `heartbeat_at`, `config.*.value`, or `summary_metrics.*`. If you prepend order with a + order is ascending (default). If you prepend order with a - order is descending. The default order is run.created_at from oldest to newest. - - `per_page`: (int) Sets the page size for query pagination. - - `include_sweeps`: (bool) Whether to include the sweep runs in the results. - - - -**Returns:** - A `Runs` object, which is an iterable collection of `Run` objects. - - - -**Examples:** - ```python -# Find runs in project where config.experiment_name has been set to "foo" -api.runs(path="my_entity/project", filters={"config.experiment_name": "foo"}) -``` - -```python -# Find runs in project where config.experiment_name has been set to "foo" or "bar" -api.runs( - path="my_entity/project", - filters={ - "$or": [ - {"config.experiment_name": "foo"}, - {"config.experiment_name": "bar"}, - ] - }, -) -``` - -```python -# Find runs in project where config.experiment_name matches a regex -# (anchors are not supported) -api.runs( - path="my_entity/project", - filters={"config.experiment_name": {"$regex": "b.*"}}, -) -``` - -```python -# Find runs in project where the run name matches a regex -# (anchors are not supported) -api.runs( - path="my_entity/project", filters={"display_name": {"$regex": "^foo.*"}} -) -``` - -```python -# Find runs in project sorted by ascending loss -api.runs(path="my_entity/project", order="+summary_metrics.loss") -``` - ---- - -### method `Api.slack_integrations` - -```python -slack_integrations( - entity: Optional[str] = None, - per_page: int = 50 -) → Iterator[ForwardRef('SlackIntegration')] -``` - -Returns an iterator of Slack integrations for an entity. - - - -**Args:** - - - `entity`: The entity (e.g. team name) for which to fetch integrations. If not provided, the user's default entity will be used. - - `per_page`: Number of integrations to fetch per page. Defaults to 50. Usually there is no reason to change this. - - - -**Yields:** - - - `Iterator[SlackIntegration]`: An iterator of Slack integrations. - - - -**Examples:** - Get all registered Slack integrations for the team "my-team": - -```python -import wandb - -api = wandb.Api() -slack_integrations = api.slack_integrations(entity="my-team") -``` - -Find only Slack integrations that post to channel names starting with "team-alerts-": - -```python -slack_integrations = api.slack_integrations(entity="my-team") -team_alert_integrations = [ - ig - for ig in slack_integrations - if ig.channel_name.startswith("team-alerts-") -] -``` - ---- - -### method `Api.sweep` - -```python -sweep(path='') -``` - -Return a sweep by parsing path in the form `entity/project/sweep_id`. - - - -**Args:** - - - `path`: Path to sweep in the form entity/project/sweep_id. If `api.entity` is set, this can be in the form project/sweep_id and if `api.project` is set this can just be the sweep_id. - - - -**Returns:** - A `Sweep` object. - ---- - -### method `Api.sync_tensorboard` - -```python -sync_tensorboard(root_dir, run_id=None, project=None, entity=None) -``` - -Sync a local directory containing tfevent files to wandb. - ---- - -### method `Api.team` - -```python -team(team: str) → public.Team -``` - -Return the matching `Team` with the given name. - - - -**Args:** - - - `team`: The name of the team. - - - -**Returns:** - A `Team` object. - ---- - -### method `Api.update_automation` - -```python -update_automation( - obj: 'Automation', - create_missing: bool = False, - **kwargs: typing_extensions.Unpack[ForwardRef('WriteAutomationsKwargs')] -) → Automation -``` - -Update an existing automation. - - - -**Args:** - - - `obj`: The automation to update. Must be an existing automation. create_missing (bool): If True, and the automation does not exist, create it. **kwargs: Any additional values to assign to the automation before updating it. If given, these will override any values that may already be set on the automation: - - `name`: The name of the automation. - - `description`: The description of the automation. - - `enabled`: Whether the automation is enabled. - - `scope`: The scope of the automation. - - `event`: The event that triggers the automation. - - `action`: The action that is triggered by the automation. - - - -**Returns:** - The updated automation. - - - -**Examples:** - Disable and edit the description of an existing automation ("my-automation"): - -```python -import wandb - -api = wandb.Api() - -automation = api.automation(name="my-automation") -automation.enabled = False -automation.description = "Kept for reference, but no longer used." - -updated_automation = api.update_automation(automation) -``` - -OR - -```python -import wandb - -api = wandb.Api() - -automation = api.automation(name="my-automation") - -updated_automation = api.update_automation( - automation, - enabled=False, - description="Kept for reference, but no longer used.", -) -``` - ---- - -### method `Api.upsert_run_queue` - -```python -upsert_run_queue( - name: str, - resource_config: dict, - resource_type: 'public.RunQueueResourceType', - entity: Optional[str] = None, - template_variables: Optional[dict] = None, - external_links: Optional[dict] = None, - prioritization_mode: Optional[ForwardRef('public.RunQueuePrioritizationMode')] = None -) -``` - -Upsert a run queue in W&B Launch. - - - -**Args:** - - - `name`: Name of the queue to create - - `entity`: Optional name of the entity to create the queue. If `None`, use the configured or default entity. - - `resource_config`: Optional default resource configuration to be used for the queue. Use handlebars (eg. `{{var}}`) to specify template variables. - - `resource_type`: Type of resource to be used for the queue. One of "local-container", "local-process", "kubernetes", "sagemaker", or "gcp-vertex". - - `template_variables`: A dictionary of template variable schemas to be used with the config. - - `external_links`: Optional dictionary of external links to be used with the queue. - - `prioritization_mode`: Optional version of prioritization to use. Either "V0" or None - - - -**Returns:** - The upserted `RunQueue`. - - - -**Raises:** - ValueError if any of the parameters are invalid wandb.Error on wandb API errors - ---- - -### method `Api.user` - -```python -user(username_or_email: str) → Optional[ForwardRef('public.User')] -``` - -Return a user from a username or email address. - -This function only works for local administrators. Use `api.viewer` to get your own user object. - - - -**Args:** - - - `username_or_email`: The username or email address of the user. - - - -**Returns:** - A `User` object or None if a user is not found. - ---- - -### method `Api.users` - -```python -users(username_or_email: str) → List[ForwardRef('public.User')] -``` - -Return all users from a partial username or email address query. - -This function only works for local administrators. Use `api.viewer` to get your own user object. - - - -**Args:** - - - `username_or_email`: The prefix or suffix of the user you want to find. - - - -**Returns:** - An array of `User` objects. - ---- - -### method `Api.webhook_integrations` - -```python -webhook_integrations( - entity: Optional[str] = None, - per_page: int = 50 -) → Iterator[ForwardRef('WebhookIntegration')] -``` - -Returns an iterator of webhook integrations for an entity. - - - -**Args:** - - - `entity`: The entity (e.g. team name) for which to fetch integrations. If not provided, the user's default entity will be used. - - `per_page`: Number of integrations to fetch per page. Defaults to 50. Usually there is no reason to change this. - - - -**Yields:** - - - `Iterator[WebhookIntegration]`: An iterator of webhook integrations. - - - -**Examples:** - Get all registered webhook integrations for the team "my-team": - -```python -import wandb - -api = wandb.Api() -webhook_integrations = api.webhook_integrations(entity="my-team") -``` - -Find only webhook integrations that post requests to "https://my-fake-url.com": - -```python -webhook_integrations = api.webhook_integrations(entity="my-team") -my_webhooks = [ - ig - for ig in webhook_integrations - if ig.url_endpoint.startswith("https://my-fake-url.com") -] -``` - diff --git a/content/en/ref/python/public-api/artifacts.md b/content/en/ref/python/public-api/artifacts.md deleted file mode 100644 index 5c9d200879..0000000000 --- a/content/en/ref/python/public-api/artifacts.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: Artifacts -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/artifacts.py >}} - - - - -## class `Artifacts` -An iterable collection of artifact versions associated with a project. - -Optionally pass in filters to narrow down the results based on specific criteria. - - - -**Args:** - - - `client`: The client instance to use for querying W&B. - - `entity`: The entity (user or team) that owns the project. - - `project`: The name of the project to query for artifacts. - - `collection_name`: The name of the artifact collection to query. - - `type`: The type of the artifacts to query. Common examples include "dataset" or "model". - - `filters`: Optional mapping of filters to apply to the query. - - `order`: Optional string to specify the order of the results. - - `per_page`: The number of artifact versions to fetch per page. Default is 50. - - `tags`: Optional string or list of strings to filter artifacts by tags. - - -### property Artifacts.length - - - - - ---- - - diff --git a/content/en/ref/python/public-api/automations.md b/content/en/ref/python/public-api/automations.md deleted file mode 100644 index b9ee7c6095..0000000000 --- a/content/en/ref/python/public-api/automations.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: Automations -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/automations.py >}} - - - - -## class `Automations` -An lazy iterator of `Automation` objects. - diff --git a/content/en/ref/python/public-api/files.md b/content/en/ref/python/public-api/files.md deleted file mode 100644 index e5f2a5e787..0000000000 --- a/content/en/ref/python/public-api/files.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -title: Files -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/files.py >}} - - - - -## class `Files` -A lazy iterator over a collection of `File` objects. - -Access and manage files uploaded to W&B during a run. Handles pagination automatically when iterating through large collections of files. - - - -**Example:** - ```python -from wandb.apis.public.files import Files -from wandb.apis.public.api import Api - -# Example run object -run = Api().run("entity/project/run-id") - -# Create a Files object to iterate over files in the run -files = Files(api.client, run) - -# Iterate over files -for file in files: - print(file.name) - print(file.url) - print(file.size) - - # Download the file - file.download(root="download_directory", replace=True) -``` - -### method `Files.__init__` - -```python -__init__( - client: 'RetryingClient', - run: 'Run', - names: 'list[str] | None' = None, - per_page: 'int' = 50, - upload: 'bool' = False, - pattern: 'str | None' = None -) -``` - -Initialize a lazy iterator over a collection of `File` objects. - -Files are retrieved in pages from the W&B server as needed. - - - -**Args:** - - - `client`: The run object that contains the files - - `run`: The run object that contains the files - - `names` (list, optional): A list of file names to filter the files - - `per_page` (int, optional): The number of files to fetch per page - - `upload` (bool, optional): If `True`, fetch the upload URL for each file - - `pattern` (str, optional): Pattern to match when returning files from W&B This pattern uses mySQL's LIKE syntax, so matching all files that end with .json would be "%.json". If both names and pattern are provided, a ValueError will be raised. - - ---- - - -### property Files.length - - - - - ---- - - - diff --git a/content/en/ref/python/public-api/projects.md b/content/en/ref/python/public-api/projects.md deleted file mode 100644 index d20f8b7a8e..0000000000 --- a/content/en/ref/python/public-api/projects.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: Projects -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/projects.py >}} - - - - -## class `Projects` -An lazy iterator of `Project` objects. - -An iterable interface to access projects created and saved by the entity. - -### method `Projects.__init__` - -```python -__init__( - client: wandb.apis.public.api.RetryingClient, - entity: str, - per_page: int = 50 -) → Projects -``` - -**Args:** - - - `client` (`wandb.apis.internal.Api`): The API client instance to use. - - `entity` (str): The entity name (username or team) to fetch projects for. - - `per_page` (int): Number of projects to fetch per request (default is 50). - - - -**Example:** - ```python -from wandb.apis.public.api import Api - -# Find projects that belong to this entity -projects = Api().projects(entity="entity") - -# Iterate over files -for project in projects: - print(f"Project: {project.name}") - print(f"- URL: {project.url}") - print(f"- Created at: {project.created_at}") - print(f"- Is benchmark: {project.is_benchmark}") -``` - - -An iterable collection of `Project` objects. - - - -**Args:** - - - `client`: The API client used to query W&B. - - `entity`: The entity which owns the projects. - - `per_page`: The number of projects to fetch per request to the API. - - ---- - - - - diff --git a/content/en/ref/python/public-api/reports.md b/content/en/ref/python/public-api/reports.md deleted file mode 100644 index 741a90f7a5..0000000000 --- a/content/en/ref/python/public-api/reports.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: Reports -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/reports.py >}} - - - - -## class `Reports` -Reports is a lazy iterator of `BetaReport` objects. - -### method `Reports.__init__` - -```python -__init__(client, project, name=None, entity=None, per_page=50) -``` - -**Args:** - - - `client` (`wandb.apis.internal.Api`): The API client instance to use. - - `project` (`wandb.sdk.internal.Project`): The project to fetch reports from. - - `name` (str, optional): The name of the report to filter by. If `None`, fetches all reports. - - `entity` (str, optional): The entity name for the project. Defaults to the project entity. - - `per_page` (int): Number of reports to fetch per page (default is 50). - - - - - - - ---- - - -### property Reports.length - - - - - ---- - - -### method `Reports.convert_objects` - -```python -convert_objects() -``` - -Converts GraphQL edges to File objects. - ---- - -### method `Reports.update_variables` - -```python -update_variables() -``` - -Updates the GraphQL query variables for pagination. - diff --git a/content/en/ref/python/public-api/runs.md b/content/en/ref/python/public-api/runs.md deleted file mode 100644 index 0afbb6485a..0000000000 --- a/content/en/ref/python/public-api/runs.md +++ /dev/null @@ -1,130 +0,0 @@ ---- -title: Runs -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/runs.py >}} - - - - -## class `Runs` -A lazy iterator of `Run` objects associated with a project and optional filter. - -Runs are retrieved in pages from the W&B server as needed. - -This is generally used indirectly using the `Api.runs` namespace. - -### method `Runs.__init__` - -```python -__init__( - client: 'RetryingClient', - entity: 'str', - project: 'str', - filters: 'dict[str, Any] | None' = None, - order: 'str' = '+created_at', - per_page: 'int' = 50, - include_sweeps: 'bool' = True -) -``` - -**Args:** - - - `client`: (`wandb.apis.public.RetryingClient`) The API client to use for requests. - - `entity`: (str) The entity (username or team) that owns the project. - - `project`: (str) The name of the project to fetch runs from. - - `filters`: (Optional[Dict[str, Any]]) A dictionary of filters to apply to the runs query. - - `order`: (str) Order can be `created_at`, `heartbeat_at`, `config.*.value`, or `summary_metrics.*`. If you prepend order with a + order is ascending (default). If you prepend order with a - order is descending. The default order is run.created_at from oldest to newest. - - `per_page`: (int) The number of runs to fetch per request (default is 50). - - `include_sweeps`: (bool) Whether to include sweep information in the runs. Defaults to True. - - - -**Examples:** - ```python -from wandb.apis.public.runs import Runs -from wandb.apis.public import Api - -# Get all runs from a project that satisfy the filters -filters = {"state": "finished", "config.optimizer": "adam"} - -runs = Api().runs( - client=api.client, - entity="entity", - project="project_name", - filters=filters, -) - -# Iterate over runs and print details -for run in runs: - print(f"Run name: {run.name}") - print(f"Run ID: {run.id}") - print(f"Run URL: {run.url}") - print(f"Run state: {run.state}") - print(f"Run config: {run.config}") - print(f"Run summary: {run.summary}") - print(f"Run history (samples=5): {run.history(samples=5)}") - print("----------") - -# Get histories for all runs with specific metrics -histories_df = runs.histories( - samples=100, # Number of samples per run - keys=["loss", "accuracy"], # Metrics to fetch - x_axis="_step", # X-axis metric - format="pandas", # Return as pandas DataFrame -) -``` - - - - - - - ---- - - -### property Runs.length - - - - - ---- - - - -### method `Runs.histories` - -```python -histories( - samples: 'int' = 500, - keys: 'list[str] | None' = None, - x_axis: 'str' = '_step', - format: "Literal['default', 'pandas', 'polars']" = 'default', - stream: "Literal['default', 'system']" = 'default' -) -``` - -Return sampled history metrics for all runs that fit the filters conditions. - - - -**Args:** - - - `samples`: The number of samples to return per run - - `keys`: Only return metrics for specific keys - - `x_axis`: Use this metric as the xAxis defaults to _step - - `format`: Format to return data in, options are "default", "pandas", "polars" - - `stream`: "default" for metrics, "system" for machine metrics - -**Returns:** - - - `pandas.DataFrame`: If `format="pandas"`, returns a `pandas.DataFrame` of history metrics. - - `polars.DataFrame`: If `format="polars"`, returns a `polars.DataFrame` of history metrics. - - `list of dicts`: If `format="default"`, returns a list of dicts containing history metrics with a `run_id` key. - diff --git a/content/en/ref/python/public-api/sweeps.md b/content/en/ref/python/public-api/sweeps.md deleted file mode 100644 index 385fa97c92..0000000000 --- a/content/en/ref/python/public-api/sweeps.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: Sweeps -namespace: public_apis_namespace -python_object_type: class ---- -{{< readfile file="/_includes/public-api-use.md" >}} - - -{{< cta-button githubLink=https://github.com/wandb/wandb/blob/main/wandb/apis/public/sweeps.py >}} - - - - -## class `Sweeps` -A lazy iterator over a collection of `Sweep` objects. - - - -**Examples:** - ```python -from wandb.apis.public import Api - -sweeps = Api().project(name="project_name", entity="entity").sweeps() - -# Iterate over sweeps and print details -for sweep in sweeps: - print(f"Sweep name: {sweep.name}") - print(f"Sweep ID: {sweep.id}") - print(f"Sweep URL: {sweep.url}") - print("----------") -``` - -### method `Sweeps.__init__` - -```python -__init__( - client: wandb.apis.public.api.RetryingClient, - entity: str, - project: str, - per_page: int = 50 -) → Sweeps -``` - -An iterable collection of `Sweep` objects. - - - -**Args:** - - - `client`: The API client used to query W&B. - - `entity`: The entity which owns the sweeps. - - `project`: The project which contains the sweeps. - - `per_page`: The number of sweeps to fetch per request to the API. - - ---- - - -### property Sweeps.length - - - - - ---- - - - diff --git a/content/en/ref/query-panel/_index.md b/content/en/ref/query-panel/_index.md deleted file mode 100644 index 09ffa2e590..0000000000 --- a/content/en/ref/query-panel/_index.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: Query Expression Language -menu: - reference: - identifier: qel - parent: reference -cascade: - menu: - reference: - parent: qel -weight: 3 ---- -Use the query expressions to select and aggregate data across runs and projects. -Learn more about [query panels]({{< relref "/guides/models/app/features/panels/query-panels/" >}}). - -## Data Types - -* [artifact](./artifact.md) -* [artifactType](./artifact-type.md) -* [artifactVersion](./artifact-version.md) -* [audio-file](./audio-file.md) -* [bokeh-file](./bokeh-file.md) -* [boolean](./boolean.md) -* [entity](./entity.md) -* [file](./file.md) -* [float](./float.md) -* [html-file](./html-file.md) -* [image-file](./image-file.md) -* [int](./int.md) -* [joined-table](./joined-table.md) -* [molecule-file](./molecule-file.md) -* [number](./number.md) -* [object3D-file](./object-3-d-file.md) -* [partitioned-table](./partitioned-table.md) -* [project](./project.md) -* [pytorch-model-file](./pytorch-model-file.md) -* [run](./run.md) -* [string](./string.md) -* [table](./table.md) -* [user](./user.md) -* [video-file](./video-file.md) diff --git a/content/en/ref/query-panel/artifact-type.md b/content/en/ref/query-panel/artifact-type.md deleted file mode 100644 index ef01475f50..0000000000 --- a/content/en/ref/query-panel/artifact-type.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: artifactType ---- -## Chainable Ops -

artifactType-artifactVersions

- -Returns the [artifactVersions]( artifact-version.md) of all [artifacts]( artifact.md) of the [artifactType]( artifact-type.md) - -| Argument | | -| :--- | :--- | -| `artifactType` | A [artifactType]( artifact-type.md) | - -#### Return Value -The [artifactVersions](artifact-version.md) of all [artifacts](artifact.md) of the [artifactType](artifact-type.md) - -

artifactType-artifacts

- -Returns the [artifacts]( artifact.md) of the [artifactType](artifact-type.md) - -| Argument | | -| :--- | :--- | -| `artifactType` | An [artifactType](artifact-type.md) | - -#### Return Value -The [artifacts]( artifact.md) of the [artifactType](artifact-type.md) - -

artifactType-name

- -Returns the name of the [artifactType](artifact-type.md) - -| Argument | | -| :--- | :--- | -| `artifactType` | A [artifactType]( artifact-type.md) | - -#### Return Value -The name of the [artifactType]( artifact-type.md) - - -## List Ops -

artifactType-artifactVersions

- -Returns the [artifactVersions]( artifact-version.md) of all [artifacts]( artifact.md) of the [artifactType]( artifact-type.md) - -| Argument | | -| :--- | :--- | -| `artifactType` | A [artifactType]( artifact-type.md) | - -#### Return Value -The [artifactVersions]( artifact-version.md) of all [artifacts]( artifact.md) of the [artifactType]( artifact-type.md) - -

artifactType-artifacts

- -Returns the [artifacts]( artifact.md) of the [artifactType]( artifact-type.md) - -| Argument | | -| :--- | :--- | -| `artifactType` | A [artifactType]( artifact-type.md) | - -#### Return Value -The [artifacts]( artifact.md) of the [artifactType]( artifact-type.md) - -

artifactType-name

- -Returns the name of the [artifactType]( artifact-type.md) - -| Argument | | -| :--- | :--- | -| `artifactType` | A [artifactType]( artifact-type.md) | - -#### Return Value -The name of the [artifactType]( artifact-type.md) - diff --git a/content/en/ref/query-panel/artifact-version.md b/content/en/ref/query-panel/artifact-version.md deleted file mode 100644 index 3b99b9c744..0000000000 --- a/content/en/ref/query-panel/artifact-version.md +++ /dev/null @@ -1,228 +0,0 @@ ---- -title: artifactVersion ---- -## Chainable Ops -

artifactVersion-aliases

- -Returns the aliases for an [artifactVersion](artifact-version.md) - -| Argument | | -| :--- | :--- | -| `artifactVersion` | An [artifactVersion](artifact-version.md) | - -#### Return Value -The aliases for an [artifactVersion](artifact-version.md) - -

artifactVersion-createdAt

- -Returns the datetime at which the [artifactVersion](artifact-version.md) was created - -| Argument | | -| :--- | :--- | -| `artifactVersion` | An [artifactVersion](artifact-version.md) | - -#### Return Value -The datetime at which the [artifactVersion](artifact-version.md) was created - -

artifactVersion-file

- -Returns the _file_ of the [artifactVersion](artifact-version.md) for the given path - -| Argument | | -| :--- | :--- | -| `artifactVersion` | An [artifactVersion](artifact-version.md) | -| `path` | The path of the _file_ | - -#### Return Value -The _file_ of the [artifactVersion](artifact-version.md) for the given path - -

artifactVersion-files

- -Returns the _list_ of _files_ of the [artifactVersion](artifact-version.md) - -| Argument | | -| :--- | :--- | -| `artifactVersion` | An [artifactVersion](artifact-version.md) | - -#### Return Value -The _list_ of _files_ of the [artifactVersion](artifact-version.md) - - - -Returns the url for an [artifactVersion](artifact-version.md) - -| Argument | | -| :--- | :--- | -| `artifactVersion` | An [artifactVersion](artifact-version.md) | - -#### Return Value -The url for an [artifactVersion](artifact-version.md) - -

artifactVersion-metadata

- -Returns the [artifactVersion](artifact-version.md) metadata dictionary - -| Argument | | -| :--- | :--- | -| `artifactVersion` | An [artifactVersion](artifact-version.md) | - -#### Return Value -The [artifactVersion](artifact-version.md) metadata dictionary - -

artifactVersion-name

- -Returns the name of the [artifactVersion](artifact-version.md) - -| Argument | | -| :--- | :--- | -| `artifactVersion` | An [artifactVersion](artifact-version.md) | - -#### Return Value -The name of the [artifactVersion](artifact-version.md) - -

artifactVersion-size

- -Returns the size of the [artifactVersion](artifact-version.md) - -| Argument | | -| :--- | :--- | -| `artifactVersion` | An [artifactVersion](artifact-version.md) | - -#### Return Value -The size of the [artifactVersion](artifact-version.md) - -

artifactVersion-usedBy

- -Returns the [runs](run.md) that use the [artifactVersion](artifact-version.md) - -| Argument | | -| :--- | :--- | -| `artifactVersion` | An [artifactVersion](artifact-version.md) | - -#### Return Value -The [runs](run.md) that use the [artifactVersion](artifact-version.md) - -

artifactVersion-versionId

- -Returns the versionId of the [artifactVersion](artifact-version.md) - -| Argument | | -| :--- | :--- | -| `artifactVersion` | An [artifactVersion](artifact-version.md) | - -#### Return Value -The versionId of the [artifactVersion](artifact-version.md) - - -## List Ops -

artifactVersion-aliases

- -Returns the aliases for an [artifactVersion](artifact-version.md) - -| Argument | | -| :--- | :--- | -| `artifactVersion` | An [artifactVersion](artifact-version.md) | - -#### Return Value -The aliases for an [artifactVersion](artifact-version.md) - -

artifactVersion-createdAt

- -Returns the datetime at which the [artifactVersion](artifact-version.md) was created - -| Argument | | -| :--- | :--- | -| `artifactVersion` | An [artifactVersion](artifact-version.md) | - -#### Return Value -The datetime at which the [artifactVersion](artifact-version.md) was created - -

artifactVersion-file

- -Returns the _file_ of the [artifactVersion](artifact-version.md) for the given path - -| Argument | | -| :--- | :--- | -| `artifactVersion` | An [artifactVersion](artifact-version.md) | -| `path` | The path of the _file_ | - -#### Return Value -The _file_ of the [artifactVersion](artifact-version.md) for the given path - -

artifactVersion-files

- -Returns the _list_ of _files_ of the [artifactVersion](artifact-version.md) - -| Argument | | -| :--- | :--- | -| `artifactVersion` | An [artifactVersion](artifact-version.md) | - -#### Return Value -The _list_ of _files_ of the [artifactVersion](artifact-version.md) - - - -Returns the url for an [artifactVersion](artifact-version.md) - -| Argument | | -| :--- | :--- | -| `artifactVersion` | An [artifactVersion](artifact-version.md) | - -#### Return Value -The url for an [artifactVersion](artifact-version.md) - -

artifactVersion-metadata

- -Returns the [artifactVersion](artifact-version.md) metadata dictionary - -| Argument | | -| :--- | :--- | -| `artifactVersion` | An [artifactVersion](artifact-version.md) | - -#### Return Value -The [artifactVersion](artifact-version.md) metadata dictionary - -

artifactVersion-name

- -Returns the name of the [artifactVersion](artifact-version.md) - -| Argument | | -| :--- | :--- | -| `artifactVersion` | An [artifactVersion](artifact-version.md) | - -#### Return Value -The name of the [artifactVersion](artifact-version.md) - -

artifactVersion-size

- -Returns the size of the [artifactVersion](artifact-version.md) - -| Argument | | -| :--- | :--- | -| `artifactVersion` | An [artifactVersion](artifact-version.md) | - -#### Return Value -The size of the [artifactVersion](artifact-version.md) - -

artifactVersion-usedBy

- -Returns the [runs](run.md) that use the [artifactVersion](artifact-version.md) - -| Argument | | -| :--- | :--- | -| `artifactVersion` | An [artifactVersion](artifact-version.md) | - -#### Return Value -The [runs](run.md) that use the [artifactVersion](artifact-version.md) - -

artifactVersion-versionId

- -Returns the versionId of the [artifactVersion](artifact-version.md) - -| Argument | | -| :--- | :--- | -| `artifactVersion` | An [artifactVersion](artifact-version.md) | - -#### Return Value -The versionId of the [artifactVersion](artifact-version.md) - diff --git a/content/en/ref/query-panel/artifact.md b/content/en/ref/query-panel/artifact.md deleted file mode 100644 index 069be3c9f7..0000000000 --- a/content/en/ref/query-panel/artifact.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: artifact ---- -## Chainable Ops - - -Returns the url for an [artifact](artifact.md) - -| Argument | | -| :--- | :--- | -| `artifact` | An [artifact](artifact.md) | - -#### Return Value -The url for an [artifact](artifact.md) - -

artifact-name

- -Returns the name of the [artifact](artifact.md) - -| Argument | | -| :--- | :--- | -| `artifact` | An [artifact](artifact.md) | - -#### Return Value -The name of the [artifact](artifact.md) - -

artifact-versions

- -Returns the versions of the [artifact](artifact.md) - -| Argument | | -| :--- | :--- | -| `artifact` | An [artifact](artifact.md) | - -#### Return Value -The versions of the [artifact](artifact.md) - - -## List Ops - - -Returns the url for an [artifact](artifact.md) - -| Argument | | -| :--- | :--- | -| `artifact` | An [artifact](artifact.md) | - -#### Return Value -The url for an [artifact](artifact.md) - -

artifact-name

- -Returns the name of the [artifact](artifact.md) - -| Argument | | -| :--- | :--- | -| `artifact` | An [artifact](artifact.md) | - -#### Return Value -The name of the [artifact](artifact.md) - -

artifact-versions

- -Returns the versions of the [artifact](artifact.md) - -| Argument | | -| :--- | :--- | -| `artifact` | An [artifact](artifact.md) | - -#### Return Value -The versions of the [artifact](artifact.md) - diff --git a/content/en/ref/query-panel/audio-file.md b/content/en/ref/query-panel/audio-file.md deleted file mode 100644 index 5a479d3628..0000000000 --- a/content/en/ref/query-panel/audio-file.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: audio-file ---- -## Chainable Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - - -## List Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - diff --git a/content/en/ref/query-panel/bokeh-file.md b/content/en/ref/query-panel/bokeh-file.md deleted file mode 100644 index 8be2325df9..0000000000 --- a/content/en/ref/query-panel/bokeh-file.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: bokeh-file ---- -## Chainable Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - - -## List Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - diff --git a/content/en/ref/query-panel/boolean.md b/content/en/ref/query-panel/boolean.md deleted file mode 100644 index fcd12ed66e..0000000000 --- a/content/en/ref/query-panel/boolean.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -title: boolean ---- -## Chainable Ops -

and

- -Returns the logical `and` of the two values - -| Argument | | -| :--- | :--- | -| `lhs` | First binary value | -| `rhs` | Second binary value | - -#### Return Value -The logical `and` of the two values - -

or

- -Returns the logical `or` of the two values - -| Argument | | -| :--- | :--- | -| `lhs` | First binary value | -| `rhs` | Second binary value | - -#### Return Value -The logical `or` of the two values - -

boolean-not

- -Returns the logical inverse of the value - -| Argument | | -| :--- | :--- | -| `bool` | The boolean value | - -#### Return Value -The logical inverse of the value - -

boolean-not

- -Returns the logical inverse of the value - -| Argument | | -| :--- | :--- | -| `bool` | The boolean value | - -#### Return Value -The logical inverse of the value - - -## List Ops -

and

- -Returns the logical `and` of the two values - -| Argument | | -| :--- | :--- | -| `lhs` | First binary value | -| `rhs` | Second binary value | - -#### Return Value -The logical `and` of the two values - -

or

- -Returns the logical `or` of the two values - -| Argument | | -| :--- | :--- | -| `lhs` | First binary value | -| `rhs` | Second binary value | - -#### Return Value -The logical `or` of the two values - -

boolean-not

- -Returns the logical inverse of the value - -| Argument | | -| :--- | :--- | -| `bool` | The boolean value | - -#### Return Value -The logical inverse of the value - -

boolean-not

- -Returns the logical inverse of the value - -| Argument | | -| :--- | :--- | -| `bool` | The boolean value | - -#### Return Value -The logical inverse of the value - diff --git a/content/en/ref/query-panel/entity.md b/content/en/ref/query-panel/entity.md deleted file mode 100644 index 061ed06a13..0000000000 --- a/content/en/ref/query-panel/entity.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: entity ---- -## Chainable Ops - - -Returns the link of the [entity](entity.md) - -| Argument | | -| :--- | :--- | -| `entity` | A [entity](entity.md) | - -#### Return Value -The link of the [entity](entity.md) - -

entity-name

- -Returns the name of the [entity](entity.md) - -| Argument | | -| :--- | :--- | -| `entity` | A [entity](entity.md) | - -#### Return Value -The name of the [entity](entity.md) - - -## List Ops - - -Returns the link of the [entity](entity.md) - -| Argument | | -| :--- | :--- | -| `entity` | A [entity](entity.md) | - -#### Return Value -The link of the [entity](entity.md) - -

entity-name

- -Returns the name of the [entity](entity.md) - -| Argument | | -| :--- | :--- | -| `entity` | A [entity](entity.md) | - -#### Return Value -The name of the [entity](entity.md) - diff --git a/content/en/ref/query-panel/file.md b/content/en/ref/query-panel/file.md deleted file mode 100644 index f7b26c910b..0000000000 --- a/content/en/ref/query-panel/file.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -title: file ---- -## Chainable Ops -

file-contents

- -Returns the contents of the _file_ - -| Argument | | -| :--- | :--- | -| `file` | A _file_ | - -#### Return Value -The contents of the _file_ - -

file-digest

- -Returns the digest of the _file_ - -| Argument | | -| :--- | :--- | -| `file` | A _file_ | - -#### Return Value -The digest of the _file_ - -

file-size

- -Returns the size of the _file_ - -| Argument | | -| :--- | :--- | -| `file` | A _file_ | - -#### Return Value -The size of the _file_ - -

file-table

- -Returns the contents of the _file_ as a _table_ - -| Argument | | -| :--- | :--- | -| `file` | A _file_ | - -#### Return Value -The contents of the _file_ as a _table_ - - -## List Ops -

file-contents

- -Returns the contents of the _file_ - -| Argument | | -| :--- | :--- | -| `file` | A _file_ | - -#### Return Value -The contents of the _file_ - -

file-digest

- -Returns the digest of the _file_ - -| Argument | | -| :--- | :--- | -| `file` | A _file_ | - -#### Return Value -The digest of the _file_ - -

file-size

- -Returns the size of the _file_ - -| Argument | | -| :--- | :--- | -| `file` | A _file_ | - -#### Return Value -The size of the _file_ - -

file-table

- -Returns the contents of the _file_ as a _table_ - -| Argument | | -| :--- | :--- | -| `file` | A _file_ | - -#### Return Value -The contents of the _file_ as a _table_ - diff --git a/content/en/ref/query-panel/float.md b/content/en/ref/query-panel/float.md deleted file mode 100644 index 42adbfbed2..0000000000 --- a/content/en/ref/query-panel/float.md +++ /dev/null @@ -1,459 +0,0 @@ ---- -title: float ---- -## Chainable Ops -

number-notEqual

- -Determines inequality of two values. - -| Argument | | -| :--- | :--- | -| `lhs` | The first value to compare. | -| `rhs` | The second value to compare. | - -#### Return Value -Whether the two values are not equal. - -

number-modulo

- -Divide a [number](number.md) by another and return remainder - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to divide | -| `rhs` | [number](number.md) to divide by | - -#### Return Value -Modulo of two [numbers](number.md) - -

number-mult

- -Multiply two [numbers](number.md) - -| Argument | | -| :--- | :--- | -| `lhs` | First [number](number.md) | -| `rhs` | Second [number](number.md) | - -#### Return Value -Product of two [numbers](number.md) - -

number-powBinary

- -Raise a [number](number.md) to an exponent - -| Argument | | -| :--- | :--- | -| `lhs` | Base [number](number.md) | -| `rhs` | Exponent [number](number.md) | - -#### Return Value -The base [numbers](number.md) raised to nth power - -

number-add

- -Add two [numbers](number.md) - -| Argument | | -| :--- | :--- | -| `lhs` | First [number](number.md) | -| `rhs` | Second [number](number.md) | - -#### Return Value -Sum of two [numbers](number.md) - -

number-sub

- -Subtract a [number](number.md) from another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to subtract from | -| `rhs` | [number](number.md) to subtract | - -#### Return Value -Difference of two [numbers](number.md) - -

number-div

- -Divide a [number](number.md) by another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to divide | -| `rhs` | [number](number.md) to divide by | - -#### Return Value -Quotient of two [numbers](number.md) - -

number-less

- -Check if a [number](number.md) is less than another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is less than the second - -

number-lessEqual

- -Check if a [number](number.md) is less than or equal to another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is less than or equal to the second - -

number-equal

- -Determines equality of two values. - -| Argument | | -| :--- | :--- | -| `lhs` | The first value to compare. | -| `rhs` | The second value to compare. | - -#### Return Value -Whether the two values are equal. - -

number-greater

- -Check if a [number](number.md) is greater than another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is greater than the second - -

number-greaterEqual

- -Check if a [number](number.md) is greater than or equal to another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is greater than or equal to the second - -

number-negate

- -Negate a [number](number.md) - -| Argument | | -| :--- | :--- | -| `val` | Number to negate | - -#### Return Value -A [number](number.md) - -

number-toString

- -Convert a [number](number.md) to a string - -| Argument | | -| :--- | :--- | -| `in` | Number to convert | - -#### Return Value -String representation of the [number](number.md) - -

number-toTimestamp

- -Converts a [number](number.md) to a _timestamp_. Values less than 31536000000 will be converted to seconds, values less than 31536000000000 will be converted to milliseconds, values less than 31536000000000000 will be converted to microseconds, and values less than 31536000000000000000 will be converted to nanoseconds. - -| Argument | | -| :--- | :--- | -| `val` | Number to convert to a timestamp | - -#### Return Value -Timestamp - -

number-abs

- -Calculates the absolute value of a [number](number.md) - -| Argument | | -| :--- | :--- | -| `n` | A [number](number.md) | - -#### Return Value -The absolute value of the [number](number.md) - - -## List Ops -

number-notEqual

- -Determines inequality of two values. - -| Argument | | -| :--- | :--- | -| `lhs` | The first value to compare. | -| `rhs` | The second value to compare. | - -#### Return Value -Whether the two values are not equal. - -

number-modulo

- -Divide a [number](number.md) by another and return remainder - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to divide | -| `rhs` | [number](number.md) to divide by | - -#### Return Value -Modulo of two [numbers](number.md) - -

number-mult

- -Multiply two [numbers](number.md) - -| Argument | | -| :--- | :--- | -| `lhs` | First [number](number.md) | -| `rhs` | Second [number](number.md) | - -#### Return Value -Product of two [numbers](number.md) - -

number-powBinary

- -Raise a [number](number.md) to an exponent - -| Argument | | -| :--- | :--- | -| `lhs` | Base [number](number.md) | -| `rhs` | Exponent [number](number.md) | - -#### Return Value -The base [numbers](number.md) raised to nth power - -

number-add

- -Add two [numbers](number.md) - -| Argument | | -| :--- | :--- | -| `lhs` | First [number](number.md) | -| `rhs` | Second [number](number.md) | - -#### Return Value -Sum of two [numbers](number.md) - -

number-sub

- -Subtract a [number](number.md) from another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to subtract from | -| `rhs` | [number](number.md) to subtract | - -#### Return Value -Difference of two [numbers](number.md) - -

number-div

- -Divide a [number](number.md) by another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to divide | -| `rhs` | [number](number.md) to divide by | - -#### Return Value -Quotient of two [numbers](number.md) - -

number-less

- -Check if a [number](number.md) is less than another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is less than the second - -

number-lessEqual

- -Check if a [number](number.md) is less than or equal to another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is less than or equal to the second - -

number-equal

- -Determines equality of two values. - -| Argument | | -| :--- | :--- | -| `lhs` | The first value to compare. | -| `rhs` | The second value to compare. | - -#### Return Value -Whether the two values are equal. - -

number-greater

- -Check if a [number](number.md) is greater than another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is greater than the second - -

number-greaterEqual

- -Check if a [number](number.md) is greater than or equal to another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is greater than or equal to the second - -

number-negate

- -Negate a [number](number.md) - -| Argument | | -| :--- | :--- | -| `val` | Number to negate | - -#### Return Value -A [number](number.md) - -

numbers-argmax

- -Finds the index of maximum [number](number.md) - -| Argument | | -| :--- | :--- | -| `numbers` | _list_ of [numbers](number.md) to find the index of maximum [number](number.md) | - -#### Return Value -Index of maximum [number](number.md) - -

numbers-argmin

- -Finds the index of minimum [number](number.md) - -| Argument | | -| :--- | :--- | -| `numbers` | _list_ of [numbers](number.md) to find the index of minimum [number](number.md) | - -#### Return Value -Index of minimum [number](number.md) - -

numbers-avg

- -Average of [numbers](number.md) - -| Argument | | -| :--- | :--- | -| `numbers` | _list_ of [numbers](number.md) to average | - -#### Return Value -Average of [numbers](number.md) - -

numbers-max

- -Maximum number - -| Argument | | -| :--- | :--- | -| `numbers` | _list_ of [numbers](number.md) to find the maximum [number](number.md) | - -#### Return Value -Maximum [number](number.md) - -

numbers-min

- -Minimum number - -| Argument | | -| :--- | :--- | -| `numbers` | _list_ of [numbers](number.md) to find the minimum [number](number.md) | - -#### Return Value -Minimum [number](number.md) - -

numbers-stddev

- -Standard deviation of [numbers](number.md) - -| Argument | | -| :--- | :--- | -| `numbers` | _list_ of [numbers](number.md) to calculate the standard deviation | - -#### Return Value -Standard deviation of [numbers](number.md) - -

numbers-sum

- -Sum of [numbers](number.md) - -| Argument | | -| :--- | :--- | -| `numbers` | _list_ of [numbers](number.md) to sum | - -#### Return Value -Sum of [numbers](number.md) - -

number-toString

- -Convert a [number](number.md) to a string - -| Argument | | -| :--- | :--- | -| `in` | Number to convert | - -#### Return Value -String representation of the [number](number.md) - -

number-toTimestamp

- -Converts a [number](number.md) to a _timestamp_. Values less than 31536000000 will be converted to seconds, values less than 31536000000000 will be converted to milliseconds, values less than 31536000000000000 will be converted to microseconds, and values less than 31536000000000000000 will be converted to nanoseconds. - -| Argument | | -| :--- | :--- | -| `val` | Number to convert to a timestamp | - -#### Return Value -Timestamp - -

number-abs

- -Calculates the absolute value of a [number](number.md) - -| Argument | | -| :--- | :--- | -| `n` | A [number](number.md) | - -#### Return Value -The absolute value of the [number](number.md) - diff --git a/content/en/ref/query-panel/html-file.md b/content/en/ref/query-panel/html-file.md deleted file mode 100644 index eb715baff1..0000000000 --- a/content/en/ref/query-panel/html-file.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: html-file ---- -## Chainable Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - - -## List Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - diff --git a/content/en/ref/query-panel/image-file.md b/content/en/ref/query-panel/image-file.md deleted file mode 100644 index f9fc2a24b5..0000000000 --- a/content/en/ref/query-panel/image-file.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: image-file ---- -## Chainable Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - - -## List Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - diff --git a/content/en/ref/query-panel/int.md b/content/en/ref/query-panel/int.md deleted file mode 100644 index 36e855727e..0000000000 --- a/content/en/ref/query-panel/int.md +++ /dev/null @@ -1,459 +0,0 @@ ---- -title: int ---- -## Chainable Ops -

number-notEqual

- -Determines inequality of two values. - -| Argument | | -| :--- | :--- | -| `lhs` | The first value to compare. | -| `rhs` | The second value to compare. | - -#### Return Value -Whether the two values are not equal. - -

number-modulo

- -Divide a [number](number.md) by another and return remainder - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to divide | -| `rhs` | [number](number.md) to divide by | - -#### Return Value -Modulo of two [numbers](number.md) - -

number-mult

- -Multiply two [numbers](number.md) - -| Argument | | -| :--- | :--- | -| `lhs` | First [number](number.md) | -| `rhs` | Second [number](number.md) | - -#### Return Value -Product of two [numbers](number.md) - -

number-powBinary

- -Raise a [number](number.md) to an exponent - -| Argument | | -| :--- | :--- | -| `lhs` | Base [number](number.md) | -| `rhs` | Exponent [number](number.md) | - -#### Return Value -The base [numbers](number.md) raised to nth power - -

number-add

- -Add two [numbers](number.md) - -| Argument | | -| :--- | :--- | -| `lhs` | First [number](number.md) | -| `rhs` | Second [number](number.md) | - -#### Return Value -Sum of two [numbers](number.md) - -

number-sub

- -Subtract a [number](number.md) from another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to subtract from | -| `rhs` | [number](number.md) to subtract | - -#### Return Value -Difference of two [numbers](number.md) - -

number-div

- -Divide a [number](number.md) by another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to divide | -| `rhs` | [number](number.md) to divide by | - -#### Return Value -Quotient of two [numbers](number.md) - -

number-less

- -Check if a [number](number.md) is less than another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is less than the second - -

number-lessEqual

- -Check if a [number](number.md) is less than or equal to another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is less than or equal to the second - -

number-equal

- -Determines equality of two values. - -| Argument | | -| :--- | :--- | -| `lhs` | The first value to compare. | -| `rhs` | The second value to compare. | - -#### Return Value -Whether the two values are equal. - -

number-greater

- -Check if a [number](number.md) is greater than another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is greater than the second - -

number-greaterEqual

- -Check if a [number](number.md) is greater than or equal to another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is greater than or equal to the second - -

number-negate

- -Negate a [number](number.md) - -| Argument | | -| :--- | :--- | -| `val` | Number to negate | - -#### Return Value -A [number](number.md) - -

number-toString

- -Convert a [number](number.md) to a string - -| Argument | | -| :--- | :--- | -| `in` | Number to convert | - -#### Return Value -String representation of the [number](number.md) - -

number-toTimestamp

- -Converts a [number](number.md) to a _timestamp_. Values less than 31536000000 will be converted to seconds, values less than 31536000000000 will be converted to milliseconds, values less than 31536000000000000 will be converted to microseconds, and values less than 31536000000000000000 will be converted to nanoseconds. - -| Argument | | -| :--- | :--- | -| `val` | Number to convert to a timestamp | - -#### Return Value -Timestamp - -

number-abs

- -Calculates the absolute value of a [number](number.md) - -| Argument | | -| :--- | :--- | -| `n` | A [number](number.md) | - -#### Return Value -The absolute value of the [number](number.md) - - -## List Ops -

number-notEqual

- -Determines inequality of two values. - -| Argument | | -| :--- | :--- | -| `lhs` | The first value to compare. | -| `rhs` | The second value to compare. | - -#### Return Value -Whether the two values are not equal. - -

number-modulo

- -Divide a [number](number.md) by another and return remainder - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to divide | -| `rhs` | [number](number.md) to divide by | - -#### Return Value -Modulo of two [numbers](number.md) - -

number-mult

- -Multiply two [numbers](number.md) - -| Argument | | -| :--- | :--- | -| `lhs` | First [number](number.md) | -| `rhs` | Second [number](number.md) | - -#### Return Value -Product of two [numbers](number.md) - -

number-powBinary

- -Raise a [number](number.md) to an exponent - -| Argument | | -| :--- | :--- | -| `lhs` | Base [number](number.md) | -| `rhs` | Exponent [number](number.md) | - -#### Return Value -The base [numbers](number.md) raised to nth power - -

number-add

- -Add two [numbers](number.md) - -| Argument | | -| :--- | :--- | -| `lhs` | First [number](number.md) | -| `rhs` | Second [number](number.md) | - -#### Return Value -Sum of two [numbers](number.md) - -

number-sub

- -Subtract a [number](number.md) from another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to subtract from | -| `rhs` | [number](number.md) to subtract | - -#### Return Value -Difference of two [numbers](number.md) - -

number-div

- -Divide a [number](number.md) by another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to divide | -| `rhs` | [number](number.md) to divide by | - -#### Return Value -Quotient of two [numbers](number.md) - -

number-less

- -Check if a [number](number.md) is less than another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is less than the second - -

number-lessEqual

- -Check if a [number](number.md) is less than or equal to another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is less than or equal to the second - -

number-equal

- -Determines equality of two values. - -| Argument | | -| :--- | :--- | -| `lhs` | The first value to compare. | -| `rhs` | The second value to compare. | - -#### Return Value -Whether the two values are equal. - -

number-greater

- -Check if a [number](number.md) is greater than another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is greater than the second - -

number-greaterEqual

- -Check if a [number](number.md) is greater than or equal to another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is greater than or equal to the second - -

number-negate

- -Negate a [number](number.md) - -| Argument | | -| :--- | :--- | -| `val` | Number to negate | - -#### Return Value -A [number](number.md) - -

numbers-argmax

- -Finds the index of maximum [number](number.md) - -| Argument | | -| :--- | :--- | -| `numbers` | _list_ of [numbers](number.md) to find the index of maximum [number](number.md) | - -#### Return Value -Index of maximum [number](number.md) - -

numbers-argmin

- -Finds the index of minimum [number](number.md) - -| Argument | | -| :--- | :--- | -| `numbers` | _list_ of [numbers](number.md) to find the index of minimum [number](number.md) | - -#### Return Value -Index of minimum [number](number.md) - -

numbers-avg

- -Average of [numbers](number.md) - -| Argument | | -| :--- | :--- | -| `numbers` | _list_ of [numbers](number.md) to average | - -#### Return Value -Average of [numbers](number.md) - -

numbers-max

- -Maximum number - -| Argument | | -| :--- | :--- | -| `numbers` | _list_ of [numbers](number.md) to find the maximum [number](number.md) | - -#### Return Value -Maximum [number](number.md) - -

numbers-min

- -Minimum number - -| Argument | | -| :--- | :--- | -| `numbers` | _list_ of [numbers](number.md) to find the minimum [number](number.md) | - -#### Return Value -Minimum [number](number.md) - -

numbers-stddev

- -Standard deviation of [numbers](number.md) - -| Argument | | -| :--- | :--- | -| `numbers` | _list_ of [numbers](number.md) to calculate the standard deviation | - -#### Return Value -Standard deviation of [numbers](number.md) - -

numbers-sum

- -Sum of [numbers](number.md) - -| Argument | | -| :--- | :--- | -| `numbers` | _list_ of [numbers](number.md) to sum | - -#### Return Value -Sum of [numbers](number.md) - -

number-toString

- -Convert a [number](number.md) to a string - -| Argument | | -| :--- | :--- | -| `in` | Number to convert | - -#### Return Value -String representation of the [number](number.md) - -

number-toTimestamp

- -Converts a [number](number.md) to a _timestamp_. Values less than 31536000000 will be converted to seconds, values less than 31536000000000 will be converted to milliseconds, values less than 31536000000000000 will be converted to microseconds, and values less than 31536000000000000000 will be converted to nanoseconds. - -| Argument | | -| :--- | :--- | -| `val` | Number to convert to a timestamp | - -#### Return Value -Timestamp - -

number-abs

- -Calculates the absolute value of a [number](number.md) - -| Argument | | -| :--- | :--- | -| `n` | A [number](number.md) | - -#### Return Value -The absolute value of the [number](number.md) - diff --git a/content/en/ref/query-panel/joined-table.md b/content/en/ref/query-panel/joined-table.md deleted file mode 100644 index a99e408b9c..0000000000 --- a/content/en/ref/query-panel/joined-table.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: joined-table ---- -## Chainable Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - -

joinedtable-file

- -Returns the _file_ of a _joined-table_ - -| Argument | | -| :--- | :--- | -| `joinedTable` | The _joined-table_ | - -#### Return Value -The _file_ of a _joined-table_ - -

joinedtable-rows

- -Returns the rows of a _joined-table_ - -| Argument | | -| :--- | :--- | -| `joinedTable` | The _joined-table_ | -| `leftOuter` | Whether to include rows from the left table that do not have a matching row in the right table | -| `rightOuter` | Whether to include rows from the right table that do not have a matching row in the left table | - -#### Return Value -The rows of the _joined-table_ - - -## List Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - diff --git a/content/en/ref/query-panel/molecule-file.md b/content/en/ref/query-panel/molecule-file.md deleted file mode 100644 index 4abd8f6f64..0000000000 --- a/content/en/ref/query-panel/molecule-file.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: molecule-file ---- -## Chainable Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - - -## List Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - diff --git a/content/en/ref/query-panel/number.md b/content/en/ref/query-panel/number.md deleted file mode 100644 index cf3a1b661a..0000000000 --- a/content/en/ref/query-panel/number.md +++ /dev/null @@ -1,459 +0,0 @@ ---- -title: number ---- -## Chainable Ops -

number-notEqual

- -Determines inequality of two values. - -| Argument | | -| :--- | :--- | -| `lhs` | The first value to compare. | -| `rhs` | The second value to compare. | - -#### Return Value -Whether the two values are not equal. - -

number-modulo

- -Divide a [number](number.md) by another and return remainder - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to divide | -| `rhs` | [number](number.md) to divide by | - -#### Return Value -Modulo of two [numbers](number.md) - -

number-mult

- -Multiply two [numbers](number.md) - -| Argument | | -| :--- | :--- | -| `lhs` | First [number](number.md) | -| `rhs` | Second [number](number.md) | - -#### Return Value -Product of two [numbers](number.md) - -

number-powBinary

- -Raise a [number](number.md) to an exponent - -| Argument | | -| :--- | :--- | -| `lhs` | Base [number](number.md) | -| `rhs` | Exponent [number](number.md) | - -#### Return Value -The base [numbers](number.md) raised to nth power - -

number-add

- -Add two [numbers](number.md) - -| Argument | | -| :--- | :--- | -| `lhs` | First [number](number.md) | -| `rhs` | Second [number](number.md) | - -#### Return Value -Sum of two [numbers](number.md) - -

number-sub

- -Subtract a [number](number.md) from another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to subtract from | -| `rhs` | [number](number.md) to subtract | - -#### Return Value -Difference of two [numbers](number.md) - -

number-div

- -Divide a [number](number.md) by another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to divide | -| `rhs` | [number](number.md) to divide by | - -#### Return Value -Quotient of two [numbers](number.md) - -

number-less

- -Check if a [number](number.md) is less than another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is less than the second - -

number-lessEqual

- -Check if a [number](number.md) is less than or equal to another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is less than or equal to the second - -

number-equal

- -Determines equality of two values. - -| Argument | | -| :--- | :--- | -| `lhs` | The first value to compare. | -| `rhs` | The second value to compare. | - -#### Return Value -Whether the two values are equal. - -

number-greater

- -Check if a [number](number.md) is greater than another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is greater than the second - -

number-greaterEqual

- -Check if a [number](number.md) is greater than or equal to another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is greater than or equal to the second - -

number-negate

- -Negate a [number](number.md) - -| Argument | | -| :--- | :--- | -| `val` | Number to negate | - -#### Return Value -A [number](number.md) - -

number-toString

- -Convert a [number](number.md) to a string - -| Argument | | -| :--- | :--- | -| `in` | Number to convert | - -#### Return Value -String representation of the [number](number.md) - -

number-toTimestamp

- -Converts a [number](number.md) to a _timestamp_. Values less than 31536000000 will be converted to seconds, values less than 31536000000000 will be converted to milliseconds, values less than 31536000000000000 will be converted to microseconds, and values less than 31536000000000000000 will be converted to nanoseconds. - -| Argument | | -| :--- | :--- | -| `val` | Number to convert to a timestamp | - -#### Return Value -Timestamp - -

number-abs

- -Calculates the absolute value of a [number](number.md) - -| Argument | | -| :--- | :--- | -| `n` | A [number](number.md) | - -#### Return Value -The absolute value of the [number](number.md) - - -## List Ops -

number-notEqual

- -Determines inequality of two values. - -| Argument | | -| :--- | :--- | -| `lhs` | The first value to compare. | -| `rhs` | The second value to compare. | - -#### Return Value -Whether the two values are not equal. - -

number-modulo

- -Divide a [number](number.md) by another and return remainder - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to divide | -| `rhs` | [number](number.md) to divide by | - -#### Return Value -Modulo of two [numbers](number.md) - -

number-mult

- -Multiply two [numbers](number.md) - -| Argument | | -| :--- | :--- | -| `lhs` | First [number](number.md) | -| `rhs` | Second [number](number.md) | - -#### Return Value -Product of two [numbers](number.md) - -

number-powBinary

- -Raise a [number](number.md) to an exponent - -| Argument | | -| :--- | :--- | -| `lhs` | Base [number](number.md) | -| `rhs` | Exponent [number](number.md) | - -#### Return Value -The base [numbers](number.md) raised to nth power - -

number-add

- -Add two [numbers](number.md) - -| Argument | | -| :--- | :--- | -| `lhs` | First [number](number.md) | -| `rhs` | Second [number](number.md) | - -#### Return Value -Sum of two [numbers](number.md) - -

number-sub

- -Subtract a [number](number.md) from another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to subtract from | -| `rhs` | [number](number.md) to subtract | - -#### Return Value -Difference of two [numbers](number.md) - -

number-div

- -Divide a [number](number.md) by another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to divide | -| `rhs` | [number](number.md) to divide by | - -#### Return Value -Quotient of two [numbers](number.md) - -

number-less

- -Check if a [number](number.md) is less than another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is less than the second - -

number-lessEqual

- -Check if a [number](number.md) is less than or equal to another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is less than or equal to the second - -

number-equal

- -Determines equality of two values. - -| Argument | | -| :--- | :--- | -| `lhs` | The first value to compare. | -| `rhs` | The second value to compare. | - -#### Return Value -Whether the two values are equal. - -

number-greater

- -Check if a [number](number.md) is greater than another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is greater than the second - -

number-greaterEqual

- -Check if a [number](number.md) is greater than or equal to another - -| Argument | | -| :--- | :--- | -| `lhs` | [number](number.md) to compare | -| `rhs` | [number](number.md) to compare to | - -#### Return Value -Whether the first [number](number.md) is greater than or equal to the second - -

number-negate

- -Negate a [number](number.md) - -| Argument | | -| :--- | :--- | -| `val` | Number to negate | - -#### Return Value -A [number](number.md) - -

numbers-argmax

- -Finds the index of maximum [number](number.md) - -| Argument | | -| :--- | :--- | -| `numbers` | _list_ of [numbers](number.md) to find the index of maximum [number](number.md) | - -#### Return Value -Index of maximum [number](number.md) - -

numbers-argmin

- -Finds the index of minimum [number](number.md) - -| Argument | | -| :--- | :--- | -| `numbers` | _list_ of [numbers](number.md) to find the index of minimum [number](number.md) | - -#### Return Value -Index of minimum [number](number.md) - -

numbers-avg

- -Average of [numbers](number.md) - -| Argument | | -| :--- | :--- | -| `numbers` | _list_ of [numbers](number.md) to average | - -#### Return Value -Average of [numbers](number.md) - -

numbers-max

- -Maximum number - -| Argument | | -| :--- | :--- | -| `numbers` | _list_ of [numbers](number.md) to find the maximum [number](number.md) | - -#### Return Value -Maximum [number](number.md) - -

numbers-min

- -Minimum number - -| Argument | | -| :--- | :--- | -| `numbers` | _list_ of [numbers](number.md) to find the minimum [number](number.md) | - -#### Return Value -Minimum [number](number.md) - -

numbers-stddev

- -Standard deviation of [numbers](number.md) - -| Argument | | -| :--- | :--- | -| `numbers` | _list_ of [numbers](number.md) to calculate the standard deviation | - -#### Return Value -Standard deviation of [numbers](number.md) - -

numbers-sum

- -Sum of [numbers](number.md) - -| Argument | | -| :--- | :--- | -| `numbers` | _list_ of [numbers](number.md) to sum | - -#### Return Value -Sum of [numbers](number.md) - -

number-toString

- -Convert a [number](number.md) to a string - -| Argument | | -| :--- | :--- | -| `in` | Number to convert | - -#### Return Value -String representation of the [number](number.md) - -

number-toTimestamp

- -Converts a [number](number.md) to a _timestamp_. Values less than 31536000000 will be converted to seconds, values less than 31536000000000 will be converted to milliseconds, values less than 31536000000000000 will be converted to microseconds, and values less than 31536000000000000000 will be converted to nanoseconds. - -| Argument | | -| :--- | :--- | -| `val` | Number to convert to a timestamp | - -#### Return Value -Timestamp - -

number-abs

- -Calculates the absolute value of a [number](number.md) - -| Argument | | -| :--- | :--- | -| `n` | A [number](number.md) | - -#### Return Value -The absolute value of the [number](number.md) - diff --git a/content/en/ref/query-panel/object-3-d-file.md b/content/en/ref/query-panel/object-3-d-file.md deleted file mode 100644 index 1f5b240466..0000000000 --- a/content/en/ref/query-panel/object-3-d-file.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: object3D-file ---- -## Chainable Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - - -## List Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - diff --git a/content/en/ref/query-panel/partitioned-table.md b/content/en/ref/query-panel/partitioned-table.md deleted file mode 100644 index 211b1358a0..0000000000 --- a/content/en/ref/query-panel/partitioned-table.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: partitioned-table ---- -## Chainable Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - -

partitionedtable-file

- -Returns the _file_ of a _partitioned-table_ - -| Argument | | -| :--- | :--- | -| `partitionedTable` | The _partitioned-table_ | - -#### Return Value -_file_ of the _partitioned-table_ - -

partitionedtable-rows

- -Returns the rows of a _partitioned-table_ - -| Argument | | -| :--- | :--- | -| `partitionedTable` | The _partitioned-table_ to get rows from | - -#### Return Value -Rows of the _partitioned-table_ - - -## List Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - diff --git a/content/en/ref/query-panel/project.md b/content/en/ref/query-panel/project.md deleted file mode 100644 index 87102c8247..0000000000 --- a/content/en/ref/query-panel/project.md +++ /dev/null @@ -1,168 +0,0 @@ ---- -title: project ---- -## Chainable Ops -

project-artifact

- -Returns the [artifact](artifact.md) for a given name within a [project](project.md) - -| Argument | | -| :--- | :--- | -| `project` | A [project](project.md) | -| `artifactName` | The name of the [artifact](artifact.md) | - -#### Return Value -The [artifact](artifact.md) for a given name within a [project](project.md) - -

project-artifactType

- -Returns the [artifactType](artifact-type.md for a given name within a [project](project.md) - -| Argument | | -| :--- | :--- | -| `project` | A [project](project.md) | -| `artifactType` | The name of the [artifactType](artifact-type.md | - -#### Return Value -The [artifactType](artifact-type.md for a given name within a [project](project.md) - -

project-artifactTypes

- -Returns the [artifactTypes](artifact-type.md for a [project](project.md) - -| Argument | | -| :--- | :--- | -| `project` | A [project](project.md) | - -#### Return Value -The [artifactTypes](artifact-type.md for a [project](project.md) - -

project-artifactVersion

- -Returns the [artifactVersion](artifact-version.md for a given name and version within a [project](project.md) - -| Argument | | -| :--- | :--- | -| `project` | A [project](project.md) | -| `artifactName` | The name of the [artifactVersion](artifact-version.md | -| `artifactVersionAlias` | The version alias of the [artifactVersion](artifact-version.md | - -#### Return Value -The [artifactVersion](artifact-version.md for a given name and version within a [project](project.md) - -

project-createdAt

- -Returns the creation time of the [project](project.md) - -| Argument | | -| :--- | :--- | -| `project` | A [project](project.md) | - -#### Return Value -The creation time of the [project](project.md) - -

project-name

- -Returns the name of the [project](project.md) - -| Argument | | -| :--- | :--- | -| `project` | A [project](project.md) | - -#### Return Value -The name of the [project](project.md) - -

project-runs

- -Returns the [runs](run.md) from a [project](project.md) - -| Argument | | -| :--- | :--- | -| `project` | A [project](project.md) | - -#### Return Value -The [runs](run.md) from a [project](project.md) - - -## List Ops -

project-artifact

- -Returns the [artifact](artifact.md) for a given name within a [project](project.md) - -| Argument | | -| :--- | :--- | -| `project` | A [project](project.md) | -| `artifactName` | The name of the [artifact](artifact.md) | - -#### Return Value -The [artifact](artifact.md) for a given name within a [project](project.md) - -

project-artifactType

- -Returns the [artifactType](artifact-type.md for a given name within a [project](project.md) - -| Argument | | -| :--- | :--- | -| `project` | A [project](project.md) | -| `artifactType` | The name of the [artifactType](artifact-type.md | - -#### Return Value -The [artifactType](artifact-type.md for a given name within a [project](project.md) - -

project-artifactTypes

- -Returns the [artifactTypes](artifact-type.md for a [project](project.md) - -| Argument | | -| :--- | :--- | -| `project` | A [project](project.md) | - -#### Return Value -The [artifactTypes](artifact-type.md for a [project](project.md) - -

project-artifactVersion

- -Returns the [artifactVersion](artifact-version.md for a given name and version within a [project](project.md) - -| Argument | | -| :--- | :--- | -| `project` | A [project](project.md) | -| `artifactName` | The name of the [artifactVersion](artifact-version.md | -| `artifactVersionAlias` | The version alias of the [artifactVersion](artifact-version.md | - -#### Return Value -The [artifactVersion](artifact-version.md for a given name and version within a [project](project.md) - -

project-createdAt

- -Returns the creation time of the [project](project.md) - -| Argument | | -| :--- | :--- | -| `project` | A [project](project.md) | - -#### Return Value -The creation time of the [project](project.md) - -

project-name

- -Returns the name of the [project](project.md) - -| Argument | | -| :--- | :--- | -| `project` | A [project](project.md) | - -#### Return Value -The name of the [project](project.md) - -

project-runs

- -Returns the [runs](run.md) from a [project](project.md) - -| Argument | | -| :--- | :--- | -| `project` | A [project](project.md) | - -#### Return Value -The [runs](run.md) from a [project](project.md) - diff --git a/content/en/ref/query-panel/pytorch-model-file.md b/content/en/ref/query-panel/pytorch-model-file.md deleted file mode 100644 index 83d6b8d994..0000000000 --- a/content/en/ref/query-panel/pytorch-model-file.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: pytorch-model-file ---- -## Chainable Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - - -## List Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - diff --git a/content/en/ref/query-panel/run.md b/content/en/ref/query-panel/run.md deleted file mode 100644 index 3da85fefa3..0000000000 --- a/content/en/ref/query-panel/run.md +++ /dev/null @@ -1,261 +0,0 @@ ---- -title: run ---- -## Chainable Ops -

run-config

- -Returns the config _typedDict_ of the [run](run.md) - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | - -#### Return Value -The config _typedDict_ of the [run](run.md) - -

run-createdAt

- -Returns the created at datetime of the [run](run.md) - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | - -#### Return Value -The created at datetime of the [run](run.md) - -

run-heartbeatAt

- -Returns the last heartbeat datetime of the [run](run.md) - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | - -#### Return Value -The last heartbeat datetime of the [run](run.md) - -

run-history

- -Returns the log history of the [run](run.md) - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | - -#### Return Value -The log history of the [run](run.md) - -

run-jobType

- -Returns the job type of the [run](run.md) - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | - -#### Return Value -The job type of the [run](run.md) - -

run-loggedArtifactVersion

- -Returns the [artifactVersion](artifact-version.md) logged by the [run](run.md) for a given name and alias - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | -| `artifactVersionName` | The name:alias of the [artifactVersion](artifact-version.md) | - -#### Return Value -The [artifactVersion](artifact-version.md) logged by the [run](run.md) for a given name and alias - -

run-loggedArtifactVersions

- -Returns all of the [artifactVersions](artifact-version.md) logged by the [run](run.md) - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | - -#### Return Value -The [artifactVersions](artifact-version.md) logged by the [run](run.md) - -

run-name

- -Returns the name of the [run](run.md) - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | - -#### Return Value -The name of the [run](run.md) - -

run-runtime

- -Returns the runtime in seconds of the [run](run.md) - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | - -#### Return Value -The runtime in seconds of the [run](run.md) - -

run-summary

- -Returns the summary _typedDict_ of the [run](run.md) - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | - -#### Return Value -The summary _typedDict_ of the [run](run.md) - -

run-usedArtifactVersions

- -Returns all of the [artifactVersions](artifact-version.md) used by the [run](run.md) - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | - -#### Return Value -The [artifactVersions](artifact-version.md) used by the [run](run.md) - -

run-user

- -Returns the [user](user.md) of the [run](run.md) - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | - -#### Return Value -The [user](user.md) of the [run](run.md) - - -## List Ops -

run-config

- -Returns the config _typedDict_ of the [run](run.md) - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | - -#### Return Value -The config _typedDict_ of the [run](run.md) - -

run-createdAt

- -Returns the created at datetime of the [run](run.md) - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | - -#### Return Value -The created at datetime of the [run](run.md) - -

run-heartbeatAt

- -Returns the last heartbeat datetime of the [run](run.md) - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | - -#### Return Value -The last heartbeat datetime of the [run](run.md) - -

run-history

- -Returns the log history of the [run](run.md) - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | - -#### Return Value -The log history of the [run](run.md) - -

run-jobType

- -Returns the job type of the [run](run.md) - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | - -#### Return Value -The job type of the [run](run.md) - -

run-loggedArtifactVersion

- -Returns the [artifactVersion](artifact-version.md) logged by the [run](run.md) for a given name and alias - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | -| `artifactVersionName` | The name:alias of the [artifactVersion](artifact-version.md) | - -#### Return Value -The [artifactVersion](artifact-version.md) logged by the [run](run.md) for a given name and alias - -

run-loggedArtifactVersions

- -Returns all of the [artifactVersions](artifact-version.md) logged by the [run](run.md) - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | - -#### Return Value -The [artifactVersions](artifact-version.md) logged by the [run](run.md) - -

run-name

- -Returns the name of the [run](run.md) - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | - -#### Return Value -The name of the [run](run.md) - -

run-runtime

- -Returns the runtime in seconds of the [run](run.md) - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | - -#### Return Value -The runtime in seconds of the [run](run.md) - -

run-summary

- -Returns the summary _typedDict_ of the [run](run.md) - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | - -#### Return Value -The summary _typedDict_ of the [run](run.md) - -

run-usedArtifactVersions

- -Returns all of the [artifactVersions](artifact-version.md) used by the [run](run.md) - -| Argument | | -| :--- | :--- | -| `run` | A [run](run.md) | - -#### Return Value -The [artifactVersions](artifact-version.md) used by the [run](run.md) - diff --git a/content/en/ref/query-panel/string.md b/content/en/ref/query-panel/string.md deleted file mode 100644 index 7bc6b24485..0000000000 --- a/content/en/ref/query-panel/string.md +++ /dev/null @@ -1,544 +0,0 @@ ---- -title: string ---- -## Chainable Ops -

string-notEqual

- -Determines inequality of two values. - -| Argument | | -| :--- | :--- | -| `lhs` | The first value to compare. | -| `rhs` | The second value to compare. | - -#### Return Value -Whether the two values are not equal. - -

string-add

- -Concatenates two [strings](string.md) - -| Argument | | -| :--- | :--- | -| `lhs` | The first [string](string.md) | -| `rhs` | The second [string](string.md) | - -#### Return Value -The concatenated [string](string.md) - -

string-equal

- -Determines equality of two values. - -| Argument | | -| :--- | :--- | -| `lhs` | The first value to compare. | -| `rhs` | The second value to compare. | - -#### Return Value -Whether the two values are equal. - -

string-append

- -Appends a suffix to a [string](string.md) - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to append to | -| `suffix` | The suffix to append | - -#### Return Value -The [string](string.md) with the suffix appended - -

string-contains

- -Checks if a [string](string.md) contains a substring - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to check | -| `sub` | The substring to check for | - -#### Return Value -Whether the [string](string.md) contains the substring - -

string-endsWith

- -Checks if a [string](string.md) ends with a suffix - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to check | -| `suffix` | The suffix to check for | - -#### Return Value -Whether the [string](string.md) ends with the suffix - -

string-findAll

- -Finds all occurrences of a substring in a [string](string.md) - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to find occurrences of the substring in | -| `sub` | The substring to find | - -#### Return Value -The _list_ of indices of the substring in the [string](string.md) - -

string-isAlnum

- -Checks if a [string](string.md) is alphanumeric - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to check | - -#### Return Value -Whether the [string](string.md) is alphanumeric - -

string-isAlpha

- -Checks if a [string](string.md) is alphabetic - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to check | - -#### Return Value -Whether the [string](string.md) is alphabetic - -

string-isNumeric

- -Checks if a [string](string.md) is numeric - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to check | - -#### Return Value -Whether the [string](string.md) is numeric - -

string-lStrip

- -Strip leading whitespace - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to strip. | - -#### Return Value -The stripped [string](string.md). - -

string-len

- -Returns the length of a [string](string.md) - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to check | - -#### Return Value -The length of the [string](string.md) - -

string-lower

- -Converts a [string](string.md) to lowercase - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to convert to lowercase | - -#### Return Value -The lowercase [string](string.md) - -

string-partition

- -Partitions a [string](string.md) into a _list_ of the [strings](string.md) - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to split | -| `sep` | The separator to split on | - -#### Return Value -A _list_ of [strings](string.md): the [string](string.md) before the separator, the separator, and the [string](string.md) after the separator - -

string-prepend

- -Prepends a prefix to a [string](string.md) - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to prepend to | -| `prefix` | The prefix to prepend | - -#### Return Value -The [string](string.md) with the prefix prepended - -

string-rStrip

- -Strip trailing whitespace - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to strip. | - -#### Return Value -The stripped [string](string.md). - -

string-replace

- -Replaces all occurrences of a substring in a [string](string.md) - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to replace contents of | -| `sub` | The substring to replace | -| `newSub` | The substring to replace the old substring with | - -#### Return Value -The [string](string.md) with the replacements - -

string-slice

- -Slices a [string](string.md) into a substring based on beginning and end indices - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to slice | -| `begin` | The beginning index of the substring | -| `end` | The ending index of the substring | - -#### Return Value -The substring - -

string-split

- -Splits a [string](string.md) into a _list_ of [strings](string.md) - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to split | -| `sep` | The separator to split on | - -#### Return Value -The _list_ of [strings](string.md) - -

string-startsWith

- -Checks if a [string](string.md) starts with a prefix - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to check | -| `prefix` | The prefix to check for | - -#### Return Value -Whether the [string](string.md) starts with the prefix - -

string-strip

- -Strip whitespace from both ends of a [string](string.md). - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to strip. | - -#### Return Value -The stripped [string](string.md). - -

string-upper

- -Converts a [string](string.md) to uppercase - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to convert to uppercase | - -#### Return Value -The uppercase [string](string.md) - -

string-levenshtein

- -Calculates the Levenshtein distance between two [strings](string.md). - -| Argument | | -| :--- | :--- | -| `str1` | The first [string](string.md). | -| `str2` | The second [string](string.md). | - -#### Return Value -The Levenshtein distance between the two [strings](string.md). - - -## List Ops -

string-notEqual

- -Determines inequality of two values. - -| Argument | | -| :--- | :--- | -| `lhs` | The first value to compare. | -| `rhs` | The second value to compare. | - -#### Return Value -Whether the two values are not equal. - -

string-add

- -Concatenates two [strings](string.md) - -| Argument | | -| :--- | :--- | -| `lhs` | The first [string](string.md) | -| `rhs` | The second [string](string.md) | - -#### Return Value -The concatenated [string](string.md) - -

string-equal

- -Determines equality of two values. - -| Argument | | -| :--- | :--- | -| `lhs` | The first value to compare. | -| `rhs` | The second value to compare. | - -#### Return Value -Whether the two values are equal. - -

string-append

- -Appends a suffix to a [string](string.md) - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to append to | -| `suffix` | The suffix to append | - -#### Return Value -The [string](string.md) with the suffix appended - -

string-contains

- -Checks if a [string](string.md) contains a substring - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to check | -| `sub` | The substring to check for | - -#### Return Value -Whether the [string](string.md) contains the substring - -

string-endsWith

- -Checks if a [string](string.md) ends with a suffix - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to check | -| `suffix` | The suffix to check for | - -#### Return Value -Whether the [string](string.md) ends with the suffix - -

string-findAll

- -Finds all occurrences of a substring in a [string](string.md) - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to find occurrences of the substring in | -| `sub` | The substring to find | - -#### Return Value -The _list_ of indices of the substring in the [string](string.md) - -

string-isAlnum

- -Checks if a [string](string.md) is alphanumeric - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to check | - -#### Return Value -Whether the [string](string.md) is alphanumeric - -

string-isAlpha

- -Checks if a [string](string.md) is alphabetic - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to check | - -#### Return Value -Whether the [string](string.md) is alphabetic - -

string-isNumeric

- -Checks if a [string](string.md) is numeric - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to check | - -#### Return Value -Whether the [string](string.md) is numeric - -

string-lStrip

- -Strip leading whitespace - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to strip. | - -#### Return Value -The stripped [string](string.md). - -

string-len

- -Returns the length of a [string](string.md) - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to check | - -#### Return Value -The length of the [string](string.md) - -

string-lower

- -Converts a [string](string.md) to lowercase - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to convert to lowercase | - -#### Return Value -The lowercase [string](string.md) - -

string-partition

- -Partitions a [string](string.md) into a _list_ of the [strings](string.md) - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to split | -| `sep` | The separator to split on | - -#### Return Value -A _list_ of [strings](string.md): the [string](string.md) before the separator, the separator, and the [string](string.md) after the separator - -

string-prepend

- -Prepends a prefix to a [string](string.md) - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to prepend to | -| `prefix` | The prefix to prepend | - -#### Return Value -The [string](string.md) with the prefix prepended - -

string-rStrip

- -Strip trailing whitespace - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to strip. | - -#### Return Value -The stripped [string](string.md). - -

string-replace

- -Replaces all occurrences of a substring in a [string](string.md) - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to replace contents of | -| `sub` | The substring to replace | -| `newSub` | The substring to replace the old substring with | - -#### Return Value -The [string](string.md) with the replacements - -

string-slice

- -Slices a [string](string.md) into a substring based on beginning and end indices - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to slice | -| `begin` | The beginning index of the substring | -| `end` | The ending index of the substring | - -#### Return Value -The substring - -

string-split

- -Splits a [string](string.md) into a _list_ of [strings](string.md) - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to split | -| `sep` | The separator to split on | - -#### Return Value -The _list_ of [strings](string.md) - -

string-startsWith

- -Checks if a [string](string.md) starts with a prefix - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to check | -| `prefix` | The prefix to check for | - -#### Return Value -Whether the [string](string.md) starts with the prefix - -

string-strip

- -Strip whitespace from both ends of a [string](string.md). - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to strip. | - -#### Return Value -The stripped [string](string.md). - -

string-upper

- -Converts a [string](string.md) to uppercase - -| Argument | | -| :--- | :--- | -| `str` | The [string](string.md) to convert to uppercase | - -#### Return Value -The uppercase [string](string.md) - -

string-levenshtein

- -Calculates the Levenshtein distance between two [strings](string.md). - -| Argument | | -| :--- | :--- | -| `str1` | The first [string](string.md). | -| `str2` | The second [string](string.md). | - -#### Return Value -The Levenshtein distance between the two [strings](string.md). - diff --git a/content/en/ref/query-panel/table.md b/content/en/ref/query-panel/table.md deleted file mode 100644 index 5371b26158..0000000000 --- a/content/en/ref/query-panel/table.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: table ---- -## Chainable Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - -

table-rows

- -Returns the rows of a _table_ - -| Argument | | -| :--- | :--- | -| `table` | A _table_ | - -#### Return Value -The rows of the _table_ - - -## List Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - -

table-rows

- -Returns the rows of a _table_ - -| Argument | | -| :--- | :--- | -| `table` | A _table_ | - -#### Return Value -The rows of the _table_ - diff --git a/content/en/ref/query-panel/user.md b/content/en/ref/query-panel/user.md deleted file mode 100644 index c2b8d8129d..0000000000 --- a/content/en/ref/query-panel/user.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: user ---- -## Chainable Ops -

user-username

- -Returns the username of the [user](user.md) - -| Argument | | -| :--- | :--- | -| `user` | A [user](user.md) | - -#### Return Value -The username of the [user](user.md) - - -## List Ops -

user-username

- -Returns the username of the [user](user.md) - -| Argument | | -| :--- | :--- | -| `user` | A [user](user.md) | - -#### Return Value -The username of the [user](user.md) - diff --git a/content/en/ref/query-panel/video-file.md b/content/en/ref/query-panel/video-file.md deleted file mode 100644 index b503942018..0000000000 --- a/content/en/ref/query-panel/video-file.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: video-file ---- -## Chainable Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - - -## List Ops -

asset-file

- -Returns the _file_ of the asset - -| Argument | | -| :--- | :--- | -| `asset` | The asset | - -#### Return Value -The _file_ of the asset - diff --git a/content/en/ref/release-notes/_index.md b/content/en/ref/release-notes/_index.md deleted file mode 100644 index e7924189c5..0000000000 --- a/content/en/ref/release-notes/_index.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Release Notes -type: docs -url: /ref/release-notes/ -cascade: -- url: /ref/release-notes/:filename/ -- type: docs -- weight: 1 -menu: - default: - parent: reference - identifier: release-notes -weight: 5 ---- - -This section includes release notes for supported W&B Server releases. For releases that are no longer supported, refer to [Archived releases]({{< relref "archived/" >}}). - - diff --git a/content/en/ref/release-notes/release-policies.md b/content/en/ref/release-notes/release-policies.md deleted file mode 100644 index 52d1259774..0000000000 --- a/content/en/ref/release-notes/release-policies.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -description: Release process for W&B Server -menu: - default: - identifier: server-release-process - parent: w-b-platform -title: Release policies and processes -weight: 20 -date: 2025-05-01 ---- -This page gives details about W&B Server releases and W&B's release policies. This page relates to [W&B Dedicated Cloud]({{< relref "/guides/hosting/hosting-options/dedicated_cloud/" >}}) and [Self-Managed]({{< relref "/guides/hosting/hosting-options/self-managed/" >}}) deployments. To learn more about an individual W&B Server release, refer to [W&B release notes]({{< relref "/ref/release-notes/" >}}). - -W&B fully manages [W&B Multi-tenant Cloud]({{< relref "/guides/hosting/hosting-options/saas_cloud.md" >}}) and the details in this page do not apply. - -## Release support and end of life policy -W&B supports a major W&B Server release for 12 months from its initial release date. -- **Dedicated Cloud** instances are automatically updated to maintain support. -- Customers with **Self-managed** instances are responsible for upgrading in time to maintain support. Avoid staying on an unsupported version. - - {{% alert %}} - W&B strongly recommends customers with **Self-managed** instances to update their deployments with the latest release at minimum once per quarter to maintain support and receive the latest features, performance improvements, and fixes. - {{% /alert %}} - -## Release types and frequencies -- **Major releases** are produced monthly, and may include new features, enhancements, performance improvements, medium and low severity bug fixes, and deprecations. An example of a major release is `0.68.0`. -- **Patch releases** within a major version are produced as needed, and include critical and high severity bug fixes. An example of a patch release is `0.67.1`. - -## Release rollout -1. After testing and validation are complete, a release is first rolled out to all **Dedicated Cloud** instances to keep them fully updated. -1. After additional observation, the release is published, and **Self-managed** deployments can upgrade to it on their own schedule, and are responsible for upgrading in time to comply with the [Release support and End of Life (EOL) policy]({{< relref "#release-support-and-end-of-life-policy" >}}). Learn more about [upgrading W&B Server]({{< relref "/guides/hosting/hosting-options/self-managed/server-upgrade-process.md" >}}). - -## Downtime during upgrades -- When a **Dedicated Cloud** instance is upgraded, downtime is generally not expected, but may occur in certain situations: - - If a new feature or enhancement requires changes to the underlying infrastructure, such as compute, storage or network. - - To roll out a critical infrastructure change such as a security fix. - - If the instance's current version has reached its [End of Life (EOL)]({{< relref "/guides/hosting/hosting-options/self-managed/server-upgrade-process.md" >}}) and is upgraded by W&B to maintain support. -- For **Self-managed** deployments, the customer is responsible for implementing a rolling update process that meets their service level objectives (SLOs), such as by [running W&B Server on Kubernetes]({{< relref "/guides/hosting/hosting-options/self-managed/kubernetes-operator/" >}}). - -## Feature availability -After installing or upgrading, certain features may not be immediately available. - -### Enterprise features -An Enterprise license includes support for important security capabilities and other enterprise-friendly functionality. Some advanced features require an Enterprise license. - -- **Dedicated Cloud** includes an Enterprise license and no action is required. -- On **Self-managed** deployments, features that require an Enterprise license are not available until it is set. To learn more or obtain an Enterprise license, refer to [Obtain your W&B Server license]({{< relref "/guides/hosting/hosting-options/self-managed.md#obtain-your-wb-server-license" >}}). - -### Private preview and opt-in features -Most features are available immediately after installing or upgrading W&B Server. The W&B team must enable certain features before you can use them in your instance. - -{{% alert color="warning" %}} -Any feature in a preview phase is subject to change. A preview feature is not guaranteed to become generally available. -{{% /alert %}} - -- **Private preview**: W&B invites design partners and early adopters to test these features and provide feedback. Private preview features are not recommended for production environments. - - The W&B team must enable a private preview feature for your instance before you can use it. Public documentation is not available; instructions are provided directly. Interfaces and APIs may change, and the feature may not be fully implemented. -- **Public preview**: Contact W&B to opt in to a public preview to try it out before it is generally available. - - The W&B team must enable a public preview feature before you can use it in your instance. Documentation may not be complete, interfaces and APIs may change, and the feature may not be fully implemented. - -To learn more about an individual W&B Server release, including any limitations, refer to [W&B Release notes]({{< relref "/ref/release-notes/" >}}). - - diff --git a/content/en/ref/release-notes/releases/0.61.0.md b/content/en/ref/release-notes/releases/0.61.0.md deleted file mode 100644 index 7c70f297b1..0000000000 --- a/content/en/ref/release-notes/releases/0.61.0.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: "0.61.0" -date: 2024-10-17 -description: "October 17, 2024" -parent: releases ---- - -## Features - -**This is a mini-feature and patch release, delivered at a different schedule than the monthly W&B server major releases** - -* Organization admins can now configure Models seats and access control for both Models & [W&B Weave](https://weave-docs.wandb.ai/) in a seamless manner from their organization dashboard. This change allows for a efficient user management when [Weave](https://weave-docs.wandb.ai/) is enabled for a Dedicated Cloud or Self-managed instance. - * [Weave](https://weave-docs.wandb.ai/) pricing is consumption-based rather than based on number of seats used. Seat management only applies to the Models product. -* You can now configure [access roles at the project level for team and restricted scoped projects](https://docs.wandb.ai/guides/hosting/iam/access-management/restricted-projects/). It allows assigning different access roles to a user within different projects in the same team, and thus adding another strong control to conform to enterprise governance needs. - - - -## Fixes - -* Fixed an issue where underlying database schema changes as part of release upgrades could timeout during platform startup time. -* Added more performance improvements to the underlying parquet store service, to further improve the chart loading times for users. Parquet store service is only available on Dedicated Cloud, and Self-managed instances based on [W&B kubernetes operator](https://docs.wandb.ai/guides/hosting/operator). -* Addressed the high CPU utilization issue for the underlying parquet store service, to make the efficient chart loading more reliable for users. Parquet store service is only available on Dedicated Cloud, and Self-managed instances based on [W&B kubernetes operator](https://docs.wandb.ai/guides/hosting/operator). diff --git a/content/en/ref/release-notes/releases/0.63.0.md b/content/en/ref/release-notes/releases/0.63.0.md deleted file mode 100644 index 90e2ad7844..0000000000 --- a/content/en/ref/release-notes/releases/0.63.0.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: "0.63.x" -date: 2024-12-10 -description: "December 10, 2024" ---- - -## Features - -**[W&B Weave](https://wandb.ai/site/weave/) is now generally available (GA) in Dedicated Cloud on AWS. Reach out to your W&B team if your teams are looking to build Generative AI apps with confidence and putting those in production.** - -![Weave UI](https://github.com/user-attachments/assets/22786cbc-7d69-4505-b329-78cb87734d19) - -The release includes the following additional updates: - -* W&B Models now seamlessly integrates with **_Azure public cloud_**. You could now create a Dedicated Cloud instance in an Azure region directly from your Azure subscription and manage it as an Azure ISV resource. [This integration is in private preview](https://wandb.ai/site/partners/azure). -* Enable automations at the Registry level to monitor changes and events across all collections in the registry and trigger actions accordingly. This eliminates the need to configure separate webhooks and automations for individual collections. -* Ability to assign x_label, e.g. node-0, in run settings object to distinguish logs and metrics by label, e.g. node, in distributed runs. Enables grouping system metrics and console logs by label for visualization in the workspace. -* **_Coming soon_** with a patch release this week, you will be able to use organization-level service accounts to automate your W&B workloads across all teams in your instance. You would still be able to use existing team-level service accounts if you would like more control over the access scope of a service account. - * Allow org-level service accounts to interact with Registry. Such service accounts can be invited to a registry using the invite modal and are displayed in the members table along with respective organization roles. - -## Fixes - -* Fixed an issue where users creating custom roles including the `Create Artifact` permission were not able to log artifacts to a project. -* Fixed the issue with metadata logging for files in instances that have subpath support configured for BYOB. -* Block webhook deletion if used by organization registry automations. diff --git a/content/en/ref/release-notes/releases/0.65.0.md b/content/en/ref/release-notes/releases/0.65.0.md deleted file mode 100644 index 7c95accd61..0000000000 --- a/content/en/ref/release-notes/releases/0.65.0.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -title: "0.65.x" -date: 2025-01-30 -description: "January 30, 2025" ---- - -## Features -- From a registry's **Settings**, you can now update the owner to a different user with the Admin role. Select **Owner** from the user's **Role** menu. -- You can now move a run to a different group in the same project. Hover over a run in the run list, click the three-vertical-dots menu, and choose **Move to another group**. -- You can now configure whether the **Log Scale setting** for line plots is enabled by default at the level of the workspace or section. - - To configure the behavior for a workspace, click the action `...` menu for the workspace, click **Line plots**, then toggle **Log scale** for the X or Y axis. - - To configure the behavior for a section, click the gear icon for the section, then toggle **Log scale** for the X or Y axis. - - diff --git a/content/en/ref/release-notes/releases/0.66.0.md b/content/en/ref/release-notes/releases/0.66.0.md deleted file mode 100644 index d85e4998f5..0000000000 --- a/content/en/ref/release-notes/releases/0.66.0.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: "0.66.x" -date: 2025-03-06 -description: "March 06, 2025" ---- - -## Features -- In tables and query panels, columns you derive from other columns now persist, so you can use them for filtering or in query panel plots. - -## Security -- Limited the maximum depth for a GraphQL document to 20. -- Upgraded pyarrow to v17.0.0. diff --git a/content/en/ref/release-notes/releases/0.67.0.md b/content/en/ref/release-notes/releases/0.67.0.md deleted file mode 100644 index 4cd1321a44..0000000000 --- a/content/en/ref/release-notes/releases/0.67.0.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: "0.67.x" -date: 2025-03-28 -description: "March 28, 2025" ---- - -## Features - -- In Reports, you can now give a run a custom display name per panel grid. This allows you to replace the run’s (often long and opaque) training-time name with one that is more meaningful to your audience. The report updates the name in all panel grids, helping you to explain your hard-won experimental insights to your colleagues in a concise and readable way. The original run name remain intact in the project, so doing this won’t disrupt your collaborators. -- When you expand a panel in the workspace, it now opens in full screen mode with more space. In this view, line plots now render with more granular detail, using up 10,000 bins. The run selector appear next to the panel, letting you easily toggle, group, or filter runs in context. -- From any panel, you can now copy a unique URL that links directly to that panel's full screen view. This makes it even easier to share a link to dig into interesting or pathological patterns in your plots. -- Run Comparer is a powerful tool you can use to compare the configurations and key metrics of important runs alongside their loss curves. Run Comparer has been updated: - - Faster to add a Run Comparer panel, as an expanded option in **Add Panels**. - - By default, a Run Comparer panel takes up more space, so you can see the values right away. - - Improved readability and legibility of a Run Comparer panel. You can use new controls to quickly change row and column sizes so you can read long or nested values. - - You can copy any value in the panel to your clipboard with a single click. - - You can search keys with regular expressions to quickly find exactly the subset of metrics you want to compare across. Your search history is saved to help you iterate efficiently between views. - - Run Comparer is now more reliable at scale, and handles larger workspaces more efficiently, reducing the likelihood of poor performance or a crashed panel. -- Segmentation mask controls have been updated: - - You can now toggle each mask type on or off in bulk, or toggle all masks or all images on or off. - - You can now change each class’s assigned color, helping to avoid confusion if multiple classes use the same color. -- When you open a media panel in full screen mode, you can now use the left or right arrows on your keyboard to step through the images, *without* first clicking on the step slider. -- Media panels now color run names, matching the run selector. This makes it easier to associate a run’s media values with related metrics and plots. -- In the run selector, you can now filter by whether a run has certain media key or not. -- You can now move runs between groups in the W&B App UI, and you can create new groups after the run is logged. -- Automations can now be edited in the UI -- An automation can now notify a Slack channel for artifact events. When creating an automation, select “Slack notification” for the Action type. -- Registry now supports global search by default, allowing you to search across all registries by registry name, collection name, alias, or tag. -- In Tables and Query panels that use the `runs` expression, you can use the new Runs History step slider and drop-down controls to view a table of metrics at each step of a run. -- Playground in W&B Weave supports new models: OpenAI's `gpt-4.5-preview` and Deepseek's `deepseek-chat` and `deepseek-reasoner`. -- Weave tracing has two new agent framework integrations: CrewAI and OpenAI’s Agent SDK. -- In the Weave UI, you can now build Datasets from traces. Learn more: https://weave-docs.wandb.ai/guides/core-types/datasets#create-edit-and-delete-a-dataset-in-the-ui -- The Weave Python SDK now provides a way to filter the inputs and outputs of your Weave data to ensure sensitive data does not leave your network perimeter. You can configure to redact sensitive data. Learn more: https://weave-docs.wandb.ai/guides/tracking/redact-pii/ -- To streamline your experience, the System tab in the individual run workspace view will be removed in an upcoming release. View full information about system metrics in the System section of the workspace. For questions, contact [support@wandb.com](mailto:support@wandb.com). - -## Security - -- `golang crypto` has been upgraded to v0.36.0. -- `golang oauth2` has been upgraded to v0.28.0. -- In Weave, `pyarrow` is now pinned to v17.0.0. - -## Performance - -- Frontend updates significantly reduce workspace reload times by storing essential data in the browser cache across visits. The update optimizes loading of saved views, metric names, the run selector, run counts, W&B’s configuration details, and the recomputation of workspace views. -- Registry overview pages now load significantly faster. -- Improved the performance of selecting metrics for the X, Y, or Z values in a scatter plot in a workspace with thousands of runs or hundreds of metrics. -- Performance improvements to Weave evaluation logging. - -## Fixes - -- Fixed a bug in Reports where following a link to a section in the report would not open to that section. -- Improved the behavior of how Gaussian smoothing handles index reflection, matching SciPy's default "reflect" mode. -- A Report comment link sent via email now opens directly to the comment. -- Fixed a bug that could crash a workspace if a sweep takes longer than 2 billion compute seconds by changing the variable type for sweep compute seconds to `int64` rather than `int32`. -- Fixed display bugs that could occur when a report included multiple run sets. -- Fixed a bug where panels Quick Added to an alphabetically sorted section were sorted incorrectly. -- Fixed a bug that generated malformed user invitation links. diff --git a/content/en/ref/release-notes/releases/0.68.0.md b/content/en/ref/release-notes/releases/0.68.0.md deleted file mode 100644 index de1da0d4cd..0000000000 --- a/content/en/ref/release-notes/releases/0.68.0.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: "0.68.x" -date: 2025-05-07 -description: "April 29, 2025" ---- - -W&B Server v0.68 includes enhancements to various types of panels and visualizations, security improvements for Registry, W&B Weave, and service accounts, performance improvements when forking and rewinding runs, and more. - -The latest patch is **v0.68.2**. Refer to [Patches]({{< relref "#patches" >}}). - -{{% alert %}} -v0.68.0 introduced a bug, fixed in [v0.68.1]({{< relref "#0_68_1" >}}), that could prevent media from loading in media panels. To avoid this bug, install or upgrade to a patch that contains the fix. If you need assistance, contact [support](mailto:support@wandb.com). -{{% /alert %}} - -## Features -- Release notes for W&B Server are now published [in the W&B documentation](/ref/release-notes/) in addition to on GitHub. [Subscribe using RSS]({/ref/release-notes/index.xml). -- Registry admins can define and assign [*protected aliases*]({{< relref "/guides/core/registry/model_registry/access_controls.md#add-protected-aliases" >}}) to represent key stages of your development pipeline. A protected alias can be assigned only by a registry admin. W&B blocks other users from adding or removing protected aliases from versions in a registry using the API or UI. -- You can now filter console logs based on a run's `x_label` value. During [distributed training]({{< relref "/guides/models/track/log/distributed-training.md#track-all-processes-to-a-single-run" >}}), this optional parameter tracks the node that logged the run. -- You can now move runs between `Groups`, one by one or in bulk. Also, you can now create new `Groups` after the initial logging time. -- Line plots now support **synchronized zooming** mode, where zooming to a given range on one plot automatically zooms into the same range on all other line plots with a common x-axis. Turn this on in the [workspace display settings for line plots]({{< relref "/guides/models/app/features/panels/line-plot/#all-line-plots-in-a-workspace" >}}). -- Line plots now support formatting custom metrics as timestamps. This is useful when synchronizing or uploading runs from a different system. -- You can now slide through [media panels]({{< relref "/guides/models/app/features/panels/media.md" >}}) using non-`_step` fields such as `epoch` or `train/global_step` (or anything else). -- In Tables and plots in [Query Panels]({{< relref "/guides/models/app/features/panels/query-panels/" >}}) that use `runs` or `runs.history` expressions, a step slider allows you to step through the progress on your metrics, text, or media through the course of your runs. The slider supports stepping through non-`_step` metrics. -- You can now customize [bar chart]({{< relref "/guides/models/app/features/panels/bar-plot.md" >}}) labels using a font size control. - -### Private preview -Private preview features are available by invitation only. To request enrollment in a private preview, contact [support]({{< relref "mailto:support@wandb.com" >}}) or your AISE. - -- **Personal workspace templates** allow you to save your workspace setup so it is automatically applied to your new [projects]({{< relref "/guides/models/track/project-page.md" >}}). Initially, you can configure certain line plot settings such as the default X axis metric, smoothing algorithm, and smoothing factor. -- **Improved Exponentially-weighted Moving Average (EMA) smoothing** provides more reliable [smoothed lines]({{< relref "/guides/models/app/features/panels/line-plot/smoothing.md" >}}) when operating on complete, unbinned data. In most cases, smoothing is handled at the back end for improved performance. - -### Weave -- Chat with fine-tuned models from within your W&B instance. [Playground](https://weave-docs.wandb.ai/guides/tools/playground/) is now supported in Dedicated Cloud. Playground is a chat interface for comparing different LLMs on historical traces. Admins can add API keys to different model providers or hook up [custom hosted LLM providers](https://weave-docs.wandb.ai/guides/tools/playground/#add-a-custom-provider) so your team can interact with them from within Weave. -- Open Telemetry Support. Now you can log traces via OpenTelemetry (OTel). See [OpenTelemetry tracing](https://weave-docs.wandb.ai/guides/tracking/otel/?utm_source=beamer&utm_medium=sidebar&utm_campaign=OpenTelemetry-support-in-Weave&utm_content=ctalink). -- Weave [tracing](https://weave-docs.wandb.ai/guides/tracking/) has new framework integrations: CrewAI, OpenAI’s Agent SDK, DSPy 2.x and Google's genai Python SDK. -- Playground supports new [OpenAI models](https://weave-docs.wandb.ai/guides/tools/playground/#openai): GPT‑4.1, GPT‑4.1 mini, and GPT‑4.1 nano. -- Build labeled datasets directly from traces, with your annotations automatically converted into dataset columns. See [Dataset creation from traces](https://weave-docs.wandb.ai/guides/core-types/datasets/#create-edit-and-delete-a-dataset-in-the-ui). - -## Security -- Registry admins can now designate a [service account]({{< relref "/guides/hosting/iam/authentication/service-accounts.md" >}}) in a registry as either a Registry Admin or a Member. Previously, the service account’s role was always Registry Admin. See [Registry service account configuration]({{< relref "/guides/core/registry/configure_registry.md" >}}). - -## Performance -- Improved the performance of many workspace interactions, particularly in large workspaces. For example, expanding sections and using the run selector are significantly more responsive. -- Improved Fork and Rewind Performance. - - [Forking]({{< relref "/guides/models/track/runs/forking.md" >}}) a run creates a new run that uses the same configuration as an existing run. Changes to the forked run do not the parent run, and vice versa. A pointer is maintained between the forked run and the parent. [Rewinding]({{< relref "/guides/models/track/runs/rewind.md" >}}) a run lets you log new data from that point in time without losing the existing data. - - In projects with many nested forks, forking new runs is now much more efficient due to improvements in caching. - -## Fixes -- Fixed a bug that could prevent an organization service account from being added to new teams. -- Fixed a bug that could cause hover marks to be missing for grouped lines. -- Fixed a bug that could include invalid project names in the **Import** dropdown of a Report panel. -- Fixed a display bug in the alignment of filters in the run selector. -- Fixed a page crash when adding a timestamp **Within Last** filter -- Fixed a bug that could prevent the X-axis from being set to **Wall Time** in global line plot settings. -- Fixed a bug that could prevent image captions from appearing when they are logged to a Table. -- Fixed a bug that could prevent sparse metrics from showing up in panels. -- In **Run Overview** pages, the **Description** field is now named **Notes**. - -## Patches -### 0.68.1 -**May 2, 2025** - -- Fixed a bug introduced in v0.68.0 that could prevent media from loading in media panels. - -### 0.68.2 -**May 7, 2025** - -- Fixed a bug introduced in v0.68.0 that could cause background jobs to crash or run inconsistently. After upgrading to v0.68.2, affected background jobs will recover automatically. If you experience issues with background jobs after upgrading, contact [Support](mailto:support@wandb.com). -- Fixed a long-standing UI bug where typing an invalid regular expression into the W&B App search field could crash the app. Now if you type an invalid regular expression, it is treated as a simple search string, and you can update the search field and try again. -- Fixed a bug where the SMTP port is set to 25 instead of the port specified in `GORILLA_EMAIL_SINK`. -- Fixed a bug where inviting a user to a team could fail with the misleading error `You have no available seats`. \ No newline at end of file diff --git a/content/en/ref/release-notes/releases/0.69.0.md b/content/en/ref/release-notes/releases/0.69.0.md deleted file mode 100644 index 398de4a133..0000000000 --- a/content/en/ref/release-notes/releases/0.69.0.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: "0.69.x" -date: 2025-06-10 - - -description: "May 28, 2025" - ---- - -W&B 0.69 focuses on making the workspace more intuitive, collaborative, and efficient. Clearer visualizations and faster artifact downloads streamline how you interact with your data, so you can gain and share insights more quickly. Updates to W&B Weave improve team workflows and evaluation tracking. A range of quality-of-life fixes tidy up the overall user experience. - -This release also marks the end of life for v0.54 and older, which are now officially unsupported. - - -The latest patch is **v0.69.1**. Refer to [Patches]({{< relref "#patches" >}}). - -## Support and end of life -
    -
  • W&B Server v0.54 and below have reached end of life as of May 27, 2025.
  • -
  • W&B Server v0.56 is scheduled to reach end of life in July 2025
  • -
- -{{% readfile "/_includes/release-notes-support-eol-reminder.md" %}} - -## Upgrading -To [upgrade]({{< relref "/guides/hosting/hosting-options/self-managed/server-upgrade-process.md#update-with-helm" >}}) to W&B v0.69.x, you must use v0.31.4+ of the `operator-wandb` Helm chart. Otherwise, after the upgrade, the `weave-cache-clear` container can fail to start. Ensure that your deployment uses these values: - -```yaml -chart: - url: https://charts.wandb.ai - name: operator-wandb - version: 0.31.4 -``` - -If you have questions or are experiencing issues with an upgrade, contact [support](mailto:support@wandb.com). - -## Features -- You can now set a custom display name for a run directly in the workspace. Customized run names show up in all plots and tables but only in your workspace, with no impact on your teammates’ views. This provides a clearer and cleaner view in your workspace, with no more labels like `*...v6-final-restart...`* in every legend and plot. -- When filtering or grouping runs, colors can sometimes overlap and become indistinct. The run selector’s new **Randomize Colors** option reassigns random colors from the default palette to your current run selection or groups, helping to make the colors more distinguishable. -- In line plots, you can now use **Cmd+Click** on a line to open a single-run view in a new tab. -- Video media panels now provide more playback controls to play, pause, seek, view full screen, and adjust playback speed. -- Settings for all types of media panels have been reorganized and improved. -- You can now customize the point and background colors for point cloud panels. -- Team-level and organization-level service accounts can now interact with Registry. -- Improved Exponentially-weighted Moving Average (EMA) smoothing provides more reliable [smoothed lines]({{< relref "/guides/models/app/features/panels/line-plot/smoothing.md" >}}) when operating on complete, unbinned data. In most cases, smoothing is handled at the back end for improved performance. This feature was in private preview in v0.68.x. - -### Private preview -Private preview features are available by invitation only. To request enrollment in a private preview, contact [support]({{< relref "mailto:support@wandb.com" >}}) or your AISE. - -- You can now color all of your runs based on a secondary metric, such as loss or custom efficiency metrics. This creates a clear gradient color scale across your runs in all plots, so you can spot patterns faster. [Watch a video demo](https://www.loom.com/share/c6ed484899324de991ef7147fd73785d). -- [Personal workspace templates](/guides/track/workspaces/#workspace-templates) allow you to save core line plot settings and automatically reapply them in new views. These settings include x-axis key, smoothing algorithm, smoothing factor, max number of lines, whether to use the run selector’s grouping, and which aggregation to apply. - -### Weave -- [Saved views](https://weave-docs.wandb.ai/guides/tools/saved-views/) simplify team collaboration and allow you to persist filter and column settings. -- PDFs and generic files are now supported. -- The new [`EvaluationLogger` API](https://weave-docs.wandb.ai/guides/evaluation/evaluation_logger) provides flexible imperative-style evaluation logging. -- You can now import [human annotations](https://weave-docs.wandb.ai/guides/tracking/feedback#add-human-annotations) into Weave datasets -- [Playground](https://weave-docs.wandb.ai/guides/tools/playground/) now supports saved configurations and prompts. -- Decorators are now supported in TypeScript. -- Added support for [tracing generator functions](https://weave-docs.wandb.ai/guides/tracking/tracing#trace-sync--async-generator-functions). -- The new [`dataset.add_rows`](https://weave-docs.wandb.ai/reference/python-sdk/weave/#method-add_rows) helper improves the efficiency of appending to an existing dataset. -- To help you understand your usage, trace and object sizes are now shown through the UI. - -## Performance -- With [`wandb` SDK](/quickstart/#install-the-wandb-library-and-log-in) v0.19.11, artifacts now download 3-5x faster on average. For example, an artifact that previously downloaded at around 100 MB/sec may now download at 450 MB/sec or faster. Actual download speeds vary based on factors such as your network and storage infrastructure. -- Improved caching on [Project](/guides/track/project-page/) and [User Settings](/guides/models/app/settings-page/user-settings/) pages. - -## Fixes -- Improved the startup process for the `weave-cache-clear` container to ensure compatibility with Python virtual environments. -- Added options for denser display of console logs. -- Workspace loading screens are now more informative. -- When adding a panel from a workspace to a report, the current project’s reports are now shown first in the destination report list. -- Fixed many cases where y-axes would over-round to a degree that caused duplicate values to display. -- Fixed confusing behavior when entering invalid smoothing parameters. -- Removed the **Partial Media** warning from media panels. This does not change the behavior of the media panels. -- When adding a [run filter based on tags](/guides/runs/filter-runs/#filter-runs-with-tags), the filter is now selected by default, as when filtering by other fields. -- Removed the green bell icon that could appear on active runs in the run selector. -- Removed the System page for individual runs. -- The project description field now respects new lines. -- Fixed URLs for legacy model registry collections. -- Fixed a bug where the Netron viewer did not expand to fill all available space on the page. -- When you click **Delete** on a project, the project name now displays in the confirmation modal. - -## Patches -### 0.69.1 -**June 10, 2025** - - -- You can now set the initial run state when creating a run with `Run.create()` by setting the `state` parameter to `pending` or `running`. -- Fixed a bug where clicking **Action History** incorrectly loaded the **Version** view. -- Improved memory performance of the Parquet store service. \ No newline at end of file diff --git a/content/en/ref/release-notes/releases/0.70.md b/content/en/ref/release-notes/releases/0.70.md deleted file mode 100644 index f3de54f264..0000000000 --- a/content/en/ref/release-notes/releases/0.70.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -title: "0.70.x" -date: 2025-07-09 -description: "July 7, 2025" ---- - -W&B Server v0.70 includes features, enhancements, and performance improvements to help you gain and share insights more efficiently. For example: - -- W&B Registry is now generally available, and organizations will be migrated from the legacy Model Registry in stages over several releases, with no action required. -- W&B organizations who use CoreWeave infrastructure can now observe CoreWeave infrastructure issues from within W&B, to streamline detection and resolution of problems. This release also brings CoreWeave AI Object Storage support for externally tracked files, as well as for BYOB storage for Dedicated Cloud and Self-Managed deployments. -- Rapidly prototype workspaces and visualizations to gain and share insights with workspace templates and additional bulk line plot and media panel settings at the workspace and section level. -- Monitor long-running running experiments before they finish with incremental table logging. - -The latest patch is **v0.70.1**. Refer to [Patches]({{< relref "#patches" >}}). - - - -## Support and end of life -
    -
  • W&B Server v0.56 and below have reached end of life as of July 7, 2025.
  • - - -
  • W&B Server v0.57 is scheduled to reach end of life on July 29, 2025.
  • -
  • W&B Server v0.58 is scheduled to reach end of life on September 2, 2025.
  • -
- -{{% readfile "/_includes/release-notes-support-eol-reminder.md" %}} - -### Upcoming changes -- In an upcoming release, we will align multi-run and single-run workspace views, so when you drill into a single run, you’ll see the same layout and configuration of panels as you’ve configured for the multi-run view, including any custom charts, layouts, and settings. The goal is help you stay in context and avoid re-work around configuring your views. However, this will remove the ability to customize unique single-run views, isolated from the rest of the workspace. Reach out to your W&B team or [support](mailto:support@wandb.ai) for any questions about the migration. -- Over the next several releases, we will migrate existing team-level Model Registry W&B Registry. For details and a timeline, see the [W&B Registry GA announcement](#registry_ga_announcement) below. - -## Features -- **W&B Registry is now generally available**! Registry offers improved asset diversity, access management, and scalability, making it a true hub for collaborating on AI initiatives across large, diverse teams. - - Registry can be turned on today with the `ENABLE_REGISTRY_UI` environment variable or by contacting your W&B support team. - - We’re migrating existing team-level Model Registry assets to W&B Registry in stages over the next several releases. **No action is needed on your end. W&B will automatically copy Model Registry assets for each team to a corresponding automatically-created team-level private registry.**  Existing references to model collections in your old team-level Model Registry will still work. - 1. In Server v0.71, Registry will be on by default for all organizations. - 1. Server v0.73 (August) will contain an opt-out environment variable that will execute this migration automatically during the upgrade. Migration takes between 5 and 30 minutes for most organizations. During the migration, linking artifacts to either the old team’s Model Registry or the new Registry will fail with an error. ****Artifact logging and retrieval** **will not be affected**. - 1. In Server v0.74 (September), we will remove this flag and migration will happen during the upgrade. - - We’re optimizing for a seamless, minimally-inconveniencing upgrade to a powerful new experience. Reach out to your W&B team or [support](mailto:support@wandb.ai) for any questions about the migration. -- **CoreWeave infrastructure monitoring**: During a [W&B Run]({{< relref "/guides/models/track/runs/_index.md" >}}) on CoreWeave infrastructure, [CoreWeave Mission Control](https://www.coreweave.com/mission-control) monitors your compute infrastructure, allowing for observation of infrastructure alerts such as GPU failures, thermal violations, and more. If an error occurs, CoreWeave sends that information to W&B. W&B populates infrastructure information onto your run’s plots in your project’s workspace. CoreWeave attempts to resolve some issues automatically, and W&B surfaces that information in the run’s page. W&B provides a link to the SLURM job’s Grafana dashboard for system-level details about the run. Learn more at [Visualize CoreWeave infrastructure alerts]({{< relref "/guides/models/app/features/panels/line-plot/_index.md" >}}). -- **CoreWeave external file tracking**: You can now track external files stored in CoreWeave AI Object Storage with reference artifacts. Learn more at [Track external files]({{< relref "/guides/core/artifacts/track-external-files.md" >}}). -- **CoreWeave BYOB support**: Dedicated Cloud and Self-Managed now support CoreWeave AI Object Storage for Instance and Team level BYOB. CoreWeave Team level BYOB on Multi-tenant Cloud is coming soon. Learn more at [Bring your own bucket (BYOB)]({{< relref "/guides/hosting/data-security/secure-storage-connector.md" >}}). -- **Bulk media settings**: Just like line plots, you can now manage all your media panel settings at once—across an entire workspace or a specific section. Easily configure media panels to display by epoch or arrange them into customized grid patterns without adjusting each panel separately. Individual panel settings override the global settings. -- Use **Workspace templates** to quickly create workspaces using the same settings as an existing workspace. Currently, a workspace template can define custom line plot settings. Learn more at [Workspace templates]({{< relref "/guides/models/track/workspaces.md#workspace-templates" >}}). -- With **incremental table logging**, you can log batches of rows to a table during a machine learning experiment. This is ideal for monitoring long-running jobs or when working with large tables that would be inefficient to log during the run for updates. Within the UI, the table is updated with new rows as they are logged, so you can view the latest data without having to wait for the entire run to finish. You can step through the increments to view the table at different points in time. Learn more at [Log tables]({{< relref "/guides/models/track/log/log-tables.md#adding-data-incrementally" >}}). - -## Fixes -- Added a banner at the top of the log viewer if only a subset of lines is shown. -- Fixed a bug in the running average calculation at data boundaries. -- Clarified x-axis unit labels for relative time plots. -- Fixed a bug in plots with smoothing where the original line would still display when **Show Original** was unchecked. -- Fixed a bug that could unexpectedly convert a grouped full-fidelity line plot with expressions into a bar chart. -- Hovering on histograms now shows the x-axis step in a tooltip. -- Fixed a bug where data exported from a panel could sort incorrectly. Exported data now sorts numerically. -- In the run selector, you can now filter and sort on **updated at**. -- Added right-handed system setting option to point cloud panels. -- Trailing slashes are now stripped from full screen panel URLs. -- Fixed a bug where a deleted saved view could reappear if you refreshed immediately after deleting it. -- Fixed a display bug that caused a flash when reloading a page with dark mode turned on. -- Fixed a bug that caused incorrect slider steps when using non-monotonic values. -- Added a convenience checkbox and notification when moving runs between groups. -- Fixed a bug where using the wildcard character `*` for the metric name in `wandb.define_metric()` would fail to match metrics with `/` in the name. -- W&B now no longer deletes source artifacts when collection portfolios are garbage collected. -- Fixed a bug that incorrectly allowed typing input in **Allowed types** and **Registry visibility** selection boxes. -- Collection cards now display the full artifact type name instead of truncating it. -- Fixed a bug where clicking **Action History** in a Registry collection would incorrectly load the **Versions** view. -- Registry now supports adding `job` type artifacts. -- Lineage tiles are now wider, displaying more text before truncating. -- Clarified text in project-level automation setup to refer to "artifacts" instead of the Registry terminology "collections". -- The artifact browser now searches all artifacts when searching the artifact browser by name, rather than the previous limit of the first 500 artifacts. - -## Patches -### 0.70.1 -**July 9, 2025** - - - -- Fixed a bug where the status of crashed runs was not updated to **Crashed** after an upgrade. -- Fixed a bug where the **State** column was missing from the **Sweeps** Runs table. -- Fixed a Weave bug where the browser for a Registry collection could display files from an incorrect version because the cached path for an artifact manifest file depended only on the artifact's version index. -- Fixed a Weave bug that could prevent JSON with valid syntax from being parsed correctly. - -These bugs were introduced in v0.70.0. \ No newline at end of file diff --git a/content/en/ref/release-notes/releases/0.71.md b/content/en/ref/release-notes/releases/0.71.md deleted file mode 100644 index 7e77e7261e..0000000000 --- a/content/en/ref/release-notes/releases/0.71.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -title: "0.71.x" -date: 2025-07-29 -description: "July 29, 2025" ---- - -With W&B Server 0.71, Registry is turned on by default for all organizations. For more details about the staged Registry rollout, see the relevant note in Features. This release brings several improvements and fixes to workspaces: Keep media panels with a common step slider in sync, navigate through through full-screen panels more efficiently, and find more details about a run’s total duration and time actively running. in the Run Overview page. Automations have been enhanced, and you can now trigger an automation based on an artifact version’s tags. - -## Support and end of life -
    -
  • W&B Server v0.57 and below reached end of life on July 29, 2025.
  • -
  • W&B Server v0.58 is scheduled to reach end of life on September 2, 2025.
  • -
- -{{% readfile "/_includes/release-notes-support-eol-reminder.md" %}} - -### Upcoming changes -- We’re optimizing our rendering behavior in the workspace to provide faster loading in workspaces with many panels, as well as more responsive and accurate drag-and-drop of panels in workspaces. **As part of this, we plan to remove the “Custom grid” layout in workspace sections in the next (0.72) release.** Custom grids will remain available in Reports. Reach out to your W&B team or [support](mailto:support@wandb.ai) for any questions or concerns. -- In an upcoming release, we will align multi-run and single-run workspace views, so when you drill into a single run, you’ll see the same layout and configuration of panels as you’ve configured for the multi-run view, including any custom charts, layouts, and settings. The goal is help you stay in context and avoid re-work around configuring your views. However, this will remove the ability to customize unique single-run views, isolated from the rest of the workspace. Reach out to your W&B team or [support](mailto:support@wandb.ai) for any questions about the migration. -- Over the next several releases, we will continue migrating existing team-level Model Registry to W&B Registry. For details and a reminder about the timeline, see the [W&B Registry GA announcement](#registry_ga_announcement) below. - -## Features -- We’re migrating existing team-level Model Registry to W&B Registry in stages over the next several releases. **No action is needed on your end; W&B will automatically copy Model Registry assets for each team to a corresponding automatically-created team-level private registry.**  Existing references to model collections in your old team-level Model Registry will still work. - 1. In Server v0.71 (this release), Registry is now turned on by default for all organizations. - 2. Server v0.73 (August) will include an opt-out environment variable that will execute this migration automatically during the upgrade. Migration takes between 5 and 30 minutes for most organizations. During the migration, linking artifacts to either the old team’s Model Registry or the new Registry will fail with an error. **Artifact logging and retrieval will not be affected**. - 3. In Server v0.74 (September), we will remove this flag and migration will happen during the upgrade. - - We’re optimizing for a seamless, minimally-inconveniencing upgrade to a powerful new experience. Reach out to your W&B for any questions about the migration. -- An automation can now be triggered by adding a tag to an artifact. See [Artifact events](/guides/core/automations/automation-events#artifact-events). -- When viewing a panel in full screen, view the next or previous panel in the section using the **Previous** and **Next** buttons or the left and right arrow keys. -- When viewing a media panel in full screen, move the step slider with **CMD + left or right arrow** keys (macOS) or **Ctrl + left or right arrow** keys (Windows / Linux). -- You can now synchronize media panels with the same step slider key so that when you advance the step slider in one media panel, the step sliders for other panels also advance. Open the workspace or section settings, go to **Media**, click the **Sync** tab, then turn on **Sync slider by key (Step)**. -- The Run Comparer includes a new **Meta** section with metadata about the run, such as the command, Python version, and GPU type. - -### Weave -- The **Trace plots** tool allows you to explore, visualize, and debug trace-level metrics like latency, cost, or tokens over time using custom interactive charts. [Learn more](https://weave-docs.wandb.ai/guides/tracking/trace-plots/). -- **Online Evaluations**: Monitor your traces in Dedicated Cloud by attaching Monitors to your incoming traces. Monitors run in the background as LLM judges and score a subset of calls that you specify. Use Monitors to track production behavior, catch regressions, collect real-world production data, and more. [Learn more](https://weave-docs.wandb.ai/guides/evaluation/guardrails_and_monitors). -- Added [AutoGen](https://weave-docs.wandb.ai/guides/integrations/autogen) and [LlamaIndex](https://weave-docs.wandb.ai/guides/integrations/llamaindex) integrations. _AutoGen_ is a framework from Microsoft for building AI agents and applications, with components for conversational AI, core multi-agent functionalities, and integrations with external services, and tools for no-code agent prototyping. _LlamaIndex_ is a powerful framework for building LLM-driven applications like RAG systems, chatbots, and agents. -- Improved Integrations with OpenAI, LangChain, ChromaDB, Verdict, including: - - Document view for Langchain and ChromaDB. - - Chat view rendering for LangChain. - - A new export format for OpenAI. -- Added new hosted open weight models for [W&B Inference](https://wandb.ai/inference): - - `Qwen3-235B-A22B-Thinking-2507` - - `Qwen/Qwen3-Coder-480B-A35B-Instruct` - - `Qwen/Qwen3-235B-A22B-Instruct-2507` - - `Kimi-K2-Instruct` -- Added support to the TypeScript SDK for creating and publishing prompts. [Learn more](https://weave-docs.wandb.ai/guides/core-types/prompts/). -- The new `Content` class allows you safely to upload data of any MIME type, with automatic Base-64 encoding, automatic metadata extraction, and more. - -## Fixes -- A run’s **Overview** page now displays the run’s uptime and tracked hours. A run’s *uptime* represents the run’s total duration from start to finish, while the run’s *tracked hours* represent the duration of time that the run was actively running experiments or computations. -- When you zoom into a line plot, then open it in full screen mode, the full screen plot now correctly maintains the same zoomed-in view. -- Fixed a bug where updating the number of groups shown in a plot did not update the plot. -- When **Show Original** is selected in line plots, the original unsmoothed line is now dimmer than the smoothed line. -- Full fidelity line plots now show the number of runs in the plot. -- Fixed a bug that could unexpectedly convert a plot that is explicitly set to a line plot to a bar plot when only one value is present per run. -- X-axis expressions now support nested config fields. -- The **Registry** link has been removed from the sidebar on the **Artifacts** page. To access Registry, click **Home**, then click **Registry**. -- Line plots in a workspace or section can optionally show the bin range in the tooltip when you hover over a point. Open the workspace or section settings, click **Line plots**, go to the **Display preferences** tab, then turn on **Show bin range in tooltip**. -- Fixed a bug when clicking a link in the **Registry** artifact lineage page would update the URL and parameters in the browser but not update the page contents. The UI now updates when the URL changes. -- Fixed a bug in **Registry** where collection tables were sorted as strings instead of floats. -- Fixed a bug in **Registry** where the lineage info drawer would always show the latest version for the selected artifact, even when a different version was selected. -- Fixed a mobile display bug where the panel search bar was missing. -- When you sort the run selector by any attribute with coloring by key on, the top runs in the plot are now colored correctly. -- When using grouped runs, parallel coordinate plots now correctly show the group name. -- **State** is now correctly shown by default in the Sweeps table. -- Sweeps now show correctly when grouping by custom display names. -- Fixed wrapping of long names for Sweeps and Reports. -- Improved the copy and paste behavior for console logs. Line numbers are no longer copied, and timestamps now appear inline instead of on a new line. diff --git a/content/en/ref/release-notes/releases/0.72.md b/content/en/ref/release-notes/releases/0.72.md deleted file mode 100644 index aeb73fae97..0000000000 --- a/content/en/ref/release-notes/releases/0.72.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: "0.72.x" -date: 2025-08-06 -description: "August 6, 2025" ---- - -W&B 0.72 includes fixes for line plots and media panels, as well as improvements to Weave integrations for OpenTelemetry and Google Agent Development Kit. - - - - -## Support and end of life -
    -
  • W&B Server v0.57 and below reached end of life on July 29, 2025.
  • -
  • W&B Server v0.58 is scheduled to reach end of life on September 2, 2025.
  • -
- -{{% readfile "/_includes/release-notes-support-eol-reminder.md" %}} - -### Upcoming changes -- We’re optimizing our rendering behavior in the workspace to provide faster loading in workspaces with many panels, as well as more responsive and accurate drag-and-drop of panels in workspaces. **As part of this, we plan to remove the “Custom grid” layout in workspace sections in the next (0.73) release.** Custom grids will remain available in Reports. Reach out to your W&B team or [support](mailto:support@wandb.ai) for any questions or concerns. -- In an upcoming release, we will align multi-run and single-run workspace views, so when you drill into a single run, you’ll see the same layout and configuration of panels as you’ve configured for the multi-run view, including any custom charts, layouts, and settings. The goal is help you stay in context and avoid re-work around configuring your views. However, this will remove the ability to customize unique single-run views, isolated from the rest of the workspace. Reach out to your W&B team or [support](mailto:support@wandb.ai) for any questions about the migration. -- Over the next several releases, we will continue migrating existing team-level Model Registry to W&B Registry. - -## Fixes -- Reverted the line plot behavior change announced in 0.71.0. Line plots with only 1 point for every line will convert to bar charts even if settings are changed. -- Fixed a bug that could cause bounding boxes to render outside the media in a media panel instead of overlaying the media. -- Fixed a bug where the Google Agent Development Kit integration did not support Weave Threads. -- Fixed a bug where the **Attributes** column was missing from Weave traces submitted through OpenTelemetry. \ No newline at end of file diff --git a/content/en/ref/release-notes/releases/0.73.md b/content/en/ref/release-notes/releases/0.73.md deleted file mode 100644 index 516ba0a181..0000000000 --- a/content/en/ref/release-notes/releases/0.73.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: "0.73.x" -date: 2025-09-10 -description: "September 3, 2025" ---- - -W&B v0.73 marks a significant milestone in the migration to W&B Registry from team-level Model Registry; most organizations will be migrated automatically during the upgrade. UI improvements include colorblind-safe run color palettes, continuous color options metric-based run coloring, and smoother panel reorganization. This release also provides service principal authentication for BYOB (Bring Your Own Bucket) setups with CoreWeave AI Object Storage, along with improved console log handling and additional enhancements. - -The latest patch is **v0.73.1**. Refer to [Patches]({{< relref "#patches" >}}). - - - -## Support and end of life -
    -
  • W&B Server v0.58 and below reached end of life on September 3, 2025.
  • -
  • W&B Server v0.60 is scheduled to reach end of life in late September 2025.
  • -
- -{{% readfile "/_includes/release-notes-support-eol-reminder.md" %}} - -## Upcoming changes -- In an upcoming release, we will align multi-run and single-run workspace views, so when you drill into a single run, you'll see the same layout and configuration of panels as you've configured for the multi-run view, including any custom charts, layouts, and settings. The goal is help you stay in context and avoid re-work around configuring your views. However, this will remove the ability to customize unique single-run views, isolated from the rest of the workspace. Reach out to your W&B team or [support](mailto:support@wandb.ai) for any questions about the migration. -- Over the next several releases, we will continue migrating existing team-level Model Registry to W&B Registry. For details and a reminder about the timeline, see the [W&B Registry GA announcement]({{< relref "#registry_ga_announcement" >}}) below. - -## Known issues -In v0.73.0, resizing or reordering workspace panels may not be reflected in saved views. This bug is fixed in v0.73.1. If you experience this issue, upgrade to v0.73.1, which includes the fix. If you can't upgrade, contact [support](mailto:support@wandb.ai) for a workaround. - -## Features -- We're migrating existing team-level Model Registry to W&B Registry in stages over the next several releases. **No action is needed on your end; W&B will automatically copy Model Registry assets for each team to a corresponding automatically-created team-level private registry.** Existing references to model collections in your old team-level Model Registry will still work. - 1. Server v0.73 (this release) includes an opt-out environment variable that will migrate the team's Model Registry automatically during the upgrade. Migration takes between 5 and 30 minutes for most organizations. During the migration, linking artifacts to either the old Model Registry or the new Registry will fail with an error. **Artifact logging and retrieval will not be affected**. - 2. In Server v0.74 (end of September), we will remove the opt-out flag and migration will happen during the upgrade. - - We're optimizing for a seamless upgrade to a powerful new experience. Contact your W&B account team or [support](mailto:support@wandb.ai) if you have any questions about the migration. -- Added a copy button to the [Run Logs console page]({{< relref "/guides/models/app/console-logs/" >}}) and improved paste behavior. -- W&B now offers two new colorblind-safe color palettes for runs. Set these in the **Runs** section of the [Workspace settings]({{< relref "/guides/models/app/features/cascade-settings/#workspace-settings" >}}). -- When [coloring runs by metrics or numeric configs]({{< relref "/guides/models/track/runs/color-code-runs/" >}}), you can now choose from five new continuous color palettes. -- During a [W&B run]({{< relref "/guides/models/track/runs/" >}}), [CoreWeave Mission Control](https://www.coreweave.com/mission-control) monitors your compute infrastructure. This integration is now available on Dedicated Cloud. -- BYOB with CoreWeave AI Object Storage now supports authentication with service principals in Multi-tenant Cloud, Dedicated Cloud, and Self-Managed deployments. This helps you to avoid using static credentials in your deployment. Learn more at [Bring your own bucket (BYOB)]({{< relref "/guides/hosting/data-security/secure-storage-connector/" >}}). - -### Weave -- You can now group sessions or conversations across multiple traces with [Weave Threads](https://weave-docs.wandb.ai/guides/tracking/threads/). -- The **Trace view**'s new [Graph view](https://weave-docs.wandb.ai/guides/tracking/trace-tree#graph-view) visualizes the call tree structure as a graph. -- The **Trace view** includes new specialized views for [documents](https://weave-docs.wandb.ai/guides/core-types/media#documents) retrieved with ChromaDB and Langchain improves handling of schemas such as chats. In **Trace view**, click a document to open its detailed view in a drawer to the right. Learn more at [Navigate the trace view](https://weave-docs.wandb.ai/guides/tracking/trace-tree/). -- You can now attach [HTML](https://weave-docs.wandb.ai/guides/core-types/media#html) to a trace as a media type. -- From the **Assets** tab, you can now create and edit prompts. Click **Assets**, then in the navigation, click **Prompts**. Click **New prompt** or click the name of an existing prompt to view its details. From there, click the pencil icon to edit and republish the prompt. - -## Fixes - -- Improved the smoothness and accuracy of [dragging and dropping panels]({{< relref "/guides/models/app/features/panels/#move-a-panel" >}}) within a section and between sections. -- In [full screen panel view]({{< relref "/guides/models/app/features/panels/#view-a-panel-in-full-screen-mode" >}}), the **Esc** key now returns you to the workspace. -- Fixed a bug that could cause a panel in a workspace to zoom unexpectedly after returning from full screen. -- In [plot settings]({{< relref "/guides/models/app/features/panels/line-plot/#edit-line-plot-settings" >}}), chart and legend settings have been consolidated to a single tab. -- Fixed a bug where panel legends were ordered incorrectly after polling updates. -- Improved the formatting of panels with long exponential Y-axis values and those with a large number of significant digits. -- [Overlays for panels]({{< relref "/guides/models/app/features/panels/media/#overlays" >}}) without matching runs are now hidden. -- Fixed a bug where clicking on a run's tag in a workspace's **Runs** tab or **Runs** list did not filter by the tag. -- Fixed a bug that could allow a user to bypass the max runs limit. -- When you toggle runs on or off, W&B no longer reloads the media for other runs in the panel. -- Fixed a bug that could cause a report to crash when expanding or collapsing a section after pressing **Tab**. -- Fixed a bug on mobile displays where scrolling could cause logged videos to automatically play in full screen. - -## Other changes -- The custom grid layout was removed from W&B Workspaces with Server release v0.73.0. Previously, custom grid layout allowed you to adjust the size of individual panels within a section. Now, resizing a panel in a workspace section resizes all panels in that section, whether you configure the workspace using the [W&B App]({{< relref "/guides/models/app/features/panels/#manage-a-sections-panels" >}}) or the [Workspace API]({{< relref "ref/wandb_workspaces/workspaces.md#class-sectionlayoutsettings" >}}). Custom grid layout remains available in [W&B Reports]({{< relref "/guides/core/reports/_index.md" >}}) and the [Reports API]({{< relref "/ref/wandb_workspaces/reports.md" >}}). - -## Patches - -### v0.73.1 -**September 10, 2025** -- Fixed a bug introduced in v0.73.0, where resizing or reordering workspace panels was not always reflected in saved views. -- Fixed a bug in the Registry UI where paging through the list of registries could fail if an organization has hundreds of registries. -- Fixed a bug where bounding boxes did not always display for media that was logged with bounding boxes. -- Fixed a bug where export tasks could get stuck in a pending state and never execute. -- Fixed a bug where `wandb verify` could fail when downloading files with special characters in their names. -- Fixed a performance regression when fetching system events, especially when plotting a large number of system events in a chart. This regression was introduced in v0.73.0. diff --git a/content/en/ref/release-notes/releases/0.74.md b/content/en/ref/release-notes/releases/0.74.md deleted file mode 100644 index bf9f639d3f..0000000000 --- a/content/en/ref/release-notes/releases/0.74.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -title: "0.74.x" -date: 2025-10-08 -description: "October 2, 2025" ---- - -W&B v0.74 delivers SCIM API improvements for enterprise identity management, including automated group sync with Okta, streamlined user role configuration, and more. In Dedicated Cloud, a powerful new full-screen image browser helps you inspect and compare images within and between runs. Weave enhancements include in-Playground LLM judge evaluations, better visibility into multi-turn Thread tool calls, DSPy improvements, and a new integration with the Verifiers library for Reinforcement Learning workflows. W&B Inference adds support for the [Z.AI](https://z.ai/) GLM v4.5 hybrid reasoning model. - -The latest patch is **v0.74.1**. Refer to [Patches](#patches). - - - -## Support and end of life -
    -
  • W&B Server v0.60 and below reached end of life on October 2, 2025.
  • -
  • W&B Server v0.61 is scheduled to reach end of life on October 28, 2025.
  • -
- -{{% readfile "/_includes/release-notes-support-eol-reminder.md" %}} - -## Features -- The SCIM API has been enhanced: - - Provisioning and deprovisioning operations are now more compatible with Okta. - - In Multi-tenant Cloud deployments, you can now configure the organization role and teams when you [create a user]({{< relref "/guides/hosting/iam/scim/#create-user" >}}). This aligns with the endpoint's behavior in Dedicated Cloud and Self-Managed. - - In Dedicated Cloud and Self-Managed deployments, you can now update a user's username or email address. See [Update user email]({{< relref "/guides/hosting/iam/scim/#update-user-email" >}}) and [Update user display name]({{< relref "/guides/hosting/iam/scim/#update-user-display-name" >}}). Not applicable to Multi-tenant Cloud deployments. - - You can now [search and retrieve a user]({{< relref "/guides/hosting/iam/scim/#get-user" >}}) by email and username. - - Okta groups are now synced automatically using [ETags]({{< relref "/guides/hosting/iam/scim/#etag-support" >}}). For details about SCIM groups, see [Group resource]({{< relref "/guides/hosting/iam/scim/#group-resource" >}}). -- When [exporting the list of users]({{< relref "/guides/hosting/monitoring-usage/org_dashboard/#export-user-details" >}}) in your organization, the CSV file now includes columns for **Models seats** and **Weave access**. -- In **W&B Dedicated Cloud**, the new full-screen image browser simplifies inspection and comparison of logged images. - - **True full-screen view.** Inspect image details more easily with edge-to-edge full-screen viewing. No more cramped panels. - - **Step slider in full-screen view.** Move through steps efficiently with an embedded slider to see how outputs evolve. - - **Quickly toggle between runs using the keyboard.** In full-screen view, use the keyboard **left / right arrow** keys to move between runs, and use **Cmd + left / right arrow** (macOS) or **Ctrl + left / right arrow** (Windows / Linux) to move between steps of the same image. - -### Weave -- From the **Evaluations** sidebar tab, you can now update prompt values and run LLM judge evaluations to test the changes. Try it out in the [Playground](https://weave-docs.wandb.ai/guides/tools/playground/). -- You can now integrate Weave into your Reinforcement Learning (RL) training workflows and [view the traces and evaluations](https://weave-docs.wandb.ai/guides/tools/weave-in-workspaces) captured during training in the W&B Workspace, together with run metrics panels. -- Weave now includes an integration with [Verifiers](https://verifiers.readthedocs.io/en/latest/), a library of modular components for creating Reinforcement Learning (RL) environments and training LLM agents. Environments built with Verifiers can serve as LLM evaluations, synthetic data pipelines, agent harnesses for OpenAI-compatible endpoints, and RL training. [Learn more](https://weave-docs.wandb.ai/guides/integrations/verifiers). -- From the **Threads** sidebar tab, you can now view tool calls for a multi-turn Thread together with its message history. -- A Team's **Project** page now shows the number of Weave traces for each project together with data about the project's runs. -- The [DSPy integration](https://weave-docs.wandb.ai/guides/integrations/dspy) has been improved. For details, see [`wandb/weave` #5184](https://github.com/wandb/weave/pull/5184). -- If your Weave code calls `wandb.init()`, it no longer needs to explicitly call `weave.init()`. -- New convenience method [`delete_all_object_versions`](https://weave-docs.wandb.ai/reference/python-sdk/weave/trace/weave.trace.weave_client/). -- The output from an OpenAI streaming endpoint call now includes a new field, `time_to_first_token`, expressed in milliseconds. - -### Inference -- [W&B Inference]({{< relref "/guides/inference/" >}}) adds support for the [Z.AI GLM](https://z.ai/blog/glm-4.5) hybrid reasoning model. v4.5 is supported. - -## Fixes -- Fixed display problems in bounding boxes with captions. -- When grouping runs in the Runs Table, you can now expand the `null` group to see the runs with null values for the grouping key. -- Increased running average smoothing parameter maximum to **1000**. -- Fixed a bug where clicking a run name could open an invalid URL if a runset included runs from multiple projects. -- Fixed text display issues in dark mode. -- Fixed a permission bug when viewing a public report that included Query Panels. -- Fixed a UI bug that could prevent code from being copied from a report. -- Fixed a bug in the order of min and max values in a line plot tooltip. -- Fixed a bug that could prevent a grouped plot from rendering if the X-axis key was a substring of the Y-axis key. - -## Patches -### v0.74.1 -**October 8, 2025** - -- Fixed a bug that could prevent an organization admin from accessing the Organization Dashboard. -- Fixed a bug introduced in 0.73.0 that allowed deletion of previously exported Parquet files. -- Fixed a bug that could allow deleting an artifact file in Parquet after it has successfully committed. -- Fixed a performance regression introduced in v0.73 when querying system metrics from MySQL. -- Fixed a bug that could prevent editing of a project with no owner. -- Historical metric histograms no longer display in summary pages by default. Instead, details about each metric display in summary pages, and histograms are available as workspace panels. - - - diff --git a/content/en/ref/release-notes/releases/archived/0.33.0.md b/content/en/ref/release-notes/releases/archived/0.33.0.md deleted file mode 100644 index 5af56d9c50..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.33.0.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -title: "0.33.0" -date: 2023-05-10 -description: "May 10, 2023" -parent: archived-releases ---- - -{{% alert color="warning" %}}{{% readfile "/_includes/unsupported_server_version.md" %}}{{% /alert %}} - -## Features - -### Prompts: Zoom and pan - -![Demo of zooming and panning](https://github.com/wandb/server/assets/97066933/c6580dff-f003-4767-86f2-ad26d40108fb) - - -Explore complex chains of LLM prompts more easily with new zoom and pan controls in our prompts tracer. - -### Model registry admin role - -![Image showing Model registry admin role](https://github.com/wandb/server/assets/97066933/b0fc6389-b8a6-437a-91a3-a991e69bca0d) - - -Control your model promotion process with a new role for model registry admins. These users can manage the list of protected aliases (for example, “challenger” or “prod”), as well as apply or remove protected aliases for model versions. - -### Viewer role - -You can now share your W&B findings with a broader audience with the introduction of a Viewer role for W&B Server. Users with this role can view anything their team(s) make, but not create, edit, or delete anything. These seats are measured separately from traditional W&B Server seats, so reach out your W&B account team to request an updated license. - -### Improved sharing: optional magic link, and easier signup for viewers - -Team admins can now disable magic link sharing for a team and its members. Disable public sharing on the team setting allows you increase team privacy controls. Meanwhile, it’s now easier for users who receive a report link to access the report in W&B after signing up. - -### Improved report composition - -![Improved report composition interface with enhanced draft publication, editing, and collaboration features](https://github.com/wandb/server/assets/97066933/c2858fd5-d2f6-47e3-9e93-f8d048df4f59) - - -Reports help share your findings W&B further throughout an organization, including with people outside the ML team. We’ve made several investments to ensure it’s as simple and frictionless as possible to create and share them—including an improved report drafting experience with enhanced draft publication, editing, management, and sharing UX to improve how teams collaborate with Reports. - -### Updated navigation - -As W&B has expanded the parts of the ML workflow we cover, we’ve heard your feedback that it can be hard to move around the application. So we’ve updated the navigation sidebar to include clearer labels on the product area, and added backlinks to certain detail screens. We’ve also renamed “Triggers” to “Automations” to better reflect the power of the feature. - -## Fixes - -- When hovering over a plot in workspaces or a report, you can now use Cmd+C or Ctrl+C to copy run names and plot values shown in the hover control. -- Changes to default workspaces are now no longer auto-saved. -- Metrics in the Overview → Summary section now are formatted with commas. -- Added an install-level option to allow non-admin users to create teams (default off; contact W&B support to enable it). -- Weave plots now support log scales. -- The Launch panel can now be expanded horizontally to give more space for viewing parameters. -- The Launch panel now indicates whether a queue is active -- The Launch panel now allows you to choose a project for the run to be logged in. -- Launch queues can now only be created by team admins. -- Improved Markdown support in Launch panel. -- Improved error message on empty Launch queue configurations. -- Filters on the Sweeps parallel coordinates plot will now apply to all selected runsets. -- Sweeps now no longer require a metric. -- Added support for tracking reference artifact files saved outside W&B in Azure Blob Storage. -- Fixed bug in Markdown editing in Reports -- Fullscreen Weave panels can now share config changes with the original panel. -- Improved display of empty tables -- Fixed bug in which the first several characters of logs were cut off diff --git a/content/en/ref/release-notes/releases/archived/0.34.0.md b/content/en/ref/release-notes/releases/archived/0.34.0.md deleted file mode 100644 index 9a7a4b8930..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.34.0.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: "0.34.0" -date: 2023-05-31 -description: "May 31, 2023" -parent: archived-releases ---- - -{{% alert color="warning" %}}{{% readfile "/_includes/unsupported_server_version.md" %}}{{% /alert %}} - -## Features - -**********New Model Registry UI********** - -![New Model Registry UI featuring list view, model filtering, version management, and automation controls](https://github.com/wandb/server/assets/97066933/3fedbdb8-aa79-4fb6-aab8-bddd8899e8dc) - -We’re making it easier for users to manage a long list of models, and navigate seamlessly between entities in the model registry. With this new UI, users can: - -- Look at all your registered models -- Filter to registered models within a specific team -- With the new list view, users can expand each panel to see the individual versions inside of it, including each version's aliases, and metadata or run metrics. Clicking on a version from this quick view can take you to it's version-view -- Look at an overview directly by clicking “View Details” -- See a preview of how many version, consumers, and automations are present for each registered model -- Create Automations directly -- See some metadata columns and details in preview -- Change Model Access Controls - -## Fixes - -- Improved search functionality for better universal search ranking results. -- Added functionality to add/delete multiple tags at once in the model registry -- Enhanced the FileMarkdown feature to correctly scroll long content. -- Made the default team selection dropdown scrollable. -- Removed the UI access restriction for Tier 1/2/3 plans based on tracked hour usage. -- Added tooltips to for LLM trace viewer spans -- LLM trace timeline/detail now splits horizontally in fullscreen -- Added entity / team badges to Model Registry entries. -- Improved the navigation bar experience for logged out users -- Disabled storage/artifact banners to avoid issue where UI blocks for orgs with excess artifacts. -- Fixed issues where user avatars were not being displayed correctly. -- Fixed issue using Launch with Azure Git URLs -- Launch configuration boxes now work in airgapped environments -- In Launch queue creation, show teams as disabled (rather than hidden) for non-admins. -- Fixed issue with embedding projector rendering -- Fixes issue that prevented users from being able to reset their password in some cases involving mixed-case usernames. -- Files with special characters now show up in the media panel in Azure -- Added the ability to override the inline display format for timestamps. -- Reports with custom charts now load when not logged in. -- Wide GIFs no longer overflow fullscreen view -- Increase default automations limit from 20 to 200. -- Fixed bug allowing the appearance of deleting the version alias of a registered model (in fact, this could not be deleted on the backend). diff --git a/content/en/ref/release-notes/releases/archived/0.35.0.md b/content/en/ref/release-notes/releases/archived/0.35.0.md deleted file mode 100644 index 81522fb637..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.35.0.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: "0.35.0" -date: 2023-06-07 -description: "June 07, 2023" -parent: archived-releases ---- - -{{% alert color="warning" %}}{{% readfile "/_includes/unsupported_server_version.md" %}}{{% /alert %}} - -## Security - -Fixed issue where API keys were logged for recently logged in users. Check for `FetchAuthUserByAPIKey` in the logs which you can find in `gorilla.log` from a debug bundle and rotate any keys that are found. - -## Features - -### Launch Agent Logs Now in the GUI - -![Image showing Launch agent logs in GUI](https://github.com/wandb/server/assets/97066933/9d68dc0d-54c9-4024-a108-ffb5a1500fa8) - -[W&B Launch](https://docs.wandb.ai/guides/launch) allows you to push machine learning jobs to a wide range of specialized compute environments. With this update, you can now use W&B to monitor and debug jobs running in these remote environments, without needing to log into your AWS or GCP console. - -## Fixes - -- Logs tab is no longer trimmed to 1000 rows. -- Fixed scenario where artifact files pagination could get into an infinite loop -- Fixed bug where success toast messages were not appearing -- The Runs table will now correctly show the git commit value diff --git a/content/en/ref/release-notes/releases/archived/0.36.0.md b/content/en/ref/release-notes/releases/archived/0.36.0.md deleted file mode 100644 index 2af5586a72..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.36.0.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: "0.36.0" -date: 2023-06-14 -description: "June 14, 2023" -parent: archived-releases ---- - -{{% alert color="warning" %}}{{% readfile "/_includes/unsupported_server_version.md" %}}{{% /alert %}} - -## Features - -**Clone Runs with Launch** - -![Run cloning interface in W&B Launch allowing hyperparameter adjustments and infrastructure selection](https://github.com/wandb/server/assets/47005026/4aebe22a-70c9-4186-be74-feaf73c1b2d2) - - -If you want to repeat a run but tweak a couple hyperparameters--say bump the batch size to take advantage of a larger machine--it's now easy to clone a run using W&B Launch. Go to the run overview, click Clone, and you'll be able to select new infrastructure to execute the job on, with new hyperparameters. Learn more in the [Launch documentation](https://docs.wandb.ai/guides/launch). - -## Fixes - - - Added report creation and update action to audit logs. - - Artifacts read through the SDK will now be captured in the [audit logs](https://docs.wandb.ai/guides/hosting/audit-logging/). - - In report creation, added button to select all plots to add to the new report - - New view-only users signing up via a report link will now be fast tracked to the report, rather than going through the normal signup process. - - Team admins can now add protected aliases. - - Improved media panel handling of intermediate steps. - - Removed inactive 'New Model' button from Model Registry homepage for anonymous users - - Ability to copy data from plot legends has been rolled out to all users. - - Fixed incorrect progress indicator in Model Registry onboarding checklist. - - Fixed issue where the Automations page could crash when job name had slashes. - - Fixed issue where a user could update the wrong user profiles. - - Added option to permanently delete runs and their associated metrics after a duration specified in an environment variable. diff --git a/content/en/ref/release-notes/releases/archived/0.38.0.md b/content/en/ref/release-notes/releases/archived/0.38.0.md deleted file mode 100644 index 50376ec36c..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.38.0.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: "0.38.0" -date: 2023-07-13 -description: "July 13, 2023" -parent: archived-releases ---- - -{{% alert color="warning" %}}{{% readfile "/_includes/unsupported_server_version.md" %}}{{% /alert %}} - -## Features - -**Metric visualization enhancements** - -![Enhanced metric visualization interface supporting up to 100 metrics with time-weighted exponential moving averages](https://github.com/wandb/server/assets/47005026/1bb0b16c-eaae-4348-be0d-cc788b67853e) - - -We're continuing to enhance our core metric visualization experience. You can now define which metrics from regular expressions to render in your plots, up to 100 metrics at once. And to more accurately represent data at high scale, we've add a new time-weighted exponential moving average smoothing algorithm for plots ([check out all of our supported algorithms](https://docs.wandb.ai/guides/app/features/panels/line-plot/smoothing#docusaurus_skipToContent_fallback)). - -**Feedback surveys** - -W&B has always built our product based on customer feedback. Now, we're happy to introduce a new way for you to shape the future of W&B: in-app feedback surveys in your Dedicated Cloud or Customer-Managed W&B install. Starting July 17th, W&B users will start periodically seeing simple 1 - 10 Net Promoter Score surveys in the application. All identifying information is anonymized. We appreciate all your feedback and look forward to making W&B even better, together. - -## Fixes - -* Major improvement to artifact download speed: over a 6x speedup on our 1-million-file artifact benchmark. Please upgrade to SDK version 0.15.5+. -* (Launch) Optuna is now available as [a sweeps scheduler with Sweeps on Launch](https://docs.wandb.ai/guides/launch/sweeps-on-launch#create-a-custom-sweep-scheduler), allowing more efficient exploration of hyperparameters. -* Run data permadeletion is now available (default off). This can be enabled with the GORILLA_DATA_RETENTION_PERIOD environment variable, specified in hours. Please take care before updating this variable and/or chat with W&B Support, since the deletion is permanent. Artifacts will not be deleted by this setting. -* Updated report sharing emails to include a preview. -* Relaxed HTML sanitation rules for reports in projects; this had been causing rare problems with report rendering. -* Expanded the maximum number of metrics that can be matched by a regex in chart configuration; previously this had been always 10, the maximum is now 100. -* Fixed issue with media panel step slider becoming unsynced with the media shown. -* Added time-weighted exponential moving average as an option for smoothing in plots. -* The "Search panels" textbox in workspaces now preserves the user's last search. -* Applying a username filter when runs are grouped will no longer error. -* (Launch) The loading of the Launch tab should now be much faster, typically under two seconds. -* (Launch) There’s now an option to edit queue configs using YAML instead of JSON. It’s also now more clear how to edit queue configs. -* (Launch) Runs will now show error messages in the UI when they crash or fail. -* (Launch) If you don’t specify a project when creating a job, we’ll now use the value for WANDB_PROJECT from your wandb.init. -* (Launch) Updated support for custom accelerator images—these will run in noninteractive mode when building, which had been blocking some images. -* (Launch) Fixed issue where the run author for sweeps was the agent service account, rather than the real author -* (Launch) Clicking outside the Launch drawer will no longer close the drawer automatically. -* (Launch) Fixed issue where training jobs that had been enqueued by a sweep but not run yet were not correctly removed from the queue if you later stopped the sweep. -* (Launch) The Launch navigation link is now hidden for users who aren't part of the team. -* (Launch) Fixed formatting and display issues on Agent logs. -* Fixed scrolling, resizing, and cloning issues in Automations panel. -* Fixed pagination on artifact action history. -* Added support for pre-signed URLs using a VPC endpoint URL if the AWS_S3_ENDPOINT_URL env var is set and passed in from the SDK side. -* Fixed enterprise dashboard link when organization name contains "&" -* Updated tag colors to be consistent - diff --git a/content/en/ref/release-notes/releases/archived/0.39.0.md b/content/en/ref/release-notes/releases/archived/0.39.0.md deleted file mode 100644 index 30a05a19a2..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.39.0.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: "0.39.0" -date: 2023-07-27 -description: "July 27, 2023" -parent: archived-releases ---- - -{{% alert color="warning" %}}{{% readfile "/_includes/unsupported_server_version.md" %}}{{% /alert %}} - -## Features - -**Revamped Organization Dashboard** - -![Revamped Organization Dashboard showing user activity, run creation statistics, and member management features](https://github.com/wandb/server/assets/47005026/ecfda350-2fc2-4023-a98c-d8eb67498957) - -We've made it easier to see who's making the most W&B with our overhauled Organization Dashboard, accessible to W&B admins. You can now see details on who's created runs and reports, who's actively using W&B, who's invites are pending--and you can export all this in CSV to share across your organization. Learn more about [access management](https://docs.wandb.ai/guides/hosting/iam/access-management-intro/). - -For Dedicated Cloud customers, this feature has been turned on. For Customer-Managed W&B customers, contact W&B support and we'll be happy to work with you to enable it. - -## Fixes - -- Restrict service API keys to team admins -- Launch agent configuration is now shown on the Agents page -- Added navigation panel while viewing a single Launch job. -- Automations can now show configuration parameters for the associated job. -- Fixed issue with grouped runs not live updating -- Removed extra `/` in magic and normal link url -- Check base for incremental artifacts -- Inviting a user into multiple teams will no longer take up too many seats in the org - - - diff --git a/content/en/ref/release-notes/releases/archived/0.40.0.md b/content/en/ref/release-notes/releases/archived/0.40.0.md deleted file mode 100644 index 1f365641e4..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.40.0.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: "0.40.0" -date: 2023-08-18 -description: "August 18, 2023" -parent: archived-releases ---- - -{{% alert color="warning" %}}{{% readfile "/_includes/unsupported_server_version.md" %}}{{% /alert %}} - -## Features - -************Webhooks************ - -![Image showing webhook configuration](https://github.com/wandb/server/assets/97066933/88ebcb78-a2e6-42ed-8a37-1be0b7556a3a) - - -Enable a seamless model CI/CD workflow using Webhook Automations to trigger specific actions within the CI/CD pipeline when certain events occur. Use webhooks to facilitate a clean hand-off point between ML engineering and devops. To see this in practice for [Model Evaluation](https://www.youtube.com/watch?v=7j-Mtbo-E74) and [Model Deployment](https://www.youtube.com/watch?v=g5UiAFjM2nA), check out the linked demo videos. Learn more in [our docs]({{< relref "/guides/core/automations/create-automations/webhook.md" >}}). - -**************************************New user activity dashboard on for all customers************************************** - -## Fixes - -- Removed limit on number of registered models an organization could have. -- Added search history to workspaces to make it easier to find commonly used plots. -- Changed reports “like” icon from hearts to stars. -- Users can now change the selected run in a workspace view with a group of runs. -- Fixed issue causing duplicate panel grids. -- Users can now pass in per-job resource config overrides for Sweeps on Launch -- Added redirect from */admin/users* to new organization dashboard. -- Fixed issues with LDAP dropping connections. -- Improvements to run permadeletion. diff --git a/content/en/ref/release-notes/releases/archived/0.41.0.md b/content/en/ref/release-notes/releases/archived/0.41.0.md deleted file mode 100644 index 1ca9940e07..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.41.0.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: "0.41.0" -date: 2023-08-28 -description: "August 28, 2023" -parent: archived-releases ---- - -{{% alert color="warning" %}}{{% readfile "/_includes/unsupported_server_version.md" %}}{{% /alert %}} - -## Features - -**********New Launch landing page********** - -![Image showing the new Launch landing page](https://github.com/wandb/server/assets/97066933/3bd0ecfe-1fcb-412f-92d3-6d3ce8f849d6) - - -We’ve updated the Launch homepage, so users looking to get started with Launch will have a much easier way to get setup quickly. Easily access detailed documentation, or simply follow the three Quickstart steps to create a Launch queue, agent, and start launching jobs immediately. - -Here are the other new features included in this release: - -- Add new reverse proxy to track OpenAI requests and responses -- Show agent version on agent overview page -- New model registry workflow removed from feature flag for all users - -## Fixes - -- Empty projects causing infinite load on storage explorer -- Runs marked failed when run queue items are failed -- Use correct bucket for storing OpenAI proxy artifacts -- SEO tags not properly rendered by host -- Trigger export in background, on context deadline as well -- Transition runs in pending state to running when run is initialized -- Query so Launch queues show most recent completed and failed jobs diff --git a/content/en/ref/release-notes/releases/archived/0.42.0.md b/content/en/ref/release-notes/releases/archived/0.42.0.md deleted file mode 100644 index a03a377684..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.42.0.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: "0.42.0" -date: 2023-09-14 -description: "September 14, 2023" -parent: archived-releases ---- - -{{% alert color="warning" %}}{{% readfile "/_includes/unsupported_server_version.md" %}}{{% /alert %}} - -## Features - -**********W&B Artifacts now supports time-to-live (TTL) policies********** - -![Image illustrating TTL policies for artifacts](https://github.com/wandb/server/assets/117778861/fcfe9484-5adb-4ace-8e88-9c9a344d94ef) - -Users can now gain more control over deleting and retention of Artifacts logged with W&B, with the ability to set retention and time-to-live (TTL) policies! Determine when you want specific Artifacts to be deleted, update policies on existing Artifacts, and set TTL policies on upstream or downstream Artifacts. - -Here are the other new features include in this release: - -- Use Launch drawer when creating Sweeps -- Delete run queue items -- Min/max aggregations nested dropdown -- Allow users to connect multiple S3-compatible buckets -- Add disk i/o system metrics -- Use the legacy way to set permissions -- Enable CustomerSecretStore -- Add Kubernetes as a backend for CustomerSecretStore - -## Fixes -- Disable storage and artifact invoices for ongoing storage calculations refractors -- Panel deletion bug -- Remove link-version event type from project automation slider -- Remove upper case styling for artifact type names -- Keep uncolored tags from changing color on render -- Stale defaults stuck in Launch drawer on reopen -- Trigger alias automations while creating artifact -- Edge case failure in infinite loading tag filters diff --git a/content/en/ref/release-notes/releases/archived/0.43.0.md b/content/en/ref/release-notes/releases/archived/0.43.0.md deleted file mode 100644 index f66313d0a7..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.43.0.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: "0.43.0" -date: 2023-10-02 -description: "October 02, 2023" -parent: archived-releases ---- - -{{% alert color="warning" %}}{{% readfile "/_includes/unsupported_server_version.md" %}}{{% /alert %}} - -Release 0.43.0 contains a number of minor bug fixes and performance improvements, including fixing the bottom of runs tables when there's a scrollbar. Check out the other fixes below: - -![Demo of fixed Runs table](https://github.com/wandb/server/assets/117778861/e4fe9656-b382-4328-80e4-edc4fcae1c88) - -## Fixes - - - Dramatically improve workspace loading perf - - Fixing broken docs link in disabled add panel menu - - Render childPanel without editor in report - - Copying text from a panel grid when editing - - Run overview crashing with 'length' key - - Padding for bottom of runs table when there's a scrollbar - - Eliminate unnecessary history key cache read - - Error handling for Teams Checkout modal - - Memory leak, excess filestream sending, and orphaned processes in Weave Python autotracer diff --git a/content/en/ref/release-notes/releases/archived/0.44.1.md b/content/en/ref/release-notes/releases/archived/0.44.1.md deleted file mode 100644 index 6fa99dd970..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.44.1.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: "0.44.1" -date: 2023-10-12 -description: "October 12, 2023" -parent: archived-releases ---- - -{{% alert color="warning" %}}{{% readfile "/_includes/unsupported_server_version.md" %}}{{% /alert %}} - -## Features - -**Add OpenAI proxy UI to SaaS and Server** - -![Image showing the new OpenAI proxy UI](https://github.com/wandb/server/assets/7208315/8bc78df9-e0e7-455e-8c74-975caa96eccf) - -**Also:** - -* New version v1.19.0 of our AWS Terraform module terraform-google-wandb is available -* Add support for AWS Secret Manager for Customer Secret Store, which can be enabled after the terraform module terrraform-aws-wandb is updated and released -* Add support for Azure Key Vault for Customer Secret Store, which can be enabled after the terraform module terrraform-azurerm-wandb is updated and released - -## Fixes - -* Quality-of-life improvements in the model registry ui -* int values no longer ignored when determining if a run achieved a sweep's optimization goal -* Cache runs data to improve workspace loading perf -* Improve TTL rendering in collection table -* Allow service accounts to be made workflow (registry) admins -* Add tooltip for truncated run tags in workspaces -* Fix report page scrolling -* Copy `y` data values for chart tooltip -* Query secrets for webhooks in local -* Fixing broken domain zoom in panel config -* Hide Customer Secret Store UI if GORILLA_CUSTOMER_SECRET_STORE_SOURCE env var not set - -## Chores - -* Bump langchain to latest -* Adding WB Prompts to quickstart -* Update AWS MIs to use terraform-kubernetes-wandb v1.12.0 -* Show correct Teams Plan tracked hours teams settings page and hide on usage page diff --git a/content/en/ref/release-notes/releases/archived/0.45.0.md b/content/en/ref/release-notes/releases/archived/0.45.0.md deleted file mode 100644 index df7eebe4cd..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.45.0.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: "0.45.0" -date: 2023-10-25 -description: "October 25, 2023" -parent: archived-releases ---- - -{{% alert color="warning" %}}{{% readfile "/_includes/unsupported_server_version.md" %}}{{% /alert %}} - -## Features - -* Enable artifact garbage collection using environment variable GORILLA_ARTIFACT_GC_ENABLED=true and cloud object versioning or soft deletion. -* The terraform module terrraform-azurerm-wandb now supports Azure Key Vault as a secrets store. - * Deployments on Azure can now use W&B Secrets with Webhooks and Automations. Secrets are stored securely in Azure Key Vault. - -## Fixes - -* Remove invalid early exit preventing history deletion -* When moving/copying runs, don't drop key-set info -* Update mutations to no longer use defunct storage plan or artifacts billing plan at all -* Respect skip flag in useRemoteServer diff --git a/content/en/ref/release-notes/releases/archived/0.46.0.md b/content/en/ref/release-notes/releases/archived/0.46.0.md deleted file mode 100644 index 8da3cd72c2..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.46.0.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: "0.46.0" -date: 2023-11-15 -description: "November 15, 2023" -parent: archived-releases ---- - -{{% alert color="warning" %}}{{% readfile "/_includes/unsupported_server_version.md" %}}{{% /alert %}} - -## Features - -* Deployments on AWS can now use W&B Secrets with Webhooks and Automations - * Secrets are stored securely in AWS Secret Manager - please use the terraform-aws-wandb module to provision one and -* Update webhooks table to display more information -* Better truncation of long strings to improve the usability of strings in the UI -* Reduce delay for scroll to report section -* Add white background to weave1 panels -* Allow deep link for weave1 panels in reports -* Allow weave1 panel resizing in reports -* Homepage banner will now show CLI login instructions -* User invites will now succeed if invite email can't be sent for some reason -* Add list of associated queues to agent overview page - -## Fixes - -* Copy function on panel overlay was dropping values -* CSS cleanup for import modal when creating report -* Fixes regression to hide legend when toggled off -* Report comment highlighting -* Remove all caching for view's LoadMetadataList() -* Let run search stretch -* Associate launch agents with user id from `X-WANDB-USERNAME` header diff --git a/content/en/ref/release-notes/releases/archived/0.47.2.md b/content/en/ref/release-notes/releases/archived/0.47.2.md deleted file mode 100644 index b39df9b79e..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.47.2.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: "0.47.2" -date: 2023-12-01 -description: "December 01, 2023" -parent: archived-releases ---- - -{{% alert color="warning" %}}{{% readfile "/_includes/unsupported_server_version.md" %}}{{% /alert %}} - -## Feature - -**Use custom roles with specific permissions to customize access control within a team** -* Available in preview to enterprise customers. Please reach out to your W&B account team or support for any questions. - -![Image showing the new UI for custom roles](custom_roles_ui.png) - -**Also:** - -* Minor runs search improvements -* Auto-resize runs search for long texts -* View webhook details, including URL, secrets, date created directly from the automations table for webhook automations - -## Fixes - -* Grouping of runs when group value is a string that looks like a number -* Janky report panel dragging behavior -* Update bar chart spec to match the one on public cloud -* Clean up panel padding and plot margins -* Restores workspace settings beta diff --git a/content/en/ref/release-notes/releases/archived/0.47.3.md b/content/en/ref/release-notes/releases/archived/0.47.3.md deleted file mode 100644 index 4ab1102551..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.47.3.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: "0.47.3" -date: 2023-12-08 -description: "December 08, 2023" -parent: archived-releases ---- - -{{% alert color="warning" %}}{{% readfile "/_includes/unsupported_server_version.md" %}}{{% /alert %}} - -# Fixes - -We're releasing a couple of important fixes for the _**Custom Roles**_ preview capability that was launched as part of v0.47.2. If you're interested in using that feature to create fine-grained roles and better align with least privilege principle, please use this latest server release and reach out to your W&B team for an updated enterprise license. diff --git a/content/en/ref/release-notes/releases/archived/0.48.0.md b/content/en/ref/release-notes/releases/archived/0.48.0.md deleted file mode 100644 index ecf903518c..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.48.0.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: "0.48.0" -date: 2023-12-20 -description: "December 20, 2023" -parent: archived-releases ---- - -{{% alert color="warning" %}}{{% readfile "/_includes/unsupported_server_version.md" %}}{{% /alert %}} - -## Feature - -* All required frontend changes for launch prioritization - * Refer to [this blog](https://wandb.ai/wandb_fc/launch-releases/reports/Introducing-Priority-Based-Job-Management-with-W-B-Launch--Vmlldzo2MzE2NjI2) on how you can run more important jobs than others using Launch. -* Refer to below changes for access control and user attribution behavior of team service accounts: - * When a team is configured in the training environment, a service account from that team can be used to log runs in either of private or public projects within that team, and additionally attribute those runs to a user only if `WANDB_USERNAME` or `WANDB_USER_EMAIL` variable is configured in the environment and the user is part of that team. - * When a team is not configured in the training environment and a service account is used, the runs would be logged to the named project within the service account's team, and those would be attributed to a user only if `WANDB_USERNAME` or `WANDB_USER_EMAIL` variable is configured in the environment and the user is part of that team. - * A team service account **can not** log runs in a private project in another team, but it can log runs to public projects in other teams. - -## Fixes - - * Reduce column widths for oversized runs selectors - * Fix a couple of bugs related to Custom Roles preview feature diff --git a/content/en/ref/release-notes/releases/archived/0.49.0.md b/content/en/ref/release-notes/releases/archived/0.49.0.md deleted file mode 100644 index 9ec141ab98..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.49.0.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: "0.49.0" -date: 2024-01-18 -description: "January 18, 2024" -parent: archived-releases ---- - -{{% alert color="warning" %}}{{% readfile "/_includes/unsupported_server_version.md" %}}{{% /alert %}} - -## Feature - -* Set a default TTL (time-to-live or scheduled deletion) policy for a team in the team settings page. - * Restrict setting or editing of a TTL policy to either of admin only or admin plus members. -* Test and debug a webhook during webhook creation or after in the team settings UI. - * W&B will send a dummy payload and display the receiving server's response. -* View Automation properties in the View Details slider. - * This includes a summary of the triggering event and action, action configs, creation date, and a copy-able curl command to test webhook automations. -* Replace agent heartbeat with last successful run time in launch overview. -* Service accounts can now use the Report API to create reports. -* Use the new role management API to automate managing the custom roles. -* Enable Kubernetes Operator for Dedicated Cloud deployments on AWS. -* Configure a non-conflicting IP address range for managed cache used in Dedicated Cloud deployments on GCP. - -## Fixes - -* Update the add runset button clickable area in reports -* Show proper truncate grouping message -* Prevent flashing of publish button in reports -* Horizonal Rule get collapsed in report section -* Add section button hidden in certain views -* Allow things like semantic versioning in the plot as string -* Remove requirements for quotes when using template variables in queue config definitions -* Improve Launch queue sorting order -* Don't auto-open panel sections when searching large workspaces -* Change label text for grouped runs -* Open/close all sections while searching diff --git a/content/en/ref/release-notes/releases/archived/0.50.2.md b/content/en/ref/release-notes/releases/archived/0.50.2.md deleted file mode 100644 index 7cb9ee976c..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.50.2.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: "0.50.2" -date: 2024-02-26 -description: "February 26, 2024" -parent: archived-releases ---- - -{{% alert color="warning" %}}{{% readfile "/_includes/unsupported_server_version.md" %}}{{% /alert %}} - -## Feature - -* Add panel bank setting to auto-expand search results -* Better visibility for run queue item issues -* Dedicated Cloud customers on AWS can now use Privatelink to securely connect to their deployments. - * The feature is in private preview and will be part of an advanced pricing tier at GA. Reach out to your W&B team if interested. -* You can now automate user role assignment for organization or team scopes using the [SCIM role assignment API](https://docs.wandb.ai/guides/hosting/iam/scim/#assign-organization-level-role-to-user) -* All Dedicated Cloud instances on AWS & Azure are now managed using the new W&B Kubernetes Operator. With that, the new Parquet Store service is also available. The service allows for performant & cost efficient storage of run history data in parquet format in the blob storage. That in turn leads to faster loading of relevant history data in charts & plots that are used to evaluate the runs. -* W&B Kubernetes Operator and along with that the Parquet Store service are now available for use in customer-managed instances. We encourage customers that already use Kubernetes to host W&B, to reach out to their W&B team on how they can use the operator. And we highly recommend others to migrate to Kubernetes in order to receive the latest performance improvements and new services in future via operator. We're happy to assist with planning such a migration. - -## Fixes - -* Properly pass template variables through sweep scheduler -* Scheduler polluting sweep yaml generator -* Display user roles correctly on team members page when search or sort is applied -* Org admins can again delete personal projects in their Dedicated Cloud or Self-managed server instance -* Add validation for SCIM GET groups API for pending users diff --git a/content/en/ref/release-notes/releases/archived/0.51.0.md b/content/en/ref/release-notes/releases/archived/0.51.0.md deleted file mode 100644 index a2f89bd493..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.51.0.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: "0.51.0" -date: 2024-03-20 -description: "March 20, 2024" -parent: archived-releases ---- - -{{% alert color="warning" %}}{{% readfile "/_includes/unsupported_server_version.md" %}}{{% /alert %}} - -## Features - -**You can now save multiple views of any workspace by clicking "Save as a new view" in the overflow menu of the workspace bar.** - -See [Saved workspace views](https://docs.wandb.ai/guides/app/pages/workspaces#create-saved-workspace-views) to learn more. - -![Image showing saved views](https://github.com/wandb/server/assets/7208315/862a36ac-8ce4-49e7-8677-d87d54ab1e54) - -The release also includes these capabilities: -* You can now [set a project's visibility scope to Restricted](https://docs.wandb.ai/guides/hosting/iam/access-management/restricted-projects/) if you want to collaborate on AI workflows related to sensitive or confidential data. - * When you create a **restricted project** within a team, you can add specific members from the team. Unlike other project visibility scopes, all members of a team do not get implicit access to a restricted project. -* **Enhanced Run Overview page performance**: now 91% faster on load, with search functionality improved by 99.9%. Also enjoy RegEx search for Config and Summary data. -* **New UX for Artifacts Lineage DAG** introduces clustering for 5+ nodes at the same level, preview window to examine a node's details, and a significant speedup in the graph's loading time. -* The template variable values used for a run executed by launch, for example GPU type and quantity, are now shown on the queue's list of runs. This makes it easier to see which runs are requesting which resources. -* Cloning a run with Launch now pre-selects the overrides, queue, and template variable values used by the cloned run. -* Instance admins will now see a `Teams` tab in the organization dashboard. It can be used to join a specific team when needed, whether it's to monitor the team activity as per organizational guidelines or to help the team when team admins are not available. -* SCIM User API now returns the `groups` attribute as part of the GET endpoint, which includes the id of the groups / teams a user is part of. -* All Dedicated Cloud instances on GCP are now managed using the new [W&B Kubernetes Operator](https://docs.wandb.ai/guides/hosting/operator/). With that, the new Parquet Store service is also available. - * Parquet store allows performant & cost efficient storage of run history data in parquet format in the blob storage. Dedicated Cloud instances on AWS & Azure are already managed using the operator and include the parquet store. -* Dedicated Cloud instances on AWS have been updated to use the latest version of the relational data storage, and the compute infrastructure has been upgraded to a newer generation with better performance. - -> **Advanced Notice**: We urge all customers who use Webhooks with Automations to add a valid A-record for their endpoints as we are going to disallow using IP address based Webhook URLs from the next release onwards. This is being done to protect against SSRF vulnerability and other related threat vectors. - -## Fixes - -* Fixed issue where expressions tab was not rendering for line plots. -* Use display name for sweeps when grouped by sweeps in charts and runs table. -* Auto navigation to runs page when selecting job version. diff --git a/content/en/ref/release-notes/releases/archived/0.52.2.md b/content/en/ref/release-notes/releases/archived/0.52.2.md deleted file mode 100644 index 7f82893e59..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.52.2.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -title: "0.52.2" -date: 2024-04-25 -description: "April 25, 2024" -parent: archived-releases ---- - -{{% alert color="warning" %}}{{% readfile "/_includes/unsupported_server_version.md" %}}{{% /alert %}} - -## Features - -* You can now enforce username and full name for users in your organization, by using OIDC claims from your SSO provider. Reach out to your W&B team or support if interested. -* You can now disable use of personal projects in your organization to ensure that all projects are created within W&B teams and governed using admin-enforced guidelines. Reach out to your W&B team or support if interested. -* Option to expand all versions in a cluster of runs or artifacts in the Artifacts Lineage DAG view. -* UI improvements to Artifacts Lineage DAG - the type will now be visible for each entry in a cluster. - -## Fixes - -* Added pagination to image panels in media banks, displaying up to 32 images per page with enhanced grid aesthetics and improved pagination controls, while introducing a workaround for potential offset inconsistencies. -* Resolved an issue where tooltips on system charts were not displaying by enforcing the `isHovered` parameter, which is essential for the crosshair UI visibility. -* Unset the max-width property for images within media panels, addressing unintended style constraints previously applied to all images. -* Fixed broken config overrides in launch drawer. -* Fixed Launch drawer's behavior when cloning from a run. diff --git a/content/en/ref/release-notes/releases/archived/0.54.0.md b/content/en/ref/release-notes/releases/archived/0.54.0.md deleted file mode 100644 index 4fb7bcd19f..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.54.0.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: "0.54.0" -date: 2024-05-24 -description: "May 24, 2024" -parent: archived-releases ---- - -{{% alert color="warning" %}}{{% readfile "/_includes/unsupported_server_version.md" %}}{{% /alert %}} - -## Features - -* You can now configure Secure storage connector (BYOB) at team-level in Dedicated Cloud or Self-managed instances on Microsoft Azure. - * Refer to [this Terraform Module](https://github.com/wandb/terraform-azurerm-wandb/tree/main/modules/secure_storage_connector) and reach out to your W&B team for any questions. -* Organization admins can now enforce privacy settings across all W&B teams by setting those at the organization level, from within the `Settings` tab in the Organization Dashboard. - * W&B recommends to notify team admins and other users before making such enforcement changes. -* Enable direct lineage option for artifact lineage DAG -* It's now possible to restrict Organization or Instance Admins from self-joining or adding themselves to a W&B team, thus ensuring that only Data & AI personas have access to the projects within the teams. - * W&B advises to exercise caution and understand all implications before enabling this setting. Reach out to your W&B team for any questions. -* Dedicated Cloud on AWS is now also available in the Seoul (S. Korea) region. - -## Fixes - -* Fix issue where Reports where failing to load on Mobile. -* Fix link to git diff file in run overview. -* Fixed the intermittently occurring issue related to loading of Organization Dashboard for certain users. diff --git a/content/en/ref/release-notes/releases/archived/0.56.0.md b/content/en/ref/release-notes/releases/archived/0.56.0.md deleted file mode 100644 index 5a89225f3a..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.56.0.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: "0.56.0" -date: 2024-06-29 -description: "June 29, 2024" -parent: releases ---- - -## Features - -**The new Full Fidelity line plot in W&B Experiments enhances the visibility of training metrics by aggregating all data along the x-axis, displaying the minimum, maximum, and average values within each bucket, allowing users to easily spot outliers and zoom into high-fidelity details without downsampling loss.** [Learn more in our documentation](https://docs.wandb.ai/guides/app/features/panels/line-plot/sampling). - -{{% alert %}} -Due to a release versioning issue, 0.56.0 is the next major release after 0.54.0. The 0.55.0 was a patch release for 0.54.0. -{{% /alert %}} - -The 0.56.0 release also includes these capabilities: -* You can now use [cross-cloud storage buckets for team-level BYOB (secure storage connector)](https://docs.wandb.ai/guides/hosting/data-security/secure-storage-connector#cross-cloud-or-s3-compatible-storage-for-team-level-byob) in Dedicated Cloud and Self-managed instances. For example, in a W&B instance on AWS, you can now configure Azure Blob Storage or Google Cloud Storage for team-level BYOB, and so on for each cross-cloud combination. -* In the same vein, you can now use [S3-compatible storage buckets like MinIO for team-level BYOB (secure storage connector)](https://docs.wandb.ai/guides/hosting/data-security/secure-storage-connector#cross-cloud-or-s3-compatible-storage-for-team-level-byob) in Dedicated Cloud and Self-managed instances. For example, in a W&B instance on GCP, you can configure a MinIO bucket hosted in cloud or on-prem for team-level BYOB. -* Admins can now automate full deletion of users in their Dedicated Cloud or Self-managed instances using the [SCIM API's DELETE User endpoint](https://docs.wandb.ai/guides/hosting/iam/scim#delete-user). The user deactivation operation has been reimplemented using the [PATCH User endpoint](https://docs.wandb.ai/guides/hosting/iam/scim#deactivate-user), along with the introduction of [user reactivation operation](https://docs.wandb.ai/guides/hosting/iam/scim#reactivate-user). -* If you use the SCIM API, you will also see a couple of minor improvements: - * The API now has a more pertinent error message in case of authentication failures. - * Relevant endpoints now return the full name of a user in the SCIM User object if it's available. - -## Fixes - -* The fix resolves an issue where deleting a search term from a runset in a report could delete the panel or cause the report to crash by ensuring proper handling of selected text during copy/paste operations. -* The fix addresses a problem with indenting bulleted items in reports, which was caused by an upgrade of slate and an additional check in the normalization process for elements. -* The fix resolves an issue where text could not be selected from a panel when the report was in edit mode. -* The fix addresses an issue where copy-pasting an entire panel grid in a Report using command-c was broken. -* The fix resolves an issue where report sharing with a magic link was broken when a team had the `Hide this team from all non-members` setting enabled. -* The fix introduces proper handling for restricted projects by allowing only explicitly invited users to access them, and implementing permissions based on project members and team roles. -* The fix allows instance admins to write to their own named workspaces, read other personal and shared workspaces, and write to shared views in private and public projects. -* The fix resolves an issue where the report would crash when trying to edit filters due to an out-of-bounds filter index caused by skipping non-individual filters while keeping the index count incremental. -* The fix addresses an issue where unselecting a runset caused media panels to crash in a report by ensuring only runs in enabled runsets are returned. -* The fix resolves an issue where the parameter importance panel crashes on initial load due to a violation of hooks error caused by a change in the order of hooks. -* The fix prevents chart data from being reloaded when scrolling down and then back up in small workspaces, enhancing performance and eliminating the feeling of slowness. diff --git a/content/en/ref/release-notes/releases/archived/0.57.2.md b/content/en/ref/release-notes/releases/archived/0.57.2.md deleted file mode 100644 index c461946871..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.57.2.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: "0.57.2" -date: 2024-07-24 -description: "July 24, 2024" -parent: releases ---- - -## Features - -**You can now use JWTs (JSON Web Tokens) to access your W&B instance from the wandb SDK or CLI, using the identity federation capability. The feature is in preview.** Refer to [Identity federation](https://docs.wandb.ai/guides/hosting/iam/identity_federation) and reach out to your W&B team for any questions. - -The 0.57.2 release also includes these capabilities: -* New `Add to reports` drawer improvements for exporting Workspace panels into Reports. -* Artifacts metadata filtering in the artifact project browser. -* Pass in artifact metadata in webhook payload via `${artifact_metadata.KEY}`. -* Added GPU memory usage panels to the RunSystemMetrics component, enhancing GPU metrics visualization for runs in the app frontend. -* Mobile users now enjoy a much smoother, more intuitive Workspace experience. -* If you're using W&B Dedicated Cloud on GCP or Azure, you can now enable private connectivity for your instance, thus ensuring that all traffic from your AI workloads and optionally browser clients only transit the cloud provider private network. Refer to [Private connectivity](https://docs.wandb.ai/guides/hosting/data-security/private-connectivity) and reach out to your W&B team for any questions. -* Team-level service accounts are now shown separately in a new tab in the team settings view. The service accounts are not listed in the Members tab anymore. Also, the API key is now hidden and can only be copied by team admins. -* Dedicated Cloud is now available in GCP's Seoul region. - -## Fixes - -* Gaussian smoothing was extremely aggressive on many plots. -* Fixed issue where pressing the `Ignore Outliers in Chart Scaling` button currently has no effect in the UI workspace. -* Disallow inviting deactivated users to an organization. -* Fixed an issue where users added to an instance using SCIM API could not onbioard successfully. - -## Performance improvements - -* Significantly improved performance when editing a panel's settings and applying the changes. -* Improved the responsiveness of run visibility toggling in large workspaces. -* Improved chart hovering and brushing performance on plots in large workspaces. -* Reduced workspace memory usage and loading times in workspaces with many keys. diff --git a/content/en/ref/release-notes/releases/archived/0.58.1.md b/content/en/ref/release-notes/releases/archived/0.58.1.md deleted file mode 100644 index b7c103068d..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.58.1.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: "0.58.1" -date: 2024-09-04 -description: "September 04, 2024" -parent: archived ---- - -## Features - -* W&B now supports sub-path for **Secure storage connector i.e. Bring your own bucket** capability. You can now provide a sub-path when configuring a bucket at the instance or team level. This is only available for new bucket configurations and not for existing configured buckets. -* W&B-managed storage on newer Dedicated Cloud instances in GCP & Azure will by default be encrypted with **W&B managed cloud-native keys**. This is already available on AWS instances. Each instance storage is encrypted with a key unique to the instance. Until now, all instances on GCP & Azure relied on default cloud provider-managed encryption keys. -* Makes the fields in the run config and summary copyable on click. -* If you're using W&B kubernetes operator for a customer-managed instance, you can now optionally use a custom CA for the controller manager. -* We've modified the W&B kubernetes operator to run in a non-root context by default, aligning with OpenShift's Security Context Constraints (SCCs). This change ensures smoother deployment of customer-managed instances on OpenShift by adhering to its security policies. - - - -## Fixes - -* Fixed an issue where exporting panels from a workspace to a report now correctly respects the panel search regex. -* Fixed an issue where setting `GORILLA_DISABLE_PERSONAL_ENTITY` to `true` was not disabling users from creating projects and writing to existing projects in their personal entities. - -## Performance improvements - -* We have significantly improved performance and stability for experiments with 100k+ logged points. If you've a customer-managed instance, this is available if the deployment is managed using the W&B kubernetes operator. -* Fixed issue where saving changes in large workspaces would be very slow or fail. -* Improved latency of opening workspace sections in large workspaces. \ No newline at end of file diff --git a/content/en/ref/release-notes/releases/archived/0.60.0.md b/content/en/ref/release-notes/releases/archived/0.60.0.md deleted file mode 100644 index 5472b757b9..0000000000 --- a/content/en/ref/release-notes/releases/archived/0.60.0.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: "0.60.0" -date: 2024-09-26 -description: "September 26, 2024" -parent: archived ---- - -## Features - -* Final updates for 1.1.1 Compliance of Level AA 2.2 for Web Content Accessibility Guidelines (WCAG) standards. -* W&B can now disable auto-version-upgrade for customer-managed instances using the W&B kubernetes operator. You can request this to your W&B team. - * Note that W&B requires all instances to upgrade periodically to comply with the 6-month end-of-life period for each version. W&B does not support versions older than 6 months. - - - -{{% alert %}} -Due to a release versioning issue, 0.60.0 is the next major release after 0.58.0. The 0.59.0 was one of the patch releases for 0.58.0. -{{% /alert %}} - -## Fixes - -* Fixed a bug to allow instance admins on Dedicated Cloud and Customer-managed instances to access workspaces in personal entities. -* SCIM Groups and Users GET endpoints now filter out service accounts from the responses. Only non service account users are now returned by those endpoints. -* Fixed a user management bug by removing the ability of team admins to simultaneously delete a user from the overall instance while deleting them from a team. Instance or Org admins are responsible to delete a user from the overall instance / organization. - -## Performance improvements - -* Reduced the latency when adding a panel by up to 90% in workspaces with many metrics. -* Improved the reliability and performance of parquet exports to blob storage when runs are resumed often. - * Runs export to blob storage in parquet format is available on Dedicated Cloud and on Customer-managed instances that are enabled using the W&B kubernetes operator. diff --git a/content/en/ref/release-notes/releases/archived/_index.md b/content/en/ref/release-notes/releases/archived/_index.md deleted file mode 100644 index 07724c4555..0000000000 --- a/content/en/ref/release-notes/releases/archived/_index.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: Archived Releases -type: docs -url: /ref/release-notes/archived/ -cascade: -- url: /ref/release-notes/archived/:filename/ -- type: docs -- weight: 1 -- parent: archived -parent: release-notes -identifier: archived-release-notes -weight: 10 ---- - -Archived releases have reached end of life and are no longer supported. A major release and its patches are supported for 12 months from the initial release date. Release notes for archived releases are provided for historical purposes. For supported releases, refer to [Releases](/ref/release-notes/). - -{{% alert color="warning" %}} -Customers using [Self-managed](/guides/hosting/hosting-options/self-managed/) are responsible to upgrade to a [supported release](/ref/releases-notes/) in time to maintain support. For assistance or questions, contact [support](mailto:support@wandb.com). -{{% /alert %}} diff --git a/content/en/ref/training.md b/content/en/ref/training.md deleted file mode 100644 index c9cf6b31cb..0000000000 --- a/content/en/ref/training.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: W&B Training API -description: Generated documentation for W&B APIs -layout: redoc ---- diff --git a/content/en/ref/wandb_workspaces/_index.md b/content/en/ref/wandb_workspaces/_index.md deleted file mode 100644 index 9ec74f691b..0000000000 --- a/content/en/ref/wandb_workspaces/_index.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -title: Reports and Workspaces API -weight: 4 ---- - -The W&B Reports and Workspaces API, accessible at `wandb_workspaces`, allows you to create [reports]({{< relref "/guides/core/reports" >}}), which can be published on the web to share findings, and well as customize a [workspace]({{< relref "/guides/models/app/features/cascade-settings" >}}) where training and fine-tuning work was done. - - -{{< cta-button githubLink="https://github.com/wandb/wandb-workspaces/blob/main/wandb_workspaces/" >}} - -{{% alert %}} -W&B Report and Workspace API is in Public Preview. -{{% /alert %}} - -## Installation and setup - -### Sign up and create an API key - -To authenticate your machine with W&B, you must first generate an API key at https://wandb.ai/authorize. - -### Install and import packages - -Install the W&B Report and Workspaces library. - -```python -pip install wandb-workspaces -``` - -### Create a report - -To create a report, specify your team's entity and provide a name for your report. Replace enclosed text with your values: - -```python -import wandb_workspaces.reports.v2 as wr -# Create -report = wr.Report( - entity="", - project="", - title='Quickstart Report', - description="That was easy!" -) - -# Save report -report.save() -``` - -Next, add blocks and panels to your report. For example, the following code creates a report with a table of contents, header, and a paragraph: - -```python -report.blocks = [ - wr.TableOfContents(), - wr.H1("Text and images example"), - wr.P("Lorem ipsum dolor sit amet."), -] -report.save() -``` - -See the [Reports API Quickstart](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/intro/Report_API_Quickstart.ipynb) Google Colab for an end to end example. - -### Create a workspace - -The following code shows how to create a workspace with a section containing three panels: a line plot, a bar plot, and a scalar chart. Replace enclosed text with your values: - -```python -# How to import -import wandb_workspaces.workspaces as ws - -# Create a workspace -ws.Workspace( - entity="", # entity that owns the workspace - project="", # project that the workspace is associated with - sections=[ - ws.Section( - name="", - panels=[ - wr.LinePlot(x="Step", y=[""]), - wr.BarPlot(metrics=[""]), - wr.ScalarChart(metric="", groupby_aggfunc=""), - ], - is_open=True, - ), - ], -) -workspace.save() -``` - -See the [Workspace API Quickstart](https://colab.research.google.com/github/wandb/wandb-workspaces/blob/Update-wandb-workspaces-tuturial/Workspace_tutorial.ipynb#scrollTo=MmxL0wjvrNtQ) Google Colab for an end to end example. diff --git a/content/en/ref/wandb_workspaces/reports.md b/content/en/ref/wandb_workspaces/reports.md deleted file mode 100644 index df0ea5b76f..0000000000 --- a/content/en/ref/wandb_workspaces/reports.md +++ /dev/null @@ -1,1400 +0,0 @@ ---- -title: Reports ---- -{{< cta-button githubLink="https://github.com/wandb/wandb-workspaces/blob/main/wandb_workspaces/reports/v2/interface.py" >}} - - - -{{% alert %}} -W&B Report and Workspace API is in Public Preview. -{{% /alert %}} - -# module `wandb_workspaces.reports.v2` -Python library for programmatically working with W&B Reports API. - -```python -import wandb_workspaces.reports.v2 as wr - -report = wr.Report( - entity="entity", - project="project", - title="An amazing title", - description="A descriptive description.", -) - -blocks = [ - wr.PanelGrid( - panels=[ - wr.LinePlot(x="time", y="velocity"), - wr.ScatterPlot(x="time", y="acceleration"), - ] - ) -] - -report.blocks = blocks -report.save() -``` - ---- - - - -## class `BarPlot` -A panel object that shows a 2D bar plot. - - - -**Attributes:** - - - `title` (Optional[str]): The text that appears at the top of the plot. - - `metrics` (LList[MetricType]): orientation Literal["v", "h"]: The orientation of the bar plot. Set to either vertical ("v") or horizontal ("h"). Defaults to horizontal ("h"). - - `range_x` (Tuple[float | None, float | None]): Tuple that specifies the range of the x-axis. - - `title_x` (Optional[str]): The label of the x-axis. - - `title_y` (Optional[str]): The label of the y-axis. - - `groupby` (Optional[str]): Group runs based on a metric logged to your W&B project that the report pulls information from. - - `groupby_aggfunc` (Optional[GroupAgg]): Aggregate runs with specified function. Options include `mean`, `min`, `max`, `median`, `sum`, `samples`, or `None`. - - `groupby_rangefunc` (Optional[GroupArea]): Group runs based on a range. Options include `minmax`, `stddev`, `stderr`, `none`, =`samples`, or `None`. - - `max_runs_to_show` (Optional[int]): The maximum number of runs to show on the plot. - - `max_bars_to_show` (Optional[int]): The maximum number of bars to show on the bar plot. - - `custom_expressions` (Optional[LList[str]]): A list of custom expressions to be used in the bar plot. - - `legend_template` (Optional[str]): The template for the legend. - - `font_size` ( Optional[FontSize]): The size of the line plot's font. Options include `small`, `medium`, `large`, `auto`, or `None`. - - `line_titles` (Optional[dict]): The titles of the lines. The keys are the line names and the values are the titles. - - `line_colors` (Optional[dict]): The colors of the lines. The keys are the line names and the values are the colors. - - - - - - - ---- - - - -## class `BlockQuote` -A block of quoted text. - - - -**Attributes:** - - - `text` (str): The text of the block quote. - - - - - - - ---- - - - -## class `CalloutBlock` -A block of callout text. - - - -**Attributes:** - - - `text` (str): The callout text. - - - - - - - ---- - - - -## class `CheckedList` -A list of items with checkboxes. Add one or more `CheckedListItem` within `CheckedList`. - - - -**Attributes:** - - - `items` (LList[CheckedListItem]): A list of one or more `CheckedListItem` objects. - - - - - - - ---- - - - -## class `CheckedListItem` -A list item with a checkbox. Add one or more `CheckedListItem` within `CheckedList`. - - - -**Attributes:** - - - `text` (str): The text of the list item. - - `checked` (bool): Whether the checkbox is checked. By default, set to `False`. - - - - - - - ---- - - - -## class `CodeBlock` -A block of code. - - - -**Attributes:** - - - `code` (str): The code in the block. - - `language` (Optional[Language]): The language of the code. Language specified is used for syntax highlighting. By default, set to `python`. Options include `javascript`, `python`, `css`, `json`, `html`, `markdown`, `yaml`. - - - - - - - ---- - - - -## class `CodeComparer` -A panel object that compares the code between two different runs. - - - -**Attributes:** - - - `diff` `(Literal['split', 'unified'])`: How to display code differences. Options include `split` and `unified`. - - - - - - - ---- - - - -## class `Config` -Metrics logged to a run's config object. Config objects are commonly logged using `wandb.Run.config[name] = ...` or passing a config as a dictionary of key-value pairs, where the key is the name of the metric and the value is the value of that metric. - - - -**Attributes:** - - - `name` (str): The name of the metric. - - - - - - - ---- - - - -## class `CustomChart` -A panel that shows a custom chart. The chart is defined by a weave query. - - - -**Attributes:** - - - `query` (dict): The query that defines the custom chart. The key is the name of the field, and the value is the query. - - `chart_name` (str): The title of the custom chart. - - `chart_fields` (dict): Key-value pairs that define the axis of the plot. Where the key is the label, and the value is the metric. - - `chart_strings` (dict): Key-value pairs that define the strings in the chart. - - - - ---- - - - -### classmethod `from_table` - -```python -from_table( - table_name: str, - chart_fields: dict = None, - chart_strings: dict = None -) -``` - -Create a custom chart from a table. - - - -**Arguments:** - - - `table_name` (str): The name of the table. - - `chart_fields` (dict): The fields to display in the chart. - - `chart_strings` (dict): The strings to display in the chart. - - - - ---- - - - -## class `Gallery` -A block that renders a gallery of reports and URLs. - - - -**Attributes:** - - - `items` (List[Union[`GalleryReport`, `GalleryURL`]]): A list of `GalleryReport` and `GalleryURL` objects. - - - - - - - ---- - - - -## class `GalleryReport` -A reference to a report in the gallery. - - - -**Attributes:** - - - `report_id` (str): The ID of the report. - - - - - - - ---- - - - -## class `GalleryURL` -A URL to an external resource. - - - -**Attributes:** - - - `url` (str): The URL of the resource. - - `title` (Optional[str]): The title of the resource. - - `description` (Optional[str]): The description of the resource. - - `image_url` (Optional[str]): The URL of an image to display. - - - - - - - ---- - - - -## class `GradientPoint` -A point in a gradient. - - - -**Attributes:** - - - `color`: The color of the point. - - `offset`: The position of the point in the gradient. The value should be between 0 and 100. - - - - - - - ---- - - - -## class `H1` -An H1 heading with the text specified. - - - -**Attributes:** - - - `text` (str): The text of the heading. - - `collapsed_blocks` (Optional[LList["BlockTypes"]]): The blocks to show when the heading is collapsed. - - - - - - - ---- - - - -## class `H2` -An H2 heading with the text specified. - - - -**Attributes:** - - - `text` (str): The text of the heading. - - `collapsed_blocks` (Optional[LList["BlockTypes"]]): One or more blocks to show when the heading is collapsed. - - - - - - - ---- - - - -## class `H3` -An H3 heading with the text specified. - - - -**Attributes:** - - - `text` (str): The text of the heading. - - `collapsed_blocks` (Optional[LList["BlockTypes"]]): One or more blocks to show when the heading is collapsed. - - - - - - - ---- - - - -## class `Heading` - - - - - - - - - - ---- - - - -## class `HorizontalRule` -HTML horizontal line. - - - - - - - ---- - - - -## class `Image` -A block that renders an image. - - - -**Attributes:** - - - `url` (str): The URL of the image. - - `caption` (str): The caption of the image. Caption appears underneath the image. - - - - - - - ---- - - - -## class `InlineCode` -Inline code. Does not add newline character after code. - - - -**Attributes:** - - - `text` (str): The code you want to appear in the report. - - - - - - - ---- - - - -## class `InlineLatex` -Inline LaTeX markdown. Does not add newline character after the LaTeX markdown. - - - -**Attributes:** - - - `text` (str): LaTeX markdown you want to appear in the report. - - - - - - - ---- - - - -## class `LatexBlock` -A block of LaTeX text. - - - -**Attributes:** - - - `text` (str): The LaTeX text. - - - - - - - ---- - - - -## class `Layout` -The layout of a panel in a report. Adjusts the size and position of the panel. - - - -**Attributes:** - - - `x` (int): The x position of the panel. - - `y` (int): The y position of the panel. - - `w` (int): The width of the panel. - - `h` (int): The height of the panel. - - - - - - - ---- - - - -## class `LinePlot` -A panel object with 2D line plots. - - - -**Attributes:** - - - `title` (Optional[str]): The text that appears at the top of the plot. - - `x` (Optional[MetricType]): The name of a metric logged to your W&B project that the report pulls information from. The metric specified is used for the x-axis. - - `y` (LList[MetricType]): One or more metrics logged to your W&B project that the report pulls information from. The metric specified is used for the y-axis. - - `range_x` (Tuple[float | `None`, float | `None`]): Tuple that specifies the range of the x-axis. - - `range_y` (Tuple[float | `None`, float | `None`]): Tuple that specifies the range of the y-axis. - - `log_x` (Optional[bool]): Plots the x-coordinates using a base-10 logarithmic scale. - - `log_y` (Optional[bool]): Plots the y-coordinates using a base-10 logarithmic scale. - - `title_x` (Optional[str]): The label of the x-axis. - - `title_y` (Optional[str]): The label of the y-axis. - - `ignore_outliers` (Optional[bool]): If set to `True`, do not plot outliers. - - `groupby` (Optional[str]): Group runs based on a metric logged to your W&B project that the report pulls information from. - - `groupby_aggfunc` (Optional[GroupAgg]): Aggregate runs with specified function. Options include `mean`, `min`, `max`, `median`, `sum`, `samples`, or `None`. - - `groupby_rangefunc` (Optional[GroupArea]): Group runs based on a range. Options include `minmax`, `stddev`, `stderr`, `none`, `samples`, or `None`. - - `smoothing_factor` (Optional[float]): The smoothing factor to apply to the smoothing type. Accepted values range between 0 and 1. - - `smoothing_type Optional[SmoothingType]`: Apply a filter based on the specified distribution. Options include `exponentialTimeWeighted`, `exponential`, `gaussian`, `average`, or `none`. - - `smoothing_show_original` (Optional[bool]): If set to `True`, show the original data. - - `max_runs_to_show` (Optional[int]): The maximum number of runs to show on the line plot. - - `custom_expressions` (Optional[LList[str]]): Custom expressions to apply to the data. - - `plot_type Optional[LinePlotStyle]`: The type of line plot to generate. Options include `line`, `stacked-area`, or `pct-area`. - - `font_size Optional[FontSize]`: The size of the line plot's font. Options include `small`, `medium`, `large`, `auto`, or `None`. - - `legend_position Optional[LegendPosition]`: Where to place the legend. Options include `north`, `south`, `east`, `west`, or `None`. - - `legend_template` (Optional[str]): The template for the legend. - - `aggregate` (Optional[bool]): If set to `True`, aggregate the data. - - `xaxis_expression` (Optional[str]): The expression for the x-axis. - - `legend_fields` (Optional[LList[str]]): The fields to include in the legend. - - - - - - - ---- - - - -## class `Link` -A link to a URL. - - - -**Attributes:** - - - `text` (Union[str, TextWithInlineComments]): The text of the link. - - `url` (str): The URL the link points to. - - - - - - - ---- - - - -## class `MarkdownBlock` -A block of markdown text. Useful if you want to write text that uses common markdown syntax. - - - -**Attributes:** - - - `text` (str): The markdown text. - - - - - - - ---- - - - -## class `MarkdownPanel` -A panel that renders markdown. - - - -**Attributes:** - - - `markdown` (str): The text you want to appear in the markdown panel. - - - - - - - ---- - - - -## class `MediaBrowser` -A panel that displays media files in a grid layout. - - - -**Attributes:** - - - `num_columns` (Optional[int]): The number of columns in the grid. - - `media_keys` (LList[str]): A list of media keys that correspond to the media files. - - - - - - - ---- - - - -## class `Metric` -A metric to display in a report that is logged in your project. - - - -**Attributes:** - - - `name` (str): The name of the metric. - - - - - - - ---- - - - -## class `OrderBy` -A metric to order by. - - - -**Attributes:** - - - `name` (str): The name of the metric. - - `ascending` (bool): Whether to sort in ascending order. By default set to `False`. - - - - - - - ---- - - - -## class `OrderedList` -A list of items in a numbered list. - - - -**Attributes:** - - - `items` (LList[str]): A list of one or more `OrderedListItem` objects. - - - - - - - ---- - - - -## class `OrderedListItem` -A list item in an ordered list. - - - -**Attributes:** - - - `text` (str): The text of the list item. - - - - - - - ---- - - - -## class `P` -A paragraph of text. - - - -**Attributes:** - - - `text` (str): The text of the paragraph. - - - - - - - ---- - - - -## class `Panel` -A panel that displays a visualization in a panel grid. - - - -**Attributes:** - - - `layout` (Layout): A `Layout` object. - - - - - - - ---- - - - -## class `PanelGrid` -A grid that consists of runsets and panels. Add runsets and panels with `Runset` and `Panel` objects, respectively. - -Available panels include: `LinePlot`, `ScatterPlot`, `BarPlot`, `ScalarChart`, `CodeComparer`, `ParallelCoordinatesPlot`, `ParameterImportancePlot`, `RunComparer`, `MediaBrowser`, `MarkdownPanel`, `CustomChart`, `WeavePanel`, `WeavePanelSummaryTable`, `WeavePanelArtifactVersionedFile`. - - - - - -**Attributes:** - - - `runsets` (LList["Runset"]): A list of one or more `Runset` objects. - - `panels` (LList["PanelTypes"]): A list of one or more `Panel` objects. - - `active_runset` (int): The number of runs you want to display within a runset. By default, it is set to 0. - - `custom_run_colors` (dict): Key-value pairs where the key is the name of a run and the value is a color specified by a hexadecimal value. - - - - - - - ---- - - - -## class `ParallelCoordinatesPlot` -A panel object that shows a parallel coordinates plot. - - - -**Attributes:** - - - `columns` (LList[ParallelCoordinatesPlotColumn]): A list of one or more `ParallelCoordinatesPlotColumn` objects. - - `title` (Optional[str]): The text that appears at the top of the plot. - - `gradient` (Optional[LList[GradientPoint]]): A list of gradient points. - - `font_size` (Optional[FontSize]): The size of the line plot's font. Options include `small`, `medium`, `large`, `auto`, or `None`. - - - - - - - ---- - - - -## class `ParallelCoordinatesPlotColumn` -A column within a parallel coordinates plot. The order of `metric`s specified determine the order of the parallel axis (x-axis) in the parallel coordinates plot. - - - -**Attributes:** - - - `metric` (str | Config | SummaryMetric): The name of the metric logged to your W&B project that the report pulls information from. - - `display_name` (Optional[str]): The name of the metric - - `inverted` (Optional[bool]): Whether to invert the metric. - - `log` (Optional[bool]): Whether to apply a log transformation to the metric. - - - - - - - ---- - - - -## class `ParameterImportancePlot` -A panel that shows how important each hyperparameter is in predicting the chosen metric. - - - -**Attributes:** - - - `with_respect_to` (str): The metric you want to compare the parameter importance against. Common metrics might include the loss, accuracy, and so forth. The metric you specify must be logged within the project that the report pulls information from. - - - - - - - ---- - - - -## class `Report` -An object that represents a W&B Report. Use the returned object's `blocks` attribute to customize your report. Report objects do not automatically save. Use the `save()` method to persists changes. - - - -**Attributes:** - - - `project` (str): The name of the W&B project you want to load in. The project specified appears in the report's URL. - - `entity` (str): The W&B entity that owns the report. The entity appears in the report's URL. - - `title` (str): The title of the report. The title appears at the top of the report as an H1 heading. - - `description` (str): A description of the report. The description appears underneath the report's title. - - `blocks` (LList[BlockTypes]): A list of one or more HTML tags, plots, grids, runsets, and more. - - `width` (Literal['readable', 'fixed', 'fluid']): The width of the report. Options include 'readable', 'fixed', 'fluid'. - - ---- - -#### property url - -The URL where the report is hosted. The report URL consists of `https://wandb.ai/{entity}/{project_name}/reports/`. Where `{entity}` and `{project_name}` consists of the entity that the report belongs to and the name of the project, respectively. - - - ---- - - - -### classmethod `from_url` - -```python -from_url(url: str, as_model: bool = False) -``` - -Load in the report into current environment. Pass in the URL where the report is hosted. - - - -**Arguments:** - - - `url` (str): The URL where the report is hosted. - - `as_model` (bool): If True, return the model object instead of the Report object. By default, set to `False`. - ---- - - - -### method `save` - -```python -save(draft: bool = False, clone: bool = False) -``` - -Persists changes made to a report object. - ---- - - - -### method `to_html` - -```python -to_html(height: int = 1024, hidden: bool = False) → str -``` - -Generate HTML containing an iframe displaying this report. Commonly used to within a Python notebook. - - - -**Arguments:** - - - `height` (int): Height of the iframe. - - `hidden` (bool): If True, hide the iframe. Default set to `False`. - ---- - - - -## class `RunComparer` -A panel that compares metrics across different runs from the project the report pulls information from. - - - -**Attributes:** - - - `diff_only` `(Optional[Literal["split", True]])`: Display only the difference across runs in a project. You can toggle this feature on and off in the W&B Report UI. - - - - - - - ---- - - - -## class `Runset` -A set of runs to display in a panel grid. - - - -**Attributes:** - - - `entity` (str): An entity that owns or has the correct permissions to the project where the runs are stored. - - `project` (str): The name of the project were the runs are stored. - - `name` (str): The name of the run set. Set to `Run set` by default. - - `query` (str): A query string to filter runs. - - `filters` (Optional[str]): A filter string to filter runs. - - `groupby` (LList[str]): A list of metric names to group by. - - `order` (LList[OrderBy]): A list of `OrderBy` objects to order by. - - `custom_run_colors` (LList[OrderBy]): A dictionary mapping run IDs to colors. - - - - - - - ---- - - - -## class `RunsetGroup` -UI element that shows a group of runsets. - - - -**Attributes:** - - - `runset_name` (str): The name of the runset. - - `keys` (Tuple[RunsetGroupKey, ...]): The keys to group by. Pass in one or more `RunsetGroupKey` objects to group by. - - - - - - - ---- - - - -## class `RunsetGroupKey` -Groups runsets by a metric type and value. Part of a `RunsetGroup`. Specify the metric type and value to group by as key-value pairs. - - - -**Attributes:** - - - `key` (Type[str] | Type[Config] | Type[SummaryMetric] | Type[Metric]): The metric type to group by. - - `value` (str): The value of the metric to group by. - - - - - - - ---- - - - -## class `ScalarChart` -A panel object that shows a scalar chart. - - - -**Attributes:** - - - `title` (Optional[str]): The text that appears at the top of the plot. - - `metric` (MetricType): The name of a metric logged to your W&B project that the report pulls information from. - - `groupby_aggfunc` (Optional[GroupAgg]): Aggregate runs with specified function. Options include `mean`, `min`, `max`, `median`, `sum`, `samples`, or `None`. - - `groupby_rangefunc` (Optional[GroupArea]): Group runs based on a range. Options include `minmax`, `stddev`, `stderr`, `none`, `samples`, or `None`. - - `custom_expressions` (Optional[LList[str]]): A list of custom expressions to be used in the scalar chart. - - `legend_template` (Optional[str]): The template for the legend. - - `font_size Optional[FontSize]`: The size of the line plot's font. Options include `small`, `medium`, `large`, `auto`, or `None`. - - - - - - - ---- - - - -## class `ScatterPlot` -A panel object that shows a 2D or 3D scatter plot. - - - -**Arguments:** - - - `title` (Optional[str]): The text that appears at the top of the plot. - - `x Optional[SummaryOrConfigOnlyMetric]`: The name of a metric logged to your W&B project that the report pulls information from. The metric specified is used for the x-axis. - - `y Optional[SummaryOrConfigOnlyMetric]`: One or more metrics logged to your W&B project that the report pulls information from. Metrics specified are plotted within the y-axis. z Optional[SummaryOrConfigOnlyMetric]: - - `range_x` (Tuple[float | `None`, float | `None`]): Tuple that specifies the range of the x-axis. - - `range_y` (Tuple[float | `None`, float | `None`]): Tuple that specifies the range of the y-axis. - - `range_z` (Tuple[float | `None`, float | `None`]): Tuple that specifies the range of the z-axis. - - `log_x` (Optional[bool]): Plots the x-coordinates using a base-10 logarithmic scale. - - `log_y` (Optional[bool]): Plots the y-coordinates using a base-10 logarithmic scale. - - `log_z` (Optional[bool]): Plots the z-coordinates using a base-10 logarithmic scale. - - `running_ymin` (Optional[bool]): Apply a moving average or rolling mean. - - `running_ymax` (Optional[bool]): Apply a moving average or rolling mean. - - `running_ymean` (Optional[bool]): Apply a moving average or rolling mean. - - `legend_template` (Optional[str]): A string that specifies the format of the legend. - - `gradient` (Optional[LList[GradientPoint]]): A list of gradient points that specify the color gradient of the plot. - - `font_size` (Optional[FontSize]): The size of the line plot's font. Options include `small`, `medium`, `large`, `auto`, or `None`. - - `regression` (Optional[bool]): If `True`, a regression line is plotted on the scatter plot. - - - - - - - ---- - - - -## class `SoundCloud` -A block that renders a SoundCloud player. - - - -**Attributes:** - - - `html` (str): The HTML code to embed the SoundCloud player. - - - - - - - ---- - - - -## class `Spotify` -A block that renders a Spotify player. - - - -**Attributes:** - - - `spotify_id` (str): The Spotify ID of the track or playlist. - - - - - - - ---- - - - -## class `SummaryMetric` -A summary metric to display in a report. - - - -**Attributes:** - - - `name` (str): The name of the metric. - - - - - - - ---- - - - -## class `TableOfContents` -A block that contains a list of sections and subsections using H1, H2, and H3 HTML blocks specified in a report. - - - - - - - ---- - - - -## class `TextWithInlineComments` -A block of text with inline comments. - - - -**Attributes:** - - - `text` (str): The text of the block. - - - - - - - ---- - - - -## class `Twitter` -A block that displays a Twitter feed. - - - -**Attributes:** - - - `html` (str): The HTML code to display the Twitter feed. - - - - - - - ---- - - - -## class `UnorderedList` -A list of items in a bulleted list. - - - -**Attributes:** - - - `items` (LList[str]): A list of one or more `UnorderedListItem` objects. - - - - - - - ---- - - - -## class `UnorderedListItem` -A list item in an unordered list. - - - -**Attributes:** - - - `text` (str): The text of the list item. - - - - - - - ---- - - - -## class `Video` -A block that renders a video. - - - -**Attributes:** - - - `url` (str): The URL of the video. - - - - - - - ---- - - - -## class `WeaveBlockArtifact` -A block that shows an artifact logged to W&B. The query takes the form of - -```python -project('entity', 'project').artifact('artifact-name') -``` - -The term "Weave" in the API name does not refer to the W&B Weave toolkit used for tracking and evaluating LLM. - - - -**Attributes:** - - - `entity` (str): The entity that owns or has the appropriate permissions to the project where the artifact is stored. - - `project` (str): The project where the artifact is stored. - - `artifact` (str): The name of the artifact to retrieve. - - `tab Literal["overview", "metadata", "usage", "files", "lineage"]`: The tab to display in the artifact panel. - - - - - - - ---- - - - -## class `WeaveBlockArtifactVersionedFile` -A block that shows a versioned file logged to a W&B artifact. The query takes the form of - -```python -project('entity', 'project').artifactVersion('name', 'version').file('file-name') -``` - -The term "Weave" in the API name does not refer to the W&B Weave toolkit used for tracking and evaluating LLM. - - - -**Attributes:** - - - `entity` (str): The entity that owns or has the appropriate permissions to the project where the artifact is stored. - - `project` (str): The project where the artifact is stored. - - `artifact` (str): The name of the artifact to retrieve. - - `version` (str): The version of the artifact to retrieve. - - `file` (str): The name of the file stored in the artifact to retrieve. - - - - - - - ---- - - - -## class `WeaveBlockSummaryTable` -A block that shows a W&B Table, pandas DataFrame, plot, or other value logged to W&B. The query takes the form of - -```python -project('entity', 'project').runs.summary['value'] -``` - -The term "Weave" in the API name does not refer to the W&B Weave toolkit used for tracking and evaluating LLM. - - - -**Attributes:** - - - `entity` (str): The entity that owns or has the appropriate permissions to the project where the values are logged. - - `project` (str): The project where the value is logged in. - - `table_name` (str): The name of the table, DataFrame, plot, or value. - - - - - - - ---- - - - -## class `WeavePanel` -An empty query panel that can be used to display custom content using queries. - -The term "Weave" in the API name does not refer to the W&B Weave toolkit used for tracking and evaluating LLM. - - - - - - - ---- - - - -## class `WeavePanelArtifact` -A panel that shows an artifact logged to W&B. - -The term "Weave" in the API name does not refer to the W&B Weave toolkit used for tracking and evaluating LLM. - - - -**Attributes:** - - - `artifact` (str): The name of the artifact to retrieve. - - `tab Literal["overview", "metadata", "usage", "files", "lineage"]`: The tab to display in the artifact panel. - - - - - - - ---- - - - -## class `WeavePanelArtifactVersionedFile` -A panel that shows a versioned file logged to a W&B artifact. - -```python -project('entity', 'project').artifactVersion('name', 'version').file('file-name') -``` - -The term "Weave" in the API name does not refer to the W&B Weave toolkit used for tracking and evaluating LLM. - - - -**Attributes:** - - - `artifact` (str): The name of the artifact to retrieve. - - `version` (str): The version of the artifact to retrieve. - - `file` (str): The name of the file stored in the artifact to retrieve. - - - - - - - ---- - - - -## class `WeavePanelSummaryTable` -A panel that shows a W&B Table, pandas DataFrame, plot, or other value logged to W&B. The query takes the form of - -```python -runs.summary['value'] -``` - -The term "Weave" in the API name does not refer to the W&B Weave toolkit used for tracking and evaluating LLM. - - - -**Attributes:** - - - `table_name` (str): The name of the table, DataFrame, plot, or value. - - - - - diff --git a/content/en/ref/wandb_workspaces/workspaces.md b/content/en/ref/wandb_workspaces/workspaces.md deleted file mode 100644 index f0e7a6be20..0000000000 --- a/content/en/ref/wandb_workspaces/workspaces.md +++ /dev/null @@ -1,262 +0,0 @@ ---- -title: Workspaces ---- -{{< cta-button githubLink="https://github.com/wandb/wandb-workspaces/blob/main/wandb_workspaces/workspaces/interface.py" >}} - - - -{{% alert %}} -W&B Report and Workspace API is in Public Preview. -{{% /alert %}} - - -# module `wandb_workspaces.workspaces` -Python library for programmatically working with W&B Workspace API. - -```python -# How to import -import wandb_workspaces.workspaces as ws - -# Example of creating a workspace -ws.Workspace( - name="Example W&B Workspace", - entity="entity", # entity that owns the workspace - project="project", # project that the workspace is associated with - sections=[ - ws.Section( - name="Validation Metrics", - panels=[ - wr.LinePlot(x="Step", y=["val_loss"]), - wr.BarPlot(metrics=["val_accuracy"]), - wr.ScalarChart(metric="f1_score", groupby_aggfunc="mean"), - ], - is_open=True, - ), - ], -) -workspace.save() -``` - ---- - - - -## class `RunSettings` -Settings for a run in a runset (left hand bar). - - - -**Attributes:** - - - `color` (str): The color of the run in the UI. Can be hex (#ff0000), css color (red), or rgb (rgb(255, 0, 0)) - - `disabled` (bool): Whether the run is deactivated (eye closed in the UI). Default is set to `False`. - - - - - - - ---- - - - -## class `RunsetSettings` -Settings for the runset (the left bar containing runs) in a workspace. - - - -**Attributes:** - - - `query` (str): A query to filter the runset (can be a regex expr, see next param). - - `regex_query` (bool): Controls whether the query (above) is a regex expr. Default is set to `False`. - - `filters` `(LList[expr.FilterExpr])`: A list of filters to apply to the runset. Filters are AND'd together. See FilterExpr for more information on creating filters. - - `groupby` `(LList[expr.MetricType])`: A list of metrics to group by in the runset. Set to `Metric`, `Summary`, `Config`, `Tags`, or `KeysInfo`. - - `order` `(LList[expr.Ordering])`: A list of metrics and ordering to apply to the runset. - - `run_settings` `(Dict[str, RunSettings])`: A dictionary of run settings, where the key is the run's ID and the value is a RunSettings object. - - - - - - - ---- - - - -## class `Section` -Represents a section in a workspace. - - - -**Attributes:** - - - `name` (str): The name/title of the section. - - `panels` `(LList[PanelTypes])`: An ordered list of panels in the section. By default, first is top-left and last is bottom-right. - - `is_open` (bool): Whether the section is open or closed. Default is closed. - - `layout_settings` `(Literal[`standard`, `custom`])`: Settings for panel layout in the section. - - `panel_settings`: Panel-level settings applied to all panels in the section, similar to `WorkspaceSettings` for a `Section`. - - - - - - - ---- - - - -## class `SectionLayoutSettings` -Panel layout settings for a section, typically seen at the top right of the section of the W&B App Workspace UI. - - - -**Attributes:** - - - `layout` `(Literal[`standard`, `custom`])`: The layout of panels in the section. `standard` follows the default grid layout, `custom` allows per per-panel layouts controlled by the individual panel settings. - - `columns` (int): In a standard layout, the number of columns in the layout. Default is 3. - - `rows` (int): In a standard layout, the number of rows in the layout. Default is 2. - - - - - - - ---- - - - -## class `SectionPanelSettings` -Panel settings for a section, similar to `WorkspaceSettings` for a section. - -Settings applied here can be overrided by more granular Panel settings in this priority: Section < Panel. - - - -**Attributes:** - - - `x_axis` (str): X-axis metric name setting. By default, set to `Step`. - - `x_min Optional[float]`: Minimum value for the x-axis. - - `x_max Optional[float]`: Maximum value for the x-axis. - - `smoothing_type` (Literal['exponentialTimeWeighted', 'exponential', 'gaussian', 'average', 'none']): Smoothing type applied to all panels. - - `smoothing_weight` (int): Smoothing weight applied to all panels. - - - - - - - ---- - - - -## class `Workspace` -Represents a W&B workspace, including sections, settings, and config for run sets. - - - -**Attributes:** - - - `entity` (str): The entity this workspace will be saved to (usually user or team name). - - `project` (str): The project this workspace will be saved to. - - `name`: The name of the workspace. - - `sections` `(LList[Section])`: An ordered list of sections in the workspace. The first section is at the top of the workspace. - - `settings` `(WorkspaceSettings)`: Settings for the workspace, typically seen at the top of the workspace in the UI. - - `runset_settings` `(RunsetSettings)`: Settings for the runset (the left bar containing runs) in a workspace. - - ---- - -#### property url - -The URL to the workspace in the W&B app. - - - ---- - - - -### classmethod `from_url` - -```python -from_url(url: str) -``` - -Get a workspace from a URL. - ---- - - - -### method `save` - -```python -save() -``` - -Save the current workspace to W&B. - - - -**Returns:** - - - `Workspace`: The updated workspace with the saved internal name and ID. - ---- - - - -### method `save_as_new_view` - -```python -save_as_new_view() -``` - -Save the current workspace as a new view to W&B. - - - -**Returns:** - - - `Workspace`: The updated workspace with the saved internal name and ID. - ---- - - - -## class `WorkspaceSettings` -Settings for the workspace, typically seen at the top of the workspace in the UI. - -This object includes settings for the x-axis, smoothing, outliers, panels, tooltips, runs, and panel query bar. - -Settings applied here can be overrided by more granular Section and Panel settings in this priority: Workspace < Section < Panel - - - -**Attributes:** - - - `x_axis` (str): X-axis metric name setting. - - `x_min` `(Optional[float])`: Minimum value for the x-axis. - - `x_max` `(Optional[float])`: Maximum value for the x-axis. - - `smoothing_type` `(Literal['exponentialTimeWeighted', 'exponential', 'gaussian', 'average', 'none'])`: Smoothing type applied to all panels. - - `smoothing_weight` (int): Smoothing weight applied to all panels. - - `ignore_outliers` (bool): Ignore outliers in all panels. - - `sort_panels_alphabetically` (bool): Sorts panels in all sections alphabetically. - - `group_by_prefix` `(Literal[`first`, `last`])`: Group panels by the first or up to last prefix (first or last). Default is set to `last`. - - `remove_legends_from_panels` (bool): Remove legends from all panels. - - `tooltip_number_of_runs` `(Literal[`default`, `all`, `none`])`: The number of runs to show in the tooltip. - - `tooltip_color_run_names` (bool): Whether to color run names in the tooltip to match the runset (True) or not (False). Default is set to `True`. - - `max_runs` (int): The maximum number of runs to show per panel (this will be the first 10 runs in the runset). - - `point_visualization_method` `(Literal[`line`, `point`, `line_point`])`: The visualization method for points. - - `panel_search_query` (str): The query for the panel search bar (can be a regex expression). - - `auto_expand_panel_search_results` (bool): Whether to auto expand the panel search results. - - - - - diff --git a/content/en/search.md b/content/en/search.md deleted file mode 100644 index d9a4d5beef..0000000000 --- a/content/en/search.md +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: Search Results -layout: search ---- \ No newline at end of file diff --git a/content/en/support/_index.md b/content/en/support/_index.md deleted file mode 100644 index be625bad05..0000000000 --- a/content/en/support/_index.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: Support ---- - -{{< banner title="How can we help?" background="/images/support/support_banner.png" >}} -Search for help from support articles, product documentation,
-and the W&B community. -{{< /banner >}} - -## Featured articles - -Here are the most commonly asked questions across all categories. - -* [What does `wandb.init` do to my training process?]({{< relref "/support/kb-articles/wandbinit_training_process.md" >}}) -* [How do I use custom CLI commands with sweeps?]({{< relref "/support/kb-articles/custom_cli_commands_sweeps.md" >}}) -* [Is it possible to save metrics offline and sync them to W&B later?]({{< relref "/support/kb-articles/same_metric_appearing_more.md" >}}) -* [How can I configure the name of the run in my training code?]({{< relref "/support/kb-articles/configure_name_run_training_code.md" >}}) - - -If you can't find what you are looking for, browse through the [popular categories]({{< relref "#popular-categories" >}}) below or search through articles based on categories. - - -## Popular categories - -Browse articles by category. - -{{< cardpane >}} - {{< card >}} - -

Experiments

-
-

Track, visualize, and compare machine learning experiments

- - {{< /card >}} - {{< card >}} - -

Artifacts

-
-

Version and track datasets, models, and other machine learning artifacts

- {{< /card >}} -{{< /cardpane >}} -{{< cardpane >}} - {{< card >}} - -

Reports

-
-

Create interactive, collaborative reports to share your work

- {{< /card >}} - {{< card >}} - -

Sweeps

-
-

Automate hyperparameter search

- {{< /card >}} -{{< /cardpane >}} - - -{{< card >}} -
- {{< img src="/images/support/callout-icon.svg" alt="Callout Icon" width="32" height="32" >}} -
-

Still can't find what you are looking for?

- - Contact support - - {{< /card >}} diff --git a/content/en/support/aws/_index.md b/content/en/support/aws/_index.md deleted file mode 100644 index d048a475c2..0000000000 --- a/content/en/support/aws/_index.md +++ /dev/null @@ -1,3 +0,0 @@ ---- -title: AWS ---- diff --git a/content/en/support/kb-articles/academic_plan_student.md b/content/en/support/kb-articles/academic_plan_student.md deleted file mode 100644 index 9ffb8cc848..0000000000 --- a/content/en/support/kb-articles/academic_plan_student.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -url: /support/:filename -title: Can I get an academic plan as a student? -toc_hide: true -type: docs -support: -- administrator -- academic -- user management ---- -Students can apply for an academic plan by following these steps: - -- Visit [the Pricing page on the wandb.com](https://wandb.ai/site/pricing). -- Apply for the academic plan. -- Alternatively, start with a 30-day trial and convert it to an academic plan by visiting the [W&B academic application page](https://wandb.ai/academic_application). \ No newline at end of file diff --git a/content/en/support/kb-articles/access_artifacts.md b/content/en/support/kb-articles/access_artifacts.md deleted file mode 100644 index 5d998f0c9e..0000000000 --- a/content/en/support/kb-articles/access_artifacts.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -url: /support/:filename -title: "Who has access to my artifacts?" -toc_hide: true -type: docs -support: - - artifacts ---- -Artifacts inherit access permissions from their parent project: - -* In a private project, only team members can access artifacts. -* In a public project, all users can read artifacts, while only team members can create or modify them. -* In an open project, all users can read and write artifacts. - -## Artifacts Workflows - -This section outlines workflows for managing and editing Artifacts. Many workflows utilize [the W&B API]({{< relref "/guides/models/track/public-api-guide.md" >}}), a component of [the client library]({{< relref "/ref/python/" >}}) that provides access to W&B-stored data. \ No newline at end of file diff --git a/content/en/support/kb-articles/access_data_logged_runs_directly_programmatically.md b/content/en/support/kb-articles/access_data_logged_runs_directly_programmatically.md deleted file mode 100644 index 74357dc829..0000000000 --- a/content/en/support/kb-articles/access_data_logged_runs_directly_programmatically.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -url: /support/:filename -title: "How can I access the data logged to my runs directly and programmatically?" -toc_hide: true -type: docs -support: - - experiments ---- -The history object tracks metrics logged with `wandb.log`. Access the history object using the API: - -```python -api = wandb.Api() -run = api.run("username/project/run_id") -print(run.history()) -``` \ No newline at end of file diff --git a/content/en/support/kb-articles/add_extra_values_sweep_start_new_one.md b/content/en/support/kb-articles/add_extra_values_sweep_start_new_one.md deleted file mode 100644 index b0c9ee9398..0000000000 --- a/content/en/support/kb-articles/add_extra_values_sweep_start_new_one.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -url: /support/:filename -title: "Is there a way to add extra values to a sweep, or do I need to start a new one?" -toc_hide: true -type: docs -support: - - sweeps ---- -Once a W&B Sweep starts, you cannot change the Sweep configuration. However, you can navigate to any table view, select runs using the checkboxes, and then choose the **Create sweep** menu option to generate a new Sweep configuration based on previous runs. \ No newline at end of file diff --git a/content/en/support/kb-articles/add_more_seats.md b/content/en/support/kb-articles/add_more_seats.md deleted file mode 100644 index c8189f8a8e..0000000000 --- a/content/en/support/kb-articles/add_more_seats.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -url: /support/:filename -title: Is there a way to add more seats? -toc_hide: true -type: docs -support: -- administrator -- user management ---- -To add more seats to an account, follow these steps: - -- Contact the Account Executive or support team (support@wandb.com) for assistance. -- Provide the organization name and the desired number of seats. diff --git a/content/en/support/kb-articles/add_plotlybokeh_charts_tables.md b/content/en/support/kb-articles/add_plotlybokeh_charts_tables.md deleted file mode 100644 index e55b2341b0..0000000000 --- a/content/en/support/kb-articles/add_plotlybokeh_charts_tables.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -url: /support/:filename -title: "How do I add Plotly or Bokeh Charts into Tables?" -toc_hide: true -type: docs -support: - - experiments - - tables - - charts ---- -Direct integration of Plotly or Bokeh figures into tables is not supported. Instead, export the figures to HTML and include the HTML in the table. Below are examples demonstrating this with interactive Plotly and Bokeh charts. - -{{< tabpane text=true >}} -{{% tab "Using Plotly" %}} -```python -import wandb -import plotly.express as px - -# Initialize a new run -with wandb.init(project="log-plotly-fig-tables", name="plotly_html") as run: - - # Create a table - table = wandb.Table(columns=["plotly_figure"]) - - # Define path for Plotly figure - path_to_plotly_html = "./plotly_figure.html" - - # Create a Plotly figure - fig = px.scatter(x=[0, 1, 2, 3, 4], y=[0, 1, 4, 9, 16]) - - # Export Plotly figure to HTML - # Setting auto_play to False prevents animated Plotly charts from playing automatically - fig.write_html(path_to_plotly_html, auto_play=False) - - # Add Plotly figure as HTML file to the table - table.add_data(wandb.Html(path_to_plotly_html)) - - # Log Table - run.log({"test_table": table}) - -``` -{{% /tab %}} -{{% tab "Using Bokeh" %}} -```python -from scipy.signal import spectrogram -import holoviews as hv -import panel as pn -from scipy.io import wavfile -import numpy as np -from bokeh.resources import INLINE - -hv.extension("bokeh", logo=False) -import wandb - -def save_audio_with_bokeh_plot_to_html(audio_path, html_file_name): - sr, wav_data = wavfile.read(audio_path) - duration = len(wav_data) / sr - f, t, sxx = spectrogram(wav_data, sr) - spec_gram = hv.Image((t, f, np.log10(sxx)), ["Time (s)", "Frequency (Hz)"]).opts( - width=500, height=150, labelled=[] - ) - audio = pn.pane.Audio(wav_data, sample_rate=sr, name="Audio", throttle=500) - slider = pn.widgets.FloatSlider(end=duration, visible=False) - line = hv.VLine(0).opts(color="white") - slider.jslink(audio, value="time", bidirectional=True) - slider.jslink(line, value="glyph.location") - combined = pn.Row(audio, spec_gram * line, slider).save(html_file_name) - -html_file_name = "audio_with_plot.html" -audio_path = "hello.wav" -save_audio_with_bokeh_plot_to_html(audio_path, html_file_name) - -wandb_html = wandb.Html(html_file_name) -with wandb.init(project="audio_test") as run: - my_table = wandb.Table(columns=["audio_with_plot"], data=[[wandb_html], [wandb_html]]) - run.log({"audio_table": my_table}) -``` -{{% /tab %}} -{{% /tabpane %}} \ No newline at end of file diff --git a/content/en/support/kb-articles/add_same_service_account_multiple_teams.md b/content/en/support/kb-articles/add_same_service_account_multiple_teams.md deleted file mode 100644 index e3781cfd37..0000000000 --- a/content/en/support/kb-articles/add_same_service_account_multiple_teams.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -url: /support/:filename -title: Is it possible to add the same service account to multiple teams? -toc_hide: true -type: docs -support: -- administrator -- team management ---- -A service account cannot be added to multiple teams in W&B. Each service account is tied to a specific team. \ No newline at end of file diff --git a/content/en/support/kb-articles/adding_multiple_authors_report.md b/content/en/support/kb-articles/adding_multiple_authors_report.md deleted file mode 100644 index 0e3a9491ba..0000000000 --- a/content/en/support/kb-articles/adding_multiple_authors_report.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -url: /support/:filename -title: "Adding multiple authors to a report" -toc_hide: true -type: docs -support: - - reports ---- -Accurately credit all contributors in your report by adding multiple authors. - -To add multiple authors, click on the **+** icon next to the name of the author. This will open a drop-down menu with all the users who have access to the report. Select the users you want to add as authors. - -{{< img src="/images/reports/reports_faq_add_multiple_reports.gif" alt="Adding multiple report authors" >}} \ No newline at end of file diff --git a/content/en/support/kb-articles/admin_local_instance_manage.md b/content/en/support/kb-articles/admin_local_instance_manage.md deleted file mode 100644 index 596483c5d0..0000000000 --- a/content/en/support/kb-articles/admin_local_instance_manage.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -url: /support/:filename -title: "If I am the admin of my local instance, how should I manage it?" -toc_hide: true -type: docs -support: - - administrator ---- -If you are the admin for your instance, review the [User Management]({{< relref "/guides/hosting/iam/access-management/manage-organization.md" >}}) section for instructions on adding users and creating teams. \ No newline at end of file diff --git a/content/en/support/kb-articles/anaconda_package.md b/content/en/support/kb-articles/anaconda_package.md deleted file mode 100644 index 967157f278..0000000000 --- a/content/en/support/kb-articles/anaconda_package.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -url: /support/:filename -title: "Is there an anaconda package for Weights and Biases?" -toc_hide: true -type: docs -support: -- python ---- -There is an anaconda package that is installable using either `pip` or `conda`. For `conda`, obtain the package from the [conda-forge](https://conda-forge.org) channel. - -{{< tabpane text=true >}} -{{% tab "pip" %}} -```shell -# Create a conda environment -conda create -n wandb-env python=3.8 anaconda -# Activate the environment -conda activate wandb-env -# Install wandb using pip -pip install wandb -``` -{{% /tab %}} -{{% tab "conda" %}} -```shell -conda activate myenv -conda install wandb --channel conda-forge -``` -{{% /tab %}} -{{< /tabpane >}} - -For installation issues, refer to this Anaconda [documentation on managing packages](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-pkgs.html) for assistance. \ No newline at end of file diff --git a/content/en/support/kb-articles/anon_users_unavailable_features.md b/content/en/support/kb-articles/anon_users_unavailable_features.md deleted file mode 100644 index e66a48f45d..0000000000 --- a/content/en/support/kb-articles/anon_users_unavailable_features.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -url: /support/:filename -title: What are features that are not available to anonymous users? -toc_hide: true -type: docs -support: -- anonymous ---- -* **No persistent data**: Runs save for 7 days in an anonymous account. Claim anonymous run data by saving it to a real account. - -{{< img src="/images/app_ui/anon_mode_no_data.png" alt="Anonymous mode interface" >}} - -* **No artifact logging**: A warning appears on the command line when attempting to log an artifact to an anonymous run: - ```bash - wandb: WARNING Artifacts logged anonymously cannot be claimed and expire after 7 days. - ``` - -* **No profile or settings pages**: The UI does not include certain pages, as they are only useful for real accounts. \ No newline at end of file diff --git a/content/en/support/kb-articles/artifact_storage_version.md b/content/en/support/kb-articles/artifact_storage_version.md deleted file mode 100644 index 272b99656d..0000000000 --- a/content/en/support/kb-articles/artifact_storage_version.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -url: /support/:filename -title: How much storage does each artifact version use? -toc_hide: true -type: docs -support: -- artifacts -- storage ---- -Only files that change between two artifact versions incur storage costs. - -{{< img src="/images/artifacts/artifacts-dedupe.PNG" alt="Artifact deduplication" >}} - -Consider an image artifact named `animals` that contains two image files, `cat.png` and `dog.png`: - -``` -images -|-- cat.png (2MB) # Added in `v0` -|-- dog.png (1MB) # Added in `v0` -``` - -This artifact receives version `v0`. - -When adding a new image, `rat.png`, a new artifact version, `v1`, is created with the following contents: - -``` -images -|-- cat.png (2MB) # Added in `v0` -|-- dog.png (1MB) # Added in `v0` -|-- rat.png (3MB) # Added in `v1` -``` - -Version `v1` tracks a total of 6MB, but occupies only 3MB of space since it shares the remaining 3MB with `v0`. Deleting `v1` reclaims the 3MB of storage associated with `rat.png`. Deleting `v0` transfers the storage costs of `cat.png` and `dog.png` to `v1`, increasing its storage size to 6MB. diff --git a/content/en/support/kb-articles/artifacts_multiple_architectures_runs.md b/content/en/support/kb-articles/artifacts_multiple_architectures_runs.md deleted file mode 100644 index f1f728b7c6..0000000000 --- a/content/en/support/kb-articles/artifacts_multiple_architectures_runs.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -url: /support/:filename -title: "Using artifacts with multiple architectures and runs?" -toc_hide: true -type: docs -support: - - artifacts ---- -There are various methods to version a model. Artifacts provide a tool for model versioning tailored to specific needs. A common approach for projects that explore multiple model architectures involves separating artifacts by architecture. Consider the following steps: - -1. Create a new artifact for each distinct model architecture. Use the `metadata` attribute of artifacts to provide detailed descriptions of the architecture, similar to the use of `config` for a run. -2. For each model, log checkpoints periodically with `log_artifact`. W&B builds a history of these checkpoints, labeling the most recent one with the `latest` alias. Refer to the latest checkpoint for any model architecture using `architecture-name:latest`. - diff --git a/content/en/support/kb-articles/best_log_models_runs_sweep.md b/content/en/support/kb-articles/best_log_models_runs_sweep.md deleted file mode 100644 index a521ac970f..0000000000 --- a/content/en/support/kb-articles/best_log_models_runs_sweep.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -url: /support/:filename -title: "How do I best log models from runs in a sweep?" -toc_hide: true -type: docs -support: - - artifacts - - sweeps ---- -One effective approach for logging models in a [sweep]({{< relref "/guides/models/sweeps/" >}}) involves creating a model artifact for the sweep. Each version represents a different run from the sweep. Implement it as follows: - -```python -wandb.Artifact(name="sweep_name", type="model") -``` \ No newline at end of file diff --git a/content/en/support/kb-articles/best_practices_organize_hyperparameter_searches.md b/content/en/support/kb-articles/best_practices_organize_hyperparameter_searches.md deleted file mode 100644 index a23b5ea468..0000000000 --- a/content/en/support/kb-articles/best_practices_organize_hyperparameter_searches.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -url: /support/:filename -title: "Best practices to organize hyperparameter searches" -toc_hide: true -type: docs -support: - - hyperparameter - - sweeps - - runs ---- -Set unique tags with `wandb.init(tags='your_tag')`. This allows efficient filtering of project runs by selecting the corresponding tag in a Project Page's Runs Table. - - -For more information on `wandb.init()`, see the [`wandb.init()` reference]({{< relref "/ref/python/functions/init.md" >}}). diff --git a/content/en/support/kb-articles/bounty_program.md b/content/en/support/kb-articles/bounty_program.md deleted file mode 100644 index 365ac8e7a9..0000000000 --- a/content/en/support/kb-articles/bounty_program.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -url: /support/:filename -title: Do you have a bug bounty program? -toc_hide: true -type: docs -support: -- security ---- -Weights and Biases has a bug bounty program. Access the [W&B security portal](https://security.wandb.ai/) for details. \ No newline at end of file diff --git a/content/en/support/kb-articles/cancel_subscription.md b/content/en/support/kb-articles/cancel_subscription.md deleted file mode 100644 index d873e92ffc..0000000000 --- a/content/en/support/kb-articles/cancel_subscription.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -url: /support/:filename -title: How do I cancel my subscription? -toc_hide: true -type: docs -support: -- administrator ---- - -- Contact the support team (support@wandb.com). -- Provide the organization name, email associated with the account, and username. \ No newline at end of file diff --git a/content/en/support/kb-articles/change_account_from_corporate_academic.md b/content/en/support/kb-articles/change_account_from_corporate_academic.md deleted file mode 100644 index 1afc989e70..0000000000 --- a/content/en/support/kb-articles/change_account_from_corporate_academic.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -url: /support/:filename -title: How can I change my account from corporate to academic? -toc_hide: true -type: docs -support: -- administrator -- academic -- user management ---- -To change an account from corporate to academic in W&B, follow these steps: - -1. **Link your academic email**: - - Access account settings. - - Add and set the academic email as the primary email. - -2. **Apply for an academic plan**: - - Visit the [W&B academic page](https://wandb.ai/site/research/). - - Submit the application for review. diff --git a/content/en/support/kb-articles/change_billing_address.md b/content/en/support/kb-articles/change_billing_address.md deleted file mode 100644 index 71a59a3db8..0000000000 --- a/content/en/support/kb-articles/change_billing_address.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -url: /support/:filename -title: How do I change my billing address? -toc_hide: true -type: docs -support: -- administrator -- billing ---- -To change the billing address, contact the support team (support@wandb.com). \ No newline at end of file diff --git a/content/en/support/kb-articles/change_directory_sweep_logs_locally.md b/content/en/support/kb-articles/change_directory_sweep_logs_locally.md deleted file mode 100644 index 51a0e0b6fa..0000000000 --- a/content/en/support/kb-articles/change_directory_sweep_logs_locally.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -url: /support/:filename -title: "How can I change the directory my sweep logs to locally?" -toc_hide: true -type: docs -support: - - sweeps ---- -Set the logging directory for W&B run data by configuring the environment variable `WANDB_DIR`. For example: - -```python -os.environ["WANDB_DIR"] = os.path.abspath("your/directory") -``` \ No newline at end of file diff --git a/content/en/support/kb-articles/change_group_after_completion.md b/content/en/support/kb-articles/change_group_after_completion.md deleted file mode 100644 index cdbe35a735..0000000000 --- a/content/en/support/kb-articles/change_group_after_completion.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -url: /support/:filename -title: Is it possible to change the group assigned to a run after completion? -toc_hide: true -type: docs -support: -- runs ---- -You can change the group assigned to a completed run using the API. This feature does not appear in the web UI. Use the following code to update the group: - -```python -import wandb - -api = wandb.Api() -run = api.run("//") -run.group = "NEW-GROUP-NAME" -run.update() -``` \ No newline at end of file diff --git a/content/en/support/kb-articles/change_username.md b/content/en/support/kb-articles/change_username.md deleted file mode 100644 index 2a0cf91405..0000000000 --- a/content/en/support/kb-articles/change_username.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -url: /support/:filename -title: Is it possible to change the username? -toc_hide: true -type: docs -support: -- administrator -- user management ---- -Changing the username after account creation is not possible. Create a new account with the desired username instead. \ No newline at end of file diff --git a/content/en/support/kb-articles/client_support_python_2.md b/content/en/support/kb-articles/client_support_python_2.md deleted file mode 100644 index 6e0d3d67e5..0000000000 --- a/content/en/support/kb-articles/client_support_python_2.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -url: /support/:filename -title: "Does the W&B client support Python 2?" -toc_hide: true -type: docs -support: -- python ---- -The W&B client library supported both Python 2.7 and Python 3 through version 0.10. Support for Python 2.7 discontinued with version 0.11 due to Python 2's end of life. Running `pip install --upgrade wandb` on a Python 2.7 system installs only new releases of the 0.10.x series. Support for the 0.10.x series includes critical bug fixes and patches only. The last version of the 0.10.x series that supports Python 2.7 is 0.10.33. \ No newline at end of file diff --git a/content/en/support/kb-articles/client_support_python_35.md b/content/en/support/kb-articles/client_support_python_35.md deleted file mode 100644 index a9c3885f8b..0000000000 --- a/content/en/support/kb-articles/client_support_python_35.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -url: /support/:filename -title: "Does the W&B client support Python 3.5?" -toc_hide: true -type: docs -support: -- python ---- -The W&B client library supported Python 3.5 until version 0.11. Support for Python 3.5 ended with version 0.12, which aligns with its end of life. For more details, visit [version 0.12 release notes](https://github.com/wandb/wandb/releases/tag/v0.12.0). \ No newline at end of file diff --git a/content/en/support/kb-articles/compare_images_media_across_epochs_steps.md b/content/en/support/kb-articles/compare_images_media_across_epochs_steps.md deleted file mode 100644 index aa6f19f064..0000000000 --- a/content/en/support/kb-articles/compare_images_media_across_epochs_steps.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -url: /support/:filename -title: "How can I compare images or media across epochs or steps?" -toc_hide: true -type: docs -support: - - experiments ---- -Expand the image panel and use the step slider to navigate through images from different steps. This process facilitates comparison of a model's output changes during training. \ No newline at end of file diff --git a/content/en/support/kb-articles/configure_name_run_training_code.md b/content/en/support/kb-articles/configure_name_run_training_code.md deleted file mode 100644 index c9f02a5bb4..0000000000 --- a/content/en/support/kb-articles/configure_name_run_training_code.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -url: /support/:filename -title: "How can I configure the name of the run in my training code?" -toc_hide: true -type: docs -support: - - experiments ---- -At the beginning of the training script, call `wandb.init` with an experiment name. For example: `wandb.init(name="my_awesome_run")`. \ No newline at end of file diff --git a/content/en/support/kb-articles/convert_from_wysiwyg_markdown.md b/content/en/support/kb-articles/convert_from_wysiwyg_markdown.md deleted file mode 100644 index f27e8f1532..0000000000 --- a/content/en/support/kb-articles/convert_from_wysiwyg_markdown.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -url: /support/:filename -title: I converted my report to WYSIWYG but want to revert back to Markdown -toc_hide: true -type: docs -support: - - reports - - wysiwyg ---- - -If the report conversion occurred through the message at the top, click the red "Revert" button to restore the prior state. Note that any changes made after conversion will be lost. - -If a single Markdown block was converted, use `cmd+z` to undo. - -If options to revert are unavailable because of a closed session, consider discarding the draft or editing from the last saved version. If neither works, contact W&B Support. \ No newline at end of file diff --git a/content/en/support/kb-articles/crashes_crash_training_run.md b/content/en/support/kb-articles/crashes_crash_training_run.md deleted file mode 100644 index 005847a27c..0000000000 --- a/content/en/support/kb-articles/crashes_crash_training_run.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -url: /support/:filename -title: "If wandb crashes, will it possibly crash my training run?" -toc_hide: true -type: docs -support: - - crashing and hanging runs ---- -It is critical to avoid interference with training runs. W&B operates in a separate process, ensuring that training continues even if W&B experiences a crash. In the event of an internet outage, W&B continually retries sending data to [wandb.ai](https://wandb.ai). \ No newline at end of file diff --git a/content/en/support/kb-articles/create_account_email_that_previously_used_deleted_account.md b/content/en/support/kb-articles/create_account_email_that_previously_used_deleted_account.md deleted file mode 100644 index 0d3587c16c..0000000000 --- a/content/en/support/kb-articles/create_account_email_that_previously_used_deleted_account.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -url: /support/:filename -title: Is it possible to create a new account with an email that was previously used for a deleted account? -toc_hide: true -type: docs -support: -- user management ---- -A new account can use an email previously associated with a deleted account. \ No newline at end of file diff --git a/content/en/support/kb-articles/create_team_add_delete_people_team.md b/content/en/support/kb-articles/create_team_add_delete_people_team.md deleted file mode 100644 index a273d46dd4..0000000000 --- a/content/en/support/kb-articles/create_team_add_delete_people_team.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -url: /support/:filename -title: "Who can create a team? Who can add or delete people from a team? Who can delete projects?" -toc_hide: true -type: docs -support: - - team management ---- -Refer to the link for details on roles and permissions: [Team Roles and Permissions]({{< relref "/guides/models/app/settings-page/teams.md#team-roles-and-permissions" >}}). \ No newline at end of file diff --git a/content/en/support/kb-articles/custom_cli_commands_sweeps.md b/content/en/support/kb-articles/custom_cli_commands_sweeps.md deleted file mode 100644 index 5a2f9a1467..0000000000 --- a/content/en/support/kb-articles/custom_cli_commands_sweeps.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -url: /support/:filename -title: "How do I use custom CLI commands with sweeps?" -toc_hide: true -type: docs -support: - - sweeps ---- -You can use W&B Sweeps with custom CLI commands if training configuration passes command-line arguments. - -In the example below, the code snippet illustrates a bash terminal where a user trains a Python script named `train.py`, providing values that the script parses: - -```bash -/usr/bin/env python train.py -b \ - your-training-config \ - --batchsize 8 \ - --lr 0.00001 -``` - -To implement custom commands, modify the `command` key in the YAML file. Based on the previous example, the configuration appears as follows: - -```yaml -program: - train.py -method: grid -parameters: - batch_size: - value: 8 - lr: - value: 0.0001 -command: - - ${env} - - python - - ${program} - - "-b" - - your-training-config - - ${args} -``` - -The `${args}` key expands to all parameters in the sweep configuration, formatted for `argparse` as `--param1 value1 --param2 value2`. - -For additional arguments outside of `argparse`, implement the following: - -```python -parser = argparse.ArgumentParser() -args, unknown = parser.parse_known_args() -``` - -{{% alert %}} -Depending on the environment, `python` might refer to Python 2. To ensure invocation of Python 3, use `python3` in the command configuration: - -```yaml -program: - script.py -command: - - ${env} - - python3 - - ${program} - - ${args} -``` -{{% /alert %}} \ No newline at end of file diff --git a/content/en/support/kb-articles/dark_mode.md b/content/en/support/kb-articles/dark_mode.md deleted file mode 100644 index b5691ccd4c..0000000000 --- a/content/en/support/kb-articles/dark_mode.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -url: /support/:filename -title: "Is there a dark mode?" -toc_hide: true -type: docs -support: - - workspaces ---- -Dark mode is in beta and not optimized for accessibility. To enable dark mode: - -1. Go to your [W&B account settings](https://wandb.ai/settings). -2. Scroll to the **Public preview features** section. -3. In **UI Display**, select **Dark mode** from the dropdown. diff --git a/content/en/support/kb-articles/deal_network_issues.md b/content/en/support/kb-articles/deal_network_issues.md deleted file mode 100644 index 1dcdd3eb43..0000000000 --- a/content/en/support/kb-articles/deal_network_issues.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -url: /support/:filename -title: "How do I deal with network issues?" -toc_hide: true -type: docs -support: - - connectivity ---- -If you encounter SSL or network errors, such as `wandb: Network error (ConnectionError), entering retry loop`, use the following solutions: - -1. Upgrade the SSL certificate. On an Ubuntu server, run `update-ca-certificates`. A valid SSL certificate is essential for syncing training logs to mitigate security risks. -2. If the network connection is unstable, operate in offline mode by setting the [optional environment variable]({{< relref "/guides/models/track/environment-variables.md#optional-environment-variables" >}}) `WANDB_MODE` to `offline`, and sync files later from a device with Internet access. -3. Consider using [W&B Private Hosting]({{< relref "/guides/hosting/" >}}), which runs locally and avoids syncing to cloud servers. - -For the `SSL CERTIFICATE_VERIFY_FAILED` error, this issue might stem from a company firewall. Configure local CAs and execute: - -`export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt` \ No newline at end of file diff --git a/content/en/support/kb-articles/delete_custom_chart_preset.md b/content/en/support/kb-articles/delete_custom_chart_preset.md deleted file mode 100644 index 67ae50b2aa..0000000000 --- a/content/en/support/kb-articles/delete_custom_chart_preset.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -url: /support/:filename -title: How do you delete a custom chart preset? -toc_hide: true -type: docs -support: -- charts ---- -Access the custom chart editor. Click on the currently selected chart type to open a menu displaying all presets. Hover over the preset to delete, then click the Trash icon. - -{{< img src="/images/app_ui/delete_custome_chart_preset.gif" alt="Deleting chart preset" >}} \ No newline at end of file diff --git a/content/en/support/kb-articles/delete_organization_account.md b/content/en/support/kb-articles/delete_organization_account.md deleted file mode 100644 index 58f389618a..0000000000 --- a/content/en/support/kb-articles/delete_organization_account.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -url: /support/:filename -title: How do I delete my organization account? -toc_hide: true -type: docs -support: -- administrator ---- -To delete an organization account, follow these steps, contact the support team (support@wandb.com). \ No newline at end of file diff --git a/content/en/support/kb-articles/delete_panel_grid.md b/content/en/support/kb-articles/delete_panel_grid.md deleted file mode 100644 index bb047131e1..0000000000 --- a/content/en/support/kb-articles/delete_panel_grid.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -url: /support/:filename -title: How do I delete a panel grid? -toc_hide: true -type: docs -support: - - reports - - wysiwyg ---- - -Select the panel grid and press delete or backspace. Click the drag handle in the top-right corner to select the panel grid. diff --git a/content/en/support/kb-articles/delete_team_from_account.md b/content/en/support/kb-articles/delete_team_from_account.md deleted file mode 100644 index be6f8b4a44..0000000000 --- a/content/en/support/kb-articles/delete_team_from_account.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -url: /support/:filename -title: How do I delete a team from my account? -toc_hide: true -type: docs -support: -- administrator -- team management ---- -To delete a team from an account: - -- Access team settings as an admin. -- Click the **Delete** button at the bottom of the page. \ No newline at end of file diff --git a/content/en/support/kb-articles/didnt_name_run_run_name_coming.md b/content/en/support/kb-articles/didnt_name_run_run_name_coming.md deleted file mode 100644 index eb16f95d8e..0000000000 --- a/content/en/support/kb-articles/didnt_name_run_run_name_coming.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -url: /support/:filename -title: "I didn't name my run. Where is the run name coming from?" -toc_hide: true -type: docs -support: - - experiments ---- -If a run is not explicitly named, W&B assigns a random name to identify it in your project. Examples of random names are `pleasant-flower-4` and `misunderstood-glade-2. \ No newline at end of file diff --git a/content/en/support/kb-articles/difference_log_summary.md b/content/en/support/kb-articles/difference_log_summary.md deleted file mode 100644 index c9d00837de..0000000000 --- a/content/en/support/kb-articles/difference_log_summary.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -url: /support/:filename -title: "What is the difference between `.log()` and `.summary`?" -toc_hide: true -type: docs -support: - - Charts ---- -The summary displays in the table, while the log saves all values for future plotting. - -For instance, call `run.log()` whenever accuracy changes. By default, `run.log()` updates the summary value unless set manually for that metric. - -The scatterplot and parallel coordinate plots use the summary value, while the line plot shows all values recorded by `run.log`. - -Some users prefer to set the summary manually to reflect the optimal accuracy instead of the most recent accuracy logged. \ No newline at end of file diff --git a/content/en/support/kb-articles/difference_team_entity_user_entity_mean_me.md b/content/en/support/kb-articles/difference_team_entity_user_entity_mean_me.md deleted file mode 100644 index 0e251c1cfe..0000000000 --- a/content/en/support/kb-articles/difference_team_entity_user_entity_mean_me.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -url: /support/:filename -title: "What is the difference between team and entity? As a user - what does entity mean for me?" -toc_hide: true -type: docs -support: - - team management ---- -A team serves as a collaborative workspace for users working on the same projects. An entity represents either a username or a team name. When logging runs in W&B, set the entity to a personal or team account using `wandb.init(entity="example-team")`. \ No newline at end of file diff --git a/content/en/support/kb-articles/difference_team_organization.md b/content/en/support/kb-articles/difference_team_organization.md deleted file mode 100644 index 5829e8e6ea..0000000000 --- a/content/en/support/kb-articles/difference_team_organization.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -url: /support/:filename -title: "What is the difference between team and organization?" -toc_hide: true -type: docs -support: - - team management - - administrator ---- -A team serves as a collaborative workspace for users working on the same projects. An organization functions as a higher-level entity that can include multiple teams, often related to billing and account management. \ No newline at end of file diff --git a/content/en/support/kb-articles/difference_wandbinit_modes.md b/content/en/support/kb-articles/difference_wandbinit_modes.md deleted file mode 100644 index b272138142..0000000000 --- a/content/en/support/kb-articles/difference_wandbinit_modes.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -url: /support/:filename -title: "What is the difference between wandb.init modes?" -toc_hide: true -type: docs -support: - - experiments ---- -These modes are available: - -* `online` (default): The client sends data to the wandb server. -* `offline`: The client stores data locally on the machine instead of sending it to the wandb server. Use the [`wandb sync`]({{< relref "/ref/cli/wandb-sync.md" >}}) command to synchronize the data later. -* `disabled`: The client simulates operation by returning mocked objects and prevents any network communication. All logging is turned off, but all API method stubs remain callable. This mode is typically used for testing. \ No newline at end of file diff --git a/content/en/support/kb-articles/different_tensorboard.md b/content/en/support/kb-articles/different_tensorboard.md deleted file mode 100644 index 6cc6a723b3..0000000000 --- a/content/en/support/kb-articles/different_tensorboard.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -url: /support/:filename -title: "How is W&B different from TensorBoard?" -toc_hide: true -type: docs -support: - - tensorboard ---- - -W&B integrates with TensorBoard and improves experiment tracking tools. The founders created W&B to address common frustrations faced by TensorBoard users. Key improvements include: - -1. **Model Reproducibility**: W&B facilitates experimentation, exploration, and model reproduction. It captures metrics, hyperparameters, code versions, and saves model checkpoints to ensure reproducibility. - -2. **Automatic Organization**: W&B streamlines project handoffs and vacations by providing an overview of all attempted models, which saves time by preventing the re-execution of old experiments. - -3. **Quick Integration**: Integrate W&B into your project in five minutes. Install the free open-source Python package and add a few lines of code. Logged metrics and records appear with each model run. - -4. **Centralized Dashboard**: Access a consistent dashboard regardless of where training occurs—locally, on lab clusters, or cloud spot instances. Eliminate the need to manage TensorBoard files across different machines. - -5. **Robust Filtering Table**: Search, filter, sort, and group results from various models efficiently. Easily identify the best-performing models for different tasks, an area where TensorBoard often struggles with larger projects. - -6. **Collaboration Tools**: W&B enhances collaboration for complex machine learning projects. Share project links and utilize private teams for result sharing. Create reports with interactive visualizations and markdown descriptions for work logs or presentations. diff --git a/content/en/support/kb-articles/downgrade_subscription_plan.md b/content/en/support/kb-articles/downgrade_subscription_plan.md deleted file mode 100644 index af48d4ecff..0000000000 --- a/content/en/support/kb-articles/downgrade_subscription_plan.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -url: /support/:filename -title: How do I downgrade my subscription plan? -toc_hide: true -type: docs -support: -- billing -- administrator ---- -To downgrade a subscription plan, contact the support team at support@wandb.com with your current plan details and the desired plan. \ No newline at end of file diff --git a/content/en/support/kb-articles/edit_share_reports.md b/content/en/support/kb-articles/edit_share_reports.md deleted file mode 100644 index 012d7c91fa..0000000000 --- a/content/en/support/kb-articles/edit_share_reports.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -url: /support/:filename -title: Who can edit and share reports? -toc_hide: true -type: docs -support: -- reports ---- -Reports created within an individual's private project remain visible only to that user. The user can share their project with a team or the public. - -In team projects, the administrator or the member who created the report can toggle permissions between edit and view access for other team members. Team members can share reports. - -To share a report, select the **Share** button in the upper right corner. Provide an email address or copy the magic link. Users invited by email must log into W&B to view the report, while users with a magic link do not need to log in. - -Shared reports maintain view-only access. \ No newline at end of file diff --git a/content/en/support/kb-articles/embedding_reports.md b/content/en/support/kb-articles/embedding_reports.md deleted file mode 100644 index c2ab782f02..0000000000 --- a/content/en/support/kb-articles/embedding_reports.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -url: /support/:filename -title: "Embedding Reports" -toc_hide: true -type: docs -support: - - reports ---- -You can share your report by embedding it. Click the **Share** button at the top right of your report, then copy the embedded code from the bottom of the pop-up window. - -{{< img src="/images/reports/emgedding_reports.gif" alt="Embedding reports" >}} \ No newline at end of file diff --git a/content/en/support/kb-articles/enable_code_logging_sweeps.md b/content/en/support/kb-articles/enable_code_logging_sweeps.md deleted file mode 100644 index 2c109818e1..0000000000 --- a/content/en/support/kb-articles/enable_code_logging_sweeps.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -url: /support/:filename -title: "How do I enable code logging with Sweeps?" -toc_hide: true -type: docs -support: - - sweeps ---- -To enable code logging for sweeps, add `wandb.log_code()` after initializing the W&B Run. This action is necessary even when code logging is enabled in the W&B profile settings. For advanced code logging, refer to the [docs for `wandb.log_code()` here]({{< relref "/ref/python/experiments/run#log_code" >}}). \ No newline at end of file diff --git a/content/en/support/kb-articles/environment_variables_overwrite_parameters.md b/content/en/support/kb-articles/environment_variables_overwrite_parameters.md deleted file mode 100644 index 9e69aa145c..0000000000 --- a/content/en/support/kb-articles/environment_variables_overwrite_parameters.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -url: /support/:filename -title: Do environment variables overwrite the parameters passed to wandb.init()? -toc_hide: true -type: docs -support: -- environment variables ---- -Arguments passed to `wandb.init` override environment variables. To set a default directory other than the system default when the environment variable isn't set, use `wandb.init(dir=os.getenv("WANDB_DIR", my_default_override))`. \ No newline at end of file diff --git a/content/en/support/kb-articles/est_runs_column.md b/content/en/support/kb-articles/est_runs_column.md deleted file mode 100644 index d1e036a1cb..0000000000 --- a/content/en/support/kb-articles/est_runs_column.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -url: /support/:filename -title: "What is the `Est. Runs` column?" -toc_hide: true -type: docs -support: - - sweeps - - hyperparameter ---- -W&B provides an estimated number of Runs generated when creating a W&B Sweep with a discrete search space. This total reflects the cartesian product of the search space. - -For instance, consider the following search space: - -{{< img src="/images/sweeps/sweeps_faq_whatisestruns_1.png" alt="Estimated runs column" >}} - -In this case, the Cartesian product equals 9. W&B displays this value in the App UI as the estimated run count (**Est. Runs**): - -{{< img src="/images/sweeps/spaces_sweeps_faq_whatisestruns_2.webp" alt="Sweep run estimation" >}} - -To retrieve the estimated Run count programmatically, use the `expected_run_count` attribute of the Sweep object within the W&B SDK: - -```python -sweep_id = wandb.sweep( - sweep_configs, project="your_project_name", entity="your_entity_name" -) -api = wandb.Api() -sweep = api.sweep(f"your_entity_name/your_project_name/sweeps/{sweep_id}") -print(f"EXPECTED RUN COUNT = {sweep.expected_run_count}") -``` \ No newline at end of file diff --git a/content/en/support/kb-articles/export_list_users_account.md b/content/en/support/kb-articles/export_list_users_account.md deleted file mode 100644 index 0a38f3c588..0000000000 --- a/content/en/support/kb-articles/export_list_users_account.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -url: /support/:filename -title: How do I export a list of users from my W&B Organisation? -toc_hide: true -type: docs -support: -- administrator -- user management ---- -To export a list of users from a W&B organization, an admin uses the SCIM API with the following code: - -```python -import base64 -import requests - -def encode_base64(username, key): - auth_string = f'{username}:{key}' - return base64.b64encode(auth_string.encode('utf-8')).decode('utf-8') - -username = '' # Organization admin username -key = '' # API key -scim_base_url = 'https://api.wandb.ai/scim/v2' -users_endpoint = f'{scim_base_url}/Users' -headers = { - 'Authorization': f'Basic {encode_base64(username, key)}', - 'Content-Type': 'application/scim+json' -} - -response = requests.get(users_endpoint, headers=headers) -users = [] -for user in response.json()['Resources']: - users.append([user['userName'], user['emails']['Value']]) -``` - -Modify the script to save the output as needed. \ No newline at end of file diff --git a/content/en/support/kb-articles/fetch_version_ids_etags_wb.md b/content/en/support/kb-articles/fetch_version_ids_etags_wb.md deleted file mode 100644 index a86dcdb2ec..0000000000 --- a/content/en/support/kb-articles/fetch_version_ids_etags_wb.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -url: /support/:filename -title: "How can I fetch these Version IDs and ETags in W&B?" -toc_hide: true -type: docs -support: - - artifacts ---- -If an artifact reference is logged with W&B and versioning is enabled on the buckets, the version IDs appear in the Amazon S3 UI. To retrieve these version IDs and ETags in W&B, fetch the artifact and access the corresponding manifest entries. For example: - -```python -artifact = run.use_artifact("my_table:latest") -for entry in artifact.manifest.entries.values(): - versionID = entry.extra.get("versionID") - etag = entry.extra.get("etag") -``` \ No newline at end of file diff --git a/content/en/support/kb-articles/files_check_code_crashes.md b/content/en/support/kb-articles/files_check_code_crashes.md deleted file mode 100644 index 81b456fe49..0000000000 --- a/content/en/support/kb-articles/files_check_code_crashes.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -url: /support/:filename -title: "Which files should I check when my code crashes?" -toc_hide: true -type: docs -support: - - logs ---- -For the affected run, check `debug.log` and `debug-internal.log` in `wandb/run-_