# Copyright (c) 2024, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
importitertools# noqa: I001
importitertools# noqa: I001
importrandom
importrandom
fromfunctoolsimportcache,partial
fromfunctoolsimportcache,partial
...
@@ -9,18 +24,18 @@ from transformers import AutoTokenizer
...
@@ -9,18 +24,18 @@ from transformers import AutoTokenizer
fromlm_eval.tasks.ruler.utilsimportSEQ_LENGTHS
fromlm_eval.tasks.ruler.utilsimportSEQ_LENGTHS
# config = {
config={
# 'tokens_to_generate': 32,
"tokens_to_generate":32,
# 'template': """Answer the question based on the given documents. Only give me the answer and do not output any other words.\n\nThe following are given documents.\n\n{context}\n\nAnswer the question based on the given documents. Only give me the answer and do not output any other words.\n\nQuestion: {query}""",
"template":"""Answer the question based on the given documents. Only give me the answer and do not output any other words.\n\nThe following are given documents.\n\n{context}\n\nAnswer the question based on the given documents. Only give me the answer and do not output any other words.\n\nQuestion: {query}""",
# 'answer_prefix': """ Answer:""",
"answer_prefix":""" Answer:""",
# }
}
SEED=42
SEED=42
TEMPLATE="""Answer the question based on the given documents. Only give me the answer and do not output any other words.\n\nThe following are given documents.\n\n{context}\n\nAnswer the question based on the given documents. Only give me the answer and do not output any other words.\n\nQuestion: {query}"""
TEMPLATE="""Answer the question based on the given documents. Only give me the answer and do not output any other words.\n\nThe following are given documents.\n\n{context}\n\nAnswer the question based on the given documents. Only give me the answer and do not output any other words.\n\nQuestion: {query}"""