Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
codecritic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ziyuan Nan
codecritic
Commits
e2d2b230
Commit
e2d2b230
authored
Oct 17, 2024
by
nzy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
step1 & 4: wrap code in main()
parent
54409c18
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
26 deletions
+29
-26
step1_sample_code.py
+9
-8
step4_test_critic_model.py
+20
-18
No files found.
step1_sample_code.py
View file @
e2d2b230
from
utils_vllm
import
vllm_chatcomplete
from
utils_vllm
import
vllm_chatcomplete
from
utils
import
read_config
from
utils
import
read_config
cfg
=
read_config
()
vllm_chatcomplete
(
if
__name__
==
"__main__"
:
cfg
[
"model"
],
cfg
=
read_config
()
cfg
[
"sample"
][
"sample_prompt_path"
],
vllm_chatcomplete
(
cfg
[
"sample"
][
"sample_result_path"
],
cfg
[
"model"
],
cfg
[
"sample"
][
"sampling_params"
]
cfg
[
"sample"
][
"sample_prompt_path"
],
)
cfg
[
"sample"
][
"sample_result_path"
],
\ No newline at end of file
cfg
[
"sample"
][
"sampling_params"
],
)
step4_test_critic_model.py
View file @
e2d2b230
...
@@ -2,22 +2,24 @@ from utils_vllm import vllm_chatcomplete, vllm_score
...
@@ -2,22 +2,24 @@ from utils_vllm import vllm_chatcomplete, vllm_score
from
utils
import
read_config
from
utils
import
read_config
from
transformers
import
AutoTokenizer
from
transformers
import
AutoTokenizer
cfg
=
read_config
()
vllm_chatcomplete
(
cfg
[
"critic"
][
"model_path"
],
cfg
[
"dataset"
][
"minimal_test_path"
],
cfg
[
"critic"
][
"test"
][
"reason_result_path"
],
cfg
[
"critic"
][
"test"
][
"sampling_params"
]
)
tokenizer
=
AutoTokenizer
.
from_pretrained
(
cfg
[
"model"
])
if
__name__
==
"__main__"
:
score_tokens
=
tokenizer
.
encode
(
"Yes"
)
cfg
=
read_config
()
assert
len
(
score_tokens
)
==
1
vllm_chatcomplete
(
score_token
=
score_tokens
[
0
]
cfg
[
"critic"
][
"model_path"
],
cfg
[
"dataset"
][
"minimal_test_path"
],
cfg
[
"critic"
][
"test"
][
"reason_result_path"
],
cfg
[
"critic"
][
"test"
][
"sampling_params"
]
)
vllm_score
(
tokenizer
=
AutoTokenizer
.
from_pretrained
(
cfg
[
"model"
])
cfg
[
"critic"
][
"model_path"
],
score_tokens
=
tokenizer
.
encode
(
"Yes"
)
cfg
[
"critic"
][
"test"
][
"reason_result_path"
],
assert
len
(
score_tokens
)
==
1
cfg
[
"critic"
][
"test"
][
"score_result_path"
],
score_token
=
score_tokens
[
0
]
score_token
)
vllm_score
(
\ No newline at end of file
cfg
[
"critic"
][
"model_path"
],
cfg
[
"critic"
][
"test"
][
"reason_result_path"
],
cfg
[
"critic"
][
"test"
][
"score_result_path"
],
score_token
)
\ 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