Run this model with HF Jobs
Run gmk123/colab on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/gmk123/colab. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/gmk123/colab on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use gmk123/colab with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use gmk123/colab with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("gmk123/colab", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update sagemaker.py
Browse files3 unmodified lines4567891011121314151617181911 unmodified lines3132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980813 unmodified linesfrom IPython .utils import capture #line:4from IPython .display import clear_output #line:5wb =f'/home/studio-lab-user/stable-diffusion-webui'#line:8def gitDownload (OOOOO0O0O0O00OO0O ,OO0O000OO00O0OO0O ):#line:11if os .path .exists (OO0O000OO00O0OO0O ):#line:12return #line:13get_ipython ().system (f'git clone {OOOOO0O0O0O00OO0O} {OO0O000OO00O0OO0O}')#line:15def installAdditional ():#line:18OO000OOO0O00OO0O0 =[f'https://github.com/AlUlkesh/stable-diffusion-webui-images-browser',f'https://github.com/etherealxx/batchlinks-webui',f'https://github.com/camenduru/sd-civitai-browser',f'https://github.com/thomasasfk/sd-webui-aspect-ratio-helper',f'https://github.com/kohya-ss/sd-webui-additional-networks',f'https://github.com/fkunn1326/openpose-editor',f'https://github.com/nonnonstop/sd-webui-3d-open-pose-editor',f'https://github.com/Physton/sd-webui-prompt-all-in-one',f'https://github.com/Bing-su/adetailer',f'https://github.com/picobyte/stable-diffusion-webui-wd14-tagger',f'https://github.com/Mikubill/sd-webui-controlnet',f'https://github.com/IDEA-Research/DWPose',f'https://github.com/hanamizuki-ai/stable-diffusion-webui-localization-zh_Hans',f'https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111',]#line:58for O0O0OOOO000OO0OOO in OO000OOO0O00OO0O0 :#line:59O0O0OO0O000O0OO00 =O0O0OOOO000OO0OOO .split ('/')[-1 ]#line:61if 'github'in O0O0OOOO000OO0OOO :#line:63get_ipython ().system (f'git clone --depth 1 {O0O0OOOO000OO0OOO} {wb}/extensions/{O0O0OO0O000O0OO00}')#line:64get_ipython ().system (f'wget https://raw.githubuserhome/studio-lab-user.com/camenduru/stable-diffusion-webui-scripts/main/run_n_times.py -O {wb}/scripts/run_n_times.py')#line:66gitDownload (f'https://huggingface.co/embed/negative',f'{wb}/embeddings/negative')#line:70get_ipython ().system (f'rm -rf {wb}/embeddings/negative/.git')#line:7111 unmodified linesprint ('Roop换脸启用')#line:88import subprocess #line:90def sync_tmp_folder ():#line:92OOO00000OOOOO0OOO =[['rm','-rf','~/tmp/*','~/tmp','~/stable-diffusion-webui/models/Stable-diffusion/tmp_models','~/stable-diffusion-webui/models/ControlNet'],['ln','-vs','/tmp','~/tmp'],['ln','-vs','/tmp/models','~/stable-diffusion-webui/models/Stable-diffusion/tmp_models'],['ln','-vs','/tmp/ControlNet','~/stable-diffusion-webui/models/ControlNet']]#line:98for OOOOOOOO00000O0O0 in OOO00000OOOOO0OOO :#line:100OOO0000OOO0000OOO =[os .path .expanduser (OOOOOO0OO0OOO0OOO )for OOOOOO0OO0OOO0OOO in OOOOOOOO00000O0O0 ]#line:101subprocess .run (OOO0000OOO0000OOO ,check =True )#line:102def run_command (O00O00O000O0OOOOO ,OOOOOOO00OOO0OOOO ):#line:104print (f"Please wait, {OOOOOOO00OOO0OOOO} is loading...")#line:105subprocess .run (O00O00O000O0OOOOO ,shell =True ,stdout =subprocess .DEVNULL ,stderr =subprocess .DEVNULL )#line:106print (f"{OOOOOOO00OOO0OOOO} ok!")#line:107def initLocal ():#line:110run_command ('conda install conda -y','Conda')#line:112run_command ('conda update -n base conda -y','Update')#line:114run_command ('conda install -n base python=3.10.6 -y','Python')#line:115run_command ('conda install -q -y glib=2.51.0','glib')#line:116run_command ('pip install torch==2.1.0 torchvision==0.16.0 --extra-index-url https://download.pytorch.org/whl/cu121','【 Installing Torch 】')#line:118run_command ('pip install xformers==0.0.22.post7','【 Installing xformers 】')#line:119get_ipython ().system ('pip install -q aria2')#line:120get_ipython ().system ('pip install tqdm')#line:121clear_output ()#line:124get_ipython ().run_line_magic ('cd','/home/studio-lab-user')#line:125get_ipython ().system (f'git clone -q --branch master https://github.com/AUTOMATIC1111/stable-diffusion-webui {wb}')#line:128sync_tmp_folder ()#line:131clear_output ()#line:133get_ipython ().system (f'pip install -q basicsr')#line:138get_ipython ().system (f'pip install -q fake_useragent')#line:139installAdditional ()#line:144get_ipython ().system (f'rm -rf {wb}/config.json')#line:147get_ipython ().system (f'wget -O {wb}/config.json "https://huggingface.co/gmk123/colab/raw/main/config.json"')#line:148get_ipython ().system (f'wget -O {wb}/styles.csv "https://huggingface.co/gmk123/colab/raw/main/styles.csv"')#line:149clear_output ()#line:151get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/192916 -d {wb}/models/Stable-diffusion -o MoyouArtificial_v1060.safetensors')#line:153get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors -d {wb}/models/VAE -o vae-ft-mse-840000-ema-pruned.safetensors')#line:155get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/embed/upscale/resolve/main/4x-UltraSharp.pth -d {wb}/models/ESRGAN -o 4x-UltraSharp.pth')#line:157wise ="--listen --api --enable-insecure-extension-access --xformers --theme dark --gradio-queue --disable-console-progressbars --upcast-sampling --cors-allow-origins=*"#line:159ngrok_token =os .environ .get ('NGROK_TOKEN')#line:162wise +=f" --ngrok {ngrok_token}"#line:163def run (OOO0O0OO00OO0O000 ):#line:166clear_output ()#line:167print (f'Ngrok内网令牌:{ngrok_token}')#line:168print (f'Ngrok注意事项:每个账号每月1G流量!!!请留意后台剩余流量。')#line:169print (f'Ngrok剩余流量:点击查看 -- https://dashboard.ngrok.com/usage')#line:170get_ipython ().system (f'mkdir -p /tmp/ControlNet')#line:171get_ipython ().run_line_magic ('cd',f'{wb}')#line:173get_ipython ().system (f'python {OOO0O0OO00OO0O000} {wise}')#line:174if os .path .exists (f'{wb}'):#line:177run (f'webui.py')#line:179else :#line:180initLocal ()#line:182run (f'launch.py')#line:1853 unmodified lines4567891011121314151617181911 unmodified lines31323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879803 unmodified linesfrom IPython .utils import capture #line:4from IPython .display import clear_output #line:5wb =f'/home/studio-lab-user/stable-diffusion-webui'#line:8def gitDownload (O0O00000OO000O0OO ,O00O0OO0OO00OOO0O ):#line:11if os .path .exists (O00O0OO0OO00OOO0O ):#line:12return #line:13get_ipython ().system (f'git clone {O0O00000OO000O0OO} {O00O0OO0OO00OOO0O}')#line:15def installAdditional ():#line:18O0O0O000OOOOOO000 =[f'https://github.com/AlUlkesh/stable-diffusion-webui-images-browser',f'https://github.com/etherealxx/batchlinks-webui',f'https://github.com/camenduru/sd-civitai-browser',f'https://github.com/thomasasfk/sd-webui-aspect-ratio-helper',f'https://github.com/kohya-ss/sd-webui-additional-networks',f'https://github.com/fkunn1326/openpose-editor',f'https://github.com/nonnonstop/sd-webui-3d-open-pose-editor',f'https://github.com/Physton/sd-webui-prompt-all-in-one',f'https://github.com/Bing-su/adetailer',f'https://github.com/picobyte/stable-diffusion-webui-wd14-tagger',f'https://github.com/Mikubill/sd-webui-controlnet',f'https://github.com/IDEA-Research/DWPose',f'https://github.com/hanamizuki-ai/stable-diffusion-webui-localization-zh_Hans',f'https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111',]#line:58for O0OOOOO00OOO0O00O in O0O0O000OOOOOO000 :#line:59OO0OOOO00OO0OOOOO =O0OOOOO00OOO0O00O .split ('/')[-1 ]#line:61if 'github'in O0OOOOO00OOO0O00O :#line:63get_ipython ().system (f'git clone --depth 1 {O0OOOOO00OOO0O00O} {wb}/extensions/{OO0OOOO00OO0OOOOO}')#line:64get_ipython ().system (f'wget https://raw.githubuserhome/studio-lab-user.com/camenduru/stable-diffusion-webui-scripts/main/run_n_times.py -O {wb}/scripts/run_n_times.py')#line:66gitDownload (f'https://huggingface.co/embed/negative',f'{wb}/embeddings/negative')#line:70get_ipython ().system (f'rm -rf {wb}/embeddings/negative/.git')#line:7111 unmodified linesprint ('Roop换脸启用')#line:88import subprocess #line:90def sync_tmp_folder ():#line:92OO000000OOOO0O0O0 =[['rm','-rf','~/tmp/*','~/tmp','~/stable-diffusion-webui/models/Stable-diffusion/tmp_models','~/stable-diffusion-webui/models/ControlNet'],['ln','-vs','/tmp','~/tmp'],['ln','-vs','/tmp/models','~/stable-diffusion-webui/models/Stable-diffusion/tmp_models'],['ln','-vs','/tmp/ControlNet','~/stable-diffusion-webui/models/ControlNet']]#line:98for O000O0OO00OOO00O0 in OO000000OOOO0O0O0 :#line:100OO0000O0O00OO00O0 =[os .path .expanduser (O0OO00O000O00O000 )for O0OO00O000O00O000 in O000O0OO00OOO00O0 ]#line:101subprocess .run (OO0000O0O00OO00O0 ,check =True )#line:102def run_command (OO00O000O00OO00OO ,OO000O0OO00O000OO ):#line:104print (f"Please wait, {OO000O0OO00O000OO} is loading...")#line:105subprocess .run (OO00O000O00OO00OO ,shell =True ,stdout =subprocess .DEVNULL ,stderr =subprocess .DEVNULL )#line:106print (f"{OO000O0OO00O000OO} ok!")#line:107def initLocal ():#line:110run_command ('conda install -y conda glib psutil gperftools aria2 gdown','【 Installing Conda 】')#line:112run_command ('conda install -y -n base python=3.10.12','【 Installing Python 3.10 】')#line:113run_command ('conda clean -y --all','【 Cleaning Conda 】')#line:114run_command ('pip install torch==2.1.2+cu121 torchvision==0.16.2+cu121 torchaudio==2.1.2 --extra-index-url https://download.pytorch.org/whl/cu121','【 Installing Torch 】')#line:115run_command ('pip install xformers==0.0.23.post1 triton==2.1.0','【 Installing xformers 】')#line:116get_ipython ().system ('pip install -q aria2')#line:118get_ipython ().system ('pip install -q tqdm')#line:119clear_output ()#line:121get_ipython ().run_line_magic ('cd','/home/studio-lab-user')#line:122get_ipython ().system (f'git clone -q --branch master https://github.com/AUTOMATIC1111/stable-diffusion-webui {wb}')#line:125sync_tmp_folder ()#line:128clear_output ()#line:130get_ipython ().system (f'pip install -q basicsr')#line:135get_ipython ().system (f'pip install -q fake_useragent')#line:136installAdditional ()#line:141get_ipython ().system (f'rm -rf {wb}/config.json')#line:144get_ipython ().system (f'wget -O {wb}/config.json "https://huggingface.co/gmk123/colab/raw/main/config.json"')#line:145get_ipython ().system (f'wget -O {wb}/styles.csv "https://huggingface.co/gmk123/colab/raw/main/styles.csv"')#line:146clear_output ()#line:148get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/192916 -d {wb}/models/Stable-diffusion -o MoyouArtificial_v1060.safetensors')#line:150get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors -d {wb}/models/VAE -o vae-ft-mse-840000-ema-pruned.safetensors')#line:152get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/embed/upscale/resolve/main/4x-UltraSharp.pth -d {wb}/models/ESRGAN -o 4x-UltraSharp.pth')#line:154wise ="--listen --api --enable-insecure-extension-access --xformers --theme dark --gradio-queue --disable-console-progressbars --upcast-sampling --skip-version-check"#line:156ngrok_token =os .environ .get ('NGROK_TOKEN')#line:159wise +=f" --ngrok {ngrok_token}"#line:160def run (O0OOO00000OO0OO0O ):#line:163clear_output ()#line:164print (f'Ngrok内网令牌:{ngrok_token}')#line:165print (f'Ngrok注意事项:每个账号每月1G流量!!!请留意后台剩余流量。')#line:166print (f'Ngrok剩余流量:点击查看 -- https://dashboard.ngrok.com/usage')#line:167get_ipython ().system (f'mkdir -p /tmp/ControlNet')#line:168get_ipython ().run_line_magic ('cd',f'{wb}')#line:170get_ipython ().system (f'python {O0OOO00000OO0OO0O} {wise}')#line:171if os .path .exists (f'{wb}'):#line:174run (f'webui.py')#line:176else :#line:177initLocal ()#line:179run (f'launch.py')#line:182
sagemaker.py+54-55