Skip to content

Commit

Permalink
Add device check
Browse files Browse the repository at this point in the history
  • Loading branch information
fpem123 committed Apr 28, 2021
1 parent aceee65 commit e4ba7a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion openchat/agents/blender.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ def set_options(self, name, device):
datapath = option.get("datapath")
option['model_file'] = modelzoo_path(datapath, name)
option["override"] = {
"no_cuda": False,
"no_cuda": False if "cuda" in device else True,
}
return option
4 changes: 3 additions & 1 deletion openchat/envs/various_web_demo_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def generate(user_id, bot_id, user_message, topic, agent: str):
# get agent obj
agent = agent.upper()
agent_obj = self.agents[agent]
print(agent_obj.model.device)

# max hold 50 user for memory
if len(self.users) > self.max_hold_user:
Expand Down Expand Up @@ -213,7 +214,8 @@ def send(user_id):
traceback.print_exc()
return {'output': 'Sorry, there was an error.'}, 500

self.app.run(host='0.0.0.0', port=80)
from waitress import serve
serve(self.app, host='0.0.0.0', port=80)

def pre_dialog_for_special_tasks(self, agent, user_id, bot_id, topic):
if isinstance(agent, ConvAI2Agent):
Expand Down

0 comments on commit e4ba7a0

Please sign in to comment.