Skip to content

Instantly share code, notes, and snippets.

View shresthakamal's full-sized avatar
🏠
Working from home

Kamal Shrestha shresthakamal

🏠
Working from home
View GitHub Profile
@shresthakamal
shresthakamal / dataset.py
Last active November 2, 2024 12:14
Custom Dataset in Pytorch from Pandas Dataframe
from torch.utils.data import Dataset
class CustomTrainDataset(Dataset):
def __init__(self, df, tokenizer):
self.df = df
self.tokenizer = tokenizer
def __len__(self):
return len(self.df)
""" Pytest Notes
Tests increases your confidence that the code behaves as you expect and ensures that changes to your code won’t cause regressions.
- Several short comming of unittest
- Need to import Test case class
- Define a function for each test cases
-
- With pytest common t tasks takes les code time saving commands for advanced tasks
@shresthakamal
shresthakamal / sampleREADME.md
Last active July 20, 2022 05:53 — forked from FrancesCoronel/sampleREADME.md
A sample README for all your GitHub projects.

#Kamal Shrestha