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

GPT2 chat-bot single interaction… Attribute Error: 'NoneType' object has no attribute 'multiprocessing_chunksize' issue:2 #113

Open
chkshahin opened this issue Sep 7, 2021 · 0 comments

Comments

@chkshahin
Copy link

GPT2 custom chat-bot single interaction. I am not using any thread in this implementation but still it says 'multiprocessing_chunksize'. Here we try to build chatbot using gpt2 and interact with our custom model which is trained by custom dataset(type : persona).
problem_

`#from bot_make.utils import helper
import shutil
from simpletransformers.conv_ai import ConvAIModel
import os
import pickle
from termcolor import colored
import requests

def cache_select(cache_name):
shutil.unpack_archive('base_model/'+cache_name,'./single_interact/cache_dir','zip')
print('done')

def cache_down(url):
try:
r = requests.get(url, allow_redirects=True)
open('single_interact/cache_dir.zip', 'wb').write(r.content)
shutil.unpack_archive('single_interact/cache_dir.zip','./single_interact/cache_dir','zip')
os.remove(f"single_interact/cache_dir.zip")
return True
except:
return False

def model_down(url):
try:
r = requests.get(url, allow_redirects=True)
open('single_interact/for_load.tar.gz', 'wb').write(r.content)
return True
except:
return False

print('Model and Cache down')
cache_ck = cache_down('https://bucket.s3.amazonaws.com/generated_data_1_model_2_cache_dir.zip')
model_ck = model_down('https://bucket.s3.amazonaws.com/generated_data_1_model_2.tar.gz')

print('Start BOT')
def model_load(model_name):
return pickle.load(open('single_interact/'+model_name, 'rb'))

#cache_select('base_model_small_cache_dir.zip')
my_model = model_load('for_load.tar.gz')

#my_model.interact()
os.chdir('single_interact/')
a = ['hello']
def single_response(user_input):
reply, history = my_model.interact_single(message=user_input, history=a)
for i in history :
a.append(i)

return reply

print("\n===============================================")
print("================= Conv AI.V ===================")
print("===============================================\n")
while 1:
talk = input(colored("You: ",'green'))
if talk=='exit':break
response = single_response(talk)

myset = set(a)
a = list(myset)
#print('Bot : ',response)
print(colored("Bot:",'red'),response)
#print('History of re : ',a)`
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