FeiLiu36 / EoH

Evolution of Heuristics
MIT License
77 stars 8 forks source link

Program Stalls at "check LLM API" Step When Executing runEoH.py #1

Closed lgy0404 closed 4 months ago

lgy0404 commented 4 months ago

Hello,

Thank you for developing this project; it has been very helpful for my research. Recently, I encountered some issues while trying to use the project, and I hope to get your help.

Issue Description: When running the runEoH.py script, the program seems unable to proceed past the LLM API check phase. Although I have confirmed that my API key is valid, the program still stalls at the "check LLM API" step.

My Script:

from eoh import eoh
from eoh.utils.getParas import Paras

# Parameter initialization #
paras = Paras()

# Set parameters #
paras.set_paras(method = "eoh",    # ['ael','eoh']
                problem = "tsp_construct", #['tsp_construct','bp_online']
                llm_api_endpoint = "api.deepseek.com", # set your LLM endpoint
                llm_api_key = "sk-***",   # set your key
                llm_model = "deepseek-chat",
                ec_pop_size = 4, # number of samples in each population
                ec_n_pop = 4,  # number of populations
                exp_n_proc = 4,  # multi-core parallel
                exp_debug_mode = False)

# initialization
evolution = eoh.EVOL(paras)

# run 
evolution.run()

Error Log:

---              Start EoH            ---
-----------------------------------------
- output folder created -
- parameters loaded -
- Prob tsp_construct loaded 
- EoH parameters loaded -
- Evolution Start -
- check LLM API

I hope you can provide some guidance or suggestions for fixing this issue. Thank you!

FeiLiu36 commented 4 months ago

Thank you for your interest in our project. I have used the same script as yours (with your API key), the program runs smoothly. After checking LLM API the initial population will be created (task no more than two minutes). The following is my terminal output.

-----------------------------------------
---              Start EoH            ---
-----------------------------------------
- output folder created -
-  parameters loaded -
- Prob tsp_construct loaded
- EoH parameters loaded -
- Evolution Start -
- check LLM API
creating initial population:
Parallel time out .
Pop initial:
 Obj:  22.7071| Obj:  25.49352| Obj:  28.54028|
initial population has been created!
 OP: e1, [1 / 4] | ......

Could it be a network problem?

FeiLiu36 commented 4 months ago

The function of "Check LLM API" is to send a simple request, prompting "1+1=?" to check whether LLM responds correctly before the evolution starts. The majority of errors in this stage are caused by the wrong endpoint, key, or llm settings. Only very very occasionally would be the failure of the remote LLM server (depending on API).

I suggest trying to get a response from the same deepseek API using the official script example. So that we may know whether it is a network problem or a program bug somewhere.

lgy0404 commented 4 months ago

Hello @FeiLiu36 ,

Thank you so much for your prompt and detailed response. Following your advice, I used a VPN to test the connection and I'm pleased to report that the program is now running smoothly. It was indeed a network issue that prevented the LLM API check from completing successfully.

Thanks again for your help and for maintaining such a useful project!

FeiLiu36 commented 4 months ago

Glad the problem is solved! By the way, I recommend you get a different key as others may use the key in your reported script.

lgy0404 commented 4 months ago

Hello @FeiLiu36 ,

Thank you for your additional advice regarding the API key. I have edited my previous messages to hide the key information.

Appreciate your helpfulness and attention to detail!