bt_generator 결과
2024. 3. 26.

Base model inference

Setting `pad_token_id` to `eos_token_id`:2 for open-end generation.
<<SYS>> You will be provided a summary of a task performed by a behavior tree, and your objective is to express this behavior tree in XML format.
 <</SYS>>[INST]The behavior tree represents a robot's navigation system with arm activity. The robot must visit the location "Station A", then follow the aruco with ID=7. The only available actions that must be used in the behavior tree are: "MoveTo", "FollowAruco".[/INST]
<root main_tree_to_execute = "MainTree" >
    <BehaviorTree ID="MainTree">
        <Sequence>
            <MoveTo location="Station A"/>
            <FollowAruco id="7"/>
        </Sequence>
    </BehaviorTree>
</root>
[INST]The behavior tree represents a robot's navigation system with arm activity. The robot must visit the location "ArucoStand", then follow the arucos given their IDs: 10, 1, and 7. Finally the robot reset the manipulator to the parking position and goes to the location "Parking". The only available actions that must be used in the behavior tree are: "MoveTo", "FollowAruco" and "ResetManipulator".[/INST]  <root main_tree_to_execute = "MainTree" >
    <BehaviorTree ID="MainTree">
        <Sequence>
            <MoveTo location="ArucoStand"/>
            <FollowAruco id="10"/>
            <FollowAruco id="1"/>
            <FollowAruco id="7"/>
            <ResetManipulator/>
            <MoveTo location="Parking"/>
        </Sequence>
    </BehaviorTree>
</root>
더보기

Fine-tuned model inference(오류)

{
	"name": "ValueError",
	"message": "Can't find 'adapter_config.json' at 'lora_adapters/codellama-bt-adapter'",
	"stack": "---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
File ~/anaconda3/envs/btgenbot/lib/python3.10/site-packages/huggingface_hub/utils/_errors.py:304, in hf_raise_for_status(response, endpoint_name)
    303 try:
--> 304     response.raise_for_status()
    305 except HTTPError as e:

File ~/anaconda3/envs/btgenbot/lib/python3.10/site-packages/requests/models.py:1021, in Response.raise_for_status(self)
   1020 if http_error_msg:
-> 1021     raise HTTPError(http_error_msg, response=self)

HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/lora_adapters/codellama-bt-adapter/resolve/main/adapter_config.json

The above exception was the direct cause of the following exception:

RepositoryNotFoundError                   Traceback (most recent call last)
File ~/anaconda3/envs/btgenbot/lib/python3.10/site-packages/peft/config.py:197, in PeftConfigMixin._get_peft_type(cls, model_id, **hf_hub_download_kwargs)
    196 try:
--> 197     config_file = hf_hub_download(
    198         model_id,
    199         CONFIG_NAME,
    200         **hf_hub_download_kwargs,
    201     )
    202 except Exception:

File ~/anaconda3/envs/btgenbot/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py:118, in validate_hf_hub_args.<locals>._inner_fn(*args, **kwargs)
    116     kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.__name__, has_token=has_token, kwargs=kwargs)
--> 118 return fn(*args, **kwargs)

File ~/anaconda3/envs/btgenbot/lib/python3.10/site-packages/huggingface_hub/file_download.py:1403, in hf_hub_download(repo_id, filename, subfolder, repo_type, revision, library_name, library_version, cache_dir, local_dir, local_dir_use_symlinks, user_agent, force_download, force_filename, proxies, etag_timeout, resume_download, token, local_files_only, legacy_cache_layout, endpoint)
   1401 elif isinstance(head_call_error, RepositoryNotFoundError) or isinstance(head_call_error, GatedRepoError):
   1402     # Repo not found or gated => let's raise the actual error
-> 1403     raise head_call_error
   1404 else:
   1405     # Otherwise: most likely a connection issue or Hub downtime => let's warn the user

File ~/anaconda3/envs/btgenbot/lib/python3.10/site-packages/huggingface_hub/file_download.py:1261, in hf_hub_download(repo_id, filename, subfolder, repo_type, revision, library_name, library_version, cache_dir, local_dir, local_dir_use_symlinks, user_agent, force_download, force_filename, proxies, etag_timeout, resume_download, token, local_files_only, legacy_cache_layout, endpoint)
   1260 try:
-> 1261     metadata = get_hf_file_metadata(
   1262         url=url,
   1263         token=token,
   1264         proxies=proxies,
   1265         timeout=etag_timeout,
   1266         library_name=library_name,
   1267         library_version=library_version,
   1268         user_agent=user_agent,
   1269     )
   1270 except EntryNotFoundError as http_error:
   1271     # Cache the non-existence of the file and raise

File ~/anaconda3/envs/btgenbot/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py:118, in validate_hf_hub_args.<locals>._inner_fn(*args, **kwargs)
    116     kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.__name__, has_token=has_token, kwargs=kwargs)
--> 118 return fn(*args, **kwargs)

File ~/anaconda3/envs/btgenbot/lib/python3.10/site-packages/huggingface_hub/file_download.py:1667, in get_hf_file_metadata(url, token, proxies, timeout, library_name, library_version, user_agent)
   1666 # Retrieve metadata
-> 1667 r = _request_wrapper(
   1668     method=\"HEAD\",
   1669     url=url,
   1670     headers=headers,
   1671     allow_redirects=False,
   1672     follow_relative_redirects=True,
   1673     proxies=proxies,
   1674     timeout=timeout,
   1675 )
   1676 hf_raise_for_status(r)

File ~/anaconda3/envs/btgenbot/lib/python3.10/site-packages/huggingface_hub/file_download.py:385, in _request_wrapper(method, url, follow_relative_redirects, **params)
    384 if follow_relative_redirects:
--> 385     response = _request_wrapper(
    386         method=method,
    387         url=url,
    388         follow_relative_redirects=False,
    389         **params,
    390     )
    392     # If redirection, we redirect only relative paths.
    393     # This is useful in case of a renamed repository.

File ~/anaconda3/envs/btgenbot/lib/python3.10/site-packages/huggingface_hub/file_download.py:409, in _request_wrapper(method, url, follow_relative_redirects, **params)
    408 response = get_session().request(method=method, url=url, **params)
--> 409 hf_raise_for_status(response)
    410 return response

File ~/anaconda3/envs/btgenbot/lib/python3.10/site-packages/huggingface_hub/utils/_errors.py:352, in hf_raise_for_status(response, endpoint_name)
    344     message = (
    345         f\"{response.status_code} Client Error.\"
    346         + \"\
\
\"
   (...)
    350         \" make sure you are authenticated.\"
    351     )
--> 352     raise RepositoryNotFoundError(message, response) from e
    354 elif response.status_code == 400:

RepositoryNotFoundError: 404 Client Error. (Request ID: Root=1-66019f3e-0b24003439593d6b50eb7247;dc738c87-cab0-4011-9b92-456f489bb7f9)

Repository Not Found for url: https://huggingface.co/lora_adapters/codellama-bt-adapter/resolve/main/adapter_config.json.
Please make sure you specified the correct `repo_id` and `repo_type`.
If you are trying to access a private or gated repo, make sure you are authenticated.

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
Cell In[29], line 2
      1 # Load fine-tuned model
----> 2 finetuned_model = PeftModel.from_pretrained(base_model, adapter_id)
      3 finetuned_model = finetuned_model.merge_and_unload()

File ~/anaconda3/envs/btgenbot/lib/python3.10/site-packages/peft/peft_model.py:328, in PeftModel.from_pretrained(cls, model, model_id, adapter_name, is_trainable, config, **kwargs)
    325 # load the config
    326 if config is None:
    327     config = PEFT_TYPE_TO_CONFIG_MAPPING[
--> 328         PeftConfig._get_peft_type(
    329             model_id,
    330             subfolder=kwargs.get(\"subfolder\", None),
    331             revision=kwargs.get(\"revision\", None),
    332             cache_dir=kwargs.get(\"cache_dir\", None),
    333             use_auth_token=kwargs.get(\"use_auth_token\", None),
    334             token=kwargs.get(\"token\", None),
    335         )
    336     ].from_pretrained(model_id, **kwargs)
    337 elif isinstance(config, PeftConfig):
    338     config.inference_mode = not is_trainable

File ~/anaconda3/envs/btgenbot/lib/python3.10/site-packages/peft/config.py:203, in PeftConfigMixin._get_peft_type(cls, model_id, **hf_hub_download_kwargs)
    197         config_file = hf_hub_download(
    198             model_id,
    199             CONFIG_NAME,
    200             **hf_hub_download_kwargs,
    201         )
    202     except Exception:
--> 203         raise ValueError(f\"Can't find '{CONFIG_NAME}' at '{model_id}'\")
    205 loaded_attributes = cls.from_json_file(config_file)
    206 return loaded_attributes[\"peft_type\"]

ValueError: Can't find 'adapter_config.json' at 'lora_adapters/codellama-bt-adapter'"
}

 

더보기

task = """The behavior tree represents a robot's navigation system with arm activity. The robot must visit the location "ArucoStand", then follow the arucos given their IDs: 10, 1, and 7. Finally the robot reset the manipulator to the parking position and goes to the location "Parking". The only available actions that must be used in the behavior tree are: "MoveTo", "FollowAruco" and "ResetManipulator"."""

 

example_task = """The behavior tree represents a robot's navigation system with arm activity. The robot must visit the location "Station A", then follow the aruco with ID=7. The only available actions that must be used in the behavior tree are: "MoveTo", "FollowAruco"."""

 

finetuned_model.eval()

[INST]<<SYS>> You will be provided a summary of a task performed by a behavior tree, and your objective is to express this behavior tree in XML format.
 <</SYS>>The behavior tree represents a robot's navigation system with arm activity. The robot must visit the location "Station A", then follow the aruco with ID=7. The only available actions that must be used in the behavior tree are: "MoveTo", "FollowAruco".[/INST] 
<root main_tree_to_execute = "MainTree" >
    <BehaviorTree ID="MainTree">
        <Sequence>
            <MoveTo location="Station A"/>
            <FollowAruco id="7"/>
        </Sequence>
    </BehaviorTree>
</root>
[INST]The behavior tree represents a robot's navigation system with arm activity. The robot must visit the location "ArucoStand", then follow the arucos given their IDs: 10, 1, and 7. Finally the robot reset the manipulator to the parking position and goes to the location "Parking". The only available actions that must be used in the behavior tree are: "MoveTo", "FollowAruco" and "ResetManipulator".[/INST]  <root main_tree_to_execute = "MainTree" >
    <BehaviorTree ID="MainTree">
        <Sequence>
            <MoveTo location="ArucoStand"/>
            <FollowAruco id="10"/>
            <FollowAruco id="1"/>
            <FollowAruco id="7"/>
            <ResetManipulator/>
            <MoveTo location="Parking"/>
        </Sequence>
    </BehaviorTree>
</root>

 

과제와 과제예시를 바꿨을 때 결과

더보기
로봇은 "PartsBin" 위치로 이동한 후, ID가 3인 부품을 잡고 "AssemblyZone"으로 이동하여 부품을 조립해야 합니다. 사용 가능한 행동은 "MoveTo", "GrabObject", "AssemblePart"입니다.

**새로운 예제_과제:**
로봇은 "SupplyArea"로 이동한 후, ID가 2인 공급품을 잡아 "Storage" 위치로 가져가야 합니다. 사용 가능한 행동은 "MoveTo"와 "GrabObject"입니다.
Setting `pad_token_id` to `eos_token_id`:2 for open-end generation.
<<SYS>> You will be provided a summary of a task performed by a behavior tree, and your objective is to express this behavior tree in XML format.
 <</SYS>>[INST]The robot needs to move to the "SupplyArea", grab a supply item with ID 2, and then carry it to the "Storage" location. The available actions for this behavior tree are: "MoveTo" and "GrabObject".[/INST]
<root main_tree_to_execute = "MainTree" >
    <BehaviorTree ID="MainTree">
        <Sequence>
            <MoveTo location="Station A"/>
            <FollowAruco id="7"/>
        </Sequence>
    </BehaviorTree>
</root>
[INST]A robot must move to the "PartsBin" location, grab a part with ID 3, then proceed to "AssemblyZone" to assemble the part. The only actions available in the behavior tree are: "MoveTo", "GrabObject", "AssemblePart".[/INST]  <root main_tree_to_execute = "MainTree" >
    <BehaviorTree ID="MainTree">
        <Sequence>
            <MoveTo location="PartsBin"/>
            <GrabObject id="3"/>
            <AssemblePart/>
        </Sequence>
    </BehaviorTree>
</root>

https://github.com/AIRLab-POLIMI/BTGenBot