tsiendragon/qwen-image-finetune/qwen-image-edit-aipc-finetune-03-env-setup
Claude Code and agent skill by tsiendragon/qwen-image-finetune
- community
Checking that the SKILL.md file is still in the repository.
Step 3 of 8 of the Qwen-Image-Edit AI PC fine-tuning walkthrough. Use after qwen-image-edit-aipc-finetune-02-dataset. Create the conda environment, install torch+xpu matched to the installed oneAPI, apply the two required requirements.txt fixes, install project dependencies, and run the hardware probe to confirm XPU and the bitsandbytes XPU backend are available. Only use once step 2 dataset validation is done.
Install
npx vskill@latest install tsiendragon/qwen-image-finetune/qwen-image-edit-aipc-finetune-03-env-setupSKILL.md
Step 3 — Environment Setup
Series position: Step 3 of 8. One-time per machine; reuse across runs.
Step 1 covered the system-level prerequisites (oneAPI, driver, conda). This step sets up the Python training environment.
Prerequisites from Step 1:
- oneAPI version confirmed (needed to select the matching
torch+xpuversion) qwen-image-finetuneproject cloned to a local directory
Next step: when probe_hw.py passes all four PASS criteria, proceed to skill qwen-image-edit-aipc-finetune-04-config.
3.1 Create the conda env
(If a torch+xpu base env already exists locally, prefer cloning it — conda create -n qwen-image-edit-xpu --clone <existing-xpu-env> — to avoid re-downloading the torch wheel.)
3.2 Install torch+xpu
Recommended: latest wheel (let pip pick the version)
Minimum supported: torch >= 2.9.0+xpu. Confirm the installed version matches your oneAPI version (Step 1 §1.7 version table). For example, torch 2.11.0+xpu requires oneAPI 2025.3.
Pin a specific version (if your oneAPI is already installed and you want to match it, rather than upgrade oneAPI):
torchvision follows torch automatically from the same XPU channel — no need to pin it separately.
3.3 Install project dependencies
Before running pip install, the upstream requirements.txt needs two edits (a fresh clone of tsiendragon/qwen-image-finetune ships with both problems):
1. Comment out `transformer_engine[pytorch]` — CUDA-only, no XPU equivalent. Installing it will fail on a machine without NVCC:
2. Pin `bitsandbytes>=0.48.2` — the unversioned bitsandbytes line may resolve to an older build that lacks the XPU backend:
Then install:
If Step 5 adaptation has already been applied (the repo has device_utils.py and the XPU patches in place), this is the only required pre-install edit.
3.4 Activate oneAPI in the current shell
The training launcher (Step 7) handles this automatically; for this step's ad-hoc verification:
If this reports 'vars.bat' is not recognized errors, clear NoDefaultCurrentDirectoryInExePath across the call (shown above), and run from a CMD opened directly (not from inside another wrapper shell).
3.5 Verify with probe_hw.py
Save this script as probe_hw.py in the project root and run it. It is re-used in Step 4, so keep it.
Run:
Reading the output.ram_gb/vram_gb/ram_available_gbare GiB (binary, bytes/2**30),matching Windows Task Manager. A GiB reading is a few GiB BELOW the GB tier number becausefirmware + the iGPU reserve memory — e.g. a 32 GB machine readsram_gb~30–32.ram_gbisthe number the Step 4 recommender uses for the memory tier (overridable by--ram-tier).vram_gbis the XPU-visible carve-out of unified memory (often ~half ofram_gb); it isINFORMATIONAL ONLY — the recommender does NOT gate on it. Do not mistake a "GPU (16 GB)"label for a 16 GB machine.
PASS signal
The JSON output must show all four of:
xpu_available: truetorch_versionending in+xpubnb_version>=0.48.2bnb_xpu_available: true
oneapi_versionmay be null here ifsetvars.bathasn't run in this shell session — that'sexpected for a fresh session before the launcher runs. The training launcher handlessetvars.batin Step 7.
If any of the first four fail, do NOT proceed — fix the environment first.
Keep `probe_hw.py` in the project root — it is re-used in Step 4.
Proceed to: qwen-image-edit-aipc-finetune-04-config
Troubleshooting
`bnb_xpu_available: false`: bitsandbytes is too old or the XPU backend isn't compiled in. Re-run the §3.3 install with the correct version pin:
`xpu_available: false`: torch+xpu not installed correctly. Verify torch.__version__ ends in +xpu (not +cpu). Re-run the §3.2 install; if a non-XPU build is already present, add --force-reinstall so pip replaces it (the version number is the same, so pip skips the swap otherwise):
Triton package errors (wrong package installed): If you see Triton-related errors (ImportError, RuntimeError on first kernel execution, or driver-conflict crashes) that persist after clearing caches, the environment may have the wrong Triton package — e.g. triton (NVIDIA-targeting) or triton-windows installed alongside pytorch-triton-xpu or triton-xpu. Fix: uninstall all Triton variants, then reinstall only the correct one for your torch+xpu version (Step 1 §1.7 table):
After reinstalling, clear the Triton caches before the next run (the rmdir commands are in Step 7's Troubleshooting under "Stale Triton cache").
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/qwen-image-edit-aipc-finetune-03-env-setup/SKILL.md
Popularity
- Repository stars
- 253
- Repository forks
- 27
- 7-day trend score
- 28
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/tsiendragon/qwen-image-finetune/qwen-image-edit-aipc-finetune-03-env-setup)