View the source of this content.
Let's get the whole "linebreak" thing out of the way. The next paragraph contains two phrases separated by a single newline character:
Roses are red Violets are blue
View the source of this content.
Let's get the whole "linebreak" thing out of the way. The next paragraph contains two phrases separated by a single newline character:
Roses are red Violets are blue
import sys | |
import logging | |
logging.basicConfig(filename='_log_crash.log', level=logging.ERROR, format='--------------------------------------------------\n%(asctime)s\n%(levelname)s: %(message)s\n') | |
def log_crashes(exc_type, exc_value, exc_traceback): | |
logging.error("CRASHED - Unhandled exception occurred", exc_info=(exc_type, exc_value, exc_traceback)) | |
sys.excepthook = log_crashes | |
def simulate_memory_error(): | |
massive_list = [bytearray(1024 * 1024 * 1000) for _ in range(1000)] |
git clone https://github.com/OneLevelStudio/FORGE | |
cd FORGE | |
python3 -m venv venv | |
source venv/bin/activate | |
pip install -U pip | |
pip install torch==2.3.1 torchvision==0.18.1 --extra-index-url https://download.pytorch.org/whl/cu121 | |
pip install -r requirements_versions.txt | |
wget -P models/Stable-diffusion https://huggingface.co/onelevelstudio/diffusion/resolve/main/573152/LVSTIFY_V5.0.safetensors | |
wget -P models/Lora https://huggingface.co/onelevelstudio/diffusion/resolve/main/375993/LORA_GHOST.safetensors |
List IMG docker images | |
List CON docker ps -a | |
Build IMG docker-compose build | |
Run CON detached docker-compose up -d | |
Build IMG + Run CON detached docker-compose up -d --build | |
Stop CON + Remove CON docker-compose down | |
Remove everything unused docker system prune -a --volumes -f | |
Remove everything 1. docker stop $(docker ps -a -q) |
zrok reserve public 1234 --unique-name baobuiquang | |
zrok share reserved baobuiquang public |
ssh -L 1234:localhost:1234 [email protected] | |
jupyter lab --no-browser --port=1234 |
# Boilerplate: https://github.com/baobuiquang/fastapi | |
from fastapi.middleware.cors import CORSMiddleware | |
from fastapi.staticfiles import StaticFiles | |
from fastapi import FastAPI | |
import uvicorn | |
import _config | |
# For images processing | |
from fastapi import File, UploadFile |
# Python | |
call py --version | |
# Virtual Environment | |
call py -m venv venv | |
call venv\Scripts\activate | |
call py -m pip install -U pip | |
call py run.py | |
# Install dependencies |
# Create folder | |
import os | |
os.makedirs("my/path", exist_ok=True) | |
# Read and write CSV | |
import pandas as pd | |
df = pd.read_csv('input_data.csv', encoding='utf-8') | |
df.to_csv('output_data.csv', encoding='utf-8', index=False) |