Skip to content

Instantly share code, notes, and snippets.

View nraw's full-sized avatar
😄
happy

nraw nraw

😄
happy
View GitHub Profile
import re
def remove_leading_whitespace(text):
leading_whitespace_match = re.match(r'(^[^\S\n]*)\w', text)
if leading_whitespace_match is not None:
leading_whitespace = leading_whitespace_match[1]
else:
return text
num_spaces = len(leading_whitespace)
@nraw
nraw / torch_model.py
Last active August 15, 2023 10:19
Kedro Pytorch Model io
""" Kedro Torch Model IO
Models need to be imported and added to the dictionary
as shown with the ExampleModel
Example of catalog entry:
modo:
type: kedro_example.io.torch_model.TorchLocalModel
filepath: modo.pt