Closed marcomeyersats closed 1 year ago
Mine defaults to falcon 180B and I need to switch back to LLaMA 30B
Thank you
Mine defaults to falcon 180B and I need to switch back to LLaMA 30B
Hi! the latest version v0.2.3 has solved the problem that switch to OpenAssistant/oasst-sft-6-llama-30b-xor
and you can find the way to switch conversation's model in README
Thank you. Lastly, the web search feature is only available via the hugging chat UI, not via the API you created?
Thank you. Lastly, the web search feature is only available via the hugging chat UI, not via the API you created?
I will support the web search feature soon. (I was going to support it, but the Web Search of HuggingChat was not working at that time, so I stopped)
Thank you for letting me know. Keep up the good work.
Thank you. Before I saw your response I discovered I could hard-code the model choice by editing the script hugging-chat-api/src/hugchat/hugchat.py Line 48:
#self.active_model = "meta-llama/Llama-2-70b-chat-hf"
#self.active_model = "codellama/CodeLlama-34b-Instruct-hf"
#self.active_model = "meta-llama/Llama-2-70b-chat-hf"
self.active_model = "tiiuae/falcon-180B-chat"
#self.active_model = "OpenAssistant/oasst-sft-6-llama-30b"
I tested this with every model choice available on https://huggingface.co/chat. I have a system prompt set for the codellama model. I didn't realize your program would do that. It seems obvious now. Each model responded except llama-30B. No matter what I tried I kept getting this message.
Traceback (most recent call last):
File "/media/hugging-chat-api/src/hugchat/hugchat.py", line 139, in new_conversation
cid = json.loads(resp.text)['conversationId']
KeyError: 'conversationId'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/scripts/hugging_chat/huggingchat_rewrite.py", line 36, in <module>
one_shot_hf_chat(long_prompt)
File "/home/scripts/hugging_chat/huggingchat_rewrite.py", line 26, in one_shot_hf_chat
chatbot = hugchat.ChatBot(cookies=cookies)
File "/media//hugging-chat-api/src/hugchat/hugchat.py", line 54, in __init__
self.current_conversation = self.new_conversation()
File "/media/5/hugging-chat-api/src/hugchat/hugchat.py", line 149, in new_conversation
raise CreateConversationError(f"Failed to create new conversation. ({err_count})")
hugchat.exceptions.CreateConversationError: Failed to create new conversation. (6)
I got the same thing manually adding a conversation id
Traceback (most recent call last):
File "/media//hugging-chat-api/src/hugchat/hugchat.py", line 140, in new_conversation
cid = json.loads(resp.text)['6504e4dd952cc2bacab1cdcc']
KeyError: '6504e4dd952cc2bacab1cdcc'
import os
import pickle
from hugchat import hugchat
def one_shot_hf_chat(long_prompt):
cookie_file_path = "/home/path/to/script/directory/hugging_chat/hc_cookie/cookie_file.pkl"
cookies = None
if os.path.exists(cookie_file_path):
with open(cookie_file_path, 'rb') as f:
cookies = pickle.load(f)
from hf_hc_token import cookies as hf_cookies
if not cookies:
cookies = hf_cookies
chatbot = hugchat.ChatBot(cookies=cookies)
response = chatbot.chat(long_prompt)
print("Chatbot: ", response)
long_prompt = ''' '''
one_shot_hf_chat(long_prompt)
I added your code to start a new conversation but it didn't do anything for me. I'm sure I used it wrong somehow.
id = chatbot.new_conversation()
chatbot.change_conversation(id)
Thank you. Before I saw your response I discovered I could hard-code the model choice by editing the script hugging-chat-api/src/hugchat/hugchat.py Line 48:
#self.active_model = "meta-llama/Llama-2-70b-chat-hf" #self.active_model = "codellama/CodeLlama-34b-Instruct-hf" #self.active_model = "meta-llama/Llama-2-70b-chat-hf" self.active_model = "tiiuae/falcon-180B-chat" #self.active_model = "OpenAssistant/oasst-sft-6-llama-30b"
I tested this with every model choice available on https://huggingface.co/chat. I have a system prompt set for the codellama model. I didn't realize your program would do that. It seems obvious now. Each model responded except llama-30B. No matter what I tried I kept getting this message.
Traceback (most recent call last): File "/media/hugging-chat-api/src/hugchat/hugchat.py", line 139, in new_conversation cid = json.loads(resp.text)['conversationId'] KeyError: 'conversationId' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/scripts/hugging_chat/huggingchat_rewrite.py", line 36, in <module> one_shot_hf_chat(long_prompt) File "/home/scripts/hugging_chat/huggingchat_rewrite.py", line 26, in one_shot_hf_chat chatbot = hugchat.ChatBot(cookies=cookies) File "/media//hugging-chat-api/src/hugchat/hugchat.py", line 54, in __init__ self.current_conversation = self.new_conversation() File "/media/5/hugging-chat-api/src/hugchat/hugchat.py", line 149, in new_conversation raise CreateConversationError(f"Failed to create new conversation. ({err_count})") hugchat.exceptions.CreateConversationError: Failed to create new conversation. (6)
I got the same thing manually adding a conversation id
Traceback (most recent call last): File "/media//hugging-chat-api/src/hugchat/hugchat.py", line 140, in new_conversation cid = json.loads(resp.text)['6504e4dd952cc2bacab1cdcc'] KeyError: '6504e4dd952cc2bacab1cdcc'
import os import pickle from hugchat import hugchat def one_shot_hf_chat(long_prompt): cookie_file_path = "/home/path/to/script/directory/hugging_chat/hc_cookie/cookie_file.pkl" cookies = None if os.path.exists(cookie_file_path): with open(cookie_file_path, 'rb') as f: cookies = pickle.load(f) from hf_hc_token import cookies as hf_cookies if not cookies: cookies = hf_cookies chatbot = hugchat.ChatBot(cookies=cookies) response = chatbot.chat(long_prompt) print("Chatbot: ", response) long_prompt = ''' ''' one_shot_hf_chat(long_prompt)
I added your code to change models but it didn't do anything for me. I'm sure I used it wrong somehow.
id = chatbot.new_conversation() chatbot.change_conversation(id)
Hey, the function switch_llm()
can set different models and I just published a new version 0.2.4 solved some problems about the function. You can try following codes after updating hugchat.
from hugchat import hugchat
from hugchat.login import Login
# Log in to huggingface and grant authorization to huggingchat
# sign = Login(EMAIL, PASSWORD)
# cookies = sign.login()
# Save cookies to the local directory
# cookie_path_dir = "./cookies_snapshot"
# sign.saveCookiesToDir(cookie_path_dir)
# Create a ChatBot
chatbot = hugchat.ChatBot(cookies=<YOUR COOKIES>, default_llm=0) # or cookie_path="usercookies/<email>.json"
print(chatbot.chat("hello"))
# You can switch llm when you want, but it is necessary to create a new conversation. (the same as web huggingchat)
chatbot.switch_llm(1)
cstr = chatbot.new_conversation()
chatbot.change_conversation(cstr)
print(chatbot.chat("hello again"))
thank you, sir that's good stuff
Does the code allow you to switch on the "Search Web" feature?