Closed mohamed82008 closed 4 years ago
I'm not sure, when I tried running this in julia I'm getting
julia benchmark.jl --hmm_semisup-only --stan-only
Activating environment at `~/open_source/open_projects/misc/TuringExamples/Project.toml`
INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_41e51c1fbfa42cb7296f09ba07955a71 NOW.
ERROR: LoadError: LoadError: PyError ($(Expr(:escape, :(ccall(#= /home/steve/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'ImportError'>
ImportError("/home/steve/packages/julias/julia-1.4-latest/bin/../lib/julia/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /tmp/tmpey1s8fp0/stanfit4anon_model_41e51c1fbfa42cb7296f09ba07955a71_6353149747872547922.cpython-37m-x86_64-linux-gnu.so)")
File "/home/steve/.julia/conda/3/lib/python3.7/site-packages/pystan/model.py", line 355, in __init__
self.module = load_module(self.module_name, lib_dir)
File "/home/steve/.julia/conda/3/lib/python3.7/site-packages/pystan/model.py", line 50, in load_module
return __import__(module_name)
But when I run this directly in python it's fine
import pystan
model_str = """
data {
int<lower=1> K; // num categories
int<lower=1> V; // num words
int<lower=0> T; // num supervised items
int<lower=1> T_unsup; // num unsupervised items
int<lower=1,upper=V> w[T]; // words
int<lower=1,upper=K> z[T]; // categories
int<lower=1,upper=V> u[T_unsup]; // unsup words
vector<lower=0>[K] alpha; // transit prior
vector<lower=0>[V] beta; // emit prior
}
parameters {
simplex[K] theta[K]; // transit probs
simplex[V] phi[K]; // emit probs
}
model {
for (k in 1:K)
theta[k] ~ dirichlet(alpha);
for (k in 1:K)
phi[k] ~ dirichlet(beta);
for (t in 1:T)
w[t] ~ categorical(phi[z[t]]);
for (t in 2:T)
z[t] ~ categorical(theta[z[t-1]]);
{
// forward algorithm computes log p(u|)
vector[K] acc;
real gamma[T_unsup,K];
gamma[1,] = log(phi[,u[1]]);
for (t in 2:T_unsup) {
for (k in 1:K) {
for (j in 1:K) {
acc[j] = gamma[t-1,j] + log(theta[j,k]) + log(phi[k,u[t]]);
}
gamma[t,k] = log_sum_exp(acc);
}
}
target += log_sum_exp(gamma[T_unsup]);
}
}
"""
sm = pystan.StanModel(model_code=model_str,
extra_compile_args = ["-ftemplate-depth-256", "-O3",
"-mtune=native", "-march=native", "-pipe"])
Does it work for you if you revert my PR?
Yes it works fine without the new changes from the PR.
I pushed a change back.
I am running the benchmarks again locally and ran into the following error with the hmm_semisup benchmark.
Any idea why this is happening @SteveBronder?