| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | import os |
| | import tempfile |
| |
|
| | from transformers.testing_utils import require_torch |
| |
|
| |
|
| | @require_torch |
| | def test_cli_download(cli): |
| | with tempfile.TemporaryDirectory() as tmpdir: |
| | output = cli("download", "hf-internal-testing/tiny-random-gptj", "--cache-dir", tmpdir) |
| | assert output.exit_code == 0 |
| |
|
| | |
| | model_dir = os.path.join(tmpdir, "models--hf-internal-testing--tiny-random-gptj") |
| | assert os.path.exists(os.path.join(model_dir, "blobs")) |
| | assert os.path.exists(os.path.join(model_dir, "refs")) |
| | assert os.path.exists(os.path.join(model_dir, "snapshots")) |
| |
|
| |
|
| | @require_torch |
| | def test_cli_download_trust_remote(cli, caplog, capsys): |
| | caplog.set_level(100000) |
| | |
| | |
| |
|
| | with capsys.disabled(): |
| | with tempfile.TemporaryDirectory() as tmpdir: |
| | output = cli( |
| | "download", |
| | "hf-internal-testing/test_dynamic_model_with_tokenizer", |
| | "--trust-remote-code", |
| | "--cache-dir", |
| | tmpdir, |
| | ) |
| | assert output.exit_code == 0 |
| |
|
| | |
| | model_dir = os.path.join(tmpdir, "models--hf-internal-testing--test_dynamic_model_with_tokenizer") |
| | assert os.path.exists(os.path.join(model_dir, "blobs")) |
| | assert os.path.exists(os.path.join(model_dir, "refs")) |
| | assert os.path.exists(os.path.join(model_dir, "snapshots")) |
| |
|