(url)
Downloads a model file and puts it under model directory.

    It downloads a file from the URL and puts it under model directory.
    For exmaple, if :obj:`url` is `http://example.com/subdir/model.npz`,
    the pretrained weights file will be saved to
    `$CHAINER_DATASET_ROOT/pfnet/chainercv/models/model.npz`.
    If there is already a file at the destination path,
    it just returns the path without downloading the same file.

    Args:
        url (string): URL to download from.

    Returns:
        string: Path to the downloaded file.
Downloads a model file and puts it under model directory.
Downloads a model file and puts it under model directory .
def download_model(url):
    """Downloads a model file and puts it under model directory.

    It downloads a file from the URL and puts it under model directory.
    For exmaple, if :obj:`url` is `http://example.com/subdir/model.npz`,
    the pretrained weights file will be saved to
    `$CHAINER_DATASET_ROOT/pfnet/chainercv/models/model.npz`.
    If there is already a file at the destination path,
    it just returns the path without downloading the same file.

    Args:
        url (string): URL to download from.

    Returns:
        string: Path to the downloaded file.

    """
    # To support ChainerMN, the target directory should be locked.
    with filelock.FileLock(os.path.join(
            get_dataset_directory(os.path.join('pfnet', 'chainercv', '.lock')),
            'models.lock')):
        root = get_dataset_directory(
            os.path.join('pfnet', 'chainercv', 'models'))
        basename = os.path.basename(url)
        path = os.path.join(root, basename)
        if not os.path.exists(path):
            cache_path = cached_download(url)
            os.rename(cache_path, path)
        return path
def download_model ( url ) : # To support ChainerMN, the target directory should be locked. with filelock . FileLock ( os . path . join ( get_dataset_directory ( os . path . join ( 'pfnet' , 'chainercv' , '.lock' ) ) , 'models.lock' ) ) : root = get_dataset_directory ( os . path . join ( 'pfnet' , 'chainercv' , 'models' ) ) basename = os . path . basename ( url ) path = os . path . join ( root , basename ) if not os . path . exists ( path ) : cache_path = cached_download ( url ) os . rename ( cache_path , path ) return path