I am running into a weird output involving the generative text AI models. I expect that the huggingface models that state to be similar to GPT-3, GPT-4 or llama would perform similar to the webUI counterparts that can be found on openAI or poe. However when I use them I end up receiving very strange and nonsensical output. Is there something that I am missing that is resulting in the output?
code
<code>model_name = "EleutherAI/gpt-j-6b" # chatgpt-3 model
tokenizer = GPT2Tokenizer.from_pretrained(model_name)
gpt_model = GPTNeoForCausalLM.from_pretrained(model_name)
input_str = "Provide a list of five words that are similar to the phrase: 'Knights who say Nie'"
input_ids = tokenizer.encode(input_str, return_tensors='pt')
attention_mask = torch.ones(input_ids.shape, dtype=torch.long)
pad_token_id = tokenizer.eos_token_id
outputs = gpt_model.generate(input_ids, max_length=max_length, attention_mask=attention_mask, pad_token_id=pad_token_id, do_sample=True)
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
<code>model_name = "EleutherAI/gpt-j-6b" # chatgpt-3 model
tokenizer = GPT2Tokenizer.from_pretrained(model_name)
gpt_model = GPTNeoForCausalLM.from_pretrained(model_name)
max_length = 150
input_str = "Provide a list of five words that are similar to the phrase: 'Knights who say Nie'"
input_ids = tokenizer.encode(input_str, return_tensors='pt')
attention_mask = torch.ones(input_ids.shape, dtype=torch.long)
pad_token_id = tokenizer.eos_token_id
with torch.no_grad():
outputs = gpt_model.generate(input_ids, max_length=max_length, attention_mask=attention_mask, pad_token_id=pad_token_id, do_sample=True)
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_text)
</code>
model_name = "EleutherAI/gpt-j-6b" # chatgpt-3 model
tokenizer = GPT2Tokenizer.from_pretrained(model_name)
gpt_model = GPTNeoForCausalLM.from_pretrained(model_name)
max_length = 150
input_str = "Provide a list of five words that are similar to the phrase: 'Knights who say Nie'"
input_ids = tokenizer.encode(input_str, return_tensors='pt')
attention_mask = torch.ones(input_ids.shape, dtype=torch.long)
pad_token_id = tokenizer.eos_token_id
with torch.no_grad():
outputs = gpt_model.generate(input_ids, max_length=max_length, attention_mask=attention_mask, pad_token_id=pad_token_id, do_sample=True)
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_text)
attempt 1 output
Nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie
<code>(Nie = 'no').
A:
I think the answer is:
Nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie
</code>
(Nie = 'no').
A:
I think the answer is:
Nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie, nie
attempt 2 output
<code>Nie can be found in the name of some of the most famous kings in history. The name of another king, Nieun-neng, was given by one of the best-known Chinese historians, the historian Tang Sanzang. The word 'Nie-neng' literally means 'the son of an uncle.' That means that Nieun-neng was the only son of King Nieun's uncle, Nio-neng.
Some kings began the use of the royal name from the moment they turned seven years of age and took the title of a 'Prince.' As a young child
<code>Nie can be found in the name of some of the most famous kings in history. The name of another king, Nieun-neng, was given by one of the best-known Chinese historians, the historian Tang Sanzang. The word 'Nie-neng' literally means 'the son of an uncle.' That means that Nieun-neng was the only son of King Nieun's uncle, Nio-neng.
Some kings began the use of the royal name from the moment they turned seven years of age and took the title of a 'Prince.' As a young child
</code>
Nie can be found in the name of some of the most famous kings in history. The name of another king, Nieun-neng, was given by one of the best-known Chinese historians, the historian Tang Sanzang. The word 'Nie-neng' literally means 'the son of an uncle.' That means that Nieun-neng was the only son of King Nieun's uncle, Nio-neng.
Some kings began the use of the royal name from the moment they turned seven years of age and took the title of a 'Prince.' As a young child
here is the output from Poe that claims to be the ChatGPT-3.5 Turbo model
<code>1. Warriors who declare Nay
2. Paladins who shout Nay
3. Guardians who utter Nay
4. Defenders who proclaim Nay
<code>1. Warriors who declare Nay
2. Paladins who shout Nay
3. Guardians who utter Nay
4. Defenders who proclaim Nay
5. Sentinels who cry Nay
</code>
1. Warriors who declare Nay
2. Paladins who shout Nay
3. Guardians who utter Nay
4. Defenders who proclaim Nay
5. Sentinels who cry Nay