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

bug-fix: requirements-change and api updating #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion environment/frontend_server/translator/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from .global_methods import *
from .models import *

with open("D:\\Tureco\\SimAIWorld\\environment\\frontend_server\\translator\\name.json", "r", encoding="utf-8") as f:
with open("./translator/name.json", "r", encoding="utf-8") as f:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里用相对路径不一定是对的吧,相对路径是相对于python启动时的工作目录的,而这里其实是想读取到跟views.py在同一目录下的name.json文件

js = f.read()
names_mapping = json.loads(js)['persona_names_mapping']
# print(names_mapping)
Expand Down
28 changes: 11 additions & 17 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
Django==2.2
django_storages==1.14
django_storages
googletrans==4.0.0rc1
gpt4all==1.0.12
gpt4all
litellm==0.1.738
numpy==1.25.2
openai==0.27.0
python-dotenv==1.0.0
Requests==2.31.0
selenium==4.12.0
selenium
tqdm==4.62.3
aiohttp==3.8.3
aiosignal==1.3.1
Expand All @@ -29,17 +26,16 @@ exceptiongroup==1.1.0
frozenlist==1.3.3
gensim==3.8.0
gunicorn==20.1.0
h11==0.14.0
idna==3.3
importlib-metadata==4.8.2
h11
idna
importlib-metadata
jmespath==1.0.1
joblib==1.1.0
kiwisolver==1.3.1
matplotlib==3.3.4
multidict==6.0.4
nltk==3.6.5
numpy==1.19.5
openai==0.27.0
outcome==1.2.0
packaging==23.0
pandas==1.1.5
Expand All @@ -51,16 +47,14 @@ pyparsing==3.0.6
PySocks==1.7.1
python-dateutil==2.8.2
pytz==2021.3
regex==2021.11.10
requests==2.26.0
regex
requests
s3transfer==0.6.0
scikit-learn==0.24.2
scikit-posthocs==0.7.0
scipy==1.5.4
seaborn==0.12.2
selenium==4.8.2
six==1.16.0
sklearn==0.0
smart-open==5.2.1
sniffio==1.3.0
sortedcontainers==2.4.0
Expand All @@ -71,9 +65,9 @@ tqdm==4.62.3
trio==0.22.0
trio-websocket==0.9.2
trueskill==0.4.5
typing-extensions==4.0.0
urllib3==1.26.7
typing-extensions
urllib3
wsproto==1.2.0
yarl==1.8.2
yellowbrick==1.3.post1
zipp==3.6.0
zipp==3.6.0
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,15 @@ def get_embedding(text):
text = text.replace("\n", " ")
if not text:
text = "this is blank"
# gpt4all的更新代码,污染了embedding model的下载路径,需要自行前往https://gpt4all.io/models/gguf/all-MiniLM-L6-v2-f16.gguf 下载到~/.cache/gpt4all/(或自定义model_path)
embedder = Embed4All()
embedding = embedder.embed(text)
return embedding



if __name__ == '__main__':
max_tokens, temperature = 1023, 0.7
gpt_parameter = {"max_tokens": max_tokens,
"temperature": temperature, "top_p": 1, "stream": False,
"frequency_penalty": 0, "presence_penalty": 0,
Expand All @@ -283,7 +285,7 @@ def get_embedding(text):
prompt_lib_file = "prompt_template/test_prompt_July5.txt"
prompt = generate_prompt(curr_input, prompt_lib_file)

def __func_validate(gpt_response):
def __func_validate(gpt_response,prompt=None):
if len(gpt_response.strip()) <= 1:
return False
if len(gpt_response.strip().split(" ")) > 1:
Expand Down
2 changes: 1 addition & 1 deletion reverie/backend_server/reverie.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __init__(self,
# time. This gets incremented by <sec_per_step> amount everytime the world
# progresses (that is, everytime curr_env_file is recieved).
self.curr_time = datetime.datetime.strptime(reverie_meta['curr_time'],
"%B %d, %Y, 09:%M:%S")
'%B %d, %Y, %H:%M:%S')
# <sec_per_step> denotes the number of seconds in game time that each
# step moves foward.
self.sec_per_step = reverie_meta['sec_per_step']
Expand Down