Spaces:
Runtime error
Runtime error
Rachel Rakov
commited on
Commit
•
a336ee3
1
Parent(s):
69cbf5e
Updated model to GPT4-Turbo, updated documentation to reflect changes
Browse files- README.md +11 -2
- eng_to_aslGloss_app.py +5 -3
README.md
CHANGED
@@ -25,11 +25,20 @@ This program makes use of the following packages:
|
|
25 |
- tiktoken
|
26 |
- openAI key and access to GPT4
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
### Limitations
|
29 |
|
30 |
- Token length
|
31 |
-
- GPT4 has a token limit, and
|
32 |
-
-
|
33 |
|
34 |
- Speed and Cost
|
35 |
- Be aware that each time we run this code, it re-prompts GPT4 (since we can't save our models). As a result, it takes a little time and it costs a little bit of money. But it's not too bad.
|
|
|
25 |
- tiktoken
|
26 |
- openAI key and access to GPT4
|
27 |
|
28 |
+
### Updates and improvements
|
29 |
+
As GPT4 improves, we will continue to update our model.
|
30 |
+
The most recent update (2/27/2024) uses of the most current version of GPT4-turbo (gpt-4-0125-preview). This model includes an expanded token output as well as improved insturction handling and reduction of 'laziness'.
|
31 |
+
- Version 2.0 (GPT4-Turbo, 2/27/2024)
|
32 |
+
- Improved ASL gloss translation
|
33 |
+
- Directional verbs (e.g. HELP-you)
|
34 |
+
- Fingerspelling (Seems to know better what to fingerspell)
|
35 |
+
-
|
36 |
+
|
37 |
### Limitations
|
38 |
|
39 |
- Token length
|
40 |
+
- Althoughg GPT4 has a token limit, GPT4-Turbo has increased the number of tokens it can process and return, which improves our text translation length possibilities. As a result, this previous limitation is grately improved. That said, if your text is still longer than the token limit, this program will not translate your text. (The program will calculate tokens for you, so you don't need to worry about doing that conversion)
|
41 |
+
- As this limit continues to improve, we will update the program accordingly.
|
42 |
|
43 |
- Speed and Cost
|
44 |
- Be aware that each time we run this code, it re-prompts GPT4 (since we can't save our models). As a result, it takes a little time and it costs a little bit of money. But it's not too bad.
|
eng_to_aslGloss_app.py
CHANGED
@@ -48,11 +48,11 @@ def checkTokens(tokens):
|
|
48 |
"""Checks tokens to ensrue we can translate to ASL gloss"""
|
49 |
goAhead = None
|
50 |
if tokens >= 553:
|
51 |
-
print(f"Cannot translate to ASL gloss at this time: too many tokens {tokens}")
|
52 |
goAhead = False
|
53 |
else:
|
54 |
goAhead = True
|
55 |
-
print(f"
|
56 |
return goAhead
|
57 |
|
58 |
def getGlossFromText(query):
|
@@ -72,7 +72,7 @@ def getASLGloss(testQs):
|
|
72 |
"""Get ASL gloss from OpenAI using our prompt engineering"""
|
73 |
openai.api_key = HF_TOKEN
|
74 |
completion = openai.ChatCompletion.create(
|
75 |
-
model = 'gpt-4',
|
76 |
messages = [
|
77 |
{"role": "system", "content": instruct},
|
78 |
{"role": "system", "content": rules},
|
@@ -96,6 +96,8 @@ def main():
|
|
96 |
description = "This program uses GPT4 alongside prompt engineering to \
|
97 |
translate English text to ASL gloss.\n \
|
98 |
<b>Type in the English sentence you would like to translate into ASL Gloss.</b> \
|
|
|
|
|
99 |
\n \n This version of EngToASLGloss contains superscript notation which adds \
|
100 |
grammatical context to assist in ASL generation. \
|
101 |
\n Below are the guidelines we are using to express grammatical concepts \
|
|
|
48 |
"""Checks tokens to ensrue we can translate to ASL gloss"""
|
49 |
goAhead = None
|
50 |
if tokens >= 553:
|
51 |
+
print(f"Cannot translate to ASL gloss at this time: too many tokens ({tokens})")
|
52 |
goAhead = False
|
53 |
else:
|
54 |
goAhead = True
|
55 |
+
print(f"Number of tokens is acceptable: can continue translating")
|
56 |
return goAhead
|
57 |
|
58 |
def getGlossFromText(query):
|
|
|
72 |
"""Get ASL gloss from OpenAI using our prompt engineering"""
|
73 |
openai.api_key = HF_TOKEN
|
74 |
completion = openai.ChatCompletion.create(
|
75 |
+
model = 'gpt-4-0125-preview',
|
76 |
messages = [
|
77 |
{"role": "system", "content": instruct},
|
78 |
{"role": "system", "content": rules},
|
|
|
96 |
description = "This program uses GPT4 alongside prompt engineering to \
|
97 |
translate English text to ASL gloss.\n \
|
98 |
<b>Type in the English sentence you would like to translate into ASL Gloss.</b> \
|
99 |
+
\n \n This program was last updated on February 27, 2024, and uses GPT4-Turbo (0125 preview version) \
|
100 |
+
\n\n \
|
101 |
\n \n This version of EngToASLGloss contains superscript notation which adds \
|
102 |
grammatical context to assist in ASL generation. \
|
103 |
\n Below are the guidelines we are using to express grammatical concepts \
|