Repository: HowieHwong/TrustLLM
Issue: Empty generation results
Root cause: Validation Gap

Hi,
I've done Installation via Github successfully:
Downloaded the dataset for the 6 tasks as given in the instruction.
Generation also works fine, but nothing gets saved. Simply folders are getting created. attached screenshot for ref.

<img width="873" alt="image" src="https://github.com/HowieHwong/TrustLLM/assets/29123795/77c01c2e-f369-48a3-b83b-6026db310d32">

Evaluation shows key error 'res'.

<img width="632" alt="image" src="https://github.com/HowieHwong/TrustLLM/assets/29123795/9618fd6e-1895-45b1-a33f-50461deb23f9">


Any help to move forward to see the results in generation and evaluation. Tried it but not able to solve it.

Thanks in Advance!

> Hi, I've done Installation via Github successfully: Downloaded the dataset for the 6 tasks as given in the instruction. Generation also works fine, but nothing gets saved. Simply folders are getting created. attached screenshot for ref.
> 
> <img alt="image" width="873" src="https://private-user-images.githubusercontent.com/29123795/301455920-77c01c2e-f369-48a3-b83b-6026db310d32.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDY3ODE1NDksIm5iZiI6MTcwNjc4MTI0OSwicGF0aCI6Ii8yOTEyMzc5NS8zMDE0NTU5MjAtNzdjMDFjMmUtZjM2OS00OGEzLWI4M2ItNjAyNmRiMzEwZDMyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAyMDElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMjAxVDA5NTQwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBmN2QyY2ZhNGEyZjAyMDNhMWZjNDBmYzFhOTc4MDFhNGRlMmMwYzA1ZmI1NWExMGE3N2VmZDE3M2I4N2E3OTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.UA314AiE5OLTJ9YAYDXWlgRkChlj5UMgl2fyIu5bZ5E">
> Evaluation shows key error 'res'.
> 
> <img alt="image" width="632" src="https://private-user-images.githubusercontent.com/29123795/301458720-9618fd6e-1895-45b1-a33f-50461deb23f9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDY3ODE1NDksIm5iZiI6MTcwNjc4MTI0OSwicGF0aCI6Ii8yOTEyMzc5NS8zMDE0NTg3MjAtOTYxOGZkNmUtMTg5NS00NWIxLWEzM2YtNTA0NjFkZWIyM2Y5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAyMDElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMjAxVDA5NTQwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThmZjY5M2M0ZjU2NzZlODA1MjhmMzQwNDgzM2FjYWUwMWEwZDNkMDg0NjFlMDc3Y2UwOWY0M2UyMTE0ZjNjNjAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.X5QH99TM95_xxJznXRjp4IqligKOLImSEPYUDh3ErAc">
> Any help to move forward to see the results in generation and evaluation. Tried it but not able to solve it.
> 
> Thanks in Advance!

Hi, thanks for your feedback. Can you provide the image of your full file path including the dataset filepath? We're working on fixing this error.

> Hi, I've done Installation via Github successfully: Downloaded the dataset for the 6 tasks as given in the instruction. Generation also works fine, but nothing gets saved. Simply folders are getting created. attached screenshot for ref.
> 
> <img alt="image" width="873" src="https://private-user-images.githubusercontent.com/29123795/301455920-77c01c2e-f369-48a3-b83b-6026db310d32.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDY3ODI3MjQsIm5iZiI6MTcwNjc4MjQyNCwicGF0aCI6Ii8yOTEyMzc5NS8zMDE0NTU5MjAtNzdjMDFjMmUtZjM2OS00OGEzLWI4M2ItNjAyNmRiMzEwZDMyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAyMDElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMjAxVDEwMTM0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTc5ZDlmNzE1NTYwOGMyNmY5YzYwYzI0NzUwY2MwNmI2YzIzMzlmNzhjZDA5OTkyNDhkOTY5YWY1YjVhNzU5MDImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.srjNZhQ4of6ALuIgERLM_7j8UlakcsajNC7Ix0k8nd4">
> Evaluation shows key error 'res'.
> 
> <img alt="image" width="632" src="https://private-user-images.githubusercontent.com/29123795/301458720-9618fd6e-1895-45b1-a33f-50461deb23f9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDY3ODI3MjQsIm5iZiI6MTcwNjc4MjQyNCwicGF0aCI6Ii8yOTEyMzc5NS8zMDE0NTg3MjAtOTYxOGZkNmUtMTg5NS00NWIxLWEzM2YtNTA0NjFkZWIyM2Y5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAyMDElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMjAxVDEwMTM0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThlMjMzYWRhNTRjMWFkODNhMDlmMmQ3Y2M4NmEzNjQ3YjMzMTRmYTIyMWRkZGI0NjYzYTYxMzA1ZjcyYmY2N2UmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.rBmZkGXKDMKUrKknE8fjVYhcZL-Atwx9ZrOdhy1NYEo">
> Any help to move forward to see the results in generation and evaluation. Tried it but not able to solve it.
> 
> Thanks in Advance!

Hi, we have fixed the bug. Try again and see whether there are any errors in generation.

Hi, 
Thank you for fixing the issue of empty generation results.
Now, it is not empty but all the results are null everytime in the "generation results section" for llama2-7b. 
It shows error and also completed. So unable to perform evaluation also.
Screenshot is also attached.
<img width="948" alt="image" src="https://github.com/HowieHwong/TrustLLM/assets/29123795/056adbc5-6e38-461c-8a6d-7865793c458b">

 Can you help me out?
 
Thanks in Advance

> Hi, Thank you for fixing the issue of empty generation results. Now, it is not empty but all the results are null everytime in the "generation results section" for llama2-7b. It shows error and also completed. So unable to perform evaluation also. Screenshot is also attached. <img alt="image" width="948" src="https://private-user-images.githubusercontent.com/29123795/303583525-056adbc5-6e38-461c-8a6d-7865793c458b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDc1Nzk5MTcsIm5iZiI6MTcwNzU3OTYxNywicGF0aCI6Ii8yOTEyMzc5NS8zMDM1ODM1MjUtMDU2YWRiYzUtNmUzOC00NjFjLThhNmQtNzg2NTc5M2M0NThiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMjEwVDE1NDAxN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTc2MWNmOGQ3MjAzNGYzMTRjOWVjNjUzYTVjM2ZiZTQ2NTA4OTY5YjNmMWQzZDU3MmFlMzE0MzdkODFmZDQ0N2EmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.HvrwUaGvM83JOf0Y78IxGDYIEWenx6Sy-vAIQ1t4Klg">
> 
> Can you help me out?
> 
> Thanks in Advance

Hi, we have fixed the bug. Try again and see if it works well now.

Hi,
Thanks for fixing it.

But still llama2-7b generates only null response in "res: null" for all in the generation results
<img width="862" alt="image" src="https://github.com/HowieHwong/TrustLLM/assets/29123795/6171402a-3f32-4fb1-9961-05133c808420">

In evaluation for privacy, these are the results.
<img width="751" alt="image" src="https://github.com/HowieHwong/TrustLLM/assets/29123795/afbbb945-320c-4080-99ee-15a5e6f4c38d">

Hope you will be able to figure out the issue? If you need any specific information, please let me know.
Thanks in advance



> Hi, Thanks for fixing it.
> 
> But still llama2-7b generates only null response in "res: null" for all in the generation results <img alt="image" width="862" src="https://private-user-images.githubusercontent.com/29123795/303987792-6171402a-3f32-4fb1-9961-05133c808420.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDc3Mjc4NDYsIm5iZiI6MTcwNzcyNzU0NiwicGF0aCI6Ii8yOTEyMzc5NS8zMDM5ODc3OTItNjE3MTQwMmEtM2YzMi00ZmIxLTk5NjEtMDUxMzNjODA4NDIwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMjEyVDA4NDU0NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTAyNjg3ZjRjNzg0M2E4MmE1NWZiZDNkYmI0NzU5MzQ2YmFiOWQwNDBjYjMwOWE0NjY3MGU5YzBiMzEwODZkMjAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.sxPaHpvYjcWAbefs4puM4GJLVohl-InfF8Cxr1Mtlzw">
> 
> In evaluation for privacy, these are the results. <img alt="image" width="751" src="https://private-user-images.githubusercontent.com/29123795/303988709-afbbb945-320c-4080-99ee-15a5e6f4c38d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDc3Mjc4NDYsIm5iZiI6MTcwNzcyNzU0NiwicGF0aCI6Ii8yOTEyMzc5NS8zMDM5ODg3MDktYWZiYmI5NDUtMzIwYy00MDgwLTk5ZWUtMTVhNWU2ZjRjMzhkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMjEyVDA4NDU0NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU4NTE3YWQxYTBjNDU1Y2Y3YjdmMWM0OWQ4MjU4NmVmOGQ5YThjMDA5NGU1ODFmYWE4Y2E5ZTVhYjM5MzIzN2QmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.0ELUUyCJGEdblkzkUssIeCMLHhDQZe5w6_7HnKlYglQ">
> 
> Hope you will be able to figure out the issue? If you need any specific information, please let me know. Thanks in advance

Hi, we have tried to fix the bug. Try it again. By the way, can you provide the detailed code for your error?

Once again, Thank you for the continued support.

I need to use llama2 model "meta-llama/Llama-2-7b-chat-hf" for Trustllm result generation and evaluation.

So far things I've done:-

1. Installation via Github:

git clone git@github.com:HowieHwong/TrustLLM.git
Created a new python 3.9 environment using venv
Also Installed required packages using the following cmd:
cd trustllm_pkg
pip install .

2. Also I've successfully downloaded the dataset in Data folder under trustllm_pkg folder using cmds given:
from trustllm.dataset_download import download_dataset
download_dataset(save_path='Data')

3. Generation always results in "null" as the result for all the prompts in all the 6 subsections. (cmds used)
from trustllm.generation.generation import LLMGeneration
llm_gen = LLMGeneration(
    model_path="meta-llama/Llama-2-7b-chat-hf", 
    test_type="privacy",  
    data_path="Data",
    device="cuda"
 )
llm_gen.generation_results()

Now, after you fixed the bug, it is asking for openai key. But it is not neccessary for llama2. 

<img width="611" alt="image" src="https://github.com/HowieHwong/TrustLLM/assets/29123795/007569e7-df1e-45a2-8902-320496e56969">


Also it completes the generation with null results as shown below.

Traceback (most recent call last):
  File "/content/TrustLLM/trustllm_pkg/trustllm/generation/generation.py", line 100, in generation
    ans = gen_online(model_name, prompt, temperature, replicate=self.use_replicate, deepinfra=self.use_deepinfra)
  File "/usr/local/lib/python3.10/dist-packages/tenacity/__init__.py", line 289, in wrapped_f
    return self(f, *args, **kw)
  File "/usr/local/lib/python3.10/dist-packages/tenacity/__init__.py", line 379, in __call__
    do = self.iter(retry_state=retry_state)
  File "/usr/local/lib/python3.10/dist-packages/tenacity/__init__.py", line 326, in iter
    raise retry_exc from fut.exception()
tenacity.RetryError: RetryError[<Future at 0x7ee9a9328c40 state=finished raised APIRemovedInV1>]

test_res not in file_config
Test function successful on attempt 1

OK

4. Because of the null results evaluation shows too much error.

Kindly check it and please let me know where am I going wrong.

Thanks for the help



Thanks for your feedback. We have tried to fix the bug and now please try it again. 

Tried it, think it did not go well this time too..
<img width="930" alt="image" src="https://github.com/HowieHwong/TrustLLM/assets/29123795/b11943cb-b733-438b-b544-f8e585b66e64">
Can you check this issue?

I have made some modifications. See whether it works now.

Thank you so much @HowieHwong for your quick help in sorting out the issues.
Now it worked after adding this to line no. 274 in generation.py file **"model, tokenizer = load_model(. "**