JuliaPy / JuliaPy/PyCall.jl

multiprocessing problem

Offen
#755 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Julia
Sterne
1.5k
Forks
186
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
julia, python, pytorch
Bereich
backend, tooling
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.