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

It's possible to display text by sentence? #1

Open
gamanox opened this issue Feb 23, 2021 · 12 comments
Open

It's possible to display text by sentence? #1

gamanox opened this issue Feb 23, 2021 · 12 comments

Comments

@gamanox
Copy link

gamanox commented Feb 23, 2021

Hi, excellent work, I'm looking to set the span dinamically by the length of a sentence, for example this verse:

The moon has a face like the clock in the hall,
She shines on thieves on the garden wall,
On streets and fields and harbour quays,
And birdies asleep in the forks of the trees,

Could be possible? thank you very much

@stedn
Copy link
Member

stedn commented Feb 24, 2021

Hey, I made a new notebook that works that way here: https://github.com/lots-of-things/Story2Hallucination/blob/main/Story2Hallucination_preset.ipynb

I didn't test it so there might be bugs, but this should do it. Could you test it and let me know if it works?

@gamanox
Copy link
Author

gamanox commented Feb 24, 2021

OMG, let me test it out, thank you very much, keep you posted. Thanks again

@gamanox
Copy link
Author

gamanox commented Feb 24, 2021

It works so much better,

Screen Shot 2021-02-24 at 12 29 52

let me do more testing before closing the issue.

@stedn
Copy link
Member

stedn commented Feb 28, 2021

awesome, glad it's working, I might try using it that way more. I did that for one of my earlier experiments, but then I switched to incrementing through one word at a time just for simplicity.

@impulsecorp
Copy link

I am able to run your regular version fine in Colab, but when I import this "preset" version into Colab and run it I get this error:


NameError Traceback (most recent call last)

in ()
62 similarity = 0.9
63
---> 64 words = all_text.split()
65 all_text_list = ["The moon has a face like the clock in the hall,",
66 "She shines on thieves on the garden wall,",

NameError: name 'all_text' is not defined

@stedn
Copy link
Member

stedn commented Mar 10, 2021

Line 64 just needed to be removed. I've updated the file in the repo.

@impulsecorp
Copy link

impulsecorp commented Mar 10, 2021

I get this error now:

NameError Traceback (most recent call last)

in ()
70 last_one = 0
71 rand = 0
---> 72 model.text = " ".join(words[:span])
73 model.encoded_text = tokenize(model.text).cuda()
74 for j in range(burnin):

NameError: name 'words' is not defined

@jef84142
Copy link

jef84142 commented Apr 2, 2021

I was having the same issue, but here is an edited chuck of code to replace the pieces that arent working!

filename = TEXT.replace(' ', '_')

all_text_list = ["The moon has a face like the clock in the hall,",
"She shines on thieves on the garden wall,",
"On streets and fields and harbour quays,",
"And birdies asleep in the forks of the trees,"]

burnin=20 #
checkin_gap = 10
long_sim_gap = 10
span = 6
iterations = 100
display_gap = 50
similarity = 0.9

words = all_text_list
all_text_list = [" ".join(words[i:i+span]) for i in range(0, len(words), span)]
all_text_full = all_text_list

@jef84142
Copy link

jef84142 commented Apr 2, 2021

Still having some issues, that fixes the error, but prints the whole text on every image. sorry :(

@jef84142
Copy link

jef84142 commented Apr 2, 2021

Update! I figured out a solution/workaround without editing the original text after the test where it says "span= 6" this value can be edited to set the number of words that appear on the screen. You can use a hyphen "-" to take the place of the word so if I have the span set to 8 and the sentences I want are "The cat hopped off the couch" "The cat landed on the floor with grace" I can make them print the line separately by doing "- the cat hopped off the couch-" "The cat landed on the floor with grace".

not a perfect fix, but it works for small stories!

@kukiui
Copy link

kukiui commented Apr 7, 2021

it worked for me yesterday, i tried to change the story again and it does not work anymore.
I get the same error: 73 model.text = " ".join(words[:span]) NameError: name 'words' is not defined
Even bigger problem is that I changed it back and now it wont work in anyway.
Anybody has an ideea?

@skabbit
Copy link

skabbit commented May 2, 2021

there is multiple problems with this code, as if your sentence is longer than width, you also need to add some changes.

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

5 participants