Skip to content

Commit

Permalink
fix: add func name to florencev2 fine tune (#248)
Browse files Browse the repository at this point in the history
* fix: add func name to florencev2 fine tune

* fix

* fix: format

* remove extra code

---------

Co-authored-by: wuyiqunLu <[email protected]>
  • Loading branch information
yuanwen-tian and wuyiqunLu authored Sep 24, 2024
1 parent 03d0e5d commit 4463b8f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
19 changes: 5 additions & 14 deletions vision_agent/agent/vision_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@
if str(WORKSPACE) != "":
os.environ["PYTHONPATH"] = f"{WORKSPACE}:{os.getenv('PYTHONPATH', '')}"

STUCK_IN_LOOP_ERROR_MESSAGE = {
"name": "Error when running conversation agent",
"value": "Agent is stuck in conversation loop, exited",
"traceback_raw": [],
}


class BoilerplateCode:
pre_code = [
Expand Down Expand Up @@ -298,13 +292,6 @@ def chat_with_code(
# sometimes it gets stuck in a loop, so we force it to exit
if last_response == response:
response["let_user_respond"] = True
self.streaming_message(
{
"role": "assistant",
"content": "{}",
"error": STUCK_IN_LOOP_ERROR_MESSAGE,
}
)

finished = response["let_user_respond"]

Expand All @@ -317,7 +304,11 @@ def chat_with_code(
{
"role": "assistant",
"content": "{}",
"error": STUCK_IN_LOOP_ERROR_MESSAGE,
"error": {
"name": "Error when running conversation agent",
"value": "Agent is stuck in conversation loop, exited",
"traceback_raw": [],
},
"finished": finished and code_action is None,
}
)
Expand Down
7 changes: 6 additions & 1 deletion vision_agent/tools/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,12 @@ def florence2_phrase_grounding(
fine_tuning=FineTuning(job_id=UUID(fine_tune_id)),
)
data = data_obj.model_dump(by_alias=True)
detections = send_inference_request(data, "tools", v2=False)
detections = send_inference_request(
data,
"tools",
v2=False,
metadata_payload={"function_name": "florence2_phrase_grounding"},
)
else:
data = {
"image": image_b64,
Expand Down

0 comments on commit 4463b8f

Please sign in to comment.