-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reproduce the Abt-Buy and Amazon-Google results #2
Comments
Hi, when you run the Starting from these source datasets, the datasets are further processed in the Some further processing like for example the serialization into a string and the application of a transformer tokenizer is then finally done in the datasets classes defined in the datasets.py script under src/contrastive/data If you follow the instructions in the README.MD you should be able to follow along the code and reproduce the exact results from the paper. |
@rpeeters85 Although I read our code carefully, I didn't find the implementation of Batch Building Process mentioned in paper. Perhaps I have overlooked some details, please advise me.
|
The batch building process for contrastive training is found in the respective You will see here that we do not only select a single item but always also a corresponding positive to that item which is a little bit different from the original SupCon implementation which uses two augmented views of the same example at this point. Augmentation in the R-SupCon implementation is thus entirely optional. Comprising the batches of such "pairs" of matching examples is handled by the transformers library in the background this is not explicitly handled in this code. After a batch is built it is passed to the corresponding data_collator in For example the output of the DataCollatorContrastivePretrain is a batch of inputs, each comprised of a (optionally augmented) single example and a randomly selected positive with their corresponding label. I hope this clears up the batch building procedure and where to find it, let me know if something remains unclear. |
how about the contrastive learning in finetuning steps? |
@ptyshevs hi, did you reproduce the results described in the paper? or lspc ? |
@rpeeters85 Hi,
The second time I followed your script, the environment was consistent, and I could run through it directly, but the f1-score was f1 =0.7846 (split + aug) f1 =0.851153039 (nosplit) on abtbuy dataset
|
In the relevant script files (pretraining and fine-tuning) a random seed is set to make the results reproducible so there should be no change in F1 across multiple runs. For what datasets are the F1s? If it is the LSPC, those should not be used with the nosplit/split option at all since this is just relevant for the source-aware sampling in the deepmatcher datasets. I don't understand what you mean by changing collators, there is one collator to handle the pretraining (either DataCollatorContrastivePretrain for LSPC datasets or DataCollatorContrastivePretrainDeepmatcher for the Deepmatcher datasets) and one to handle the fine-tuning step DataCollatorContrastiveClassification. Both are imported and set in the respective script files (e.g. run_pretraining.py/run_pretraining_deepmatcher.py for pretraining and run_finetune_siamese.py for fine-tuning) Regarding your second comment: There is no contrastive learning in the fine-tuning stage. Here the batch building process is based on the pairs found in the predefined train/validation/test splits which are subsequently embedded using the frozen pretrained transformer, combined using the combination presented in the paper (this happens in the forward method of the classification model) and passed to a linear layer for the matching/non-matching decisison. |
@rpeeters85 thank you for your time,
that is may be caused by env. I have solved it by create new env as yours. the score I can reproduce your results on lspc after I use the env as yours. I confused by the results scores on abtbuy datasets. How about your running in a single GPU or multi-GPUs? if you are using multi-GPUs, how many are used in your experiments? |
Yes those results are low for abtbuy and nosplit should actually perform much worse than split. I am only running on single GPUs. I do not know what happens if you try multi-GPU training. This will be handled somewhere in the huggingface code and I would assume it does not work with my custom batch building in the collators since they are somewhat different compared to a default huggingface batch for RoBERTa. Did you get your results with multi-gpu training? If yes, definitely use only single GPUs and report back. If not, I can try rerunning this repo from scratch for abt-buy in the coming days to try and reproduce the problem. |
About the performance of a single GPU and multi-GPU, I try to verify it. and I found that I obtain a normal score on abtbuy datasets with a single GPU. this is so strange. I have a question about the code : contrastive-product-matching/src/processing/preprocess/preprocess-deepmatcher-datasets.py Line 58 in bfcf91f
if condition during training, this code will print some numbers as follows:
I have tried to find it in the code. I thought it is caused by transformers data collators. if you can tell me without much effort, I will thanks so much, if it no attracts your attention, I can see more transformers details by myself. |
Hi, couldn't find the preprocessing you've done for the mentioned datasets. Curious to see how to obtain the similar metrics as you've reported in your paper
The text was updated successfully, but these errors were encountered: