Download setup_extract.ps1 from jeffbrian/DressCode: direct link, hf CLI and curl.
- Browser
- Download file 1.73 kB
-
https://huggingface.co/datasets/jeffbrian/DressCode/resolve/main/setup_extract.ps1
- Command line
-
hf download hf://datasets/jeffbrian/DressCode/setup_extract.ps1
-
curl -L -o setup_extract.ps1 https://huggingface.co/datasets/jeffbrian/DressCode/resolve/main/setup_extract.ps1
1.73 kB
| param([string]$OutDir = "") | |
| $ErrorActionPreference = "Stop" | |
| $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path | |
| $TarName = "DressCode.tar" | |
| $TarPath = Join-Path $ScriptDir $TarName | |
| if (-not $OutDir) { $OutDir = Join-Path $ScriptDir "data\DressCode" } | |
| function Join-Parts([string]$OutFile) { | |
| $parts = Get-ChildItem -Path ($OutFile + ".part*") -EA SilentlyContinue | Sort-Object Name | |
| if (-not $parts -or $parts.Count -eq 0) { return $false } | |
| Write-Host "==> Joining $($parts.Count) parts -> $OutFile" | |
| if (Test-Path $OutFile) { Remove-Item $OutFile -Force } | |
| $fs = [System.IO.File]::Open($OutFile, 'Create') | |
| try { | |
| foreach ($p in $parts) { | |
| Write-Host " + $($p.Name)" | |
| $src = [System.IO.File]::OpenRead($p.FullName) | |
| try { $src.CopyTo($fs) } finally { $src.Dispose() } | |
| } | |
| } finally { $fs.Dispose() } | |
| return $true | |
| } | |
| if (-not (Test-Path $TarPath)) { | |
| if (-not (Join-Parts $TarPath)) { Write-Error "Missing $TarPath / parts" } | |
| } | |
| $parent = Split-Path -Parent $OutDir | |
| New-Item -ItemType Directory -Force -Path $parent | Out-Null | |
| Write-Host "==> Extracting $TarName -> $parent" | |
| & tar.exe -xf $TarPath -C $parent | |
| if ($LASTEXITCODE -ne 0) { throw "tar extract failed" } | |
| $Root = $OutDir | |
| foreach ($c in @((Join-Path $parent "DressCode"), (Join-Path $OutDir "DressCode"), $OutDir)) { | |
| if (Test-Path (Join-Path $c "dresses")) { $Root = $c; break } | |
| } | |
| $missing = $false | |
| foreach ($n in @("dresses", "upper_body", "lower_body")) { | |
| if (-not (Test-Path (Join-Path $Root $n))) { Write-Host " MISSING: $n"; $missing = $true } | |
| else { Write-Host " OK: $n" } | |
| } | |
| if ($missing) { throw "layout check failed" } | |
| Write-Host "==> Done. Dataset root: $Root" | |