Instructions to use TymofiiNasobko/Lapa-function-calling with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TymofiiNasobko/Lapa-function-calling with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("TymofiiNasobko/Lapa-function-calling", device_map="auto") - Notebooks
- Google Colab
- Kaggle
TymofiiNasobko/Lapa-function-calling
Browse files- README.md +3 -3
- adapter_config.json +10 -10
- adapter_model.safetensors +2 -2
- chat_template.jinja +68 -12
- training_args.bin +2 -2
README.md
CHANGED
|
@@ -4,8 +4,8 @@ library_name: transformers
|
|
| 4 |
model_name: Lapa-function-calling
|
| 5 |
tags:
|
| 6 |
- generated_from_trainer
|
| 7 |
-
- sft
|
| 8 |
- trl
|
|
|
|
| 9 |
licence: license
|
| 10 |
---
|
| 11 |
|
|
@@ -34,10 +34,10 @@ This model was trained with SFT.
|
|
| 34 |
|
| 35 |
### Framework versions
|
| 36 |
|
| 37 |
-
- TRL: 0.
|
| 38 |
- Transformers: 4.57.3
|
| 39 |
- Pytorch: 2.6.0+cu118
|
| 40 |
-
- Datasets: 4.4.
|
| 41 |
- Tokenizers: 0.22.1
|
| 42 |
|
| 43 |
## Citations
|
|
|
|
| 4 |
model_name: Lapa-function-calling
|
| 5 |
tags:
|
| 6 |
- generated_from_trainer
|
|
|
|
| 7 |
- trl
|
| 8 |
+
- sft
|
| 9 |
licence: license
|
| 10 |
---
|
| 11 |
|
|
|
|
| 34 |
|
| 35 |
### Framework versions
|
| 36 |
|
| 37 |
+
- TRL: 0.26.2
|
| 38 |
- Transformers: 4.57.3
|
| 39 |
- Pytorch: 2.6.0+cu118
|
| 40 |
+
- Datasets: 4.4.2
|
| 41 |
- Tokenizers: 0.22.1
|
| 42 |
|
| 43 |
## Citations
|
adapter_config.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
| 16 |
"layers_pattern": null,
|
| 17 |
"layers_to_transform": null,
|
| 18 |
"loftq_config": {},
|
| 19 |
-
"lora_alpha":
|
| 20 |
"lora_bias": false,
|
| 21 |
"lora_dropout": 0.05,
|
| 22 |
"megatron_config": null,
|
|
@@ -28,20 +28,20 @@
|
|
| 28 |
"peft_type": "LORA",
|
| 29 |
"peft_version": "0.18.0",
|
| 30 |
"qalora_group_size": 16,
|
| 31 |
-
"r":
|
| 32 |
"rank_pattern": {},
|
| 33 |
"revision": null,
|
| 34 |
"target_modules": [
|
| 35 |
-
"
|
| 36 |
-
"
|
| 37 |
-
"down_proj",
|
| 38 |
-
"fc2",
|
| 39 |
-
"q_proj",
|
| 40 |
"out_proj",
|
|
|
|
|
|
|
|
|
|
| 41 |
"fc1",
|
| 42 |
-
"
|
| 43 |
-
"
|
| 44 |
-
"
|
| 45 |
],
|
| 46 |
"target_parameters": null,
|
| 47 |
"task_type": "CAUSAL_LM",
|
|
|
|
| 16 |
"layers_pattern": null,
|
| 17 |
"layers_to_transform": null,
|
| 18 |
"loftq_config": {},
|
| 19 |
+
"lora_alpha": 32,
|
| 20 |
"lora_bias": false,
|
| 21 |
"lora_dropout": 0.05,
|
| 22 |
"megatron_config": null,
|
|
|
|
| 28 |
"peft_type": "LORA",
|
| 29 |
"peft_version": "0.18.0",
|
| 30 |
"qalora_group_size": 16,
|
| 31 |
+
"r": 16,
|
| 32 |
"rank_pattern": {},
|
| 33 |
"revision": null,
|
| 34 |
"target_modules": [
|
| 35 |
+
"gate_proj",
|
| 36 |
+
"up_proj",
|
|
|
|
|
|
|
|
|
|
| 37 |
"out_proj",
|
| 38 |
+
"fc2",
|
| 39 |
+
"k_proj",
|
| 40 |
+
"down_proj",
|
| 41 |
"fc1",
|
| 42 |
+
"v_proj",
|
| 43 |
+
"o_proj",
|
| 44 |
+
"q_proj"
|
| 45 |
],
|
| 46 |
"target_parameters": null,
|
| 47 |
"task_type": "CAUSAL_LM",
|
adapter_model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2a94bd8ade22dbd4bc7fdfe61013744587d42bd243f5aec473266e2205c404b8
|
| 3 |
+
size 4324333160
|
chat_template.jinja
CHANGED
|
@@ -1,15 +1,45 @@
|
|
| 1 |
{{ bos_token }}
|
| 2 |
-
{%- if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
{%- if messages[0]['content'] is string -%}
|
| 4 |
-
{
|
| 5 |
-
' -%}
|
| 6 |
{%- else -%}
|
| 7 |
-
{
|
| 8 |
-
' -%}
|
| 9 |
{%- endif -%}
|
| 10 |
-
{
|
|
|
|
| 11 |
{%- else -%}
|
| 12 |
-
{%- set first_user_prefix = "" -%}
|
| 13 |
{%- set loop_messages = messages -%}
|
| 14 |
{%- endif -%}
|
| 15 |
{%- for message in loop_messages -%}
|
|
@@ -18,12 +48,25 @@
|
|
| 18 |
{%- else -%}
|
| 19 |
{%- set role = message['role'] -%}
|
| 20 |
{%- endif -%}
|
| 21 |
-
|
| 22 |
{{ '<start_of_turn>' + role + '
|
| 23 |
-
'
|
| 24 |
{%- if message['content'] is string -%}
|
| 25 |
{%- if role == "model" -%}
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
{%- else -%}
|
| 28 |
{{ message['content'] | trim }}
|
| 29 |
{%- endif -%}
|
|
@@ -33,7 +76,21 @@
|
|
| 33 |
{{ '<start_of_image>' }}
|
| 34 |
{%- elif item['type'] == 'text' -%}
|
| 35 |
{%- if role == "model" -%}
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
{%- else -%}
|
| 38 |
{{ item['text'] | trim }}
|
| 39 |
{%- endif -%}
|
|
@@ -51,7 +108,6 @@
|
|
| 51 |
' }}
|
| 52 |
{%- endif -%}
|
| 53 |
{%- endfor -%}
|
| 54 |
-
|
| 55 |
{%- if add_generation_prompt -%}
|
| 56 |
{{'<start_of_turn>model
|
| 57 |
'}}
|
|
|
|
| 1 |
{{ bos_token }}
|
| 2 |
+
{%- if tools -%}
|
| 3 |
+
{%- set loop_messages = messages[1:] -%}
|
| 4 |
+
{{- '<start_of_turn>' + 'system' + '
|
| 5 |
+
' -}}
|
| 6 |
+
{%- if messages[0]['role'] == "system" -%}
|
| 7 |
+
{%- if messages[0]['content'] is string -%}
|
| 8 |
+
{{- messages[0]['content'] + '
|
| 9 |
+
' + '
|
| 10 |
+
' -}}
|
| 11 |
+
{%- else -%}
|
| 12 |
+
{{- messages[0]['content'][0]['text'] + '
|
| 13 |
+
' + '
|
| 14 |
+
' -}}
|
| 15 |
+
{%- endif -%}
|
| 16 |
+
{%- endif -%}
|
| 17 |
+
{{- "# Tools
|
| 18 |
+
|
| 19 |
+
You may call one or more functions to assist with the user query.
|
| 20 |
+
|
| 21 |
+
You are provided with function signatures within <tools></tools> XML tags:
|
| 22 |
+
<tools>" -}}
|
| 23 |
+
{%- for tool in tools -%}
|
| 24 |
+
{{- "
|
| 25 |
+
" -}}
|
| 26 |
+
{{- tool | tojson -}}
|
| 27 |
+
{%- endfor -%}
|
| 28 |
+
{"name": "{{ tool_call['name'] }}", "arguments": {{ tool_call['arguments'] | tojson }}}
|
| 29 |
+
{{- '<end_of_turn>' + '
|
| 30 |
+
' -}}
|
| 31 |
+
{%- elif messages[0]['role'] == "system" -%}
|
| 32 |
+
{%- set loop_messages = messages[1:] -%}
|
| 33 |
+
{{- '<start_of_turn>' + 'system' + '
|
| 34 |
+
' -}}
|
| 35 |
{%- if messages[0]['content'] is string -%}
|
| 36 |
+
{{- messages[0]['content'] -}}
|
|
|
|
| 37 |
{%- else -%}
|
| 38 |
+
{{- messages[0]['content'][0]['text'] -}}
|
|
|
|
| 39 |
{%- endif -%}
|
| 40 |
+
{{- '<end_of_turn>
|
| 41 |
+
' }}
|
| 42 |
{%- else -%}
|
|
|
|
| 43 |
{%- set loop_messages = messages -%}
|
| 44 |
{%- endif -%}
|
| 45 |
{%- for message in loop_messages -%}
|
|
|
|
| 48 |
{%- else -%}
|
| 49 |
{%- set role = message['role'] -%}
|
| 50 |
{%- endif -%}
|
|
|
|
| 51 |
{{ '<start_of_turn>' + role + '
|
| 52 |
+
' }}
|
| 53 |
{%- if message['content'] is string -%}
|
| 54 |
{%- if role == "model" -%}
|
| 55 |
+
{% generation %}
|
| 56 |
+
{{- message['content'] | trim -}}
|
| 57 |
+
{% if message['tool_calls'] %}
|
| 58 |
+
{% for tool_call in message['tool_calls'] %}
|
| 59 |
+
{% if tool_call['function'] is defined %}
|
| 60 |
+
{% set tool_call = tool_call['function'] %}
|
| 61 |
+
{% endif %}
|
| 62 |
+
{{- "
|
| 63 |
+
" -}}
|
| 64 |
+
<tool_call>
|
| 65 |
+
{"name": "{{ tool_call['name'] }}", "arguments": {{ tool_call['arguments'] | tojson }}}
|
| 66 |
+
</tool_call>
|
| 67 |
+
{%- endfor -%}
|
| 68 |
+
{%- endif -%}
|
| 69 |
+
{% endgeneration %}
|
| 70 |
{%- else -%}
|
| 71 |
{{ message['content'] | trim }}
|
| 72 |
{%- endif -%}
|
|
|
|
| 76 |
{{ '<start_of_image>' }}
|
| 77 |
{%- elif item['type'] == 'text' -%}
|
| 78 |
{%- if role == "model" -%}
|
| 79 |
+
{% generation %}
|
| 80 |
+
{{- item['text'] | trim -}}
|
| 81 |
+
{% if message['tool_calls'] %}
|
| 82 |
+
{% for tool_call in message['tool_calls'] %}
|
| 83 |
+
{% if tool_call['function'] is defined %}
|
| 84 |
+
{% set tool_call = tool_call['function'] %}
|
| 85 |
+
{% endif %}
|
| 86 |
+
{{- "
|
| 87 |
+
" -}}
|
| 88 |
+
<tool_call>
|
| 89 |
+
{"name": "{{ tool_call['name'] }}", "arguments": {{ tool_call['arguments'] | tojson }}}
|
| 90 |
+
</tool_call>
|
| 91 |
+
{%- endfor -%}
|
| 92 |
+
{%- endif -%}
|
| 93 |
+
{% endgeneration %}
|
| 94 |
{%- else -%}
|
| 95 |
{{ item['text'] | trim }}
|
| 96 |
{%- endif -%}
|
|
|
|
| 108 |
' }}
|
| 109 |
{%- endif -%}
|
| 110 |
{%- endfor -%}
|
|
|
|
| 111 |
{%- if add_generation_prompt -%}
|
| 112 |
{{'<start_of_turn>model
|
| 113 |
'}}
|
training_args.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:12352aff4b6f68c7f229e2cedca2ed31cbfe6e2546540c2c02f8aff4cdc9e90d
|
| 3 |
+
size 5880
|