Logo Torchtalk Setup

Torchtalk Setup

Tổ chức
opendatahub-io
torchtalk-setup

Install and configure TorchTalk MCP server for PyTorch cross-language analysis

Tổng quan

Nhà phát hànhopendatahub-io
Kho mãai-helpers
Tên kỹ năngtorchtalk-setup
Sao
39
Bản fork
76
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépApache-2.0
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được opendatahub-io công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Torchtalk Setup trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/opendatahub-io/ai-helpers/tree/main/plugins/odh-pytorch/skills/torchtalk-setup
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/opendatahub-io/ai-helpers.git /tmp/ai-helpers
mkdir -p .claude/skills
cp -r /tmp/ai-helpers/plugins/odh-pytorch/skills/torchtalk-setup .claude/skills/torchtalk-setup
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Torchtalk Setup trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Torchtalk Setup ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Torchtalk Setup với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Name

odh-ai-helpers:torchtalk-setup

Synopsis

text
/torchtalk:setup

Description

The torchtalk:setup command guides you through the complete installation and configuration of the TorchTalk MCP server, which enables cross-language binding analysis for PyTorch codebases (Python/C++/CUDA). This command:

  • Checks for and installs required dependencies (Python 3.10+, pip)
  • Clones and builds TorchTalk from source
  • Locates or clones PyTorch source code
  • Configures TorchTalk with the PyTorch source path
  • Registers the MCP server with Claude Code at user scope
  • Verifies the complete setup

After setup, you can use /torchtalk:trace and the full suite of TorchTalk MCP tools across all Claude Code sessions.

Implementation

Phase 1: Check Prerequisites

1.1 Verify Python Version
bash
python3 --version

Minimum required: Python 3.10

If Python is too old or missing:

text
Python 3.10+ is required for TorchTalk.

Install or upgrade Python:
- macOS: brew install python@3.12
- Ubuntu/Debian: sudo apt install python3.12
- Fedora/RHEL: sudo dnf install python3.12
1.2 Verify pip
bash
python3 -m pip --version

If pip is missing, provide platform-specific installation instructions.

1.3 Check for Existing TorchTalk Installation
bash
which torchtalk

If torchtalk is found:

  • Run torchtalk status to show current configuration
  • Ask the user if they want to:
    1. Reconfigure the existing installation
    2. Reinstall from scratch
    3. Exit setup

Phase 2: Install TorchTalk

2.1 Determine Installation Location

Ask the user where they want to install TorchTalk:

text
Where would you like to install TorchTalk?

1. ~/src/torchtalk (recommended)
2. ~/.local/share/torchtalk
3. Custom path

Store the chosen directory as $TORCHTALK_DIR.

2.2 Clone the Repository
bash
mkdir -p "$(dirname "$TORCHTALK_DIR")"
git clone https://github.com/adabeyta/torchtalk.git "$TORCHTALK_DIR"

Handle errors:

  • Directory already exists: Ask to use existing or remove and re-clone
  • Network issues: Provide troubleshooting steps
  • Permission issues: Suggest a different directory
2.3 Install from Source
bash
cd "$TORCHTALK_DIR"
pip install -e .

Verify installation:

bash
torchtalk --help

If install fails:

  • Check Python version meets minimum requirements
  • Check for missing system dependencies (libclang may need system packages)
  • Display error message and suggest checking the TorchTalk README

If libclang fails to install:

text
libclang requires the clang development libraries.

Install:
- macOS: xcode-select --install (usually already present)
- Ubuntu/Debian: sudo apt install libclang-dev
- Fedora/RHEL: sudo dnf install clang-devel

Phase 3: Locate PyTorch Source

3.1 Check for Existing PyTorch Source

Search common locations:

bash
echo "$PYTORCH_SOURCE"
ls -d ~/pytorch ~/src/pytorch /myworkspace/pytorch 2>/dev/null

If PyTorch source is found, confirm with the user:

text
Found PyTorch source at: /path/to/pytorch

Is this the correct PyTorch source directory? (y/n)
3.2 If Not Found, Ask the User
text
PyTorch source code is required for TorchTalk to index bindings.

Options:
1. Enter the path to an existing PyTorch checkout
2. Clone PyTorch now (requires ~2GB disk space, takes a few minutes)
3. Exit setup and clone manually

If cloning:

bash
git clone https://github.com/pytorch/pytorch "$PYTORCH_CLONE_DIR"

Store the PyTorch path as $PYTORCH_SOURCE.

3.3 Validate PyTorch Source

Run checks separately so users get actionable error messages:

bash
test -d "$PYTORCH_SOURCE/torch"

If the torch/ directory is missing:

text
No 'torch/' directory found — does not appear to be a PyTorch checkout.
Please verify the path and try again.
bash
test -f "$PYTORCH_SOURCE/aten/src/ATen/native/native_functions.yaml"

If native_functions.yaml is missing:

text
native_functions.yaml not found (required for operator indexing).
The PyTorch checkout may be incomplete or too old.
Consider running: cd "$PYTORCH_SOURCE" && git pull

These checks mirror TorchTalk's validate_pytorch_path() which validates both the torch/ directory and native_functions.yaml.

Phase 4: Configure TorchTalk

4.1 Run TorchTalk Init
bash
torchtalk init --pytorch-source "$PYTORCH_SOURCE"

This writes the PyTorch path to ~/.config/torchtalk/config.toml so future runs need no arguments.

Verify configuration:

bash
torchtalk status

Confirm the output shows:

  • Config file exists
  • PyTorch source is valid
  • Status is Ready
4.2 Register MCP Server with Claude Code
bash
claude mcp add torchtalk -s user -- torchtalk mcp-serve

This registers TorchTalk at user scope, making it available across all Claude Code sessions regardless of working directory.

If claude command is not found:

text
The Claude Code CLI is required to register MCP servers.

If you're running this from within Claude Code, the registration
may need to be done from a terminal. Copy and run:

  claude mcp add torchtalk -s user -- torchtalk mcp-serve

Phase 5: Verify Setup

Run validation checks to confirm torchtalk status reports all green and mcp-serve starts without errors:

bash
torchtalk status
timeout 5 torchtalk mcp-serve 2>&1 || true

Display summary:

text
Setup Complete!
===============

  TorchTalk installed at:  $TORCHTALK_DIR
  PyTorch source:          $PYTORCH_SOURCE
  Config file:             ~/.config/torchtalk/config.toml
  MCP server:              Registered at user scope

Next Steps:
-----------

1. Restart Claude Code to activate the MCP server

2. Verify MCP tools are available:
   Run: mcp__torchtalk__get_status

3. Trace your first operator:
   /torchtalk:trace matmul

Optional - Build PyTorch for full call graph support:
   cd $PYTORCH_SOURCE && python setup.py develop

Available Commands:
-------------------
- /torchtalk:trace <function> [focus]  -- Trace binding chains
- The TorchTalk Analyzer skill handles broader questions like
  "How does nn.Linear work?" or "What breaks if I change gemm?"

Documentation:
--------------
- TorchTalk: https://github.com/adabeyta/torchtalk

Phase 6: Optional Call Graph Setup

After the main setup is complete, inform the user about optional advanced features:

text
Optional: C++ Call Graph Support
================================

TorchTalk can analyze C++ function call relationships (impact analysis,
caller/callee tracking) if PyTorch has been built at least once.

This generates compile_commands.json which TorchTalk uses for
libclang-based static analysis.

Would you like to:
1. Skip for now (you can build later)
2. Learn how to build PyTorch

If the user wants build instructions:

text
Building PyTorch (one-time, takes 30-60 minutes):

  cd $PYTORCH_SOURCE
  python setup.py develop

After building, the call graph features (impact, calls, called_by)
will be automatically available on the next Claude Code session.

Check if compile_commands.json already exists:

bash
test -f "$PYTORCH_SOURCE/build/compile_commands.json" && echo "found" || echo "not found"

If found: compile_commands.json already exists. Call graph features are available.

Return Value

  • Success: Installation path, config file location, MCP server registration confirmation, and summary of next steps
  • Partial Success: List of completed and failed steps with instructions to complete remaining setup manually
  • Error: Detailed error message, step where failure occurred, and troubleshooting suggestions

Examples

  1. Fresh install with existing PyTorch source:

    text
    /torchtalk:setup
    
    > Python 3.12.1 detected
    > Installing TorchTalk to ~/src/torchtalk...
    > Found PyTorch source at ~/pytorch
    > Running torchtalk init...
    > Registering MCP server...
    
    Setup complete! Restart Claude Code to activate.
  2. Fresh install, clone everything:

    text
    /torchtalk:setup
    
    > Python 3.11.5 detected
    > Installing TorchTalk to ~/src/torchtalk...
    > Cloning PyTorch to ~/src/pytorch...
    > Running torchtalk init...
    > Registering MCP server...
    
    Setup complete! Restart Claude Code to activate.
  3. Reconfigure existing installation:

    text
    /torchtalk:setup
    
    > TorchTalk already installed at ~/src/torchtalk
    > Reconfigure? yes
    > Updating PyTorch source path...
    > Re-registering MCP server...
    
    Reconfiguration complete!

Error Handling

libclang Installation Failure

Scenario: pip install -e . fails on the libclang dependency.

Action:

text
libclang failed to install. This is usually a missing system package.

Install the clang development libraries:
- macOS: xcode-select --install
- Ubuntu/Debian: sudo apt install libclang-dev
- Fedora/RHEL: sudo dnf install clang-devel

Then retry: pip install -e .

PyTorch Source Too Old or Incomplete

Scenario: The PyTorch checkout is missing expected files.

Action:

text
The PyTorch source may be incomplete or too old.

Expected files not found:
- aten/src/ATen/native/native_functions.yaml

Try updating your PyTorch checkout:
  cd $PYTORCH_SOURCE && git pull

Or clone a fresh copy:
  git clone https://github.com/pytorch/pytorch

MCP Server Registration Failure

Scenario: claude mcp add command fails.

Action:

text
Failed to register MCP server with Claude Code.

You can register manually by running in a terminal:
  claude mcp add torchtalk -s user -- torchtalk mcp-serve

Or add to ~/.claude.json manually:
  {
    "mcpServers": {
      "torchtalk": {
        "command": "torchtalk",
        "args": ["mcp-serve"]
      }
    }
  }

See Also

Arguments

  • This command takes no arguments. All configuration is collected interactively.

Câu hỏi thường gặp

Kỹ năng AI Torchtalk Setup làm được gì?

Install and configure TorchTalk MCP server for PyTorch cross-language analysis

Vì sao nên dùng Torchtalk Setup trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Torchtalk Setup là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Torchtalk Setup trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/opendatahub-io/ai-helpers/tree/main/plugins/odh-pytorch/skills/torchtalk-setup. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Torchtalk Setup?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Torchtalk Setup với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Torchtalk Setup với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Torchtalk Setup có miễn phí không?

Có. Kỹ năng này được opendatahub-io phát hành trên GitHub theo giấy phép Apache-2.0. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇