hlky's picture
Upload folder using huggingface_hub
fb74498 verified
Raw
History Blame Contribute Delete
590 Bytes
from pathlib import Path
MARKER_DIR = Path('automodel_poc')
MARKER_DIR.mkdir(parents=True, exist_ok=True)
(MARKER_DIR / 'import_executed.txt').write_text('evil module imported\n')
class UNet2DConditionModel:
@classmethod
def from_pretrained(cls, pretrained_model_or_path, **kwargs):
MARKER_DIR.mkdir(parents=True, exist_ok=True)
(MARKER_DIR / 'from_pretrained_executed.txt').write_text(
f'from_pretrained called path={pretrained_model_or_path} kwargs={kwargs}\n'
)
print('EVIL_FROM_PRETRAINED_EXECUTED')
return cls()