SWE-agent icon indicating copy to clipboard operation
SWE-agent copied to clipboard

data must be str, not NoneType

Open viciaky opened this issue 10 months ago • 6 comments

Describe the issue

Hi I create a very simple repo and create an issue.

docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock \
  -v $(pwd)/keys.cfg:/app/keys.cfg \
  sweagent/swe-agent-run:latest \
  python run.py --image_name=sweagent/swe-agent:latest \
  --model_name azure:gpt4 \
  --data_path https://github.com/viciaky/test/issues/1 \
  --config_file config/default_from_url.yaml  --skip_existing=False

it showed the correct result but never save in prediction jsonl and model patch

Error: INFO Found submission:

INFO Saved trajectory to trajectories/root/azure-gpt4__viciaky__test__default_from_url__t-0.00__p-0.95__c-3.00__install-1/viciaky__test-i1.traj
INFO Saved predictions to trajectories/root/azure-gpt4__viciaky__test__default_from_url__t-0.00__p-0.95__c-3.00__install-1/all_preds.jsonl
Traceback (most recent call last): File "/app/run.py", line 144, in main save_patch(traj_dir, instance_id, info) File "/app/run.py", line 271, in save_patch patch_output_file.write_text(model_patch) File "/usr/local/lib/python3.9/pathlib.py", line 1283, in write_text raise TypeError('data must be str, not %s' % TypeError: data must be str, not NoneType WARNING ❌ Failed on viciaky__test-i1: data must be str, not NoneType

Suggest an improvement to documentation

No response

viciaky avatar Apr 17 '24 03:04 viciaky

I looked at .traj file here is the info, and the "submission" is null. i am using azure gpt4 endpoint. is there any configuration i am missing here?

"info": {
    "exit_status": "submitted",
    "submission": null,
    "model_stats": {
      "total_cost": 0.11188000000000001,
      "instance_cost": 0.11188000000000001,
      "tokens_sent": 10273,
      "tokens_received": 305,
      "api_calls": 1
    }
  }

viciaky avatar Apr 17 '24 04:04 viciaky

Thanks for the report, this was probably fixed in https://github.com/princeton-nlp/SWE-agent/pull/242. Let me know if switching to the latest version didn't solve this!

klieret avatar Apr 17 '24 14:04 klieret

@klieret I'm using v0.4.0 and I seem to have the same kind of issue:

[...]

         Given the complexity of the issue and the lack of explicit latency handling in the examined files, it may be necessary to consult with the development team or documentation to understand how latency is currently managed for MIDI regions and to determine the best
         approach for implementing any required adjustments.                                                                                                                                                                                                                   
                                                                                                                                                                                                                                                                               
                                                                                                                                                                                                                                                                               
INFO     🎬 ACTION (primary)                                                                                                                                                                                                                                                   
         submit                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                               
INFO     Found submission:                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                               
INFO     Saved trajectory to trajectories/root/gpt4__issue__default__t-0.00__p-0.95__c-10.00__install-1/967ef2.traj                                                                                                                                                            
INFO     Saved predictions to trajectories/root/gpt4__issue__default__t-0.00__p-0.95__c-10.00__install-1/all_preds.jsonl                                                                                                                                                       
Traceback (most recent call last):
  File "/app/run.py", line 150, in main
    patch_path = save_patch(traj_dir, instance_id, info)
  File "/app/run.py", line 281, in save_patch
    patch_output_file.write_text(model_patch)
  File "/usr/local/lib/python3.9/pathlib.py", line 1283, in write_text
    raise TypeError('data must be str, not %s' %
TypeError: data must be str, not NoneType
WARNING  ❌ Failed on 967ef2: data must be str, not NoneType                                                                                                                                                                                                                   
INFO     Beginning environment shutdown...                                                                                                                                                                                                                                     
INFO     Agent container stopped                                                                                                                                                                                                                                               
INFO     Found image sweagent/swe-agent:latest with tags: ['sweagent/swe-agent:latest'], created: 2024-04-15T19:20:51.646667378Z for linux arm64.                                                                                                                              
DEBUG    Starting container with command: docker run -i --rm --name sweagent-swe-agent-latest-7e58b0d4a9 sweagent/swe-agent:latest /bin/bash -l -m                                                                                                                             
INFO     🌱 Environment Initialized    

maximedupre avatar May 09 '24 22:05 maximedupre

Could you send me the full ommand that you ran?

Also it looks like you're running from the swe-agent-run docker container, right? There's no v0.4.0 docker container yet, so I'm a bit confused what version you're running on.

klieret avatar May 09 '24 22:05 klieret

In fact, on the latest swe-agent-run docker container line 150 also doesn't correspond to the one from the traceback you sent. I believe you might be running on an old container.

klieret avatar May 09 '24 22:05 klieret

Oh! I'm new to Docker, so I didn't know there was a matching docker container version.

I seem to be using the latest version:

docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v ./:/app/studio -v /Users/maximedupre/Desktop/SWE-agent/keys.cfg:/app/keys.cfg -v /Users/maximedupre/Desktop/docker-volume:/app/trajectories/root sweagent/swe-agent-run:latest python run.py --image_name=sweagent/swe-agent:latest --model_name gpt4 --per_instance_cost_limit 10.00 --data_path studio/issue.md --repo_path studio --config_file config/default.yaml --skip_existing=False

Edit

I believe that I need to run docker pull sweagent/swe-agent:latest and that it's the version of my docker container that matters, not which git branch I have checkout :D

Edit 2

The error does not occur again after running docker pull sweagent/swe-agent:latest and re-running the sweagent command.

maximedupre avatar May 09 '24 23:05 maximedupre

Looks like we can close this? Thanks @klieret

ofirpress avatar May 10 '24 20:05 ofirpress