|
|
|
|
|
from dataset import PasswordTesterDataset |
|
|
import torch |
|
|
import json |
|
|
|
|
|
class DualityAI: |
|
|
def __init__(self, config_path): |
|
|
with open(config_path) as f: |
|
|
self.config = json.load(f) |
|
|
self.dataset = PasswordTesterDataset( |
|
|
self.config['safetensors_file'], |
|
|
self.config['tokenizer_file'] |
|
|
) |
|
|
|
|
|
def interact(self, index=0): |
|
|
|
|
|
body = self.dataset[index] |
|
|
|
|
|
mind = body.float() / 255.0 |
|
|
return {'BODY': body, 'MIND': mind} |
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
ai = DualityAI("config.json") |
|
|
result = ai.interact(0) |
|
|
print("BODY tensor:", result['BODY']) |
|
|
print("MIND tensor:", result['MIND']) |
|
|
|