Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try add model_init_args & model_init_kwargs #82

Open
yangtianyu92 opened this issue Sep 1, 2020 · 2 comments
Open

try add model_init_args & model_init_kwargs #82

yangtianyu92 opened this issue Sep 1, 2020 · 2 comments

Comments

@yangtianyu92
Copy link

def _setup_redis_worker_and_runforever(model_class, batch_size, max_latency, gpu_id, redis_broker, prefix=''):
redis_worker = RedisWorker(model_class, batch_size, max_latency, redis_broker=redis_broker, prefix=prefix)
redis_worker.run_forever(gpu_id)

def run_redis_workers_forever(model_class, batch_size, max_latency=0.1,
worker_num=1, cuda_devices=None, redis_broker="localhost:6379",
prefix='', model_init_args=None, model_init_kwargs=None):
procs = []
for i in range(worker_num):
if cuda_devices is not None:
gpu_id = cuda_devices[i % len(cuda_devices)]
else:
gpu_id = None
args = [model_class, batch_size, max_latency, gpu_id, redis_broker, prefix]
p = mp.Process(target=_setup_redis_worker_and_runforever, args=args, name="stream_worker", daemon=True)
p.start()
procs.append(p)

for p in procs:
    p.join()

model_init_args & model_init_kwargs 这俩参数没往里面传, init_model这个方法读不到参数,得改一下才行。。。所以作者你觉得这是问题还不是个问题?我比较菜,就不乱改了。

@yangtianyu92
Copy link
Author

怪了,我是从pip 下载的。。。为什么会不一样呢。。。

@yangtianyu92
Copy link
Author

我重新确定了下,github上的代码是可以直接传参数的,我也是这么改的。但是pip安装的确实跟github是不一样的。求作者重新上传下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant