Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ChatGLM2-6B_fastllm
Commits
4536fa79
Commit
4536fa79
authored
Aug 17, 2023
by
zhouxiang
Browse files
提交完善
parent
3a1bb385
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
chatglm_export.py
chatglm_export.py
+6
-6
cli_demo.py
cli_demo.py
+3
-3
No files found.
chatglm_export.py
View file @
4536fa79
...
...
@@ -23,8 +23,8 @@ fastllm_weight_type_dict = {
"embedding"
:
2
}
v
=
np
.
random
.
randint
(
-
127
,
127
,
[
10
,
20
])
;
temp
=
v
;
v
=
np
.
random
.
randint
(
-
127
,
127
,
[
10
,
20
])
temp
=
v
c_max
=
np
.
expand_dims
(
np
.
abs
(
v
).
max
(
axis
=
-
1
),
-
1
)
c_scale
=
c_max
/
127.0
v
=
(
v
/
c_scale
+
128.5
).
clip
(
1
,
255
).
astype
(
np
.
uint8
)
...
...
@@ -36,8 +36,8 @@ def write_int8(fo, v):
fo
.
write
(
struct
.
pack
(
'i'
,
3
))
fo
.
write
(
struct
.
pack
(
'i'
,
0
))
for
i
in
range
(
c_max
.
shape
[
0
]):
fo
.
write
(
struct
.
pack
(
'f'
,
-
c_max
[
i
][
0
]))
;
fo
.
write
(
struct
.
pack
(
'f'
,
c_max
[
i
][
0
]))
;
fo
.
write
(
struct
.
pack
(
'f'
,
-
c_max
[
i
][
0
]))
fo
.
write
(
struct
.
pack
(
'f'
,
c_max
[
i
][
0
]))
fo
.
write
(
v
.
data
)
def
write_int4
(
fo
,
v
):
...
...
@@ -51,8 +51,8 @@ def write_int4(fo, v):
fo
.
write
(
struct
.
pack
(
'i'
,
8
))
fo
.
write
(
struct
.
pack
(
'i'
,
0
))
for
i
in
range
(
c_min
.
shape
[
0
]):
fo
.
write
(
struct
.
pack
(
'f'
,
c_min
[
i
][
0
]))
;
fo
.
write
(
struct
.
pack
(
'f'
,
c_max
[
i
][
0
]))
;
fo
.
write
(
struct
.
pack
(
'f'
,
c_min
[
i
][
0
]))
fo
.
write
(
struct
.
pack
(
'f'
,
c_max
[
i
][
0
]))
fo
.
write
(
v
.
data
)
def
tofile
(
exportPath
,
...
...
cli_demo.py
View file @
4536fa79
...
...
@@ -21,9 +21,9 @@ if __name__ == "__main__":
history
=
[]
print
(
"输入内容即可进行对话,clear 清空对话历史,stop 终止程序"
)
continue
print
(
"AI:"
,
end
=
""
)
;
curResponse
=
""
;
print
(
"AI:"
,
end
=
""
)
curResponse
=
""
for
response
in
model
.
stream_response
(
query
,
history
=
history
):
curResponse
+=
response
;
curResponse
+=
response
print
(
response
,
flush
=
True
,
end
=
""
)
history
.
append
((
query
,
curResponse
))
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment