train_dreambooth.py: error: the following arguments are required: - stable-diffusion

I'm trying to fit train SD 1.5 with DreamBooth with prior preservation following the steps from https://github.com/huggingface/diffusers/tree/main/examples/dreambooth
But i'm receiving an error:
train_dreambooth.py: error: the following arguments are required: --pretrained_model_name_or_path, --instance_data_dir, --instance_prompt
Traceback (most recent call last):
File "/home/myuser/miniconda3/envs/dbooth/bin/accelerate", line 10, in <module>
sys.exit(main())
File "/home/myuser/miniconda3/envs/dbooth/lib/python3.7/site-packages/accelerate/commands/accelerate_cli.py", line 45, in main
args.func(args)
File "/home/myuser/miniconda3/envs/dbooth/lib/python3.7/site-packages/accelerate/commands/launch.py", line 1104, in launch_command
simple_launcher(args)
File "/home/myuser/miniconda3/envs/dbooth/lib/python3.7/site-packages/accelerate/commands/launch.py", line 567, in simple_launcher
raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['/home/myuser/miniconda3/envs/dbooth/bin/python3.7', 'train_dreambooth.py']' returned non-zero exit status 2.
This is my script.sh for make the training:
#!/bin/bash
export MODEL_NAME="v1-5-pruned.ckpt"
export INSTANCE_DIR="retocadas"
export CLASS_DIR="person_ddim"
export OUTPUT_DIR="salida"
accelerate launch train_dreambooth.py \
--pretrained_model_name_or_path=$MODEL_NAME \
--instance_data_dir=$INSTANCE_DIR \
--class_data_dir=$CLASS_DIR \
--output_dir=$OUTPUT_DIR \
--with_prior_preservation --prior_loss_weight=1.0 \
--instance_prompt="AnUniqueExample" \
--class_prompt="person" \
--resolution=512 \
--train_batch_size=1 \
--gradient_accumulation_steps=2 --gradient_checkpointing \
--use_8bit_adam \
--learning_rate=5e-6 \
--lr_scheduler="constant" \
--lr_warmup_steps=0 \
--num_class_images=200 \
--max_train_steps=800
All files and paths indicated in the header are on the same path as the .sh file.
Someone can help me to find the problem?

It doesn't want a CKPT file it wants a directory with all the components of the model. Go to hugging face and download the models files into a folder and point the training script to that folder.

Related

proto grror when generating gateway protoc-gen-grpc-gateway: program not found or is not executable

I have found similar posts but they are rather old and they sadly did not solve my issue.
I am trying to add a Gateway for my GoLang GRPC services
PROJ_PATH=${CURDIR}
.PHONY: proto
proto: ## Generate protobuf code
# Compile proto files inside the project.
protoc api.proto --proto_path=${PROJ_PATH}/proto --go_out=. --go-grpc_out=. \
--grpc-gateway_out . \
--grpc-gateway_opt generate_unbound_methods=true \
--openapiv2_out . \
--openapiv2_opt logtostderr=true \
--openapiv2_opt generate_unbound_methods=true
I add the two dependencies
go get github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway
go get github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2
But I still get his error
protoc-gen-grpc-gateway: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--grpc-gateway_out: protoc-gen-grpc-gateway: Plugin failed with status code 1.
make: *** [proto] Error 1
I had to remove the import and gateway options in the GRPC file because this error so it looks like I have the wrong plugin but reading here tells me otherwise.
google/api/annotations.proto: File not found.
api.proto:5:1: Import "google/api/annotations.proto" was not found or had errors.
make: *** [proto] Error 1
syntax = "proto3";
option go_package = "pkg/api";
import "google/api/annotations.proto"; <---- had to remove
service ApiService {
rpc Test(TestRequest) returns (TestResponse){
option (google.api.http) = { <---- had to remove
get: "/v1/test"
body: "*"
};
}
}
Any advice would be greatly appreciated.
---- solved with ------
go install \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway#latest \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2#latest
then add the path to the proto command
--plugin=protoc-gen-grpc-gateway=${GOPATH}/bin/protoc-gen-grpc-gateway \
full command...
protoc api.proto --proto_path=${PROJ_PATH}/proto --go_out=. --go-grpc_out=. \
--grpc-gateway_out . \
--grpc-gateway_opt generate_unbound_methods=true \
--plugin=protoc-gen-grpc-gateway=${GOPATH}/bin/protoc-gen-grpc-gateway \
--openapiv2_out . \
--openapiv2_opt logtostderr=true \
--openapiv2_opt generate_unbound_methods=true
I had to install the binary like so
go install \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway#latest \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2#latest
Then update the proto command with the path.
--plugin=protoc-gen-grpc-gateway=${GOPATH}/bin/protoc-gen-grpc-gateway \
Full proto command
PROJ_PATH=${CURDIR}
.PHONY: proto
proto: ## Generate protobuf code
# Compile proto files inside the project.
protoc api.proto --proto_path=${PROJ_PATH}/proto --go_out=. --go-grpc_out=. \
--grpc-gateway_out . \
--grpc-gateway_opt generate_unbound_methods=true \
--plugin=protoc-gen-grpc-gateway=${GOPATH}/bin/protoc-gen-grpc-gateway \
--openapiv2_out . \
--openapiv2_opt logtostderr=true \
--openapiv2_opt generate_unbound_methods=true

Can I completely customize the flags for ./configure in a SPEC file?

My rpmbuild log tells me all the flags used when calling configure:
./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu \
--program-prefix= \
--disable-dependency-tracking \
--prefix=/usr \
--exec-prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--sysconfdir=/etc \
--datadir=/usr/share \
--includedir=/usr/include \
--libdir=/usr/lib64 \
--libexecdir=/usr/libexec \
--localstatedir=/var \
--sharedstatedir=/var/lib \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--prefix=/opt/custom/SENSOR/Qt-5.15.2 \
--confirm-license \
--opensource
My problem is that the 'build' and 'host' flags (plus several others) are unknown commands for this particular configure script. How can I take complete control of the call to configure in my SPEC file? It's obviously not enough to add new flags to the %configure scriptlet, I need to remove flags that rpmbuild is adding by default.
It looks like the answer is to call configure directly instead of using the scriptlet. I.e., replace %configure with:
./configure --prefix=/opt/custom/SENSOR -confirm-license -opensource

Protoc does not export the TS file version of *_grpc_pb.js?

I am new to setting up the gRPC web based client side. Our backend is already up and running on Go with gRPC. I am testing out what it's like converting the .proto file into TS. I am successfully able to generate some of the files, however, I am missing the TypeScript "Service" file.
I pretty much followed the instructions from the grpc_tools_node_protoc_ts site.
Setup a script to generate files for 1) the service and 2) the client model:
PROTOC_GEN_TS_PATH="./node_modules/.bin/protoc-gen-ts"
GRPC_TOOLS_NODE_PROTOC_PLUGIN="./node_modules/.bin/grpc_tools_node_protoc_plugin"
GRPC_TOOLS_NODE_PROTOC="./node_modules/.bin/grpc_tools_node_protoc"
OUT_DIR="./_protos_/proto/"
# JavaScript code generating
${GRPC_TOOLS_NODE_PROTOC} \
--plugin=protoc-gen-grpc="${GRPC_TOOLS_NODE_PROTOC_PLUGIN}" \
--js_out=import_style=commonjs,binary:"${OUT_DIR}" \
--grpc_out="${OUT_DIR}" \
-I "${OUT_DIR}" \
"${OUT_DIR}"/*.proto
${GRPC_TOOLS_NODE_PROTOC} \
--plugin=protoc-gen-ts="${PROTOC_GEN_TS_PATH}" \
--ts_out="${OUT_DIR}" \
-I "${OUT_DIR}" \
"${OUT_DIR}"/*.proto
What I get on the output is missing the *_grpc_pb.d.ts. I am under the impression I need this? 🤷🏻‍♂️
I have also tried adding the service option to the flag:
--ts_out="service=grpc-web:${OUT_DIR}" \
This now generates a *_pb_service.d.ts output file, still without the *_grpc_pb.d.ts file. I was reading the docs more and am thinking this service=grpc-web is actually the option I need since we're not running a node server.
Does this seem right? This is what I have now:
# Note the ts_out flag "service=grpc-node":
# This does generate the *_grpc_pb.d.ts but not the service files
protoc \
--plugin="protoc-gen-ts=${PROTOC_GEN_TS_PATH}" \
--plugin=protoc-gen-grpc=${GRPC_TOOLS_NODE_PROTOC_PLUGIN} \
--js_out="import_style=commonjs,binary:${OUT_DIR}" \
--ts_out="service=grpc-node:${OUT_DIR}" \
--grpc_out="${OUT_DIR}" \
-I "${OUT_DIR}" \
"${OUT_DIR}"/*.proto
# Note the ts_out flag "service=grpc-web":
# This does generate the service files, but not the *_grpc_pb.d.ts file
protoc \
--plugin="protoc-gen-ts=${PROTOC_GEN_TS_PATH}" \
--plugin=protoc-gen-grpc=${GRPC_TOOLS_NODE_PROTOC_PLUGIN} \
--js_out="import_style=commonjs,binary:${OUT_DIR}" \
--ts_out="service=grpc-web:${OUT_DIR}" \
--grpc_out="${OUT_DIR}" \
-I "${OUT_DIR}" \
"${OUT_DIR}"/*.proto

grpc __strdup() not found in python3.6-alpine arm

When using google libraries that require grpc we are running into this error.
The environment is docker arm python3.6-alpine with ...
grpcio>=1.33.2
google-cloud-pubsub>=2.1.0
google-api-python-client>=1.12.5
google-auth>=1.23.0
In our dockerfile we are installing
WORKDIR /tmp
RUN set -ex \
&& apk add --no-cache --virtual .build-deps \
cmake \
curl \
g++ \
gcc \
jpeg-dev \
libffi-dev \
libjpeg \
make \
musl-dev \
postgresql-dev \
python3-dev \
tzdata \
zlib \
zlib-dev
... later on
RUN pip3 install -r requirements.txt
and I even added libc6-compat and tried that.
also I added alpines build-base and alpine-sdk to try to cover all the bases.
Traceback (most recent call last):
File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.6/site-packages/...", line 48, in <module>
from ... import...
File "/usr/local/lib/python3.6/site-packages/...", line 13, in <module>
from google.cloud import pubsub_v1
File "/usr/local/lib/python3.6/site-packages/google/cloud/pubsub_v1/__init__.py", line 17, in <module>
from google.cloud.pubsub_v1 import types
File "/usr/local/lib/python3.6/site-packages/google/cloud/pubsub_v1/types.py", line 36, in <module>
from google.pubsub_v1.types import pubsub as pubsub_gapic_types
File "/usr/local/lib/python3.6/site-packages/google/pubsub_v1/__init__.py", line 18, in <module>
from .services.publisher import PublisherClient
File "/usr/local/lib/python3.6/site-packages/google/pubsub_v1/services/publisher/__init__.py", line 18, in <module>
from .client import PublisherClient
File "/usr/local/lib/python3.6/site-packages/google/pubsub_v1/services/publisher/client.py", line 27, in <module>
from google.api_core import gapic_v1 # type: ignore
File "/usr/local/lib/python3.6/site-packages/google/api_core/gapic_v1/__init__.py", line 18, in <module>
from google.api_core.gapic_v1 import config
File "/usr/local/lib/python3.6/site-packages/google/api_core/gapic_v1/config.py", line 23, in <module>
import grpc
File "/usr/local/lib/python3.6/site-packages/grpc/__init__.py", line 23, in <module>
from grpc._cython import cygrpc as _cygrpc
ImportError: Error relocating /usr/local/lib/python3.6/site-packages/grpc/_cython/cygrpc.cpython-36m-arm-linux-gnueabihf.so: __strdup: symbol not found
This works fine in x64 alpine. So far we are only having issue in the arm version.
Any idea how to resolve this?
I switched to FROM --platform=linux/arm/v7 python:3.8-alpine and added some deps
RUN set -ex \
&& apk add --no-cache --virtual .build-deps \
cmake \
curl \
g++ \
gcc \
jpeg-dev \
libffi-dev \
libjpeg \
make \
musl-dev \
musl \
postgresql-dev \
python3-dev \
tzdata \
zlib \
zlib-dev \
libc6-compat \
libc-dev \
alpine-sdk \
build-base \
linux-headers \
cython \
c-ares-dev \
gdbm \
libffi
Now it works.
It seems that as ARM becomes more mainstream there will be better support and such.
Multiple times now we have had no issues building on x86_64 but lots of issues with the ARM builds (mostly with the google libraries).
I still don't know what caused the original problem. I only solved this by chance. I kept trying different things.
I found that alpine has py3-grpcio and py3-google-api-core adn others available as an apk.
So I added those.
On inspection of the package I saw it is v1.17.0
py3-google-api-core: Fetching https://distfiles.alpinelinux.org/distfiles/google-api-core-1.17.0.tar.gz
If you look in the google source for the python pubsub you can see in versions <= 1.4.2 (I think):
dependencies = [
# google-api-core[grpc] 1.17.0 causes problems, thus restricting its
# version until the issue gets fixed.
# https://github.com/googleapis/python-pubsub/issues/74
"google-api-core[grpc] >= 1.14.0, < 1.17.0",
"grpc-google-iam-v1 >= 0.12.3, < 0.13dev",
'enum34; python_version < "3.4"',
]
Notice the first comment.
"Of course", I thought. Why would it be working versions.
But in the alpine package source I noticed that it is using python3.8 so that is why I switched our dockerfile from python3.6 to python3.8. So I guess ultimately even though I did not end up using the alpine py3-* packages they did help lead me to a solution :)

How to solve the CSScomb error in PhpStorm?

I wanted to install on PhpStorm 8.0.1 CSScomb.js
I do everything as it is written on a page on github. Established CSScomb globally and locally (so sure). Prescribed ways and...
...run and out this error:
Error running CSScomb: Can not run program "C: \ Users \ Kanat \
AppData \ Roaming \ npm \ node_modules \ csscomb \ bin \ csscomb" (in
directory "D: \ OpenServer \ domains \ LPDevplate \ src \ scss \
modules"): CreateProcess error = 193% 1 is not a valid Win32
application
Someone faced with this error and help solve it?
the same error "Error running 'CSScomb': Cannot run program"

Resources