MCPcopy Create free account
hub / github.com/AkaliKong/MiniOneRec / __init__

Method __init__

data.py:470–492  ·  view source on GitHub ↗
(self, train_file, tokenizer, max_len=2048, sample=-1, test=False, seed=0, category="", K=4, dedup=False)

Source from the content-addressed store, hash-verified

468
469class 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'])

Callers

nothing calls this directly

Calls 2

__init__Method · 0.45
get_inputsMethod · 0.45

Tested by

no test coverage detected