Changelog:
-
Encapsulation:
- Enclosed both
MaxViT
andRT2
functionalities within a single class namedRT2
to streamline the initialization and usage process.
- Enclosed both
-
Default Parameters:
- Set default values for various parameters in the
RT2
class. This allows users to instantiate the class without having to provide every single parameter, unless they need a non-default configuration.
- Set default values for various parameters in the
-
Training and Evaluation Modes:
- Introduced
train()
andeval()
methods to easily toggle between training and evaluation modes for theRT2
model, reflecting standard practice in PyTorch.
- Introduced
-
Unified Forward Method:
- Created a
__call__
method that wraps around the forward method of theRT2
model. This provides an intuitive way to process videos and instructions by directly invoking the instance of theRoboticTransformer
class.
- Created a
-
Conditional Execution:
- Modified the forward process (via the
__call__
method) to conditionally use thecond_scale
argument if provided, ensuring that it's used only during evaluation as hinted in the provided code.
- Modified the forward process (via the
-
Example Usage:
- Added an example at the end to demonstrate how to use the new
RT2
class for training and evaluation.
- Added an example at the end to demonstrate how to use the new
Overall, these changes are geared towards making the code more user-friendly and modular, encapsulating intricacies, and providing a more Pythonic interface to users.