can't save models/networks/embeddings in stable diffusion - directory

When I try to save any model merga or hipernetwork,etc inside stable diffusion, there's an error and a message like this appear in the cmd:
RuntimeError: Parent directory "place/where/i'm/trying/to/save" does not exist.
Is there anyway I can change the parent directory or to make the program save the files properly?
I tried do create hypernetworks, Embeddings and merge models in Stabble Diffusion
I expected the archives to be saved in the setted folders
The program was unable to find the parent directory to such folders

Related

The system cannot find the file specified in Rmarkdown

I am doing my current project in RStudio Desktop. I am doing RMarkdown to later transfer. I am having some trouble getting an error of the system cannot find the file specified RMarkdown. At first, it says that the combined_databike was not found, but I literally did it in the same file already also you can see in the upper right all of the data frames which mention "combined_databike." This being said when I am trying to hit knit it gives me the error. Now the error says is at the tripdata_202006, which I cannot understand because I imported every file from tripdata_202006 to tripdata_202105 using the "import dataset."
I want to understand why is not working and how I bring a solution.
That's because the file you want to read is not in the folder where your project or in this case your rmarkdown file is.
As you can see in the file list of your console, in your directory you have 4 files, and you don't have the folder "Bike data" where the file 202006-divvy-tripdata.csv is located, according to the path that is in line 83 of your code.
Maybe to solve that, I think you have two options, the first one is to write the whole path to the folder location and then to the file. And the second option is to move the folder "Bike data" with the files you have in it, where your rmarkdown file is located.

Setting Rmd directory

I'm new to R. I usually work my projects in a setting characterized by a directory in which I assign datasets, code and graphics specific folders. This is:
Main directory ~Project
Code ~Project\Code
Within my setup chunk I declare:
knitr::opts_knit$set(root.dir = "~Project")
knitr::opts_knit$get("root.dir")
However, in any following chunk where, for example I wish to load a dataset stored in 'Data' folder as:
read.csv("Data/series.csv",header=TRUE,check.names=FALSE)
I get a warning message on failure to find such directory.
Any advice? Thank you very much!
You need a ".." before that to tell R Studio first to go up a level (to the main directory):
read.csv("../Data/series.csv",header=TRUE,check.names=FALSE)
If you want to check what directory you're in, try running code like print(getwd()) in your chunk.
It's also not clear whether your error comes when you try to knit the document, or just when working on the Project; that does make a difference.

Defining a 'scripts' directory in R?

I am working with R in several directories containing model output I'd like to analyse and plot. I maintain a single 'scripts' directory for this project.
I'd like to be able to 'point' an environment variable at this scripts directory so that I could tab complete source(...) commands. Is this a possibility?
So far, I've managed to create an RPATH environment variable, and have written a function in my .Rprofile which lists the directory's contents without me having to type it out. I can't quite figure how I'd get tab completion though.
Any help/advice would be greatly appreciated.

multiple working directories in R

I wrote a list of different functions and script and I put them in some subfolders of the working directory so I can divide all my functions in arguments (descriptive statistic, geostatistic, regression....)
When I type source("function_in_subfolder") R tells me that there is no function.
I understood that it happens because functions have to stay in the working directory.
Is there a way to set also subfolders of the working directory as source for the functions (let's say in a hierarchical way)?
The source function has a chdir argument which, if set to TRUE, will set the working directory to that where the script resides. The new work directory is valid for the duration of the execution of the script, after that it is changed back. Assumung the following structure
main.R
one/
script.R
two/
subscript.R
you can call source("one/script.R", chdir=T) from main.R and, in script.R, call source("two/subscript.R", chdir=T).
However, by default, R will start its search from the current directory. There is no such thing as a "list of search paths" like, e.g., the PATH environment variable, although apparently someone attempted to create such a thing. I would strongly advise against attempting to find a script file "anywhere". Instead, indicate precisely which script is to be run at which point. Otherwise, name clashes resulting from simply adding a file to your scripts can lead to unpredictable behavior which is also difficult to debug.
One solution is to use list.files to get the full path of your function. for example:
myfunction.path <- list.files(getwd(),
recursive=TRUE,full.names=TRUE,
pattern='^myfunction.R$')
Then you can call it :
source(myfunction.path)
The recursive call of list.files can be expensive, so maybe you should call it once at the beginning of your analyze for example and store all functions paths in a named list. And BE CAREFUL the result can not be unique if you create 2 sources files withe the same name in 2 differents sub-directories.

write.table to new directory

Is there any way to use write() and write.table() so that the output file is in a different directory than the working directory? It tried setting the path to the output file before the filename, and just get an error message.
If you're using windows, R will know to go outside the current directory if it sees C:/ first (presumably other mounted drives too). With Macs it will go outside the current wd if it sees /. So:
Mac OS X:
write.table(foo, file="/users/name/folder/filename.ext")
Windows
write.table(foo, file="C:/users/name/folder/filename.ext")
Always test to make sure you have the path right first!
list.files("C:/...")
list.files("/....") #Give errors if path doesn't exist as typed
So if you're in /users/parent/subdir and you want to reference something in parent, you must type out the full path - write.table(foo, "parent/name.ext") will tell R to make a file: /users/parent/subdir/parent/name.ext.
Sure:
write.table(foo,file="../bar/baz.txt")
Or you can use absolute paths - nomenclature will depend on your operating system.

Resources