JuliaPy / JuliaPy/PyCall.jl

multiprocessing problem

Aperta
#755 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Julia
Stelle
1.5k
Fork
186
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I tried to call PyStan using PyCall in Windows, but found repeating ``ERROR: unknown option `-c` ``.

Example:
```julia
using PyCall

pystan = pyimport("pystan")

schools_code = """
data {
vector[8] y; // estimated treatment effects
}
parameters {
real mu;
}
model {
y ~ normal(mu, 1.0);
}
"""

schools_dat = Dict("y" => [28, 8, -3, 7, -1, 1, 18, 12],)

sm = pystan.StanModel(model_code=schools_code)
fit = sm.sampling(data=schools_dat, iter=1000, chains=4)
```

Since I encountered a similar problem in pymc, I replaced `num_chains=4` with `num_chains=1` and "fixed" it. But it is still a problem considering exactly the same code works in pure Python.

I guess that the problem is due to multiprocessing (maybe only on Windows), so PyTorch `dataloader`, a well known lightweight multiprocessing caller is tested. Still, `num_workers=0` (non-multiprocessing) works but `num_workers=4` like the following example will not work.

Example:
```julia
using PyCall

torch = pyimport("torch")
torchvision = pyimport("torchvision")
transforms = pyimport("torchvision.transforms")
datasets = pyimport("torchvision.datasets")

dataset = datasets.FakeData(transform=transforms.ToTensor())
dataloader = torch.utils.data.DataLoader(dataset, batch_size=10, num_workers=4)

for batch in dataloader
println(batch)
break
end
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Start by reproducing the PyCall examples on Windows, comparing the single-process and multiprocessing settings for PyStan and PyTorch DataLoader. The payload names no repository files or tests, so first locate the PyCall multiprocessing entry point and establish whether the `-c` error is specific to Windows; done means the shown multi-worker cases work without the error.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
julia, python, pytorch
Ambito
backend, tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.