Install Windows XP using USB Flash Disk/ Flash Drive - Step by Step Guide

本文提供了一个详细的教程,指导用户如何使用USB闪存盘安装Windows XP系统。教程包括准备USB闪存盘、下载必要软件、配置BIOS等步骤,并解决了常见问题。

http://komku.blogspot.com/2008/11/install-windows-xp-using-usb-flash-disk.html

 

Someone in this post (Acer Aspire One Specifications and Windows XP Drivers ) ask me to write a tutorial about how to install Windows XP using USB flash disk/flash drive.
If you want to install Windows XP , but your notebook (or PC) has no CDROM, you should install Windows XP using USB Flash disk/Flash Drive/Thumb drive...
just follow this guide :

blogger-emoticon.blogspot.com
step 1 :
Buy an USB Flash Drive (at least 2GB).
When you do this tutorial, please make sure your computer/laptop/PC has a CD-ROM (or DVD).
so, now you have 2 computers, with CD-ROM support and without CD-ROM support (e.g Acer Aspire One , Asus EEE-PC).





step 2 :
Download this software pack (Komku-SP-usb.exe - Download ) 1.47MB
UPDATE 1 :
Anonymous said…
your download at mediafire keeps timing out, any other hosts available?
Mirror Depositfiles
Mirror Rapidshare
Mirror Easy-Share
Mirror Megaupload




this software pack contains 3 application :

-BootSect.exe (Boot Sector Manipulation Tool)
-PeToUSB (http://GoCoding.Com )
-usb_prep8 (Prepares Windows XP Setup LocalSource for Copy to USB-Drive)

step 3 :
Double click Komku-SP-usb.exe


a window will appear... and click Install



step 4 :
Insert your USB Flash Drive.
When I made this tutorial, I was using 4GB Transcend USB FlashDrive...



Locate folder C:\Komku\PeToUSB\
double click PeToUSB.exe




a window will appear like this...


Destination Drive : select USB Removable
check on Enable Disk Format
check on Quick Format
check on Enable LBA (FAT 16x)
Drive Label : XP-KOMKU (or whatever you want)
then click Start

Click Yes to continue....



"You are about to repartition and format a disk. Disk: .... All existing volumes and data on that disk will be lost. Are You Sure You Want To Continue?"
click Yes


Wait a few seconds...

Click OK , and you can close PeToUSB window.


step 5 :
Open Command Prompt ...
Click Start > Run > type cmd > click OK


On Command Prompt window, go to directory C:\Komku\bootsect\
how to do this?
first type this cd\ and press Enter


then type cd komku\bootsect and press Enter


the result...


Don't close Command Prompt window, and go to step 6...


step 6:
on command prompt window, type bootsect /nt52 H:


H:
is drive letter for my USB Flash Drive, it may be different with yours...

and press Enter

the result... "Successfully updated filesystem bootcode. Bootcode was succesfully updated on all targeted volumes."


don't close Command Prompt window, and go to step 7...


step 7:
now type this cd.. and press Enter


then type cd usb_prep8 and press Enter


type usb_prep8 again... and pres Enter



step 8:
Your command prompt window will look like this


Press any key to continue...
usb_prep8 welcome screen will appear



Prepares Windows XP LocalSource for Copy to USB-Drive:

0) Change Type of USB-Drive, currently [USB-stick]
1) Change XP Setup Source Path, currently []
2) Change Virtual TempDrive, currently [T:]
3) Change Target USB-Drive Letter, currently []
4) Make New Tempimage with XP LocalSource and Copy to USB-Drive
5) Use Existing Tempimage with XP LocalSource and Copy to USB-Drive
F) Change Log File - Simple OR Extended, currently [Simple]
Q) Quit

Enter your choice:_

now, insert your original Windows XP CD, or Windows XP with sata ahci driver to your CD/DVD ROM
and back to Command Prompt window

type 1 then press Enter...
"Browse For Folder" window will appear, select your CD/DVD drive and click OK



the result... "XP Setup Source Path" changed to G:\ (yours may be different)


now for point 2, if letter T is currently assigned to a drive in your computer, you must change it.... if not, leave it as it is
how to change it?
type 2 and press Enter...

"Enter Available Virtual DriveLetter"
for example you doesn't have drive S
so you type S and press Enter

back to usb_prep8 welcome screen...
now type 3 and press Enter...

"Please give Target USB-Drive Letter e.g type U" Enter Target USB-Drive Letter:
because my Flash drive letter is H
so, type H and press Enter...

after back to usb_prep8 welcome screen...
now type 4 and press Enter to make new temporary image with XP LocalSource and copy it to USB Flash Drive
please wait a few seconds..


"WARNING, ALL DATA ON NON-REMOVABLE DISK
DRIVE T: WILL BE LOST! Proceed with Format (Y/N)?"
type Y and press Enter
please wait....
when format virtual disk complete, press any key to continue...


please wait... making of LocalSource folder is in progress...


when "Making of LocalSource folder $WIN_NT$.~LS Ready"
Press any key to continue...



"Copy TempDrive Files to USB-Drive in about 15 minutes = Yes OR STOP = End Program = No"
Click Yes , and wait...


"Would you like USB-stick to be preferred Boot Drive U: bla... bla..."
Click Yes



"Would you like to unmount the Virtual Drive ?"
Click Yes , wait a few seconds, and press any key....
press any key again to close usb_prep8...


Now, your USB Flash Drive is ready... blogger-emoticon.blogspot.com


step 9 :
Now, insert your USB Flash Drive/Flash Disk/Thumb Drive to your notebook (e.g Acer Aspire One )
go to BIOS and make USB HDD (or USB ZIP in some other machine) as primary boot device....

then boot form your USB Flash Drive....
and select "TXT Mode Setup Windows XP, Never unplug USB-Drive Until After Logon"



After Hard Disk detected, delete all partition , create single partition... and install Windows XP on that partition...
and wait...


once text mode setup is complete, computer will restart....
this time select "GUI Mode setup Windows XP, Continue Setup + Start XP "



Continue Windows XP setup.... and Done! blogger-emoticon.blogspot.com
Windows XP Installed....




Remember, you can use this tutorial to install Windows XP on all other computers.. not just Aspire One and Asus EEE-PC....
blogger-emoticon.blogspot.com good luck!


UPDATE 2 :
FAQ
Anonymous said…
what if i use a 1GB flash drive ? will it still work?
Yes it is.. :)


Anonymous said…
hi all
can somebody tell me how to install xp with this method in SATA HD?
i finished the tutorial,but when boot up,the hdd is not showed.
help me plz
Follow this guide ( Slipstreaming driver using nLite )
FYI, you can burn it as image, then use virtual drive as Daemon Tools ( Download ) to mount it


Anonymous said…
Trying to restore XPSP3 on Medion akoya MD96910 netbook. Worked fine until 99% of files copied then got: Setup cannot copy the file: iaahci.cat - giving 3 options (retry, skip, quit). Retry didn't work so skipped. Similar message for iaahci.inf iaStor.cat iaStor.inf iaStor.sys. Subsequent XP Boot then failed. I do not understand why the intelSATA drivers (these files) won't load. Will try again with Netbook Bios AHCI mode set to Disable but not confident that will make any difference. Help!
Ref: MD96910 netbook restore. With AHCI mode disabled it works without loading the intelSATA files. I assume these will have to be loaded, just got to figure how to do that now! Thanks for great install guide - brilliant. If you could put a comment about intelSATA it would be great, I cannot be the only person who doesn't understand it.


Allen said…
PeToUSB didn't find any removable flash drive. Please help me .
by the way, I'm using Windows Vista.
Try use XP... or
use another USB port... My friend tried it on his Lenovo... when he plug in his USB flashdrive on left side of his notebook... PeToUSB didn't find any removable flashdrive... he change it to the right side then it works (XP) :)
read this :

Anonymous said…
Easy and well written.. thanks for making our lives easier. Although I should mention that I've tried it inder Windows Vista at first and the USB Flash Driver wasn't readable at all. The whole process must be under Windows XP. Again thanks, and wish you all the best.

Anonymous said…
I was having the "No USB Disks" error with PeToUSB as well with by Samsung U3 (2G) and my microSD + Reader (4G) on 32-bit Vista. The USBs were all formatted to FAT.
Then I switched to XP, and the USB was detected


I want do this is Vista...
Ali Jaffer said…
If you're on Windows Vista, try using the "Run as Administrator" function for both formatting the drive and command prompt.


Anonymous said…
thanks for the instructions works like a charm everytime :D
got one question though, can you use partition manager to make partitions after XP has been installed successfully using this method?
Like Obama said... Yes We Can!


For more FAQ read comments.....

Anonymous said…
Hi Guys this is greate blog Guess what i sued the same instruction to install the Server 2003 sr2 and works well for my Home server
Thanks to you all the Contributor


UPDATE 3 :
Everyone please read this WinToFlash Guide - Install Windows XP from USB Flash drive

UPDATE 4 :
NOTE TO ANYBODY WHO'S FLASH DRIVE CANNOT BE DETECTED... If you are in Vista or Windows 7 (Like Me) you have to Right-Click PeToUSB.exe, go to Properties, Compatibility Tab, and in Windows 7, choose RUN IN COMPATIBILITY MODE, and select Windows XP (Service Pack 3).
In Vista, just do some kind of "xp" mode. Also, in Windows 7, Command Prompt will probably give you a "denied" message on one of the "CMD" commands. Before going into Command Prompt, Right Click it (When typing into the search box in start menu) and click "Run as Administrator".


-Jason
"The 11 Year Old Tech Wiz"

UPDATE 5 :
Install Windows 7 from USB Flash drive guide

 

 

### Step-by-Step Guide to Complete PC Hardware Assembly and Software Installation #### **1. Prepare the Components** Ensure all hardware is available: - Case, Motherboard, CPU, RAM, GPU (if not integrated), Storage (SSD/HDD), PSU, Cooling (fan or liquid cooler) - Tools: Screwdriver, anti-static wrist strap #### **2. Install CPU into the Motherboard** - Open the CPU socket lever on the motherboard. - Align the CPU (match triangle marker) and gently place it into the socket. - Secure the socket lever. #### **3. Install CPU Cooler** - Apply thermal paste (if not pre-applied). - Mount the cooler according to its design (clip, bracket, or screws). - Connect the fan power cable to the **CPU_FAN** header. #### **4. Install RAM** - Open the clips on the memory slots. - Align the notch on the DDR4/DDR5 module with the slot. - Press firmly until clips snap into place. #### **5. Mount the Motherboard into the Case** - Install standoffs in the case (if not pre-installed). - Place I/O shield into the back of the case. - Lower the motherboard onto the standoffs and secure with screws. #### **6. Install Power Supply (PSU)** - Place the PSU into the case’s PSU bay (usually bottom-rear). - Secure with screws. - Route main **24-pin ATX** and **8-pin CPU power** cables to the motherboard. #### **7. Install Storage (SSD/HDD)** - Mount drive in a drive bay (2.5"/3.5"). - Connect **SATA data cable** to the motherboard and **SATA power** from PSU. - For M.2 SSD: Insert into M.2 slot, secure with screw. #### **8. Install Graphics Card (GPU)** - Remove PCIe slot covers on the case. - Insert GPU into **PCIe x16** slot. - Secure with screws; connect required **PCIe power cables** from PSU. #### **9. Connect Front Panel Headers** - Connect **Power Switch, Reset, HDD LED, Power LED** using the motherboard manual for pin layout. - Connect **Front USB and Audio** headers to their respective pins. #### **10. Cable Management** - Route cables through cutouts. - Use zip ties to secure and improve airflow. #### **11. Double-Check All Connections** - Ensure all power cables (main, CPU, GPU, drives) are securely connected. - Verify RAM, GPU, and CPU are seated properly. #### **12. Power On (First Boot)** - Connect monitor, keyboard, and power cord. - Press power button. - Check for POST (Power-On Self-Test) — screen should show BIOS/UEFI. #### **13. Install Operating System (e.g., Windows 10/11)** - Create bootable USB using another PC and Microsoft Media Creation Tool. - Insert USB, boot from it (press $F12$/$DEL$/EFI boot menu). - Follow setup: select language, partition disk, install OS. #### **14. Install Drivers and Updates** - Install motherboard drivers (chipset, LAN, audio) from manufacturer’s website or included USB. - Update GPU drivers (NVIDIA/AMD/Intel). - Run Windows Update. #### **15. Final Checks and Optimization** - Enter BIOS ($DEL$ key at boot): confirm XMP profile enabled (for RAM speed). - Set boot order (SSD first). - Install antivirus and essential software. > Your PC is now fully assembled and ready for use. 翻译为中文
09-22
我想在UR5e上面复现github上的这个代码,但我不知道怎么开始。包括配置中控之类的,请你把我当成一个小白来详细教我。# Diffusion Policy [[Project page]](https://diffusion-policy.cs.columbia.edu/) [[Paper]](https://diffusion-policy.cs.columbia.edu/#paper) [[Data]](https://diffusion-policy.cs.columbia.edu/data/) [[Colab (state)]](https://colab.research.google.com/drive/1gxdkgRVfM55zihY9TFLja97cSVZOZq2B?usp=sharing) [[Colab (vision)]](https://colab.research.google.com/drive/18GIHeOQ5DyjMN8iIRZL2EKZ0745NLIpg?usp=sharing) [Cheng Chi](http://cheng-chi.github.io/)<sup>1</sup>, [Siyuan Feng](https://www.cs.cmu.edu/~sfeng/)<sup>2</sup>, [Yilun Du](https://yilundu.github.io/)<sup>3</sup>, [Zhenjia Xu](https://www.zhenjiaxu.com/)<sup>1</sup>, [Eric Cousineau](https://www.eacousineau.com/)<sup>2</sup>, [Benjamin Burchfiel](http://www.benburchfiel.com/)<sup>2</sup>, [Shuran Song](https://www.cs.columbia.edu/~shurans/)<sup>1</sup> <sup>1</sup>Columbia University, <sup>2</sup>Toyota Research Institute, <sup>3</sup>MIT <img src="media/teaser.png" alt="drawing" width="100%"/> <img src="media/multimodal_sim.png" alt="drawing" width="100%"/> ## 🛝 Try it out! Our self-contained Google Colab notebooks is the easiest way to play with Diffusion Policy. We provide separate notebooks for [state-based environment](https://colab.research.google.com/drive/1gxdkgRVfM55zihY9TFLja97cSVZOZq2B?usp=sharing) and [vision-based environment](https://colab.research.google.com/drive/18GIHeOQ5DyjMN8iIRZL2EKZ0745NLIpg?usp=sharing). ## 🧾 Checkout our experiment logs! For each experiment used to generate Table I,II and IV in the [paper](https://diffusion-policy.cs.columbia.edu/#paper), we provide: 1. A `config.yaml` that contains all parameters needed to reproduce the experiment. 2. Detailed training/eval `logs.json.txt` for every training step. 3. Checkpoints for the best `epoch=*-test_mean_score=*.ckpt` and last `latest.ckpt` epoch of each run. Experiment logs are hosted on our website as nested directories in format: `https://diffusion-policy.cs.columbia.edu/data/experiments/<image|low_dim>/<task>/<method>/` Within each experiment directory you may find: ``` . ├── config.yaml ├── metrics │   └── logs.json.txt ├── train_0 │   ├── checkpoints │   │   ├── epoch=0300-test_mean_score=1.000.ckpt │   │   └── latest.ckpt │   └── logs.json.txt ├── train_1 │   ├── checkpoints │   │   ├── epoch=0250-test_mean_score=1.000.ckpt │   │   └── latest.ckpt │   └── logs.json.txt └── train_2 ├── checkpoints │   ├── epoch=0250-test_mean_score=1.000.ckpt │   └── latest.ckpt └── logs.json.txt ``` The `metrics/logs.json.txt` file aggregates evaluation metrics from all 3 training runs every 50 epochs using `multirun_metrics.py`. The numbers reported in the paper correspond to `max` and `k_min_train_loss` aggregation keys. To download all files in a subdirectory, use: ```console $ wget --recursive --no-parent --no-host-directories --relative --reject="index.html*" https://diffusion-policy.cs.columbia.edu/data/experiments/low_dim/square_ph/diffusion_policy_cnn/ ``` ## 🛠️ Installation ### 🖥️ Simulation To reproduce our simulation benchmark results, install our conda environment on a Linux machine with Nvidia GPU. On Ubuntu 20.04 you need to install the following apt packages for mujoco: ```console $ sudo apt install -y libosmesa6-dev libgl1-mesa-glx libglfw3 patchelf ``` We recommend [Mambaforge](https://github.com/conda-forge/miniforge#mambaforge) instead of the standard anaconda distribution for faster installation: ```console $ mamba env create -f conda_environment.yaml ``` but you can use conda as well: ```console $ conda env create -f conda_environment.yaml ``` The `conda_environment_macos.yaml` file is only for development on MacOS and does not have full support for benchmarks. ### 🦾 Real Robot Hardware (for Push-T): * 1x [UR5-CB3](https://www.universal-robots.com/cb3) or [UR5e](https://www.universal-robots.com/products/ur5-robot/) ([RTDE Interface](https://www.universal-robots.com/articles/ur/interface-communication/real-time-data-exchange-rtde-guide/) is required) * 2x [RealSense D415](https://www.intelrealsense.com/depth-camera-d415/) * 1x [3Dconnexion SpaceMouse](https://3dconnexion.com/us/product/spacemouse-wireless/) (for teleop) * 1x [Millibar Robotics Manual Tool Changer](https://www.millibar.com/manual-tool-changer/) (only need robot side) * 1x 3D printed [End effector](https://cad.onshape.com/documents/a818888644a15afa6cc68ee5/w/2885b48b018cda84f425beca/e/3e8771c2124cee024edd2fed?renderMode=0&uiState=63ffcba6631ca919895e64e5) * 1x 3D printed [T-block](https://cad.onshape.com/documents/f1140134e38f6ed6902648d5/w/a78cf81827600e4ff4058d03/e/f35f57fb7589f72e05c76caf?renderMode=0&uiState=63ffcbc9af4a881b344898ee) * USB-C cables and screws for RealSense Software: * Ubuntu 20.04.3 (tested) * Mujoco dependencies: `sudo apt install libosmesa6-dev libgl1-mesa-glx libglfw3 patchelf` * [RealSense SDK](https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md) * Spacemouse dependencies: `sudo apt install libspnav-dev spacenavd; sudo systemctl start spacenavd` * Conda environment `mamba env create -f conda_environment_real.yaml` ## 🖥️ Reproducing Simulation Benchmark Results ### Download Training Data Under the repo root, create data subdirectory: ```console [diffusion_policy]$ mkdir data && cd data ``` Download the corresponding zip file from [https://diffusion-policy.cs.columbia.edu/data/training/](https://diffusion-policy.cs.columbia.edu/data/training/) ```console [data]$ wget https://diffusion-policy.cs.columbia.edu/data/training/pusht.zip ``` Extract training data: ```console [data]$ unzip pusht.zip && rm -f pusht.zip && cd .. ``` Grab config file for the corresponding experiment: ```console [diffusion_policy]$ wget -O image_pusht_diffusion_policy_cnn.yaml https://diffusion-policy.cs.columbia.edu/data/experiments/image/pusht/diffusion_policy_cnn/config.yaml ``` ### Running for a single seed Activate conda environment and login to [wandb](https://wandb.ai) (if you haven't already). ```console [diffusion_policy]$ conda activate robodiff (robodiff)[diffusion_policy]$ wandb login ``` Launch training with seed 42 on GPU 0. ```console (robodiff)[diffusion_policy]$ python train.py --config-dir=. --config-name=image_pusht_diffusion_policy_cnn.yaml training.seed=42 training.device=cuda:0 hydra.run.dir='data/outputs/${now:%Y.%m.%d}/${now:%H.%M.%S}_${name}_${task_name}' ``` This will create a directory in format `data/outputs/yyyy.mm.dd/hh.mm.ss_<method_name>_<task_name>` where configs, logs and checkpoints are written to. The policy will be evaluated every 50 epochs with the success rate logged as `test/mean_score` on wandb, as well as videos for some rollouts. ```console (robodiff)[diffusion_policy]$ tree data/outputs/2023.03.01/20.02.03_train_diffusion_unet_hybrid_pusht_image -I wandb data/outputs/2023.03.01/20.02.03_train_diffusion_unet_hybrid_pusht_image ├── checkpoints │ ├── epoch=0000-test_mean_score=0.134.ckpt │ └── latest.ckpt ├── .hydra │ ├── config.yaml │ ├── hydra.yaml │ └── overrides.yaml ├── logs.json.txt ├── media │ ├── 2k5u6wli.mp4 │ ├── 2kvovxms.mp4 │ ├── 2pxd9f6b.mp4 │ ├── 2q5gjt5f.mp4 │ ├── 2sawbf6m.mp4 │ └── 538ubl79.mp4 └── train.log 3 directories, 13 files ``` ### Running for multiple seeds Launch local ray cluster. For large scale experiments, you might want to setup an [AWS cluster with autoscaling](https://docs.ray.io/en/master/cluster/vms/user-guides/launching-clusters/aws.html). All other commands remain the same. ```console (robodiff)[diffusion_policy]$ export CUDA_VISIBLE_DEVICES=0,1,2 # select GPUs to be managed by the ray cluster (robodiff)[diffusion_policy]$ ray start --head --num-gpus=3 ``` Launch a ray client which will start 3 training workers (3 seeds) and 1 metrics monitor worker. ```console (robodiff)[diffusion_policy]$ python ray_train_multirun.py --config-dir=. --config-name=image_pusht_diffusion_policy_cnn.yaml --seeds=42,43,44 --monitor_key=test/mean_score -- multi_run.run_dir='data/outputs/${now:%Y.%m.%d}/${now:%H.%M.%S}_${name}_${task_name}' multi_run.wandb_name_base='${now:%Y.%m.%d-%H.%M.%S}_${name}_${task_name}' ``` In addition to the wandb log written by each training worker individually, the metrics monitor worker will log to wandb project `diffusion_policy_metrics` for the metrics aggregated from all 3 training runs. Local config, logs and checkpoints will be written to `data/outputs/yyyy.mm.dd/hh.mm.ss_<method_name>_<task_name>` in a directory structure identical to our [training logs](https://diffusion-policy.cs.columbia.edu/data/experiments/): ```console (robodiff)[diffusion_policy]$ tree data/outputs/2023.03.01/22.13.58_train_diffusion_unet_hybrid_pusht_image -I 'wandb|media' data/outputs/2023.03.01/22.13.58_train_diffusion_unet_hybrid_pusht_image ├── config.yaml ├── metrics │ ├── logs.json.txt │ ├── metrics.json │ └── metrics.log ├── train_0 │ ├── checkpoints │ │ ├── epoch=0000-test_mean_score=0.174.ckpt │ │ └── latest.ckpt │ ├── logs.json.txt │ └── train.log ├── train_1 │ ├── checkpoints │ │ ├── epoch=0000-test_mean_score=0.131.ckpt │ │ └── latest.ckpt │ ├── logs.json.txt │ └── train.log └── train_2 ├── checkpoints │ ├── epoch=0000-test_mean_score=0.105.ckpt │ └── latest.ckpt ├── logs.json.txt └── train.log 7 directories, 16 files ``` ### 🆕 Evaluate Pre-trained Checkpoints Download a checkpoint from the published training log folders, such as [https://diffusion-policy.cs.columbia.edu/data/experiments/low_dim/pusht/diffusion_policy_cnn/train_0/checkpoints/epoch=0550-test_mean_score=0.969.ckpt](https://diffusion-policy.cs.columbia.edu/data/experiments/low_dim/pusht/diffusion_policy_cnn/train_0/checkpoints/epoch=0550-test_mean_score=0.969.ckpt). Run the evaluation script: ```console (robodiff)[diffusion_policy]$ python eval.py --checkpoint data/0550-test_mean_score=0.969.ckpt --output_dir data/pusht_eval_output --device cuda:0 ``` This will generate the following directory structure: ```console (robodiff)[diffusion_policy]$ tree data/pusht_eval_output data/pusht_eval_output ├── eval_log.json └── media ├── 1fxtno84.mp4 ├── 224l7jqd.mp4 ├── 2fo4btlf.mp4 ├── 2in4cn7a.mp4 ├── 34b3o2qq.mp4 └── 3p7jqn32.mp4 1 directory, 7 files ``` `eval_log.json` contains metrics that is logged to wandb during training: ```console (robodiff)[diffusion_policy]$ cat data/pusht_eval_output/eval_log.json { "test/mean_score": 0.9150393806777066, "test/sim_max_reward_4300000": 1.0, "test/sim_max_reward_4300001": 0.9872969750774386, ... "train/sim_video_1": "data/pusht_eval_output//media/2fo4btlf.mp4" } ``` ## 🦾 Demo, Training and Eval on a Real Robot Make sure your UR5 robot is running and accepting command from its network interface (emergency stop button within reach at all time), your RealSense cameras plugged in to your workstation (tested with `realsense-viewer`) and your SpaceMouse connected with the `spacenavd` daemon running (verify with `systemctl status spacenavd`). Start the demonstration collection script. Press "C" to start recording. Use SpaceMouse to move the robot. Press "S" to stop recording. ```console (robodiff)[diffusion_policy]$ python demo_real_robot.py -o data/demo_pusht_real --robot_ip 192.168.0.204 ``` This should result in a demonstration dataset in `data/demo_pusht_real` with in the same structure as our example [real Push-T training dataset](https://diffusion-policy.cs.columbia.edu/data/training/pusht_real.zip). To train a Diffusion Policy, launch training with config: ```console (robodiff)[diffusion_policy]$ python train.py --config-name=train_diffusion_unet_real_image_workspace task.dataset_path=data/demo_pusht_real ``` Edit [`diffusion_policy/config/task/real_pusht_image.yaml`](./diffusion_policy/config/task/real_pusht_image.yaml) if your camera setup is different. Assuming the training has finished and you have a checkpoint at `data/outputs/blah/checkpoints/latest.ckpt`, launch the evaluation script with: ```console python eval_real_robot.py -i data/outputs/blah/checkpoints/latest.ckpt -o data/eval_pusht_real --robot_ip 192.168.0.204 ``` Press "C" to start evaluation (handing control over to the policy). Press "S" to stop the current episode. ## 🗺️ Codebase Tutorial This codebase is structured under the requirement that: 1. implementing `N` tasks and `M` methods will only require `O(N+M)` amount of code instead of `O(N*M)` 2. while retaining maximum flexibility. To achieve this requirement, we 1. maintained a simple unified interface between tasks and methods and 2. made the implementation of the tasks and the methods independent of each other. These design decisions come at the cost of code repetition between the tasks and the methods. However, we believe that the benefit of being able to add/modify task/methods without affecting the remainder and being able understand a task/method by reading the code linearly outweighs the cost of copying and pasting 😊. ### The Split On the task side, we have: * `Dataset`: adapts a (third-party) dataset to the interface. * `EnvRunner`: executes a `Policy` that accepts the interface and produce logs and metrics. * `config/task/<task_name>.yaml`: contains all information needed to construct `Dataset` and `EnvRunner`. * (optional) `Env`: an `gym==0.21.0` compatible class that encapsulates the task environment. On the policy side, we have: * `Policy`: implements inference according to the interface and part of the training process. * `Workspace`: manages the life-cycle of training and evaluation (interleaved) of a method. * `config/<workspace_name>.yaml`: contains all information needed to construct `Policy` and `Workspace`. ### The Interface #### Low Dim A [`LowdimPolicy`](./diffusion_policy/policy/base_lowdim_policy.py) takes observation dictionary: - `"obs":` Tensor of shape `(B,To,Do)` and predicts action dictionary: - `"action": ` Tensor of shape `(B,Ta,Da)` A [`LowdimDataset`](./diffusion_policy/dataset/base_dataset.py) returns a sample of dictionary: - `"obs":` Tensor of shape `(To, Do)` - `"action":` Tensor of shape `(Ta, Da)` Its `get_normalizer` method returns a [`LinearNormalizer`](./diffusion_policy/model/common/normalizer.py) with keys `"obs","action"`. The `Policy` handles normalization on GPU with its copy of the `LinearNormalizer`. The parameters of the `LinearNormalizer` is saved as part of the `Policy`'s weights checkpoint. #### Image A [`ImagePolicy`](./diffusion_policy/policy/base_image_policy.py) takes observation dictionary: - `"key0":` Tensor of shape `(B,To,*)` - `"key1":` Tensor of shape e.g. `(B,To,H,W,3)` ([0,1] float32) and predicts action dictionary: - `"action": ` Tensor of shape `(B,Ta,Da)` A [`ImageDataset`](./diffusion_policy/dataset/base_dataset.py) returns a sample of dictionary: - `"obs":` Dict of - `"key0":` Tensor of shape `(To, *)` - `"key1":` Tensor fo shape `(To,H,W,3)` - `"action":` Tensor of shape `(Ta, Da)` Its `get_normalizer` method returns a [`LinearNormalizer`](./diffusion_policy/model/common/normalizer.py) with keys `"key0","key1","action"`. #### Example ``` To = 3 Ta = 4 T = 6 |o|o|o| | | |a|a|a|a| |o|o| | |a|a|a|a|a| | | | | |a|a| ``` Terminology in the paper: `varname` in the codebase - Observation Horizon: `To|n_obs_steps` - Action Horizon: `Ta|n_action_steps` - Prediction Horizon: `T|horizon` The classical (e.g. MDP) single step observation/action formulation is included as a special case where `To=1` and `Ta=1`. ## 🔩 Key Components ### `Workspace` A `Workspace` object encapsulates all states and code needed to run an experiment. * Inherits from [`BaseWorkspace`](./diffusion_policy/workspace/base_workspace.py). * A single `OmegaConf` config object generated by `hydra` should contain all information needed to construct the Workspace object and running experiments. This config correspond to `config/<workspace_name>.yaml` + hydra overrides. * The `run` method contains the entire pipeline for the experiment. * Checkpoints happen at the `Workspace` level. All training states implemented as object attributes are automatically saved by the `save_checkpoint` method. * All other states for the experiment should be implemented as local variables in the `run` method. The entrypoint for training is `train.py` which uses `@hydra.main` decorator. Read [hydra](https://hydra.cc/)'s official documentation for command line arguments and config overrides. For example, the argument `task=<task_name>` will replace the `task` subtree of the config with the content of `config/task/<task_name>.yaml`, thereby selecting the task to run for this experiment. ### `Dataset` A `Dataset` object: * Inherits from `torch.utils.data.Dataset`. * Returns a sample conforming to [the interface](#the-interface) depending on whether the task has Low Dim or Image observations. * Has a method `get_normalizer` that returns a `LinearNormalizer` conforming to [the interface](#the-interface). Normalization is a very common source of bugs during project development. It is sometimes helpful to print out the specific `scale` and `bias` vectors used for each key in the `LinearNormalizer`. Most of our implementations of `Dataset` uses a combination of [`ReplayBuffer`](#replaybuffer) and [`SequenceSampler`](./diffusion_policy/common/sampler.py) to generate samples. Correctly handling padding at the beginning and the end of each demonstration episode according to `To` and `Ta` is important for good performance. Please read our [`SequenceSampler`](./diffusion_policy/common/sampler.py) before implementing your own sampling method. ### `Policy` A `Policy` object: * Inherits from `BaseLowdimPolicy` or `BaseImagePolicy`. * Has a method `predict_action` that given observation dict, predicts actions conforming to [the interface](#the-interface). * Has a method `set_normalizer` that takes in a `LinearNormalizer` and handles observation/action normalization internally in the policy. * (optional) Might has a method `compute_loss` that takes in a batch and returns the loss to be optimized. * (optional) Usually each `Policy` class correspond to a `Workspace` class due to the differences of training and evaluation process between methods. ### `EnvRunner` A `EnvRunner` object abstracts away the subtle differences between different task environments. * Has a method `run` that takes a `Policy` object for evaluation, and returns a dict of logs and metrics. Each value should be compatible with `wandb.log`. To maximize evaluation speed, we usually vectorize environments using our modification of [`gym.vector.AsyncVectorEnv`](./diffusion_policy/gym_util/async_vector_env.py) which runs each individual environment in a separate process (workaround python GIL). ⚠️ Since subprocesses are launched using `fork` on linux, you need to be specially careful for environments that creates its OpenGL context during initialization (e.g. robosuite) which, once inherited by the child process memory space, often causes obscure bugs like segmentation fault. As a workaround, you can provide a `dummy_env_fn` that constructs an environment without initializing OpenGL. ### `ReplayBuffer` The [`ReplayBuffer`](./diffusion_policy/common/replay_buffer.py) is a key data structure for storing a demonstration dataset both in-memory and on-disk with chunking and compression. It makes heavy use of the [`zarr`](https://zarr.readthedocs.io/en/stable/index.html) format but also has a `numpy` backend for lower access overhead. On disk, it can be stored as a nested directory (e.g. `data/pusht_cchi_v7_replay.zarr`) or a zip file (e.g. `data/robomimic/datasets/square/mh/image_abs.hdf5.zarr.zip`). Due to the relative small size of our datasets, it's often possible to store the entire image-based dataset in RAM with [`Jpeg2000` compression](./diffusion_policy/codecs/imagecodecs_numcodecs.py) which eliminates disk IO during training at the expense increasing of CPU workload. Example: ``` data/pusht_cchi_v7_replay.zarr ├── data │ ├── action (25650, 2) float32 │ ├── img (25650, 96, 96, 3) float32 │ ├── keypoint (25650, 9, 2) float32 │ ├── n_contacts (25650, 1) float32 │ └── state (25650, 5) float32 └── meta └── episode_ends (206,) int64 ``` Each array in `data` stores one data field from all episodes concatenated along the first dimension (time). The `meta/episode_ends` array stores the end index for each episode along the fist dimension. ### `SharedMemoryRingBuffer` The [`SharedMemoryRingBuffer`](./diffusion_policy/shared_memory/shared_memory_ring_buffer.py) is a lock-free FILO data structure used extensively in our [real robot implementation](./diffusion_policy/real_world) to utilize multiple CPU cores while avoiding pickle serialization and locking overhead for `multiprocessing.Queue`. As an example, we would like to get the most recent `To` frames from 5 RealSense cameras. We launch 1 realsense SDK/pipeline per process using [`SingleRealsense`](./diffusion_policy/real_world/single_realsense.py), each continuously writes the captured images into a `SharedMemoryRingBuffer` shared with the main process. We can very quickly get the last `To` frames in the main process due to the FILO nature of `SharedMemoryRingBuffer`. We also implemented [`SharedMemoryQueue`](./diffusion_policy/shared_memory/shared_memory_queue.py) for FIFO, which is used in [`RTDEInterpolationController`](./diffusion_policy/real_world/rtde_interpolation_controller.py). ### `RealEnv` In contrast to [OpenAI Gym](https://gymnasium.farama.org/), our polices interact with the environment asynchronously. In [`RealEnv`](./diffusion_policy/real_world/real_env.py), the `step` method in `gym` is split into two methods: `get_obs` and `exec_actions`. The `get_obs` method returns the latest observation from `SharedMemoryRingBuffer` as well as their corresponding timestamps. This method can be call at any time during an evaluation episode. The `exec_actions` method accepts a sequence of actions and timestamps for the expected time of execution for each step. Once called, the actions are simply enqueued to the `RTDEInterpolationController`, and the method returns without blocking for execution. ## 🩹 Adding a Task Read and imitate: * `diffusion_policy/dataset/pusht_image_dataset.py` * `diffusion_policy/env_runner/pusht_image_runner.py` * `diffusion_policy/config/task/pusht_image.yaml` Make sure that `shape_meta` correspond to input and output shapes for your task. Make sure `env_runner._target_` and `dataset._target_` point to the new classes you have added. When training, add `task=<your_task_name>` to `train.py`'s arguments. ## 🩹 Adding a Method Read and imitate: * `diffusion_policy/workspace/train_diffusion_unet_image_workspace.py` * `diffusion_policy/policy/diffusion_unet_image_policy.py` * `diffusion_policy/config/train_diffusion_unet_image_workspace.yaml` Make sure your workspace yaml's `_target_` points to the new workspace class you created. ## 🏷️ License This repository is released under the MIT license. See [LICENSE](LICENSE) for additional details. ## 🙏 Acknowledgement * Our [`ConditionalUnet1D`](./diffusion_policy/model/diffusion/conditional_unet1d.py) implementation is adapted from [Planning with Diffusion](https://github.com/jannerm/diffuser). * Our [`TransformerForDiffusion`](./diffusion_policy/model/diffusion/transformer_for_diffusion.py) implementation is adapted from [MinGPT](https://github.com/karpathy/minGPT). * The [BET](./diffusion_policy/model/bet) baseline is adapted from [its original repo](https://github.com/notmahi/bet). * The [IBC](./diffusion_policy/policy/ibc_dfo_lowdim_policy.py) baseline is adapted from [Kevin Zakka's reimplementation](https://github.com/kevinzakka/ibc). * The [Robomimic](https://github.com/ARISE-Initiative/robomimic) tasks and [`ObservationEncoder`](https://github.com/ARISE-Initiative/robomimic/blob/master/robomimic/models/obs_nets.py) are used extensively in this project. * The [Push-T](./diffusion_policy/env/pusht) task is adapted from [IBC](https://github.com/google-research/ibc). * The [Block Pushing](./diffusion_policy/env/block_pushing) task is adapted from [BET](https://github.com/notmahi/bet) and [IBC](https://github.com/google-research/ibc). * The [Kitchen](./diffusion_policy/env/kitchen) task is adapted from [BET](https://github.com/notmahi/bet) and [Relay Policy Learning](https://github.com/google-research/relay-policy-learning). * Our [shared_memory](./diffusion_policy/shared_memory) data structures are heavily inspired by [shared-ndarray2](https://gitlab.com/osu-nrsg/shared-ndarray2).
06-29
Google Cloud Tools¶ Google Cloud tools make it easier to connect your agents to Google Cloud’s products and services. With just a few lines of code you can use these tools to connect your agents with: Any custom APIs that developers host in Apigee. 100s of prebuilt connectors to enterprise systems such as Salesforce, Workday, and SAP. Automation workflows built using application integration. Databases such as Spanner, AlloyDB, Postgres and more using the MCP Toolbox for databases. Google Cloud Tools Apigee API Hub Tools¶ ApiHubToolset lets you turn any documented API from Apigee API hub into a tool with a few lines of code. This section shows you the step by step instructions including setting up authentication for a secure connection to your APIs. Prerequisites Install ADK Install the Google Cloud CLI. Apigee API hub instance with documented (i.e. OpenAPI spec) APIs Set up your project structure and create required files project_root_folder | `-- my_agent |-- .env |-- __init__.py |-- agent.py `__ tool.py Create an API Hub Toolset¶ Note: This tutorial includes an agent creation. If you already have an agent, you only need to follow a subset of these steps. Get your access token, so that APIHubToolset can fetch spec from API Hub API. In your terminal run the following command gcloud auth print-access-token # Prints your access token like 'ya29....' Ensure that the account used has the required permissions. You can use the pre-defined role or assign the following permissions:roles/apihub.viewer apihub.specs.get (required) apihub.apis.get (optional) apihub.apis.list (optional) apihub.versions.get (optional) apihub.versions.list (optional) apihub.specs.list (optional) Create a tool with . Add the below to APIHubToolsettools.py If your API requires authentication, you must configure authentication for the tool. The following code sample demonstrates how to configure an API key. ADK supports token based auth (API Key, Bearer token), service account, and OpenID Connect. We will soon add support for various OAuth2 flows. from google.adk.tools.openapi_tool.auth.auth_helpers import token_to_scheme_credential from google.adk.tools.apihub_tool.apihub_toolset import APIHubToolset # Provide authentication for your APIs. Not required if your APIs don't required authentication. auth_scheme, auth_credential = token_to_scheme_credential( "apikey", "query", "apikey", apikey_credential_str ) sample_toolset_with_auth = APIHubToolset( name="apihub-sample-tool", description="Sample Tool", access_token="...", # Copy your access token generated in step 1 apihub_resource_name="...", # API Hub resource name auth_scheme=auth_scheme, auth_credential=auth_credential, ) For production deployment we recommend using a service account instead of an access token. In the code snippet above, use and provide your security account credentials instead of the token.service_account_json=service_account_cred_json_str For apihub_resource_name, if you know the specific ID of the OpenAPI Spec being used for your API, use . If you would like the Toolset to automatically pull the first available spec from the API, use `projects/my-project-id/locations/us-west1/apis/my-api-id/versions/version-id/specs/spec-id``projects/my-project-id/locations/us-west1/apis/my-api-id` Create your agent file Agent.py and add the created tools to your agent definition: from google.adk.agents.llm_agent import LlmAgent from .tools import sample_toolset root_agent = LlmAgent( model='gemini-2.0-flash', name='enterprise_assistant', instruction='Help user, leverage the tools you have access to', tools=sample_toolset.get_tools(), ) Configure your `__init__.py` to expose your agent from . import agent Start the Google ADK Web UI and try your agent: # make sure to run `adk web` from your project_root_folder adk web Then go to http://localhost:8000 to try your agent from the Web UI. Application Integration Tools¶ With ApplicationIntegrationToolset you can seamlessly give your agents a secure and governed to enterprise applications using Integration Connector’s 100+ pre-built connectors for systems like Salesforce, ServiceNow, JIRA, SAP, and more. Support for both on-prem and SaaS applications. In addition you can turn your existing Application Integration process automations into agentic workflows by providing application integration workflows as tools to your ADK agents. Prerequisites Install ADK An existing Application Integration workflow or Integrations Connector connection you want to use with your agent To use tool with default credentials: have Google Cloud CLI installed. See installation guide. Run: gcloud config set project <project-id> gcloud auth application-default login gcloud auth application-default set-quota-project <project-id> Set up your project structure and create required files project_root_folder |-- .env `-- my_agent |-- __init__.py |-- agent.py `__ tools.py When running the agent, make sure to run adk web in project_root_folder Use Integration Connectors¶ Connect your agent to enterprise applications using Integration Connectors. Prerequisites To use a connector from Integration Connectors, you need to provision Application Integration in the same region as your connection by clicking on "QUICK SETUP" button. Google Cloud Tools Go to Connection Tool template from the template library and click on "USE TEMPLATE" button. Google Cloud Tools Fill the Integration Name as ExecuteConnection (It is mandatory to use this integration name only) and select the region same as the connection region. Click on "CREATE". Publish the integration by using the "PUBLISH" button on the Application Integration Editor. Google Cloud Tools Steps: Create a tool with ApplicationIntegrationToolset from google.adk.tools.application_integration_tool.application_integration_toolset import ApplicationIntegrationToolset connector_tool = ApplicationIntegrationToolset( project="test-project", # TODO: replace with GCP project of the connection location="us-central1", #TODO: replace with location of the connection connection="test-connection", #TODO: replace with connection name entity_operations={"Entity_One": ["LIST","CREATE"], "Entity_Two": []},#empty list for actions means all operations on the entity are supported. actions=["action1"], #TODO: replace with actions service_account_credentials='{...}', # optional tool_name="tool_prefix2", tool_instructions="..." ) Note: - You can provide service account to be used instead of using default credentials. - To find the list of supported entities and actions for a connection, use the connectors apis: listActions or listEntityTypes Add the tool to your agent. Update your fileagent.py from google.adk.agents.llm_agent import LlmAgent from .tools import connector_tool root_agent = LlmAgent( model='gemini-2.0-flash', name='connector_agent', instruction="Help user, leverage the tools you have access to", tools=connector_tool.get_tools(), ) Configure your `__init__.py` to expose your agent from . import agent Start the Google ADK Web UI and try your agent. # make sure to run `adk web` from your project_root_folder adk web Then go to http://localhost:8000, and choose my_agent agent (same as the agent folder name) Use App Integration Workflows¶ Use existing Application Integration workflow as a tool for your agent or create a new one. Steps: Create a tool with ApplicationIntegrationToolset integration_tool = ApplicationIntegrationToolset( project="test-project", # TODO: replace with GCP project of the connection location="us-central1", #TODO: replace with location of the connection integration="test-integration", #TODO: replace with integration name trigger="api_trigger/test_trigger",#TODO: replace with trigger id service_account_credentials='{...}', #optional tool_name="tool_prefix1", tool_instructions="..." ) Note: You can provide service account to be used instead of using default credentials Add the tool to your agent. Update your fileagent.py from google.adk.agents.llm_agent import LlmAgent from .tools import integration_tool, connector_tool root_agent = LlmAgent( model='gemini-2.0-flash', name='integration_agent', instruction="Help user, leverage the tools you have access to", tools=integration_tool.get_tools(), ) Configure your `__init__.py` to expose your agent from . import agent Start the Google ADK Web UI and try your agent. # make sure to run `adk web` from your project_root_folder adk web Then go to http://localhost:8000, and choose my_agent agent (same as the agent folder name) Toolbox Tools for Databases¶ MCP Toolbox for Databases is an open source MCP server for databases. It was designed with enterprise-grade and production-quality in mind. It enables you to develop tools easier, faster, and more securely by handling the complexities such as connection pooling, authentication, and more. Google’s Agent Development Kit (ADK) has built in support for Toolbox. For more information on getting started or configuring Toolbox, see the documentation. GenAI Toolbox Configure and deploy¶ Toolbox is an open source server that you deploy and manage yourself. For more instructions on deploying and configuring, see the official Toolbox documentation: Installing the Server Configuring Toolbox Install client SDK¶ ADK relies on the python package to use Toolbox. Install the package before getting started:toolbox-langchain pip install toolbox-langchain langchain Loading Toolbox Tools¶ Once you’ve Toolbox server is configured and up and running, you can load tools from your server using the ADK: from google.adk.tools.toolbox_tool import ToolboxTool toolbox = ToolboxTool("https://127.0.0.1:5000") # Load a specific set of tools tools = toolbox.get_toolset(toolset_name='my-toolset-name'), # Load single tool tools = toolbox.get_tool(tool_name='my-tool-name'), root_agent = Agent( ..., tools=tools # Provide the list of tools to the Agent ) Advanced Toolbox Features¶ Toolbox has a variety of features to make developing Gen AI tools for databases. For more information, read more about the following features: Authenticated Parameters: bind tool inputs to values from OIDC tokens automatically, making it easy to run sensitive queries without potentially leaking data Authorized Invocations: restrict access to use a tool based on the users Auth token OpenTelemetry: get metrics and tracing from Toolbox with OpenTelemetry帮我画一张思维导图
05-02
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值