Skip to content
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

Infer Results are not getting saved #3

Open
Anurag-38 opened this issue Sep 28, 2023 · 9 comments
Open

Infer Results are not getting saved #3

Anurag-38 opened this issue Sep 28, 2023 · 9 comments

Comments

@Anurag-38
Copy link

I have modified the model for inference as per the requirements, but the results of the inference are not being saved.

I've made these changes to data_path.json(these paths are respective to my drive as I am executing this code in Colab NB)
{
"sec_src": "/content/drive/MyDrive/InLegal/LeSICiN-main/data/secs.jsonl",
"train_src": "/content/drive/MyDrive/InLegal/LeSICiN-main/data/train.jsonl",
"dev_src": "/content/drive/MyDrive/InLegal/LeSICiN-main/data/dev.jsonl",
"test_src": "/content/drive/MyDrive/InLegal/LeSICiN-main/data/test.jsonl",
"infer_src": "/content/drive/MyDrive/InLegal/LeSICiN-main/data/infer1.json",
"sec_cache": "/content/drive/MyDrive/InLegal/LeSICiN-main/cache/secs.pkl",
"train_cache": "/content/drive/MyDrive/InLegal/LeSICiN-main/cache/train.pkl",
"dev_cache": "/content/drive/MyDrive/InLegal/LeSICiN-main/cache/dev.pkl",
"test_cache": "/content/drive/MyDrive/InLegal/LeSICiN-main/cache/test.pkl",
"infer_cache": "/content/drive/MyDrive/InLegal/LeSICiN-main/cache/infer.pkl",
"s2v_path": "/content/drive/MyDrive/InLegal/LeSICiN-main/data/ils2v.bin",
"type_map": "/content/drive/MyDrive/InLegal/LeSICiN-main/data/type_map.json",
"label_tree": "/content/drive/MyDrive/InLegal/LeSICiN-main/data/label_tree.json",
"citation_network": "/content/drive/MyDrive/InLegal/LeSICiN-main/data/citation_network.json",
"schemas": "/content/drive/MyDrive/InLegal/LeSICiN-main/data/schemas.json",
"model_load": null,
"metrics_load": null,
"model_dump": "/content/drive/MyDrive/InLegal/LeSICiN-main/saved/best_model.pt",
"dev_metrics_dump": "/content/drive/MyDrive/InLegal/LeSICiN-main/saved/dev_metrics.json",
"test_metrics_dump": "/content/drive/MyDrive/InLegal/LeSICiN-main/saved/test_metrics.json",
"infer_trg": "/content/drive/MyDrive/InLegal/LeSICiN-main/saved/infer_results.json"
}

And in "infer_src" I have used an example of mine:

{"id": "100114", "text": ["ORDER Kidwai, J.", "Kirpa Ram, Siaram, Ram Harsh and Bijai Bahadur were prosecuted on the complaint of Ram Asrey under Sections 379, 447 and 352/506, Penal Code, on the allegation that they had entered a grove situated in Ajitpur on 29-4-1949 and cut mangoes worth about Rs. 35/- from the grove.", "The case was tried and disposed of by Shri Kamta Prasad, Judicial Magistrate, Kaisarganj at Bahraich."], "labels": ["Section 379 in The Indian Penal Code"]}

Now I have tried giving a path "/content/drive/MyDrive/InLegal/LeSICiN-main/saved/infer_results.json" to "infer_trg" twice as I describe below
1.For the first time I tried giving a path with the file name "infer_results.json"(in this case there was no such file at this location
2.For the second time I created an empty json file with the same name and then executed the code hoping whatever the result of inference is will be saved into this empty file but unfortunately this didn't work either.

Can someone pls tell what I am doing wrong or how to solve this issue?

Thanks,
Anurag.

@naamShahreyar
Copy link

can you share the requirements.txt file? i am facing difficulties in running run.py file, getting dependencie issues. I will be really greatful to you!

@Anurag-38
Copy link
Author

can you share the requirements.txt file? i am facing difficulties in running run.py file, getting dependencie issues. I will be really greatful to you!

Hey,

The original code didn't have a requirements.txt file, so when I ran the code in a new environment, I only needed a few packages. You can only run this code locally if you have GPU support; otherwise, you need to use Google Colab NB. These are the packages I installed:

1.torch_sparse
2.torch_scatter
3.sent2vec

You most probably have an issue with sent2vec. You need to git clone this package and then install it. The steps are already provided in the original code. Feel free to contact me if you need any further assistance.

@naamShahreyar
Copy link

Thanks Anurag for your quick response. I was able to figure this out last night. Have you got the same evaluation metrics as in the paper? if yes, can you please share your hyper parameter config file?
Thanks in advance!

@Anurag-38
Copy link
Author

As I was using this model for inference only I had kept the metrics path null.

@naamShahreyar
Copy link

thanks for your response mate. Can you share your hyper parameters config? i'm geting some index error during training :(

@Anurag-2-0
Copy link

Anurag-2-0 commented Oct 8, 2023

please help!

I've made absolutely no changes to the hyperparameter file. Please share a screenshot or the code that's causing the error so I can understand what's going on in the code.

@Anurag-2-0
Copy link

As I mentioned, I was executing this model only for inference so I made no changes to the original code.

@naamShahreyar
Copy link

As I mentioned, I was executing this model only for inference so I made no changes to the original code.

okay thanks for your response!

@rnemu
Copy link

rnemu commented Jun 17, 2024

I have modified the model for inference as per the requirements, but the results of the inference are not being saved.

I've made these changes to data_path.json(these paths are respective to my drive as I am executing this code in Colab NB) { "sec_src": "/content/drive/MyDrive/InLegal/LeSICiN-main/data/secs.jsonl", "train_src": "/content/drive/MyDrive/InLegal/LeSICiN-main/data/train.jsonl", "dev_src": "/content/drive/MyDrive/InLegal/LeSICiN-main/data/dev.jsonl", "test_src": "/content/drive/MyDrive/InLegal/LeSICiN-main/data/test.jsonl", "infer_src": "/content/drive/MyDrive/InLegal/LeSICiN-main/data/infer1.json", "sec_cache": "/content/drive/MyDrive/InLegal/LeSICiN-main/cache/secs.pkl", "train_cache": "/content/drive/MyDrive/InLegal/LeSICiN-main/cache/train.pkl", "dev_cache": "/content/drive/MyDrive/InLegal/LeSICiN-main/cache/dev.pkl", "test_cache": "/content/drive/MyDrive/InLegal/LeSICiN-main/cache/test.pkl", "infer_cache": "/content/drive/MyDrive/InLegal/LeSICiN-main/cache/infer.pkl", "s2v_path": "/content/drive/MyDrive/InLegal/LeSICiN-main/data/ils2v.bin", "type_map": "/content/drive/MyDrive/InLegal/LeSICiN-main/data/type_map.json", "label_tree": "/content/drive/MyDrive/InLegal/LeSICiN-main/data/label_tree.json", "citation_network": "/content/drive/MyDrive/InLegal/LeSICiN-main/data/citation_network.json", "schemas": "/content/drive/MyDrive/InLegal/LeSICiN-main/data/schemas.json", "model_load": null, "metrics_load": null, "model_dump": "/content/drive/MyDrive/InLegal/LeSICiN-main/saved/best_model.pt", "dev_metrics_dump": "/content/drive/MyDrive/InLegal/LeSICiN-main/saved/dev_metrics.json", "test_metrics_dump": "/content/drive/MyDrive/InLegal/LeSICiN-main/saved/test_metrics.json", "infer_trg": "/content/drive/MyDrive/InLegal/LeSICiN-main/saved/infer_results.json" }

And in "infer_src" I have used an example of mine:

{"id": "100114", "text": ["ORDER Kidwai, J.", "Kirpa Ram, Siaram, Ram Harsh and Bijai Bahadur were prosecuted on the complaint of Ram Asrey under Sections 379, 447 and 352/506, Penal Code, on the allegation that they had entered a grove situated in Ajitpur on 29-4-1949 and cut mangoes worth about Rs. 35/- from the grove.", "The case was tried and disposed of by Shri Kamta Prasad, Judicial Magistrate, Kaisarganj at Bahraich."], "labels": ["Section 379 in The Indian Penal Code"]}

Now I have tried giving a path "/content/drive/MyDrive/InLegal/LeSICiN-main/saved/infer_results.json" to "infer_trg" twice as I describe below 1.For the first time I tried giving a path with the file name "infer_results.json"(in this case there was no such file at this location 2.For the second time I created an empty json file with the same name and then executed the code hoping whatever the result of inference is will be saved into this empty file but unfortunately this didn't work either.

Can someone pls tell what I am doing wrong or how to solve this issue?

Thanks, Anurag.

I am facing problems in infer results. Code is implemented correctly and infer_results.json file also created but the model is predicting nothing means in .json file,predictions is empty list.Please,can you help me about this problem ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants