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
OpenDAS
opencompass
Commits
538b4393
"tests/pipelines/vscode:/vscode.git/clone" did not exist on "9b37ed33b5fa09e594b38e4e6f7477beff3bd66a"
Unverified
Commit
538b4393
authored
Jul 28, 2023
by
Haodong Duan
Committed by
GitHub
Jul 28, 2023
Browse files
[Fix] Fix seed in HFEvaluator (#122)
parent
46c96457
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
opencompass/openicl/icl_evaluator/icl_hf_evaluator.py
opencompass/openicl/icl_evaluator/icl_hf_evaluator.py
+8
-1
No files found.
opencompass/openicl/icl_evaluator/icl_hf_evaluator.py
View file @
538b4393
import
random
from
typing
import
List
import
evaluate
import
numpy
as
np
from
opencompass.registry
import
ICL_EVALUATORS
...
...
@@ -12,10 +14,15 @@ class HuggingfaceEvaluator(BaseEvaluator):
Args:
metric (str): Metric name in evaluate module.
seed (int): There exists some randomness during the calculation of some
metrics, thus we set a fixed random seed for reproducing. Defaults
to 0.
"""
def
__init__
(
self
,
metric
:
str
)
->
None
:
def
__init__
(
self
,
metric
:
str
,
seed
:
int
=
0
)
->
None
:
self
.
metric
=
metric
random
.
seed
(
seed
)
np
.
random
.
seed
(
seed
)
super
().
__init__
()
def
_preprocess
(
self
,
predictions
:
List
,
references
:
List
)
->
dict
:
...
...
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