hf-transformers-bot commited on
Commit
a942006
·
verified ·
1 Parent(s): b319ca3

Update tiny models for GraniteSpeechModel

Browse files
chat_template.jinja ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {# Alias tools -> available_tools #}
2
+ {%- if tools and not available_tools -%}
3
+ {%- set available_tools = tools -%}
4
+ {%- endif -%}
5
+ {%- if messages[0]['role'] == 'system' %}
6
+ {%- set system_message = messages[0]['content'] %}
7
+ {%- set loop_messages = messages[1:] %}
8
+ {%- else %}
9
+ {%- set system_message = "Knowledge Cutoff Date: April 2024.
10
+ Today's Date: " + strftime_now('%B %d, %Y') + ".
11
+ You are Granite, developed by IBM." %}
12
+ {%- if available_tools and documents %}
13
+ {%- set system_message = system_message + " You are a helpful assistant with access to the following tools. When a tool is required to answer the user's query, respond only with <|tool_call|> followed by a JSON list of tools used. If a tool does not exist in the provided list of tools, notify the user that you do not have the ability to fulfill the request.
14
+ Write the response to the user's input by strictly aligning with the facts in the provided documents. If the information needed to answer the question is not available in the documents, inform the user that the question cannot be answered based on the available data." %}
15
+ {%- elif available_tools %}
16
+ {%- set system_message = system_message + " You are a helpful assistant with access to the following tools. When a tool is required to answer the user's query, respond only with <|tool_call|> followed by a JSON list of tools used. If a tool does not exist in the provided list of tools, notify the user that you do not have the ability to fulfill the request." %}
17
+ {%- elif documents %}
18
+ {%- set system_message = system_message + " Write the response to the user's input by strictly aligning with the facts in the provided documents. If the information needed to answer the question is not available in the documents, inform the user that the question cannot be answered based on the available data." %}
19
+ {%- elif thinking %}
20
+ {%- set system_message = system_message + " You are a helpful AI assistant.
21
+ Respond to every user query in a comprehensive and detailed way. You can write down your thoughts and reasoning process before responding. In the thought process, engage in a comprehensive cycle of analysis, summarization, exploration, reassessment, reflection, backtracing, and iteration to develop well-considered thinking process. In the response section, based on various attempts, explorations, and reflections from the thoughts section, systematically present the final solution that you deem correct. The response should summarize the thought process. Write your thoughts between <think></think> and write your response between <response></response> for each user query." %}
22
+ {%- else %}
23
+ {%- set system_message = system_message + " You are a helpful AI assistant." %}
24
+ {%- endif %}
25
+ {%- if 'citations' in controls and documents %}
26
+ {%- set system_message = system_message + '
27
+ Use the symbols <|start_of_cite|> and <|end_of_cite|> to indicate when a fact comes from a document in the search result, e.g <|start_of_cite|> {document_id: 1}my fact <|end_of_cite|> for a fact from document 1. Afterwards, list all the citations with their corresponding documents in an ordered list.' %}
28
+ {%- endif %}
29
+ {%- if 'hallucinations' in controls and documents %}
30
+ {%- set system_message = system_message + '
31
+ Finally, after the response is written, include a numbered list of sentences from the response with a corresponding risk value that are hallucinated and not based in the documents.' %}
32
+ {%- endif %}
33
+ {%- set loop_messages = messages %}
34
+ {%- endif %}
35
+ {{- '<|start_of_role|>system<|end_of_role|>' + system_message + '<|end_of_text|>
36
+ ' }}
37
+ {%- if available_tools %}
38
+ {{- '<|start_of_role|>available_tools<|end_of_role|>' }}
39
+ {{- available_tools | tojson(indent=4) }}
40
+ {{- '<|end_of_text|>
41
+ ' }}
42
+ {%- endif %}
43
+ {%- if documents %}
44
+ {%- for document in documents %}
45
+ {{- '<|start_of_role|>document {"document_id": "' + document['doc_id'] | string + '"}<|end_of_role|>
46
+ ' }}
47
+ {{- document['text'] }}
48
+ {{- '<|end_of_text|>
49
+ ' }}
50
+ {%- endfor %}
51
+ {%- endif %}
52
+ {%- for message in loop_messages %}
53
+ {{- '<|start_of_role|>' + message['role'] + '<|end_of_role|>' + message['content'] + '<|end_of_text|>
54
+ ' }}
55
+ {%- if loop.last and add_generation_prompt %}
56
+ {{- '<|start_of_role|>assistant' }}
57
+ {%- if controls %}
58
+ {{- ' ' + controls | tojson()}}
59
+ {%- endif %}
60
+ {{- '<|end_of_role|>' }}
61
+ {%- endif %}
62
+ {%- endfor %}
config.json ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "GraniteSpeechModel"
4
+ ],
5
+ "audio_token_index": 0,
6
+ "downsample_rate": 5,
7
+ "dtype": "float32",
8
+ "encoder_config": {
9
+ "context_size": 200,
10
+ "conv_expansion_factor": 2,
11
+ "conv_kernel_size": 15,
12
+ "dim_head": 16,
13
+ "dropout": 0.1,
14
+ "feedforward_mult": 4,
15
+ "hidden_dim": 32,
16
+ "input_dim": 80,
17
+ "max_pos_emb": 512,
18
+ "model_type": "granite_speech_encoder",
19
+ "num_heads": 2,
20
+ "num_layers": 2,
21
+ "output_dim": 42
22
+ },
23
+ "has_lora_adapter": true,
24
+ "initializer_range": 0.02,
25
+ "model_type": "granite_speech",
26
+ "pad_token_id": 0,
27
+ "projector_config": {
28
+ "attention_probs_dropout_prob": 0.1,
29
+ "cross_attention_frequency": 2,
30
+ "encoder_hidden_size": 32,
31
+ "hidden_act": "gelu",
32
+ "hidden_dropout_prob": 0.1,
33
+ "hidden_size": 32,
34
+ "initializer_range": 0.02,
35
+ "intermediate_size": 256,
36
+ "layer_norm_eps": 1e-12,
37
+ "max_position_embeddings": 512,
38
+ "model_type": "blip_2_qformer",
39
+ "num_attention_heads": 4,
40
+ "num_hidden_layers": 2,
41
+ "pad_token_id": 0,
42
+ "use_qformer_text_input": false,
43
+ "vocab_size": 30522
44
+ },
45
+ "text_config": {
46
+ "attention_bias": false,
47
+ "attention_dropout": 0.0,
48
+ "attention_multiplier": 1.0,
49
+ "bos_token_id": 0,
50
+ "embedding_multiplier": 1.0,
51
+ "eos_token_id": 0,
52
+ "hidden_act": "gelu",
53
+ "hidden_size": 32,
54
+ "initializer_range": 0.02,
55
+ "intermediate_size": 32,
56
+ "logits_scaling": 1.0,
57
+ "max_position_embeddings": 512,
58
+ "mlp_bias": false,
59
+ "model_type": "granite",
60
+ "num_attention_heads": 2,
61
+ "num_hidden_layers": 2,
62
+ "num_key_value_heads": 2,
63
+ "pad_token_id": 0,
64
+ "residual_multiplier": 1.0,
65
+ "rms_norm_eps": 1e-06,
66
+ "rope_parameters": {
67
+ "rope_theta": 10000.0,
68
+ "rope_type": "default"
69
+ },
70
+ "tie_word_embeddings": false,
71
+ "use_cache": true,
72
+ "vocab_size": 49160
73
+ },
74
+ "tie_word_embeddings": true,
75
+ "transformers_version": "5.16.0.dev0",
76
+ "window_size": 15
77
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7822cf82a5755f859a37fa653b491b1afc16cd7908c1a8a2aa614341e9c8f26c
3
+ size 6938152
preprocessor_config.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "feature_extractor_type": "GraniteSpeechFeatureExtractor",
3
+ "feature_size": 80,
4
+ "melspec_kwargs": {
5
+ "hop_length": 160,
6
+ "n_fft": 512,
7
+ "n_mels": 80,
8
+ "sample_rate": 16000,
9
+ "win_length": 400
10
+ },
11
+ "padding_side": "right",
12
+ "padding_value": 0.0,
13
+ "projector_downsample_rate": 5,
14
+ "projector_window_size": 15,
15
+ "return_attention_mask": true,
16
+ "sampling_rate": 16000
17
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<|end_of_text|>",
5
+ "clean_up_tokenization_spaces": true,
6
+ "eos_token": "<|end_of_text|>",
7
+ "errors": "replace",
8
+ "is_local": true,
9
+ "local_files_only": false,
10
+ "model_max_length": 9223372036854775807,
11
+ "pad_token": "<|end_of_text|>",
12
+ "padding_side": "left",
13
+ "tokenizer_class": "GPT2Tokenizer",
14
+ "unk_token": "<|end_of_text|>",
15
+ "vocab_size": 49152
16
+ }