pytorch-model-recovery

Reconstruct PyTorch model architectures from weight files and state dictionaries.

Updated Feb 24, 2026
One-click install
npx skills add https://github.com/Zurybr/lefarma-skills --skill pytorch-model-recovery
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytorch-model-recovery
Source: https://github.com/Zurybr/lefarma-skills/tree/main/letta/benchmarks/trajectory-only/pytorch-model-recovery
Command: npx skills add https://github.com/Zurybr/lefarma-skills --skill pytorch-model-recovery

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch, numpy, and includes references (resource) components.

What problem does it solve?

This Skill addresses the challenge of reconstructing PyTorch models when only weight files or state dictionaries are available, often due to missing source code or corrupted saves.

Core Features & Use Cases

  • Architecture Inference: Reconstruct model architecture by analyzing weight tensor shapes and naming conventions.
  • Weight Reconstruction: Load and verify state dictionaries against inferred architectures.
  • CPU-Optimized Execution: Provides strategies for efficient model recovery in CPU-constrained environments.
  • Use Case: Recover a critical machine learning model from a saved .pt file when the original Python code defining the model architecture is lost.

Quick Start

Use the pytorch-model-recovery skill to reconstruct a PyTorch model from the provided 'model_weights.pt' file.

Frequently Asked Questions about pytorch-model-recovery

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reconstruct a PyTorch model from a state dictionary without the original source code?

Reconstructing a PyTorch model from a state dictionary involves inferring the architecture by analyzing weight tensor shapes and naming patterns, then validating the saved weights against the generated structure.

Can I recover PyTorch weights from a .pt file in a CPU-limited environment?

Yes, you can recover PyTorch weights in a CPU-limited environment by applying CPU-optimized execution strategies that efficiently rebuild and validate models from saved artifacts without GPU acceleration.

What is architecture inference for PyTorch weight reconstruction?

Architecture inference for PyTorch weight reconstruction is the process of determining a model's layer structure by analyzing the dimensions of tensor weights and their naming conventions within a state dictionary.

Does this model recovery approach require GPU acceleration to rebuild a state dictionary?

No, this model recovery approach does not require GPU acceleration, as it specifically provides deterministic architecture rebuilding and weight validation strategies tailored for CPU-constrained execution environments.

How to validate inferred PyTorch architectures against saved weights?

To validate inferred PyTorch architectures against saved weights, you load the state dictionary into the reconstructed model structure and verify that all tensor shapes and naming patterns deterministically match the original artifacts.