(self, train_file, tokenizer, max_len=2048, sample=-1, test=False, seed=0, category="", K=4, dedup=False)
| 468 | |
| 469 | class SidSFTDataset_GPR(CSVBaseDataset): |
| 470 | def __init__(self, train_file, tokenizer, max_len=2048, sample=-1, test=False, seed=0, category="", K=4, dedup=False): |
| 471 | super().__init__(train_file, sample, seed, max_len, category, dedup, tokenizer, test) |
| 472 | |
| 473 | # Try to load features from standard location |
| 474 | try: |
| 475 | with open(f'data/{category}/{category}.user.json', 'r') as f: |
| 476 | self.user_features = json.load(f) |
| 477 | except FileNotFoundError: |
| 478 | try: |
| 479 | dataset_dir = os.path.dirname(train_file) |
| 480 | # Assuming structure data/Amazon/train/Sports... -> data/Sports/Sports.user.json |
| 481 | with open(f'data/{category}/{category}.user.json', 'r') as f: |
| 482 | self.user_features = json.load(f) |
| 483 | except: |
| 484 | self.user_features = {} |
| 485 | |
| 486 | try: |
| 487 | with open(f'data/{category}/{category}.item.json', 'r') as f: |
| 488 | self.item_features = json.load(f) |
| 489 | except FileNotFoundError: |
| 490 | self.item_features = {} |
| 491 | |
| 492 | self.get_inputs() |
| 493 | |
| 494 | def get_history(self, row): |
| 495 | row['history_item_sid'] = eval(row['history_item_sid']) |
nothing calls this directly
no test coverage detected