mirror of
https://github.com/modelscope/modelscope.git
synced 2026-02-24 12:10:09 +01:00
fix accuracy sensitiveness
This commit is contained in:
@@ -55,15 +55,6 @@ class LlamafileCMD(CLICommand):
|
||||
'Selected accuracy of GGUF files in the repo. Ignored when "file" is also provided.'
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
'--launch',
|
||||
type=str,
|
||||
required=False,
|
||||
default='True',
|
||||
help=
|
||||
'Whether to launch model with the downloaded llamafile, default to True.'
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
'--file',
|
||||
type=str,
|
||||
@@ -80,6 +71,15 @@ class LlamafileCMD(CLICommand):
|
||||
'Directory where the selected llamafile would will be downloaded to.'
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
'--launch',
|
||||
type=str,
|
||||
required=False,
|
||||
default='True',
|
||||
help=
|
||||
'Whether to launch model with the downloaded llamafile, default to True.'
|
||||
)
|
||||
|
||||
parser.set_defaults(func=subparser_func)
|
||||
|
||||
def execute(self):
|
||||
@@ -106,7 +106,7 @@ class LlamafileCMD(CLICommand):
|
||||
selected_file = f
|
||||
found = True
|
||||
break
|
||||
if self.args.accuracy and self.args.accuracy in f.lower():
|
||||
if self.args.accuracy and self.args.accuracy.lower() in f.lower():
|
||||
selected_file = f
|
||||
found = True
|
||||
break
|
||||
|
||||
@@ -29,6 +29,24 @@ class LlamafileCMDTest(unittest.TestCase):
|
||||
in output)
|
||||
self.assertTrue('Launching model with llamafile' in output)
|
||||
|
||||
accuracy = 'Q2_K'
|
||||
cmd = f'python -m modelscope.cli.cli {self.cmd} --model {self.model_id} --accuracy {accuracy}'
|
||||
stat, output = subprocess.getstatusoutput(cmd)
|
||||
self.assertEqual(stat, 0)
|
||||
self.assertTrue(
|
||||
'llamafile matching criteria found: [My-Model-14B-Q2_K.llamafile]'
|
||||
in output)
|
||||
self.assertTrue('Launching model with llamafile' in output)
|
||||
|
||||
accuracy = 'q2_k'
|
||||
cmd = f'python -m modelscope.cli.cli {self.cmd} --model {self.model_id} --accuracy {accuracy}'
|
||||
stat, output = subprocess.getstatusoutput(cmd)
|
||||
self.assertEqual(stat, 0)
|
||||
self.assertTrue(
|
||||
'llamafile matching criteria found: [My-Model-14B-Q2_K.llamafile]'
|
||||
in output)
|
||||
self.assertTrue('Launching model with llamafile' in output)
|
||||
|
||||
def test_given_file(self):
|
||||
file = 'My-Model-14B-FP16.llamafile'
|
||||
cmd = f'python -m modelscope.cli.cli {self.cmd} --model {self.model_id} --file {file}'
|
||||
|
||||
Reference in New Issue
Block a user