helenai commited on
Commit
6ba86e2
1 Parent(s): afb5398

commit files to HF hub

Browse files
README.md ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ tags:
5
+ - openvino
6
+ ---
7
+
8
+ # baichuan-inc/Baichuan2-13B-Chat
9
+
10
+ This is the [baichuan-inc/Baichuan2-13B-Chat](https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat) model converted to [OpenVINO](https://openvino.ai) with INT8 weights compression for accelerated inference.
11
+
12
+ An example of how to do inference on this model:
13
+ ```python
14
+ from optimum.intel import OVModelForCausalLM
15
+ from transformers import AutoTokenizer, pipeline
16
+
17
+ # model_id should be set to either a local directory or a model available on the HuggingFace hub.
18
+ model_id = "helenai/baichuan-inc-Baichuan2-13B-Chat-ov"
19
+ tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
20
+ model = OVModelForCausalLM.from_pretrained(model_id)
21
+ pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
22
+ result = pipe("hello world")
23
+ print(result)
24
+ ```
25
+
config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "_name_or_path": "baichuan-inc/Baichuan2-13B-Chat",
4
+ "architectures": [
5
+ "BaichuanForCausalLM"
6
+ ],
7
+ "auto_map": {
8
+ "AutoConfig": "baichuan-inc/Baichuan2-13B-Chat--configuration_baichuan.BaichuanConfig",
9
+ "AutoModelForCausalLM": "baichuan-inc/Baichuan2-13B-Chat--modeling_baichuan.BaichuanForCausalLM"
10
+ },
11
+ "bos_token_id": 1,
12
+ "eos_token_id": 2,
13
+ "gradient_checkpointing": [
14
+ false
15
+ ],
16
+ "hidden_act": "silu",
17
+ "hidden_size": 5120,
18
+ "initializer_range": 0.02,
19
+ "intermediate_size": 13696,
20
+ "is_decoder": true,
21
+ "model_max_length": 4096,
22
+ "model_type": "baichuan",
23
+ "num_attention_heads": 40,
24
+ "num_hidden_layers": 40,
25
+ "pad_token_id": 0,
26
+ "rms_norm_eps": 1e-06,
27
+ "tie_word_embeddings": false,
28
+ "tokenizer_class": "BaichuanTokenizer",
29
+ "torch_dtype": "bfloat16",
30
+ "transformers_version": "4.39.0",
31
+ "use_cache": true,
32
+ "vocab_size": 125696,
33
+ "z_loss_weight": 0
34
+ }
inference.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ from optimum.intel import OVModelForCausalLM
2
+ from transformers import AutoTokenizer, pipeline
3
+
4
+ # model_id should be set to either a local directory or a model available on the HuggingFace hub.
5
+ model_id = "helenai/baichuan-inc-Baichuan2-13B-Chat-ov"
6
+ tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
7
+ model = OVModelForCausalLM.from_pretrained(model_id)
8
+ pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
9
+ result = pipe("hello world")
10
+ print(result)
openvino_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:25cb2ae0f6439944e7432d7441e49253ed7f106a8fc3832a40a9d02107bfdc10
3
+ size 16589380381
openvino_model.xml ADDED
The diff for this file is too large to render. See raw diff
 
special_tokens_map.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": true,
6
+ "rstrip": false,
7
+ "single_word": true
8
+ },
9
+ "eos_token": {
10
+ "content": "</s>",
11
+ "lstrip": false,
12
+ "normalized": true,
13
+ "rstrip": false,
14
+ "single_word": true
15
+ },
16
+ "pad_token": {
17
+ "content": "<unk>",
18
+ "lstrip": false,
19
+ "normalized": true,
20
+ "rstrip": false,
21
+ "single_word": true
22
+ },
23
+ "unk_token": {
24
+ "content": "<unk>",
25
+ "lstrip": false,
26
+ "normalized": true,
27
+ "rstrip": false,
28
+ "single_word": true
29
+ }
30
+ }
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:79452955be6b419a65984273a9f08af86042e1c2a75ee3ba989cbf620a133cc2
3
+ size 2001107
tokenizer_config.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_eos_token": false,
4
+ "added_tokens_decoder": {
5
+ "0": {
6
+ "content": "<unk>",
7
+ "lstrip": false,
8
+ "normalized": true,
9
+ "rstrip": false,
10
+ "single_word": true,
11
+ "special": true
12
+ },
13
+ "1": {
14
+ "content": "<s>",
15
+ "lstrip": false,
16
+ "normalized": true,
17
+ "rstrip": false,
18
+ "single_word": true,
19
+ "special": true
20
+ },
21
+ "2": {
22
+ "content": "</s>",
23
+ "lstrip": false,
24
+ "normalized": true,
25
+ "rstrip": false,
26
+ "single_word": true,
27
+ "special": true
28
+ }
29
+ },
30
+ "auto_map": {
31
+ "AutoTokenizer": [
32
+ "baichuan-inc/Baichuan2-13B-Chat--tokenization_baichuan.BaichuanTokenizer",
33
+ null
34
+ ]
35
+ },
36
+ "bos_token": "<s>",
37
+ "clean_up_tokenization_spaces": false,
38
+ "eos_token": "</s>",
39
+ "model_max_length": 4096,
40
+ "pad_token": "<unk>",
41
+ "sp_model_kwargs": {},
42
+ "tokenizer_class": "BaichuanTokenizer",
43
+ "unk_token": "<unk>"
44
+ }