MTDoven commited on
Commit
181711a
·
verified ·
1 Parent(s): 56a500e

Upload 249 files

Browse files
Files changed (48) hide show
  1. .gitignore +0 -2
  2. README.md +83 -18
  3. checkpoint/README.md +1 -0
  4. checkpoint/generalization.pth +3 -0
  5. dataset/__pycache__/__init__.cpython-311.pyc +0 -0
  6. dataset/__pycache__/dataset.cpython-311.pyc +0 -0
  7. dataset/__pycache__/register.cpython-311.pyc +0 -0
  8. dataset/condition_classinput_inference/__pycache__/dataset.cpython-311.pyc +0 -0
  9. dataset/condition_classinput_inference/__pycache__/model.cpython-311.pyc +0 -0
  10. dataset/condition_classinput_inference/__pycache__/train.cpython-311.pyc +0 -0
  11. dataset/condition_classinput_inference/structure.cache +0 -0
  12. dataset/condition_classinput_vittiny/structure.cache +0 -0
  13. dataset/config.json +1 -1
  14. demo.sh +1 -0
  15. model/__pycache__/__init__.cpython-311.pyc +0 -0
  16. model/__pycache__/__init__.cpython-312.pyc +0 -0
  17. model/__pycache__/denoiser.cpython-311.pyc +0 -0
  18. model/__pycache__/denoiser.cpython-312.pyc +0 -0
  19. model/__pycache__/diffusion.cpython-311.pyc +0 -0
  20. model/__pycache__/diffusion.cpython-312.pyc +0 -0
  21. model/__pycache__/gatemlp.cpython-311.pyc +0 -0
  22. model/__pycache__/lstm.cpython-311.pyc +0 -0
  23. model/__pycache__/mamba.cpython-311.pyc +0 -0
  24. model/__pycache__/mamba.cpython-312.pyc +0 -0
  25. model/__pycache__/transformer.cpython-311.pyc +0 -0
  26. model/__pycache__/transformer.cpython-312.pyc +0 -0
  27. requirements.txt +7 -6
  28. workspace/classinput/Qwen25llm/LICENSE +54 -0
  29. workspace/classinput/Qwen25llm/README.md +110 -0
  30. workspace/classinput/Qwen25llm/config.json +27 -0
  31. workspace/classinput/Qwen25llm/configuration.json +1 -0
  32. workspace/classinput/Qwen25llm/generation_config.json +14 -0
  33. workspace/classinput/Qwen25llm/merges.txt +0 -0
  34. workspace/classinput/Qwen25llm/model-00001-of-00002.safetensors +3 -0
  35. workspace/classinput/Qwen25llm/model-00002-of-00002.safetensors +3 -0
  36. workspace/classinput/Qwen25llm/model.safetensors.index.json +441 -0
  37. workspace/classinput/Qwen25llm/tokenizer.json +0 -0
  38. workspace/classinput/Qwen25llm/tokenizer_config.json +207 -0
  39. workspace/classinput/Qwen25llm/vocab.json +0 -0
  40. workspace/classinput/__pycache__/generalization.cpython-311.pyc +0 -0
  41. workspace/classinput/__pycache__/generalization.cpython-312.pyc +0 -0
  42. workspace/classinput/__pycache__/generate.cpython-311.pyc +0 -0
  43. workspace/classinput/__pycache__/generate.cpython-312.pyc +0 -0
  44. workspace/classinput/generate.py +29 -26
  45. workspace/classinput/launch.py +1 -5
  46. workspace/classinput/qwen25llm.py +71 -59
  47. workspace/config.json +1 -1
  48. workspace/demo.sh +1 -0
.gitignore CHANGED
@@ -1,10 +1,8 @@
1
  /.idea
2
  /.vscode
3
- **/checkpoint*/
4
  **/__pycache__/
5
  **/generated*/
6
  **/wandb/
7
  **/full_model.pth
8
  /rubbish
9
  **/*cache*
10
- /workspace/classinput/Qwen25llm/
 
1
  /.idea
2
  /.vscode
 
3
  **/__pycache__/
4
  **/generated*/
5
  **/wandb/
6
  **/full_model.pth
7
  /rubbish
8
  **/*cache*
 
README.md CHANGED
@@ -10,12 +10,12 @@ pipeline_tag: any-to-any
10
 
11
 
12
  # Recurrent Parameter Generation
13
- The official repository of paper [Recurrent Diffusion for Large-Scale Parameter Generation]().
14
 
15
 
16
- ## Introduction
17
  Parameter generation has long struggled to scale, significantly limiting its applications.
18
- In this study, we introduce Recurrent diffusion for large-scale Parameter Generation, or RPG,
19
  which models large-scale parameter generation through a recurrent diffusion process.
20
  We divide the trained parameters into non-overlapping parts and propose a recurrent model to learn their relationships.
21
  The outputs of this recurrent model, serving as conditions, are then input into a diffusion model to generate neural network parameters.
@@ -28,9 +28,6 @@ indicating that recurrent diffusion greatly enhances the practicality of paramet
28
 
29
 
30
 
31
-
32
-
33
-
34
  ## Environment
35
  Before you get started, you need to set up a conda environment first.
36
  1. Create your conda environment.
@@ -41,13 +38,13 @@ conda install pytorch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 pytorch-cuda=
41
  ```
42
  2. Install mamba-ssm. (You may run into compilation issues, refer to the [official mamba-ssm repository](https://github.com/state-spaces/mamba) for details.)
43
  ```shell
44
- pip install mamba-ssm[causal-conv1d]
45
  pip install causal-conv1d
 
46
  ```
47
  3. Install other dependencies for this repository.
48
  ```shell
49
  git lfs install
50
- git clone https://huggingface.co/MTDoven/Recurrent-Parameter-Generation
51
  cd Recurrent-Parameter-Generation
52
  pip install -r requirements.txt
53
  ```
@@ -56,26 +53,94 @@ pip install -r requirements.txt
56
 
57
 
58
  ## Quick Start
59
- 1. Modify your config file.
60
- ```shell
61
- # Set up your configs interactively.
62
- python ./workspace/set_configs.py
63
- ```
64
-
65
- 2. Try to generate with RPG model.
66
  ```shell
67
  cd ./workspace
68
- CUDA_VISIBLE_DEVICES=0 python ./classinput/launch.py
69
- # CUDA_VISIBLE_DEVICES=<GPU_index> python ./classinput/launch.py
70
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  You can get more information from [Github](https://github.com/NUS-HPC-AI-Lab/Recurrent-Parameter-Generation).
73
 
74
 
75
 
76
 
77
  ## Acknowledgment
78
- coming soon...
 
 
 
 
 
 
 
 
 
 
79
 
80
 
81
  ## Citation
 
10
 
11
 
12
  # Recurrent Parameter Generation
13
+ ### [Paper]() | [Project Page](https://NUS-HPC-AI-Lab.github.io/Recurrent-Parameter-Generation/) | [Huggingface](https://huggingface.co/MTDoven/Recurrent-Parameter-Generation)
14
 
15
 
16
+ ## Abstract
17
  Parameter generation has long struggled to scale, significantly limiting its applications.
18
+ In this study, we introduce **R**ecurrent diffusion for large-scale **P**arameter **G**eneration, or **RPG**,
19
  which models large-scale parameter generation through a recurrent diffusion process.
20
  We divide the trained parameters into non-overlapping parts and propose a recurrent model to learn their relationships.
21
  The outputs of this recurrent model, serving as conditions, are then input into a diffusion model to generate neural network parameters.
 
28
 
29
 
30
 
 
 
 
31
  ## Environment
32
  Before you get started, you need to set up a conda environment first.
33
  1. Create your conda environment.
 
38
  ```
39
  2. Install mamba-ssm. (You may run into compilation issues, refer to the [official mamba-ssm repository](https://github.com/state-spaces/mamba) for details.)
40
  ```shell
 
41
  pip install causal-conv1d
42
+ pip install mamba-ssm[causal-conv1d]
43
  ```
44
  3. Install other dependencies for this repository.
45
  ```shell
46
  git lfs install
47
+ git clone https://huggingface.co/MTDoven/Recurrent-Parameter-Generation.git
48
  cd Recurrent-Parameter-Generation
49
  pip install -r requirements.txt
50
  ```
 
53
 
54
 
55
  ## Quick Start
56
+ Try to generate with RPG model.
 
 
 
 
 
 
57
  ```shell
58
  cd ./workspace
59
+ CUDA_VISIBLE_DEVICES=0 sh demo.sh
60
+ # CUDA_VISIBLE_DEVICES=<GPU_index> sh demo.sh
61
  ```
62
+ Here are some examples.
63
+ ```angular2html
64
+ description: "Give me a model to select all living things"
65
+ expected_class: [0,0,1,1,1,1,1,1,0,0] # bird, cat, deer, dog, frog, horse
66
+
67
+ description: "Find all vehicles that operate on roads"
68
+ expected_class: [0,1,0,0,0,0,0,0,0,1] # automobile, truck
69
+
70
+ description: "Select all things that can fly"
71
+ expected_class: [1,0,1,0,0,0,0,0,0,0] # airplane, bird
72
+
73
+ description: "Find all transportation methods that travel on water"
74
+ expected_class: [0,0,0,0,0,0,0,0,1,0] # ship
75
+
76
+ description: "Classify all mammals"
77
+ expected_class: [0,0,0,1,1,1,0,1,0,0] # cat, deer, dog, horse
78
+
79
+ description: "Find all animals with fur"
80
+ expected_class: [0,0,1,1,1,1,0,1,0,0] # bird, cat, deer, dog, horse
81
+
82
+ description: "Select all pets commonly found in households"
83
+ expected_class: [0,0,1,1,0,1,0,0,0,0] # bird, cat, dog
84
+
85
+ description: "Identify all cold-blooded animals"
86
+ expected_class: [0,0,0,0,0,0,1,0,0,0] # frog
87
 
88
+ description: "Find all objects that can carry cargo"
89
+ expected_class: [1,1,0,0,0,0,0,0,1,1] # airplane, automobile, ship, truck
90
+
91
+ description: "Select all things used for commercial transportation"
92
+ expected_class: [1,1,0,0,0,0,0,0,1,1] # airplane, automobile, ship, truck
93
+
94
+ description: "Identify all animals that can swim naturally"
95
+ expected_class: [0,0,0,1,0,0,1,0,0,0] # cat, frog
96
+
97
+ description: "Find all things with wheels"
98
+ expected_class: [1,1,0,0,0,0,0,0,0,1] # airplane, automobile, truck
99
+
100
+ description: "Select all creatures with four legs"
101
+ expected_class: [0,0,0,1,1,1,0,1,0,0] # cat, deer, dog, horse
102
+
103
+ description: "Identify all creatures that live in forests"
104
+ expected_class: [0,0,1,1,1,1,0,0,0,0] # bird, cat, deer, dog
105
+
106
+ description: "Find all animals that can live near water"
107
+ expected_class: [0,0,1,0,0,0,1,0,0,0] # bird, frog
108
+
109
+ description: "Select all man-made objects"
110
+ expected_class: [1,1,0,0,0,0,0,0,1,1] # airplane, automobile, ship, truck
111
+
112
+ description: "Find all things that make noise naturally"
113
+ expected_class: [0,0,1,1,1,1,1,1,0,0] # all animals
114
+
115
+ description: "Identify all animals that can climb trees"
116
+ expected_class: [0,0,1,1,0,1,0,0,0,0] # bird, cat, dog
117
+
118
+ "Select all animals that hunt other animals"
119
+ expected_class: [0,0,0,1,0,1,0,0,0,0] # cat, dog
120
+
121
+ description: "Find all things that are both man-made and can operate on water"
122
+ expected_class: [0,0,0,0,0,0,0,0,1,0] # ship
123
+
124
+ description: "Select all animals that are both pets and can climb"
125
+ expected_class: [0,0,0,1,0,1,0,0,0,0] # cat, dog
126
+ ```
127
  You can get more information from [Github](https://github.com/NUS-HPC-AI-Lab/Recurrent-Parameter-Generation).
128
 
129
 
130
 
131
 
132
  ## Acknowledgment
133
+ We thank
134
+ [Zhiyuan Liang](https://jerryliang24.github.io/),
135
+ [Zhuang Liu](https://liuzhuang13.github.io/),
136
+ [Gongfan Fang](https://fangggf.github.io/),
137
+ [Zangwei Zheng](https://zhengzangw.github.io/),
138
+ [Tianlong Chen](https://tianlong-chen.github.io/),
139
+ and [Zhangyang Wang](https://www.ece.utexas.edu/people/faculty/atlas-wang)
140
+ for valuable discussions and feedbacks.
141
+ This research is supported by the National Research Foundation,
142
+ Singapore under its AI Singapore Programme
143
+ (AISG Award No: AISG2-PhD-2021-08-008).
144
 
145
 
146
  ## Citation
checkpoint/README.md ADDED
@@ -0,0 +1 @@
 
 
1
+ ## Put your `generalization.pth` here.
checkpoint/generalization.pth CHANGED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:70692f90dd6654a7821140824d7b8b6a586c4af02be87cdc4631b524679f95a0
3
+ size 3959520666
dataset/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (215 Bytes). View file
 
dataset/__pycache__/dataset.cpython-311.pyc ADDED
Binary file (25.1 kB). View file
 
dataset/__pycache__/register.cpython-311.pyc ADDED
Binary file (11.1 kB). View file
 
dataset/condition_classinput_inference/__pycache__/dataset.cpython-311.pyc ADDED
Binary file (3.28 kB). View file
 
dataset/condition_classinput_inference/__pycache__/model.cpython-311.pyc ADDED
Binary file (1.52 kB). View file
 
dataset/condition_classinput_inference/__pycache__/train.cpython-311.pyc ADDED
Binary file (12.1 kB). View file
 
dataset/condition_classinput_inference/structure.cache ADDED
Binary file (504 kB). View file
 
dataset/condition_classinput_vittiny/structure.cache ADDED
Binary file (95.6 kB). View file
 
dataset/config.json CHANGED
@@ -1 +1 @@
1
- {"dataset_root": "path_to_your_dataset", "imagenet_root": {"train": null, "test": null}, "dora_root": "/home/wangkai/arpgen/DoRA/commonsense_reasoning", "dora_env_name": "dora_llama"}
 
1
+ {"dataset_root": "path_to_your_dataset", "imagenet_root": {"train": null, "test": null}, "dora_root": null, "dora_env_name": "dora_llama"}
demo.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ python ./workspace/classinput/launch.py
model/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (16.5 kB). View file
 
model/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (15 kB). View file
 
model/__pycache__/denoiser.cpython-311.pyc ADDED
Binary file (8.69 kB). View file
 
model/__pycache__/denoiser.cpython-312.pyc ADDED
Binary file (7.63 kB). View file
 
model/__pycache__/diffusion.cpython-311.pyc ADDED
Binary file (16.3 kB). View file
 
model/__pycache__/diffusion.cpython-312.pyc ADDED
Binary file (15.1 kB). View file
 
model/__pycache__/gatemlp.cpython-311.pyc ADDED
Binary file (3.56 kB). View file
 
model/__pycache__/lstm.cpython-311.pyc ADDED
Binary file (2.05 kB). View file
 
model/__pycache__/mamba.cpython-311.pyc ADDED
Binary file (2.37 kB). View file
 
model/__pycache__/mamba.cpython-312.pyc ADDED
Binary file (1.98 kB). View file
 
model/__pycache__/transformer.cpython-311.pyc ADDED
Binary file (6.92 kB). View file
 
model/__pycache__/transformer.cpython-312.pyc ADDED
Binary file (6.06 kB). View file
 
requirements.txt CHANGED
@@ -1,6 +1,7 @@
1
- timm
2
- wandb
3
- einops
4
- seaborn
5
- openpyxl
6
- bitsandbytes
 
 
1
+ timm
2
+ wandb
3
+ einops
4
+ seaborn
5
+ openpyxl
6
+ bitsandbytes
7
+ transformers
workspace/classinput/Qwen25llm/LICENSE ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Qwen RESEARCH LICENSE AGREEMENT
2
+
3
+ Qwen RESEARCH LICENSE AGREEMENT Release Date: September 19, 2024
4
+
5
+ By clicking to agree or by using or distributing any portion or element of the Qwen Materials, you will be deemed to have recognized and accepted the content of this Agreement, which is effective immediately.
6
+
7
+ 1. Definitions
8
+ a. This Qwen RESEARCH LICENSE AGREEMENT (this "Agreement") shall mean the terms and conditions for use, reproduction, distribution and modification of the Materials as defined by this Agreement.
9
+ b. "We" (or "Us") shall mean Alibaba Cloud.
10
+ c. "You" (or "Your") shall mean a natural person or legal entity exercising the rights granted by this Agreement and/or using the Materials for any purpose and in any field of use.
11
+ d. "Third Parties" shall mean individuals or legal entities that are not under common control with us or you.
12
+ e. "Qwen" shall mean the large language models, and software and algorithms, consisting of trained model weights, parameters (including optimizer states), machine-learning model code, inference-enabling code, training-enabling code, fine-tuning enabling code and other elements of the foregoing distributed by us.
13
+ f. "Materials" shall mean, collectively, Alibaba Cloud's proprietary Qwen and Documentation (and any portion thereof) made available under this Agreement.
14
+ g. "Source" form shall mean the preferred form for making modifications, including but not limited to model source code, documentation source, and configuration files.
15
+ h. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
16
+ i. "Non-Commercial" shall mean for research or evaluation purposes only.
17
+
18
+ 2. Grant of Rights
19
+ a. You are granted a non-exclusive, worldwide, non-transferable and royalty-free limited license under Alibaba Cloud's intellectual property or other rights owned by us embodied in the Materials to use, reproduce, distribute, copy, create derivative works of, and make modifications to the Materials FOR NON-COMMERCIAL PURPOSES ONLY.
20
+ b. If you are commercially using the Materials, you shall request a license from us.
21
+
22
+ 3. Redistribution
23
+ You may distribute copies or make the Materials, or derivative works thereof, available as part of a product or service that contains any of them, with or without modifications, and in Source or Object form, provided that you meet the following conditions:
24
+ a. You shall give any other recipients of the Materials or derivative works a copy of this Agreement;
25
+ b. You shall cause any modified files to carry prominent notices stating that you changed the files;
26
+ c. You shall retain in all copies of the Materials that you distribute the following attribution notices within a "Notice" text file distributed as a part of such copies: "Qwen is licensed under the Qwen RESEARCH LICENSE AGREEMENT, Copyright (c) Alibaba Cloud. All Rights Reserved."; and
27
+ d. You may add your own copyright statement to your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of your modifications, or for any such derivative works as a whole, provided your use, reproduction, and distribution of the work otherwise complies with the terms and conditions of this Agreement.
28
+
29
+ 4. Rules of use
30
+ a. The Materials may be subject to export controls or restrictions in China, the United States or other countries or regions. You shall comply with applicable laws and regulations in your use of the Materials.
31
+ b. If you use the Materials or any outputs or results therefrom to create, train, fine-tune, or improve an AI model that is distributed or made available, you shall prominently display “Built with Qwen” or “Improved using Qwen” in the related product documentation.
32
+
33
+ 5. Intellectual Property
34
+ a. We retain ownership of all intellectual property rights in and to the Materials and derivatives made by or for us. Conditioned upon compliance with the terms and conditions of this Agreement, with respect to any derivative works and modifications of the Materials that are made by you, you are and will be the owner of such derivative works and modifications.
35
+ b. No trademark license is granted to use the trade names, trademarks, service marks, or product names of us, except as required to fulfill notice requirements under this Agreement or as required for reasonable and customary use in describing and redistributing the Materials.
36
+ c. If you commence a lawsuit or other proceedings (including a cross-claim or counterclaim in a lawsuit) against us or any entity alleging that the Materials or any output therefrom, or any part of the foregoing, infringe any intellectual property or other right owned or licensable by you, then all licenses granted to you under this Agreement shall terminate as of the date such lawsuit or other proceeding is commenced or brought.
37
+
38
+ 6. Disclaimer of Warranty and Limitation of Liability
39
+ a. We are not obligated to support, update, provide training for, or develop any further version of the Qwen Materials or to grant any license thereto.
40
+ b. THE MATERIALS ARE PROVIDED "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY OF ANY KIND INCLUDING WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, OR FITNESS FOR A PARTICULAR PURPOSE. WE MAKE NO WARRANTY AND ASSUME NO RESPONSIBILITY FOR THE SAFETY OR STABILITY OF THE MATERIALS AND ANY OUTPUT THEREFROM.
41
+ c. IN NO EVENT SHALL WE BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE MATERIALS OR ANY OUTPUT OF IT, NO MATTER HOW IT’S CAUSED.
42
+ d. You will defend, indemnify and hold harmless us from and against any claim by any third party arising out of or related to your use or distribution of the Materials.
43
+
44
+ 7. Survival and Termination.
45
+ a. The term of this Agreement shall commence upon your acceptance of this Agreement or access to the Materials and will continue in full force and effect until terminated in accordance with the terms and conditions herein.
46
+ b. We may terminate this Agreement if you breach any of the terms or conditions of this Agreement. Upon termination of this Agreement, you must delete and cease use of the Materials. Sections 6 and 8 shall survive the termination of this Agreement.
47
+
48
+ 8. Governing Law and Jurisdiction.
49
+ a. This Agreement and any dispute arising out of or relating to it will be governed by the laws of China, without regard to conflict of law principles, and the UN Convention on Contracts for the International Sale of Goods does not apply to this Agreement.
50
+ b. The People's Courts in Hangzhou City shall have exclusive jurisdiction over any dispute arising out of this Agreement.
51
+
52
+ 9. Other Terms and Conditions.
53
+ a. Any arrangements, understandings, or agreements regarding the Material not stated herein are separate from and independent of the terms and conditions of this Agreement. You shall request a separate license from us, if you use the Materials in ways not expressly agreed to in this Agreement.
54
+ b. We shall not be bound by any additional or different terms or conditions communicated by you unless expressly agreed.
workspace/classinput/Qwen25llm/README.md ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: qwen-research
4
+ license_link: https://huggingface.co/Qwen/Qwen2.5-3B-Instruct/blob/main/LICENSE
5
+ language:
6
+ - en
7
+ pipeline_tag: text-generation
8
+ base_model: Qwen/Qwen2.5-3B
9
+ tags:
10
+ - chat
11
+ ---
12
+
13
+ # Qwen2.5-3B-Instruct
14
+
15
+ ## Introduction
16
+
17
+ Qwen2.5 is the latest series of Qwen large language models. For Qwen2.5, we release a number of base language models and instruction-tuned language models ranging from 0.5 to 72 billion parameters. Qwen2.5 brings the following improvements upon Qwen2:
18
+
19
+ - Significantly **more knowledge** and has greatly improved capabilities in **coding** and **mathematics**, thanks to our specialized expert models in these domains.
20
+ - Significant improvements in **instruction following**, **generating long texts** (over 8K tokens), **understanding structured data** (e.g, tables), and **generating structured outputs** especially JSON. **More resilient to the diversity of system prompts**, enhancing role-play implementation and condition-setting for chatbots.
21
+ - **Long-context Support** up to 128K tokens and can generate up to 8K tokens.
22
+ - **Multilingual support** for over 29 languages, including Chinese, English, French, Spanish, Portuguese, German, Italian, Russian, Japanese, Korean, Vietnamese, Thai, Arabic, and more.
23
+
24
+ **This repo contains the instruction-tuned 3B Qwen2.5 model**, which has the following features:
25
+ - Type: Causal Language Models
26
+ - Training Stage: Pretraining & Post-training
27
+ - Architecture: transformers with RoPE, SwiGLU, RMSNorm, Attention QKV bias and tied word embeddings
28
+ - Number of Parameters: 3.09B
29
+ - Number of Paramaters (Non-Embedding): 2.77B
30
+ - Number of Layers: 36
31
+ - Number of Attention Heads (GQA): 16 for Q and 2 for KV
32
+ - Context Length: Full 32,768 tokens and generation 8192 tokens
33
+
34
+ For more details, please refer to our [blog](https://qwenlm.github.io/blog/qwen2.5/), [GitHub](https://github.com/QwenLM/Qwen2.5), and [Documentation](https://qwen.readthedocs.io/en/latest/).
35
+
36
+ ## Requirements
37
+
38
+ The code of Qwen2.5 has been in the latest Hugging face `transformers` and we advise you to use the latest version of `transformers`.
39
+
40
+ With `transformers<4.37.0`, you will encounter the following error:
41
+ ```
42
+ KeyError: 'qwen2'
43
+ ```
44
+
45
+ ## Quickstart
46
+
47
+ Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
48
+
49
+ ```python
50
+ from modelscope import AutoModelForCausalLM, AutoTokenizer
51
+
52
+ model_name = "qwen/Qwen2.5-3B-Instruct"
53
+
54
+ model = AutoModelForCausalLM.from_pretrained(
55
+ model_name,
56
+ torch_dtype="auto",
57
+ device_map="auto"
58
+ )
59
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
60
+
61
+ prompt = "Give me a short introduction to large language model."
62
+ messages = [
63
+ {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
64
+ {"role": "user", "content": prompt}
65
+ ]
66
+ text = tokenizer.apply_chat_template(
67
+ messages,
68
+ tokenize=False,
69
+ add_generation_prompt=True
70
+ )
71
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
72
+
73
+ generated_ids = model.generate(
74
+ **model_inputs,
75
+ max_new_tokens=512
76
+ )
77
+ generated_ids = [
78
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
79
+ ]
80
+
81
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
82
+ ```
83
+
84
+
85
+ ## Evaluation & Performance
86
+
87
+ Detailed evaluation results are reported in this [📑 blog](https://qwenlm.github.io/blog/qwen2.5/).
88
+
89
+ For requirements on GPU memory and the respective throughput, see results [here](https://qwen.readthedocs.io/en/latest/benchmark/speed_benchmark.html).
90
+
91
+ ## Citation
92
+
93
+ If you find our work helpful, feel free to give us a cite.
94
+
95
+ ```
96
+ @misc{qwen2.5,
97
+ title = {Qwen2.5: A Party of Foundation Models},
98
+ url = {https://qwenlm.github.io/blog/qwen2.5/},
99
+ author = {Qwen Team},
100
+ month = {September},
101
+ year = {2024}
102
+ }
103
+
104
+ @article{qwen2,
105
+ title={Qwen2 Technical Report},
106
+ author={An Yang and Baosong Yang and Binyuan Hui and Bo Zheng and Bowen Yu and Chang Zhou and Chengpeng Li and Chengyuan Li and Dayiheng Liu and Fei Huang and Guanting Dong and Haoran Wei and Huan Lin and Jialong Tang and Jialin Wang and Jian Yang and Jianhong Tu and Jianwei Zhang and Jianxin Ma and Jin Xu and Jingren Zhou and Jinze Bai and Jinzheng He and Junyang Lin and Kai Dang and Keming Lu and Keqin Chen and Kexin Yang and Mei Li and Mingfeng Xue and Na Ni and Pei Zhang and Peng Wang and Ru Peng and Rui Men and Ruize Gao and Runji Lin and Shijie Wang and Shuai Bai and Sinan Tan and Tianhang Zhu and Tianhao Li and Tianyu Liu and Wenbin Ge and Xiaodong Deng and Xiaohuan Zhou and Xingzhang Ren and Xinyu Zhang and Xipin Wei and Xuancheng Ren and Yang Fan and Yang Yao and Yichang Zhang and Yu Wan and Yunfei Chu and Yuqiong Liu and Zeyu Cui and Zhenru Zhang and Zhihao Fan},
107
+ journal={arXiv preprint arXiv:2407.10671},
108
+ year={2024}
109
+ }
110
+ ```
workspace/classinput/Qwen25llm/config.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen2ForCausalLM"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "bos_token_id": 151643,
7
+ "eos_token_id": 151645,
8
+ "hidden_act": "silu",
9
+ "hidden_size": 2048,
10
+ "initializer_range": 0.02,
11
+ "intermediate_size": 11008,
12
+ "max_position_embeddings": 32768,
13
+ "max_window_layers": 70,
14
+ "model_type": "qwen2",
15
+ "num_attention_heads": 16,
16
+ "num_hidden_layers": 36,
17
+ "num_key_value_heads": 2,
18
+ "rms_norm_eps": 1e-06,
19
+ "rope_theta": 1000000.0,
20
+ "sliding_window": 32768,
21
+ "tie_word_embeddings": true,
22
+ "torch_dtype": "bfloat16",
23
+ "transformers_version": "4.43.1",
24
+ "use_cache": true,
25
+ "use_sliding_window": false,
26
+ "vocab_size": 151936
27
+ }
workspace/classinput/Qwen25llm/configuration.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {}
workspace/classinput/Qwen25llm/generation_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "pad_token_id": 151643,
4
+ "do_sample": true,
5
+ "eos_token_id": [
6
+ 151645,
7
+ 151643
8
+ ],
9
+ "repetition_penalty": 1.05,
10
+ "temperature": 0.7,
11
+ "top_p": 0.8,
12
+ "top_k": 20,
13
+ "transformers_version": "4.37.0"
14
+ }
workspace/classinput/Qwen25llm/merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
workspace/classinput/Qwen25llm/model-00001-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:67347b23fb4165b652eb6611f5e1f2a06dfcddba8e909df1b2b0b1857bee06c2
3
+ size 3968658944
workspace/classinput/Qwen25llm/model-00002-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a40d941d0e7e0b966ad8b62bb6d6b7c88cce1299197b599d9d0a4ce59aabfc1d
3
+ size 2203268048
workspace/classinput/Qwen25llm/model.safetensors.index.json ADDED
@@ -0,0 +1,441 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 6171877376
4
+ },
5
+ "weight_map": {
6
+ "model.embed_tokens.weight": "model-00001-of-00002.safetensors",
7
+ "model.layers.0.input_layernorm.weight": "model-00001-of-00002.safetensors",
8
+ "model.layers.0.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
9
+ "model.layers.0.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
10
+ "model.layers.0.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
11
+ "model.layers.0.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
12
+ "model.layers.0.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
13
+ "model.layers.0.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
14
+ "model.layers.0.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
15
+ "model.layers.0.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
16
+ "model.layers.0.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
17
+ "model.layers.0.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
18
+ "model.layers.0.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
19
+ "model.layers.1.input_layernorm.weight": "model-00001-of-00002.safetensors",
20
+ "model.layers.1.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
21
+ "model.layers.1.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
22
+ "model.layers.1.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
23
+ "model.layers.1.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
24
+ "model.layers.1.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
25
+ "model.layers.1.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
26
+ "model.layers.1.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
27
+ "model.layers.1.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
28
+ "model.layers.1.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
29
+ "model.layers.1.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
30
+ "model.layers.1.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
31
+ "model.layers.10.input_layernorm.weight": "model-00001-of-00002.safetensors",
32
+ "model.layers.10.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
33
+ "model.layers.10.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
34
+ "model.layers.10.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
35
+ "model.layers.10.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
36
+ "model.layers.10.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
37
+ "model.layers.10.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
38
+ "model.layers.10.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
39
+ "model.layers.10.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
40
+ "model.layers.10.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
41
+ "model.layers.10.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
42
+ "model.layers.10.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
43
+ "model.layers.11.input_layernorm.weight": "model-00001-of-00002.safetensors",
44
+ "model.layers.11.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
45
+ "model.layers.11.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
46
+ "model.layers.11.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
47
+ "model.layers.11.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
48
+ "model.layers.11.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
49
+ "model.layers.11.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
50
+ "model.layers.11.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
51
+ "model.layers.11.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
52
+ "model.layers.11.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
53
+ "model.layers.11.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
54
+ "model.layers.11.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
55
+ "model.layers.12.input_layernorm.weight": "model-00001-of-00002.safetensors",
56
+ "model.layers.12.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
57
+ "model.layers.12.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
58
+ "model.layers.12.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
59
+ "model.layers.12.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
60
+ "model.layers.12.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
61
+ "model.layers.12.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
62
+ "model.layers.12.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
63
+ "model.layers.12.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
64
+ "model.layers.12.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
65
+ "model.layers.12.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
66
+ "model.layers.12.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
67
+ "model.layers.13.input_layernorm.weight": "model-00001-of-00002.safetensors",
68
+ "model.layers.13.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
69
+ "model.layers.13.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
70
+ "model.layers.13.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
71
+ "model.layers.13.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
72
+ "model.layers.13.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
73
+ "model.layers.13.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
74
+ "model.layers.13.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
75
+ "model.layers.13.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
76
+ "model.layers.13.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
77
+ "model.layers.13.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
78
+ "model.layers.13.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
79
+ "model.layers.14.input_layernorm.weight": "model-00001-of-00002.safetensors",
80
+ "model.layers.14.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
81
+ "model.layers.14.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
82
+ "model.layers.14.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
83
+ "model.layers.14.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
84
+ "model.layers.14.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
85
+ "model.layers.14.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
86
+ "model.layers.14.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
87
+ "model.layers.14.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
88
+ "model.layers.14.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
89
+ "model.layers.14.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
90
+ "model.layers.14.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
91
+ "model.layers.15.input_layernorm.weight": "model-00001-of-00002.safetensors",
92
+ "model.layers.15.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
93
+ "model.layers.15.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
94
+ "model.layers.15.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
95
+ "model.layers.15.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
96
+ "model.layers.15.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
97
+ "model.layers.15.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
98
+ "model.layers.15.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
99
+ "model.layers.15.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
100
+ "model.layers.15.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
101
+ "model.layers.15.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
102
+ "model.layers.15.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
103
+ "model.layers.16.input_layernorm.weight": "model-00001-of-00002.safetensors",
104
+ "model.layers.16.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
105
+ "model.layers.16.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
106
+ "model.layers.16.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
107
+ "model.layers.16.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
108
+ "model.layers.16.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
109
+ "model.layers.16.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
110
+ "model.layers.16.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
111
+ "model.layers.16.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
112
+ "model.layers.16.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
113
+ "model.layers.16.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
114
+ "model.layers.16.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
115
+ "model.layers.17.input_layernorm.weight": "model-00001-of-00002.safetensors",
116
+ "model.layers.17.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
117
+ "model.layers.17.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
118
+ "model.layers.17.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
119
+ "model.layers.17.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
120
+ "model.layers.17.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
121
+ "model.layers.17.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
122
+ "model.layers.17.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
123
+ "model.layers.17.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
124
+ "model.layers.17.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
125
+ "model.layers.17.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
126
+ "model.layers.17.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
127
+ "model.layers.18.input_layernorm.weight": "model-00001-of-00002.safetensors",
128
+ "model.layers.18.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
129
+ "model.layers.18.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
130
+ "model.layers.18.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
131
+ "model.layers.18.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
132
+ "model.layers.18.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
133
+ "model.layers.18.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
134
+ "model.layers.18.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
135
+ "model.layers.18.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
136
+ "model.layers.18.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
137
+ "model.layers.18.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
138
+ "model.layers.18.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
139
+ "model.layers.19.input_layernorm.weight": "model-00001-of-00002.safetensors",
140
+ "model.layers.19.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
141
+ "model.layers.19.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
142
+ "model.layers.19.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
143
+ "model.layers.19.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
144
+ "model.layers.19.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
145
+ "model.layers.19.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
146
+ "model.layers.19.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
147
+ "model.layers.19.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
148
+ "model.layers.19.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
149
+ "model.layers.19.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
150
+ "model.layers.19.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
151
+ "model.layers.2.input_layernorm.weight": "model-00001-of-00002.safetensors",
152
+ "model.layers.2.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
153
+ "model.layers.2.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
154
+ "model.layers.2.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
155
+ "model.layers.2.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
156
+ "model.layers.2.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
157
+ "model.layers.2.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
158
+ "model.layers.2.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
159
+ "model.layers.2.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
160
+ "model.layers.2.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
161
+ "model.layers.2.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
162
+ "model.layers.2.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
163
+ "model.layers.20.input_layernorm.weight": "model-00001-of-00002.safetensors",
164
+ "model.layers.20.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
165
+ "model.layers.20.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
166
+ "model.layers.20.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
167
+ "model.layers.20.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
168
+ "model.layers.20.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
169
+ "model.layers.20.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
170
+ "model.layers.20.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
171
+ "model.layers.20.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
172
+ "model.layers.20.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
173
+ "model.layers.20.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
174
+ "model.layers.20.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
175
+ "model.layers.21.input_layernorm.weight": "model-00001-of-00002.safetensors",
176
+ "model.layers.21.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
177
+ "model.layers.21.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
178
+ "model.layers.21.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
179
+ "model.layers.21.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
180
+ "model.layers.21.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
181
+ "model.layers.21.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
182
+ "model.layers.21.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
183
+ "model.layers.21.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
184
+ "model.layers.21.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
185
+ "model.layers.21.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
186
+ "model.layers.21.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
187
+ "model.layers.22.input_layernorm.weight": "model-00002-of-00002.safetensors",
188
+ "model.layers.22.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
189
+ "model.layers.22.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
190
+ "model.layers.22.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
191
+ "model.layers.22.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
192
+ "model.layers.22.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
193
+ "model.layers.22.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
194
+ "model.layers.22.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
195
+ "model.layers.22.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
196
+ "model.layers.22.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
197
+ "model.layers.22.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
198
+ "model.layers.22.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
199
+ "model.layers.23.input_layernorm.weight": "model-00002-of-00002.safetensors",
200
+ "model.layers.23.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
201
+ "model.layers.23.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
202
+ "model.layers.23.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
203
+ "model.layers.23.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
204
+ "model.layers.23.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
205
+ "model.layers.23.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
206
+ "model.layers.23.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
207
+ "model.layers.23.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
208
+ "model.layers.23.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
209
+ "model.layers.23.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
210
+ "model.layers.23.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
211
+ "model.layers.24.input_layernorm.weight": "model-00002-of-00002.safetensors",
212
+ "model.layers.24.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
213
+ "model.layers.24.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
214
+ "model.layers.24.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
215
+ "model.layers.24.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
216
+ "model.layers.24.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
217
+ "model.layers.24.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
218
+ "model.layers.24.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
219
+ "model.layers.24.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
220
+ "model.layers.24.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
221
+ "model.layers.24.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
222
+ "model.layers.24.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
223
+ "model.layers.25.input_layernorm.weight": "model-00002-of-00002.safetensors",
224
+ "model.layers.25.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
225
+ "model.layers.25.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
226
+ "model.layers.25.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
227
+ "model.layers.25.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
228
+ "model.layers.25.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
229
+ "model.layers.25.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
230
+ "model.layers.25.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
231
+ "model.layers.25.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
232
+ "model.layers.25.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
233
+ "model.layers.25.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
234
+ "model.layers.25.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
235
+ "model.layers.26.input_layernorm.weight": "model-00002-of-00002.safetensors",
236
+ "model.layers.26.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
237
+ "model.layers.26.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
238
+ "model.layers.26.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
239
+ "model.layers.26.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
240
+ "model.layers.26.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
241
+ "model.layers.26.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
242
+ "model.layers.26.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
243
+ "model.layers.26.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
244
+ "model.layers.26.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
245
+ "model.layers.26.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
246
+ "model.layers.26.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
247
+ "model.layers.27.input_layernorm.weight": "model-00002-of-00002.safetensors",
248
+ "model.layers.27.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
249
+ "model.layers.27.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
250
+ "model.layers.27.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
251
+ "model.layers.27.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
252
+ "model.layers.27.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
253
+ "model.layers.27.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
254
+ "model.layers.27.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
255
+ "model.layers.27.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
256
+ "model.layers.27.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
257
+ "model.layers.27.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
258
+ "model.layers.27.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
259
+ "model.layers.28.input_layernorm.weight": "model-00002-of-00002.safetensors",
260
+ "model.layers.28.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
261
+ "model.layers.28.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
262
+ "model.layers.28.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
263
+ "model.layers.28.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
264
+ "model.layers.28.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
265
+ "model.layers.28.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
266
+ "model.layers.28.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
267
+ "model.layers.28.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
268
+ "model.layers.28.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
269
+ "model.layers.28.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
270
+ "model.layers.28.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
271
+ "model.layers.29.input_layernorm.weight": "model-00002-of-00002.safetensors",
272
+ "model.layers.29.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
273
+ "model.layers.29.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
274
+ "model.layers.29.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
275
+ "model.layers.29.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
276
+ "model.layers.29.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
277
+ "model.layers.29.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
278
+ "model.layers.29.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
279
+ "model.layers.29.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
280
+ "model.layers.29.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
281
+ "model.layers.29.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
282
+ "model.layers.29.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
283
+ "model.layers.3.input_layernorm.weight": "model-00001-of-00002.safetensors",
284
+ "model.layers.3.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
285
+ "model.layers.3.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
286
+ "model.layers.3.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
287
+ "model.layers.3.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
288
+ "model.layers.3.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
289
+ "model.layers.3.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
290
+ "model.layers.3.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
291
+ "model.layers.3.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
292
+ "model.layers.3.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
293
+ "model.layers.3.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
294
+ "model.layers.3.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
295
+ "model.layers.30.input_layernorm.weight": "model-00002-of-00002.safetensors",
296
+ "model.layers.30.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
297
+ "model.layers.30.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
298
+ "model.layers.30.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
299
+ "model.layers.30.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
300
+ "model.layers.30.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
301
+ "model.layers.30.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
302
+ "model.layers.30.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
303
+ "model.layers.30.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
304
+ "model.layers.30.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
305
+ "model.layers.30.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
306
+ "model.layers.30.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
307
+ "model.layers.31.input_layernorm.weight": "model-00002-of-00002.safetensors",
308
+ "model.layers.31.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
309
+ "model.layers.31.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
310
+ "model.layers.31.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
311
+ "model.layers.31.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
312
+ "model.layers.31.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
313
+ "model.layers.31.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
314
+ "model.layers.31.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
315
+ "model.layers.31.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
316
+ "model.layers.31.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
317
+ "model.layers.31.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
318
+ "model.layers.31.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
319
+ "model.layers.32.input_layernorm.weight": "model-00002-of-00002.safetensors",
320
+ "model.layers.32.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
321
+ "model.layers.32.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
322
+ "model.layers.32.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
323
+ "model.layers.32.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
324
+ "model.layers.32.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
325
+ "model.layers.32.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
326
+ "model.layers.32.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
327
+ "model.layers.32.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
328
+ "model.layers.32.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
329
+ "model.layers.32.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
330
+ "model.layers.32.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
331
+ "model.layers.33.input_layernorm.weight": "model-00002-of-00002.safetensors",
332
+ "model.layers.33.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
333
+ "model.layers.33.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
334
+ "model.layers.33.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
335
+ "model.layers.33.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
336
+ "model.layers.33.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
337
+ "model.layers.33.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
338
+ "model.layers.33.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
339
+ "model.layers.33.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
340
+ "model.layers.33.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
341
+ "model.layers.33.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
342
+ "model.layers.33.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
343
+ "model.layers.34.input_layernorm.weight": "model-00002-of-00002.safetensors",
344
+ "model.layers.34.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
345
+ "model.layers.34.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
346
+ "model.layers.34.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
347
+ "model.layers.34.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
348
+ "model.layers.34.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
349
+ "model.layers.34.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
350
+ "model.layers.34.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
351
+ "model.layers.34.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
352
+ "model.layers.34.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
353
+ "model.layers.34.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
354
+ "model.layers.34.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
355
+ "model.layers.35.input_layernorm.weight": "model-00002-of-00002.safetensors",
356
+ "model.layers.35.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
357
+ "model.layers.35.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
358
+ "model.layers.35.mlp.up_proj.weight": "model-00002-of-00002.safetensors",
359
+ "model.layers.35.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
360
+ "model.layers.35.self_attn.k_proj.bias": "model-00002-of-00002.safetensors",
361
+ "model.layers.35.self_attn.k_proj.weight": "model-00002-of-00002.safetensors",
362
+ "model.layers.35.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
363
+ "model.layers.35.self_attn.q_proj.bias": "model-00002-of-00002.safetensors",
364
+ "model.layers.35.self_attn.q_proj.weight": "model-00002-of-00002.safetensors",
365
+ "model.layers.35.self_attn.v_proj.bias": "model-00002-of-00002.safetensors",
366
+ "model.layers.35.self_attn.v_proj.weight": "model-00002-of-00002.safetensors",
367
+ "model.layers.4.input_layernorm.weight": "model-00001-of-00002.safetensors",
368
+ "model.layers.4.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
369
+ "model.layers.4.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
370
+ "model.layers.4.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
371
+ "model.layers.4.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
372
+ "model.layers.4.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
373
+ "model.layers.4.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
374
+ "model.layers.4.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
375
+ "model.layers.4.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
376
+ "model.layers.4.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
377
+ "model.layers.4.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
378
+ "model.layers.4.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
379
+ "model.layers.5.input_layernorm.weight": "model-00001-of-00002.safetensors",
380
+ "model.layers.5.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
381
+ "model.layers.5.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
382
+ "model.layers.5.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
383
+ "model.layers.5.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
384
+ "model.layers.5.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
385
+ "model.layers.5.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
386
+ "model.layers.5.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
387
+ "model.layers.5.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
388
+ "model.layers.5.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
389
+ "model.layers.5.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
390
+ "model.layers.5.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
391
+ "model.layers.6.input_layernorm.weight": "model-00001-of-00002.safetensors",
392
+ "model.layers.6.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
393
+ "model.layers.6.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
394
+ "model.layers.6.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
395
+ "model.layers.6.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
396
+ "model.layers.6.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
397
+ "model.layers.6.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
398
+ "model.layers.6.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
399
+ "model.layers.6.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
400
+ "model.layers.6.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
401
+ "model.layers.6.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
402
+ "model.layers.6.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
403
+ "model.layers.7.input_layernorm.weight": "model-00001-of-00002.safetensors",
404
+ "model.layers.7.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
405
+ "model.layers.7.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
406
+ "model.layers.7.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
407
+ "model.layers.7.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
408
+ "model.layers.7.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
409
+ "model.layers.7.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
410
+ "model.layers.7.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
411
+ "model.layers.7.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
412
+ "model.layers.7.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
413
+ "model.layers.7.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
414
+ "model.layers.7.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
415
+ "model.layers.8.input_layernorm.weight": "model-00001-of-00002.safetensors",
416
+ "model.layers.8.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
417
+ "model.layers.8.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
418
+ "model.layers.8.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
419
+ "model.layers.8.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
420
+ "model.layers.8.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
421
+ "model.layers.8.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
422
+ "model.layers.8.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
423
+ "model.layers.8.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
424
+ "model.layers.8.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
425
+ "model.layers.8.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
426
+ "model.layers.8.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
427
+ "model.layers.9.input_layernorm.weight": "model-00001-of-00002.safetensors",
428
+ "model.layers.9.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
429
+ "model.layers.9.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
430
+ "model.layers.9.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
431
+ "model.layers.9.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
432
+ "model.layers.9.self_attn.k_proj.bias": "model-00001-of-00002.safetensors",
433
+ "model.layers.9.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
434
+ "model.layers.9.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
435
+ "model.layers.9.self_attn.q_proj.bias": "model-00001-of-00002.safetensors",
436
+ "model.layers.9.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
437
+ "model.layers.9.self_attn.v_proj.bias": "model-00001-of-00002.safetensors",
438
+ "model.layers.9.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
439
+ "model.norm.weight": "model-00002-of-00002.safetensors"
440
+ }
441
+ }
workspace/classinput/Qwen25llm/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
workspace/classinput/Qwen25llm/tokenizer_config.json ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ }
181
+ },
182
+ "additional_special_tokens": [
183
+ "<|im_start|>",
184
+ "<|im_end|>",
185
+ "<|object_ref_start|>",
186
+ "<|object_ref_end|>",
187
+ "<|box_start|>",
188
+ "<|box_end|>",
189
+ "<|quad_start|>",
190
+ "<|quad_end|>",
191
+ "<|vision_start|>",
192
+ "<|vision_end|>",
193
+ "<|vision_pad|>",
194
+ "<|image_pad|>",
195
+ "<|video_pad|>"
196
+ ],
197
+ "bos_token": null,
198
+ "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}\n {%- endif %}\n {{- \"\\n\\n# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0]['role'] == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0]['content'] + '<|im_end|>\\n' }}\n {%- else %}\n {{- '<|im_start|>system\\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) or (message.role == \"assistant\" and not message.tool_calls) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content %}\n {{- '\\n' + message.content }}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n",
199
+ "clean_up_tokenization_spaces": false,
200
+ "eos_token": "<|im_end|>",
201
+ "errors": "replace",
202
+ "model_max_length": 131072,
203
+ "pad_token": "<|endoftext|>",
204
+ "split_special_tokens": false,
205
+ "tokenizer_class": "Qwen2Tokenizer",
206
+ "unk_token": null
207
+ }
workspace/classinput/Qwen25llm/vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
workspace/classinput/__pycache__/generalization.cpython-311.pyc ADDED
Binary file (7.91 kB). View file
 
workspace/classinput/__pycache__/generalization.cpython-312.pyc ADDED
Binary file (6.73 kB). View file
 
workspace/classinput/__pycache__/generate.cpython-311.pyc ADDED
Binary file (4.13 kB). View file
 
workspace/classinput/__pycache__/generate.cpython-312.pyc ADDED
Binary file (3.55 kB). View file
 
workspace/classinput/generate.py CHANGED
@@ -1,23 +1,26 @@
1
  import sys, os, json
2
- root = os.sep + os.sep.join(__file__.split(os.sep)[1:__file__.split(os.sep).index("Recurrent-Parameter-Generation")+1])
3
  sys.path.append(root)
4
  os.chdir(root)
5
 
 
6
  # torch
 
7
  import torch
8
- import random
9
  from torch import nn
10
  # father
11
  from workspace.classinput import generalization as item
 
 
12
  train_set = item.train_set
13
  test_set = item.test_set
14
  train_set.set_infinite_dataset(max_num=train_set.real_length)
15
  print("num_generated:", test_set.real_length)
16
  config = item.config
17
  model = item.model
 
18
  assert config.get("tag") is not None, "Remember to set a tag."
19
 
20
-
21
  # Model
22
  print('==> Building model..')
23
  diction = torch.load("./checkpoint/generalization.pth")
@@ -26,38 +29,38 @@ model.to_permutation_state = nn.Embedding(*permutation_shape)
26
  model.load_state_dict(diction)
27
  model = model.cuda()
28
 
29
-
30
  # generate
31
  print('==> Defining generate..')
32
- def generate(save_path, embedding, real_embedding, need_test=True):
33
- class_index = str(int("".join([str(int(i)) for i in real_embedding]), 2)).zfill(4)
 
34
  print("\n==> Generating..")
35
  model.eval()
36
  with torch.no_grad():
 
 
 
 
 
 
 
 
 
 
 
37
  prediction = model(sample=True, condition=embedding[None], permutation_state=False)
38
- generated_norm = torch.nanmean((prediction.cpu()).abs())
 
 
39
  print("Generated_norm:", generated_norm.item())
40
- train_set.save_params(prediction, save_path=save_path.format(class_index))
41
- print("Saved to:", save_path.format(class_index))
42
  if need_test:
 
 
 
 
 
 
43
  test_command = os.path.join(test_set.test_command + save_path.format(class_index))
44
  os.system(test_command)
45
  model.train()
46
  return prediction
47
-
48
-
49
-
50
-
51
- # if __name__ == "__main__":
52
- # for i in range(config["num_generated"]):
53
- # if config["specific_item"] is not None:
54
- # assert isinstance(config["specific_item"], int)
55
- # i = config["specific_item"]
56
- # print(f"generate index {i}\n")
57
- # print("Save to", config["generated_path"].format(config["tag"], "class####"))
58
- # generate(
59
- # save_path=config["generated_path"],
60
- # test_command=config["test_command"],
61
- # need_test=config["need_test"],
62
- # index=random.randint(0, len(train_set)-1) if config["specific_item"] is None else i,
63
- # )
 
1
  import sys, os, json
2
+ root = os.sep + os.sep.join(__file__.split(os.sep)[1:__file__.split(os.sep).index("Recurrent-Parameter-Generation") + 1])
3
  sys.path.append(root)
4
  os.chdir(root)
5
 
6
+
7
  # torch
8
+ import time
9
  import torch
 
10
  from torch import nn
11
  # father
12
  from workspace.classinput import generalization as item
13
+
14
+
15
  train_set = item.train_set
16
  test_set = item.test_set
17
  train_set.set_infinite_dataset(max_num=train_set.real_length)
18
  print("num_generated:", test_set.real_length)
19
  config = item.config
20
  model = item.model
21
+ model.config["diffusion_batch"] = 128
22
  assert config.get("tag") is not None, "Remember to set a tag."
23
 
 
24
  # Model
25
  print('==> Building model..')
26
  diction = torch.load("./checkpoint/generalization.pth")
 
29
  model.load_state_dict(diction)
30
  model = model.cuda()
31
 
 
32
  # generate
33
  print('==> Defining generate..')
34
+
35
+
36
+ def generate(save_path, embedding, need_test=True):
37
  print("\n==> Generating..")
38
  model.eval()
39
  with torch.no_grad():
40
+ start_time = time.time()
41
+ prediction = None
42
+ def display_time():
43
+ while prediction is None:
44
+ elapsed_time = time.time() - start_time
45
+ elapsed_minutes = elapsed_time / 60
46
+ print(f"Elapsed time: {elapsed_minutes:.2f} minutes", end="\r")
47
+ time.sleep(0.1)
48
+ import threading
49
+ timer_thread = threading.Thread(target=display_time)
50
+ timer_thread.start()
51
  prediction = model(sample=True, condition=embedding[None], permutation_state=False)
52
+ timer_thread.join()
53
+ print()
54
+ generated_norm = torch.nanmean((prediction.cpu()).abs())
55
  print("Generated_norm:", generated_norm.item())
 
 
56
  if need_test:
57
+ real_emb = input("Input your expected class (ONLY FOR EVALUATING): ")
58
+ # real_emb = "[0,0,1,1,1,1,1,1,0,0]"
59
+ real_emb = torch.tensor(eval(real_emb), dtype=torch.float)
60
+ class_index = str(int("".join([str(int(i)) for i in real_emb]), 2)).zfill(4)
61
+ train_set.save_params(prediction, save_path=save_path.format(class_index))
62
+ print("Saved to:", save_path.format(class_index))
63
  test_command = os.path.join(test_set.test_command + save_path.format(class_index))
64
  os.system(test_command)
65
  model.train()
66
  return prediction
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
workspace/classinput/launch.py CHANGED
@@ -18,11 +18,7 @@ while True:
18
  print("\n\n\n==================================================================================")
19
  print('class includes: ("airplane", "automobile", "bird", "cat", "deer", "dog", "frog", "horse", "ship", "truck")')
20
  text_emb = input("Input your description: ") or "Give me a model to select all living things."
21
- real_emb = input("Input your expected class (only for evaluating): ") or "[0,0,1,1,1,1,1,1,0,0]"
22
  # text_emb = "Give me a model to select all living things."
23
- # real_emb = "[0,0,1,1,1,1,1,1,0,0]"
24
-
25
  emb = get_embedding(prompt=text_emb)
26
  emb = torch.tensor(emb, dtype=torch.float)
27
- real_emb = torch.tensor(eval(real_emb), dtype=torch.float)
28
- params = generate(save_path=save_name, embedding=emb, real_embedding=real_emb, need_test=True)
 
18
  print("\n\n\n==================================================================================")
19
  print('class includes: ("airplane", "automobile", "bird", "cat", "deer", "dog", "frog", "horse", "ship", "truck")')
20
  text_emb = input("Input your description: ") or "Give me a model to select all living things."
 
21
  # text_emb = "Give me a model to select all living things."
 
 
22
  emb = get_embedding(prompt=text_emb)
23
  emb = torch.tensor(emb, dtype=torch.float)
24
+ params = generate(save_path=save_name, embedding=emb)
 
workspace/classinput/qwen25llm.py CHANGED
@@ -1,59 +1,71 @@
1
- from transformers import AutoModelForCausalLM, AutoTokenizer
2
-
3
-
4
- model_name = "/home/wangkai/Recurrent-Parameter-Generation/workspace/classinput/Qwen25llm"
5
- model = AutoModelForCausalLM.from_pretrained(
6
- model_name,
7
- torch_dtype="auto",
8
- device_map="auto"
9
- ) # load model
10
- tokenizer = AutoTokenizer.from_pretrained(model_name)
11
-
12
-
13
- def describe(prompt, system_prompt):
14
- messages = [
15
- {"role": "system", "content": system_prompt},
16
- {"role": "user", "content": prompt}
17
- ] # construct msgs
18
- text = tokenizer.apply_chat_template(
19
- messages,
20
- tokenize=False,
21
- add_generation_prompt=True
22
- ) # get text
23
- model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
24
- generated_ids = model.generate(
25
- **model_inputs,
26
- max_new_tokens=512
27
- ) # generate
28
- generated_ids = [
29
- output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
30
- ] # generate
31
- response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
32
- return response
33
-
34
-
35
- def discriminate(class_name, prompt):
36
- system_prompt = "You are an accurate discriminator. " \
37
- "You need to determines if the class name matches the description. " \
38
- "Answer with YES or NO."
39
- keywords = [word for word in prompt.split(" ")
40
- if "select" in word or "classif" in word or "find" in word or "all" in word]
41
- if len(keywords) == 0:
42
- description = prompt
43
- else: # # len(keywords > 0)
44
- description = prompt.rsplit(keywords[-1], 1)[-1]
45
- prompt = f"Does the {class_name} belong to \"{description}\"? \n\nAnswer me with YES or NO."
46
- result = describe(prompt, system_prompt)
47
- if "NO" in result or "no" in result or "No" in result:
48
- return False
49
- else: # assert YES in result
50
- return True
51
-
52
-
53
- def get_embedding(prompt):
54
- class_names = ("airplane", "automobile", "bird", "cat", "deer", "dog", "frog", "horse", "ship", "truck")
55
- results = []
56
- for class_name in class_names:
57
- result = discriminate(class_name, prompt)
58
- results.append(result)
59
- return results
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import AutoModelForCausalLM, AutoTokenizer
2
+ import os
3
+
4
+
5
+ model_name = os.path.join(os.path.dirname(__file__), "Qwen25llm")
6
+
7
+
8
+ print("Downloading Qwen2.5 files...")
9
+ from huggingface_hub import snapshot_download
10
+ snapshot_download(repo_id="Qwen2.5-3B-Instruct",
11
+ repo_type="model",
12
+ cache_dir=model_name,
13
+ local_dir_use_symlinks=False,
14
+ resume_download=True)
15
+
16
+
17
+ model = AutoModelForCausalLM.from_pretrained(
18
+ model_name,
19
+ torch_dtype="auto",
20
+ device_map="auto"
21
+ ) # load model
22
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
23
+
24
+
25
+ def describe(prompt, system_prompt):
26
+ messages = [
27
+ {"role": "system", "content": system_prompt},
28
+ {"role": "user", "content": prompt}
29
+ ] # construct msgs
30
+ text = tokenizer.apply_chat_template(
31
+ messages,
32
+ tokenize=False,
33
+ add_generation_prompt=True
34
+ ) # get text
35
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
36
+ generated_ids = model.generate(
37
+ **model_inputs,
38
+ max_new_tokens=512
39
+ ) # generate
40
+ generated_ids = [
41
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
42
+ ] # generate
43
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
44
+ return response
45
+
46
+
47
+ def discriminate(class_name, prompt):
48
+ system_prompt = "You are an accurate discriminator. " \
49
+ "You need to determines if the class name matches the description. " \
50
+ "Answer with YES or NO."
51
+ keywords = [word for word in prompt.split(" ")
52
+ if "select" in word or "classif" in word or "find" in word or "all" in word]
53
+ if len(keywords) == 0:
54
+ description = prompt
55
+ else: # # len(keywords > 0)
56
+ description = prompt.rsplit(keywords[-1], 1)[-1]
57
+ prompt = f"Does the {class_name} belong to \"{description}\"? \n\nAnswer me with YES or NO."
58
+ result = describe(prompt, system_prompt)
59
+ if "NO" in result or "no" in result or "No" in result:
60
+ return False
61
+ else: # assert YES in result
62
+ return True
63
+
64
+
65
+ def get_embedding(prompt):
66
+ class_names = ("airplane", "automobile", "bird", "cat", "deer", "dog", "frog", "horse", "ship", "truck")
67
+ results = []
68
+ for class_name in class_names:
69
+ result = discriminate(class_name, prompt)
70
+ results.append(result)
71
+ return results
workspace/config.json CHANGED
@@ -1 +1 @@
1
- {"use_wandb": true, "wandb_api_key": "your_wandb_key", "test_gpu_ids": "0"}
 
1
+ {"use_wandb": false, "wandb_api_key": "your_wandb_key", "test_gpu_ids": "0"}
workspace/demo.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ python ./classinput/launch.py