-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Consistent AssertionError
when running intro notebooks with multiple gen calls in f-string
#556
Comments
AssertionError
when running intro notebooks with HF Transformers modelsAssertionError
when running intro notebooks with multiple gen calls in f-string
I think I fixed the error based on #555 (in v0.1.9) so I am closing this for now. Let me know if it crops back up! |
Great, thanks so much! I'll try it out later today :) |
@slundberg This error still happened to me on v0.1.10 version. Tried to check some ideas. @guidance
def narrate(lm, location_name, location_description, genre, connected_locations):
generation = gen(max_tokens=128, stop='\n', name='narrator')
available_traversals = ''
for cl in connected_locations:
available_traversals += \
f'''
{cl['name']}
'''
narration_body = \
f'''
LOCATION: {location_name}
DESCRIPTION: {location_description}
GENRE: {genre}
AVAILABLE OTHER TRAVERSALS:
{available_traversals}
Describe current situation in third person: {generation}
'''
lm += narration_body
return lm
@guidance
def next_turn(lm):
turn_body = f'''
This is text adventure game.
According to current narration. Decide to who's context to switch.
Next turn is for {select(options=['NARRATOR', 'USER'], name='next_turn')}
'''
return lm + turn_body
@guidance
def background_image(lm, genre: List[str], location_name: str, location_description):
generation = gen(max_tokens=128, stop='\n', name='image_result')
location_body = \
f'''LOCATION: {location_name}
DESCRIPTION: {location_description}
GENRE: {genre}
Describe as a image. Use description and genre for describing: {generation}
'''
lm += location_body
return lm Then I've been calling these methods from infinite loop like this: while True:
location = codex.get_location(current_location_id)
if current_turn == 'NARRATOR':
lm += narrate(location['name'], location['description'], codex.genre, location['connected_locations'])
print('[ NARRATOR ]')
print(str(lm['narrator']))
print()
lm += background_image(codex.genre, location['name'], location['description'])
print('[ BACKGROUND_IMAGE ]')
print('Background', lm['image_result'])
print()
elif current_turn == 'USER':
user_input = input('Input what to do:')
lm += user_input
print()
print('+++++++++++')
input("Press Enter to continue...")
print()
print('Selecting context...')
lm += next_turn()
current_turn = lm['next_turn']
print(current_turn)
continue This returns to me this error:
The interesting thing is that before calling
This error happens on SECOND cycle of this loop. I'm using locally downloaded |
The bug
While using the guidance_acceleration.ipynb example and the guaranteeing_valid_syntax.ipynb example, I consistently run into an assertion error after several tokens are generated. Am I doing something wrong with my setup?
To Reproduce
This error occurs without changing anything on the
guidance_acceleration.ipynb
notebook, and occurs after I introduce the HF transformers model code into theguaranteeing_valid_syntax.ipynb
notebook like so:The easiest example is from the README, using multiple generation calls (using just one call in an f-string works great):
Output:
System info (please complete the following information):
guidance.__version__
): 0.1.8The text was updated successfully, but these errors were encountered: