Spaces:
Build error
Build error
add 2 files
Browse files- config.json +37 -0
- definetool.py +19 -0
config.json
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": [
|
3 |
+
"QWenLMHeadModel"
|
4 |
+
],
|
5 |
+
"auto_map": {
|
6 |
+
"AutoConfig": "configuration_qwen.QWenConfig",
|
7 |
+
"AutoModelForCausalLM": "modeling_qwen.QWenLMHeadModel"
|
8 |
+
},
|
9 |
+
"attn_dropout_prob": 0.0,
|
10 |
+
"bf16": false,
|
11 |
+
"emb_dropout_prob": 0.0,
|
12 |
+
"fp16": false,
|
13 |
+
"fp32": false,
|
14 |
+
"hidden_size": 2048,
|
15 |
+
"intermediate_size": 11008,
|
16 |
+
"initializer_range": 0.02,
|
17 |
+
"kv_channels": 128,
|
18 |
+
"layer_norm_epsilon": 1e-06,
|
19 |
+
"max_position_embeddings": 8192,
|
20 |
+
"model_type": "qwen",
|
21 |
+
"no_bias": true,
|
22 |
+
"num_attention_heads": 16,
|
23 |
+
"num_hidden_layers": 24,
|
24 |
+
"onnx_safe": null,
|
25 |
+
"rotary_emb_base": 10000,
|
26 |
+
"rotary_pct": 1.0,
|
27 |
+
"scale_attn_weights": true,
|
28 |
+
"seq_length": 8192,
|
29 |
+
"tie_word_embeddings": false,
|
30 |
+
"tokenizer_class": "QWenTokenizer",
|
31 |
+
"transformers_version": "4.32.0",
|
32 |
+
"use_cache": true,
|
33 |
+
"use_dynamic_ntk": true,
|
34 |
+
"use_flash_attn": "auto",
|
35 |
+
"use_logn_attn": true,
|
36 |
+
"vocab_size": 151936
|
37 |
+
}
|
definetool.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# First, define a tool
|
2 |
+
def get_current_temperature(location: str) -> float:
|
3 |
+
"""
|
4 |
+
Get the current temperature at a location.
|
5 |
+
|
6 |
+
Args:
|
7 |
+
location: The location to get the temperature for, in the format "City, Country"
|
8 |
+
Returns:
|
9 |
+
The current temperature at the specified location in the specified units, as a float.
|
10 |
+
"""
|
11 |
+
return 22. # A real function should probably actually get the temperature!
|
12 |
+
|
13 |
+
# Next, create a chat and apply the chat template
|
14 |
+
messages = [
|
15 |
+
{"role": "system", "content": "You are a bot that responds to weather queries."},
|
16 |
+
{"role": "user", "content": "Hey, what's the temperature in Paris right now?"}
|
17 |
+
]
|
18 |
+
|
19 |
+
inputs = tokenizer.apply_chat_template(messages, tools=[get_current_temperature], add_generation_prompt=True)
|