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
gaoqiong
lm-evaluation-harness
Commits
3ee4c2e2
Commit
3ee4c2e2
authored
Jun 26, 2023
by
Matt Hoffner
Browse files
rename to LlamaCppLM
parent
8f992eb3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
9 deletions
+6
-9
lm_eval/models/__init__.py
lm_eval/models/__init__.py
+1
-1
lm_eval/models/llama.py
lm_eval/models/llama.py
+1
-1
tests/test_llama.py
tests/test_llama.py
+4
-7
No files found.
lm_eval/models/__init__.py
View file @
3ee4c2e2
...
...
@@ -16,7 +16,7 @@ MODEL_REGISTRY = {
"anthropic"
:
anthropic_llms
.
AnthropicLM
,
"textsynth"
:
textsynth
.
TextSynthLM
,
"dummy"
:
dummy
.
DummyLM
,
"llama"
:
llama
.
LlamaLM
"llama"
:
llama
.
Llama
Cpp
LM
}
...
...
lm_eval/models/llama.py
View file @
3ee4c2e2
...
...
@@ -18,7 +18,7 @@ def llama_completion(base_url, prompt, **kwargs):
print
(
f
"RequestException:
{
e
}
"
)
return
None
class
LlamaLM
(
BaseLM
):
class
Llama
Cpp
LM
(
BaseLM
):
def
__init__
(
self
,
base_url
,
truncate
=
False
):
super
().
__init__
()
self
.
base_url
=
base_url
...
...
tests/test_llama.py
View file @
3ee4c2e2
import
unittest
from
unittest.mock
import
MagicMock
from
lm_eval.models.llama
import
LlamaLM
from
lm_eval.models.llama
import
Llama
Cpp
LM
class
LlamaLMTest
(
unittest
.
TestCase
):
class
Llama
Cpp
LMTest
(
unittest
.
TestCase
):
def
test_loglikelihood
(
self
):
base_url
=
"https://matthoffner-ggml-llm-api.hf.space"
lm
=
LlamaLM
(
base_url
)
lm
=
Llama
Cpp
LM
(
base_url
)
# Create a MagicMock object to mock llama_completion
llama_completion_mock
=
MagicMock
()
...
...
@@ -29,7 +29,7 @@ class LlamaLMTest(unittest.TestCase):
def
test_greedy_until
(
self
):
base_url
=
"https://matthoffner-ggml-llm-api.hf.space"
lm
=
LlamaLM
(
base_url
)
lm
=
Llama
Cpp
LM
(
base_url
)
# Define the llama_completion method with the desired behavior
def
llama_completion_mock
(
url
,
context
,
stop
=
None
):
...
...
@@ -48,8 +48,5 @@ class LlamaLMTest(unittest.TestCase):
expected_res
=
[
"generated_text1"
,
"generated_text2"
]
self
.
assertEqual
(
res
,
expected_res
)
if
__name__
==
"__main__"
:
unittest
.
main
()
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