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

Is this simulator still working? #177

Open
vmatter opened this issue Jan 8, 2025 · 5 comments
Open

Is this simulator still working? #177

vmatter opened this issue Jan 8, 2025 · 5 comments

Comments

@vmatter
Copy link

vmatter commented Jan 8, 2025

Hi everyone,

I would really like to use this simulator in my dissertation. However, from what I have tested so far, there are lots of errors. I tried to fix the TOKEN LIMIT EXCEEDED error and the static images, but honestly, no luck from my side.

Does anyone have a stable version of this simulator? Or do you guys know any other context simulator?

Best Regards

@LuisESV
Copy link

LuisESV commented Jan 8, 2025 via email

@ornery8x
Copy link

ornery8x commented Jan 9, 2025

i dont think so,

i also tryed https://github.com/drudilorenzo/generative_agents
but couldnt get it to work either

please msg me if anyone has a working version !

@vmatter
Copy link
Author

vmatter commented Jan 9, 2025

Hi @LuisESV and @ornery8x, I was able to reach the option's part after lots of fixes to run it on Windows, but it does not show anything:

image

And tons of issues when I execute the command run 1:
image

image

The steps that I executed so far to reach this part above on Windows:

Step 1 - In Anaconda Prompt:
conda create -n simulacra python=3.9.12 pip

Step 2 - In Anaconda Prompt:
conda activate simulacra

Step 3 - In Anaconda Prompt:
cd "<MY_PATH>\generative_agents-fix-and-improve" && pip install -r requirements.txt

Step 4 - Changed the run_frontend.sh file

#!/bin/bash

FRONTEND_SCRIPT_PATH="environment/frontend_server"
FRONTEND_SCRIPT_FILE="manage.py"
CONDA_ENV="simulacra"

FILE_NAME="Bash-Script-Frontend"
echo "(${FILE_NAME}): Running frontend server"

# Activate the Conda environment (Windows compatible)
source C:/Users/<MY_USER>/anaconda3/etc/profile.d/conda.sh
conda activate ${CONDA_ENV}

cd ${FRONTEND_SCRIPT_PATH}

PORT=8000
if [ -z "$1" ]; then
    echo "(${FILE_NAME}): No port provided. Using default port: ${PORT}"
else
    PORT=$1
fi

python ${FRONTEND_SCRIPT_FILE} runserver ${PORT}

# Pause to see errors
read -p "Press Enter to close..."

Step 5 - In Anaconda Prompt (separated prompt, needed for the front_end):
cd "<MY_PATH>\generative_agents-fix-and-improve" && run_frontend.sh

Step 6 - Changed run_backend.sh

#!/bin/bash

BACKEND_SCRIPT_PATH="reverie/backend_server"
BACKEND_SCRIPT_FILE="reverie.py"
LOGS_PATH="logs"

echo "Running backend server at: http://127.0.0.1:8000/simulator_home"
cd ${BACKEND_SCRIPT_PATH} || exit

timestamp=$(date +"%Y-%m-%d_%H-%M-%S")
echo "Timestamp: ${timestamp}"

# Ensure the logs directory exists
mkdir -p ${LOGS_PATH}

# Run the Python script directly using the Python executable from the simulacra environment
C:/Users/<MY_USER>/anaconda3/envs/simulacra/python ${BACKEND_SCRIPT_FILE} --origin ${1} --target ${2} | tee ${LOGS_PATH}/${2}_${timestamp}.txt

# Pause to see any errors
read -p "Press Enter to close..."

Step 7 - In Anaconda Prompt fixed issue "with init() got an unexpected keyword argument 'proxies'"
pip install "httpx<0.28"

Step 8 - Updated the strftime in "C:\Users**<MY_USER>\anaconda3\envs\simulacra\Lib\site-packages\openai_cost_logger\openai_cost_logger.py" since Windows doesn't allow colons (:) in file or folder names. You need to replace the colons in the timestamp used in filenames.**

Replace:
self.creation_datetime = strftime("%Y-%m-%d_%H:%M:%S")
With:
self.creation_datetime = strftime("%Y-%m-%d_%H-%M-%S")

Replace:
"creation_datetime": strftime("%Y-%m-%d %H:%M:%S"),
With:
self.creation_datetime = strftime("%Y-%m-%d_%H-%M-%S")

Replace:
"datetime": strftime("%Y-%m-%d %H:%M:%S"),
With:
"datetime": strftime("%Y-%m-%d %H-%M-%S"),

Step 9 - Changed run_backend_automatic.sh

#!/bin/bash

# Paths and file names
BACKEND_SCRIPT_PATH="reverie/backend_server"
BACKEND_SCRIPT_FILE="automatic_execution.py"
CONDA_ENV="simulacra"
LOGS_PATH="../../logs"

FILE_NAME="Bash-Script"

# Navigate to the backend script directory
cd ${BACKEND_SCRIPT_PATH} || { echo "Error: Cannot find ${BACKEND_SCRIPT_PATH}"; exit 1; }

# Activate the Conda environment (Windows version)
C:/Users/<MY_USER>/anaconda3/Scripts/activate ${CONDA_ENV}

# Initialize arguments
ARGS=""
while [[ $# -gt 0 ]]; do
    case "$1" in
        --origin|-o)
            ARGS="${ARGS} --origin ${2}"
            shift 2
            ;;
        --target|-t)
            ARGS="${ARGS} --target ${2}"
            TARGET=${2}
            shift 2
            ;;
        --steps|-s)
            ARGS="${ARGS} --steps ${2}"
            shift 2
            ;;
        --ui)
            ARGS="${ARGS} --ui ${2}"
            shift 2
            ;;
        --browser_path|-bp)
            ARGS="${ARGS} --browser_path ${2}"
            shift 2
            ;;
        --port|-p)
            ARGS="${ARGS} --port ${2}"
            echo "(${FILE_NAME}): Running backend server at: http://127.0.0.1:${2}/simulator_home"
            shift 2
            ;;
        *)
            echo "Unknown argument: $1"
            exit 1
            ;;
    esac
done

# Display arguments
echo "(${FILE_NAME}): Arguments: ${ARGS}"

# Generate a timestamp
timestamp=$(date +"%Y-%m-%d_%H-%M-%S")
echo "(${FILE_NAME}): Timestamp: ${timestamp}"

# Create the logs directory if it doesn't exist
mkdir -p ${LOGS_PATH}

# Run the backend script and save the output to a log file
python ${BACKEND_SCRIPT_FILE} ${ARGS} | tee ${LOGS_PATH}/${TARGET}_${timestamp}.txt

# Pause for the user to see any errors
read -p "Press Enter to close..."

Step 10 - In Anaconda Prompt:
cd "<MY_PATH>\generative_agents-fix-and-improve" && run_backend.sh base_the_ville_isabella_maria_klaus simulation-test

Now I am trying to find out why the rest is not working...

@vmatter
Copy link
Author

vmatter commented Jan 9, 2025

Ok, I think I solved the issue below:
Error: Error code: 404 - {'error': {'message': 'The model gpt-35-turbo-0125 does not exist or you do not have access to it.', 'type': 'invalid_request_error', 'param': None, 'code': 'model_not_found'}}

I replaced every reference of "gpt-35-turbo-0125" with "gpt-3.5-turbo".
Just search all (ctrl+shift+f) in VS Code and replace them in the classes.

Now at least I cannot see any API errors anymore:
image

image

Now I just need to find out why the screen is blank:
image

@vmatter
Copy link
Author

vmatter commented Jan 9, 2025

I found out that if you execute only once the url "http://localhost:8000/simulator_home" and never refresh it the image appears:
image

But if you refresh the page you face the issue "Please start the backend first.":
image

From what I checked, even with the code "running without errors" the sprites do not move, but the different contexts appear below. I must say that I must still check what is causing this issue.

Well, huge progress for today, at least the context generation of the simulator seems to be working.

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

3 participants