つばろぐ

主に C#, .NET, Azure の備忘録です。たまに日記。

Phi3のモデルクローン時のpost-checkoutエラーへの対処

devblogs.microsoft.com

こちらの記事を読んで Phi3 を試してみようと思い、C# のラボコンテンツをテキストに沿って進めました。

github.com

すると、最初のモデルクローンでエラーが発生しました。

git clone https://huggingface.co/microsoft/Phi-3-vision-128k-instruct-onnx-cpu
Cloning into 'Phi-3-vision-128k-instruct-onnx-cpu'...
remote: Enumerating objects: 30, done.
remote: Counting objects: 100% (27/27), done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 30 (delta 5), reused 0 (delta 0), pack-reused 3 (from 1)
Unpacking objects: 100% (30/30), 487.91 KiB | 310.00 KiB/s, done.
Filtering content: 100% (6/6), 2.99 GiB | 9.53 MiB/s, done.
fatal: active `post-checkout` hook found during `git clone`:
        D:/phi3/models/Phi-3-vision-128k-instruct-onnx-cpu/.git/hooks/post-checkout
For security reasons, this is disallowed by default.
If this is intentional and the hook should actually be run, please
run the command again with `GIT_CLONE_PROTECTION_ACTIVE=false`
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'

クローンしようとしたのはこちら。

huggingface.co

エラー内容を読むに、セキュリティ保護の観点からチェックアウト後のフックを禁止しているため、環境変数 GIT_CLONE_PROTECTION_ACTIVE をセットしましょうとのこと。
なので PowerShell環境変数をセット。

$env:GIT_CLONE_PROTECTION_ACTIVE = "false"

github.com

これで問題なくクローンに成功しました。

git clone https://huggingface.co/microsoft/Phi-3-vision-128k-instruct-onnx-cpu
Cloning into 'Phi-3-vision-128k-instruct-onnx-cpu'...
remote: Enumerating objects: 30, done.
remote: Counting objects: 100% (27/27), done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 30 (delta 5), reused 0 (delta 0), pack-reused 3 (from 1)
Unpacking objects: 100% (30/30), 487.91 KiB | 357.00 KiB/s, done.
Filtering content: 100% (6/6), 2.99 GiB | 9.85 MiB/s, done.