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

data must be str, not NoneType #244

Closed
viciaky opened this issue Apr 17, 2024 · 7 comments
Closed

data must be str, not NoneType #244

viciaky opened this issue Apr 17, 2024 · 7 comments
Labels
🐛 bug Something isn't working

Comments

@viciaky
Copy link

viciaky commented Apr 17, 2024

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
Copy link
Author

viciaky commented Apr 17, 2024

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
    }
  }

@klieret
Copy link
Member

klieret commented Apr 17, 2024

Thanks for the report, this was probably fixed in #242. Let me know if switching to the latest version didn't solve this!

@klieret klieret closed this as completed Apr 17, 2024
@maximedupre
Copy link

maximedupre commented May 9, 2024

@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    

@klieret klieret reopened this May 9, 2024
@klieret klieret changed the title not saving prediction or model patch data must be str, not NoneType May 9, 2024
@klieret
Copy link
Member

klieret commented May 9, 2024

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
Copy link
Member

klieret commented May 9, 2024

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 klieret added the 🐛 bug Something isn't working label May 9, 2024
@maximedupre
Copy link

maximedupre commented May 9, 2024

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.

@ofirpress
Copy link
Member

Looks like we can close this? Thanks @klieret

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants