INNER CODE UNIT · Python
__len__
Koziev/NLP_Datasets · Conversations/Data/run_chitchat_query.py:34
def __len__(self):
return len(self.examples)
def __getitem__(self, idx):
if torch.is_tensor(idx):
idx = idx.tolist()
sample = self.examples[idx]
if self.transform:
sample = self.transform(sample)
return sample
if __name__ == '__main__':
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model_dir = os.path.expanduser('~/polygon/chatbot/tmp/rugpt_chitchat')