Team Members:
1. Singamsetty Sandeep (213050064)
2. Saswat Meher (22m0804)


Requirements:
Pytorch
Python3
Keras
Transformers
Datasets
numpy
scipy
sklearn
tensorflow
sklearn_crfsuite

Hardware Requirements:
>15 GB Ram
For BERT based model: GPU

Setup before running:
preprocesses data can be donwloaded from: https://drive.google.com/drive/folders/13bpmwRF5TV9ssU8eQgwXlvaLvp0nvqvW?usp=sharing
from folder additional. those are (train/test/dev)_data_preprocessed.json
keep them in the same folder as code.


Execution and Reproducing Results:

CRF:
Folder: /code/CRF_NER
File: crf_sklearn.py

To train using test data and predict for test data 
Run: python crf_sklearn.py
Make sure the files used in this code, train_data_preprocessed.json etc. exist in the same folder.
You can also try running CRF.py which is an extention Prof. Soumen's code. But will take more that 6Hrs
for 1 epoch in cpu. Was failing to load in GPU because of the size.

LSTM:
Folder: /code/LSTM_NER
File: lstm_ner.py

To train call the train() function.
The test() function is also included to test for one example.
All the predefined parameters are included. (epochs etc.)
Make sure the files used in this code, train_data_preprocessed.json etc. exist in the same folder.

BERT:

Folder: /code/BERT_NER
File: bert_ner.py

To train call the train() function.
The test() function is also included to test for one example.

Note: 

All the predefined parameters are included. (epochs etc.)
Make sure the files used in this code, train_data_preprocessed.json etc. exist in the same folder.
Also make sure you have GPU. Also, for seqeval of distilbert-base-uncased, Nvidia libraries are required. Depends on GPU configuration, so not mentioning them here. The model checkpoint used Hugging face API to access the base model, so make sure connection is accessible.









Erasing Concepts from Diffusion Models (ESD)

Our project aims to address concerns regarding large-scale diffusion models producing undesirable output such as sexually inappropriate content or copyrighted artistic styles. We analyze a fine-tuning method that can erase specific visual concepts from pre-trained diffusion model weights, given only the name of the style.
This approach offers several advantages over existing methods. Firstly, we can remove concepts from a diffusion model permanently, rather than modifying the output at inference time. This makes the method more secure and less prone to being circumvented even if a user has access to model weights. Secondly, we want to perform comparative analysis of the ESD method against existing approaches and demonstrate its effectiveness.
Overall, our project seeks to analyze the current novel method for erasing specific visual concepts from diffusion model weights, addressing concerns about the production of undesirable output.
Related Papers:
https://arxiv.org/pdf/2303.07345.pdf


Ideas from: 
https://arxiv.org/abs/2207.12598
https://arxiv.org/abs/2004.06030
https://arxiv.org/pdf/2211.05105.pdf SLD

https://proceedings.mlr.press/v162/ravfogel22a.html
https://arxiv.org/abs/2111.08947
https://arxiv.org/abs/2007.15646
https://arxiv.org/abs/2209.02299
https://arxiv.org/abs/1912.03817
https://arxiv.org/abs/2104.08164 for LMs
https://arxiv.org/abs/1911.04933

https://arxiv.org/abs/2303.05699

Timeline:
Week 1:
Studying ESD paper and its references

Week 2:
Training diffusion model on custom constraints

Week 3:
Running various experiments, to analyse performance of our model.

Week 4:
Documentation of experiments and results, and exploring future works.


