Skip to content

Commit 91db063

Browse files
feat: allow passing model filename when downloading a model from CLI
1 parent 69f3d32 commit 91db063

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Commands/DownloadModelCommand.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected function configure(): void
4646

4747
$this->addOption(
4848
'quantized',
49-
'q',
49+
null,
5050
InputOption::VALUE_OPTIONAL,
5151
'Whether to download the quantized version of the model.',
5252
true
@@ -70,6 +70,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7070
$cacheDir = $input->getOption('cache-dir');
7171
$quantized = filter_var($input->getOption('quantized'), FILTER_VALIDATE_BOOLEAN);
7272
$task = $input->getArgument('task');
73+
$modelFilename = $input->getOption('model-filename');
7374

7475
Transformers::setup()
7576
->setCacheDir($cacheDir)
@@ -91,10 +92,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9192
};
9293

9394
if ($task != null) {
94-
pipeline($task, $model, quantized: $quantized, onProgress: $onProgress);
95+
pipeline($task, $model, quantized: $quantized, modelFilename: $modelFilename, onProgress: $onProgress);
9596
} else {
9697
AutoTokenizer::fromPretrained($model, onProgress: $onProgress);
97-
AutoModel::fromPretrained($model, $quantized, onProgress: $onProgress);
98+
AutoModel::fromPretrained($model, $quantized, modelFilename: $modelFilename, onProgress: $onProgress);
9899
}
99100

100101
$output->writeln('✔ Model files downloaded successfully.');

0 commit comments

Comments
 (0)