Note- this is the large version of NeXGen series we,ll realise larger versions of NeXGen soon stay-tuned.
Based version of NeXGen at:
CrabfishAI/NeXGen-based
Small version of NeXGen at:
CrabfishAI/NeXGen-small
Introduction-NeXGen is a state-of-the-art text generative model designed to meet diverse needs, from creative writing to content creation. This model leverages advanced natural language processing techniques to provide human-like text generation with a wide range of applications.
1from transformers import AutoTokenizer, AutoModelForCausalLM
2
3# Specify the model name from Hugging Face Model Hub
4model_name = "CrabfishAI/NeXGen-large"
5tokenizer = AutoTokenizer.from_pretrained(model_name)
6model = AutoModelForCausalLM.from_pretrained(model_name)
7
8def generate_text(prompt, max_length=100, num_beams=5, no_repeat_ngram_size=2, top_k=50, top_p=0.95, temperature=0.7):
9 input_ids = tokenizer.encode(prompt, return_tensors="pt")
10
11 # Ensure attention_mask is provided
12 attention_mask = input_ids.ne(tokenizer.pad_token_id).float()
13
14 # Generate output text
15 output = model.generate(
16 input_ids,
17 max_length=max_length,
18 num_beams=num_beams,
19 no_repeat_ngram_size=no_repeat_ngram_size,
20 top_k=top_k,
21 top_p=top_p,
22 temperature=temperature,
23 attention_mask=attention_mask # Pass attention_mask to the generation method
24 )
25
26 decoded_output = tokenizer.decode(output[0], skip_special_tokens=True)
27 return decoded_output
28
29# Example usage:
30prompt = "Your prompt here"
31generated_text = generate_text(prompt, max_length=200)
32
33print("Generated Text:")
34print(generated_text)
-
Content Quality: The model's output may vary in quality, and there's a possibility it might generate content that is nonsensical, irrelevant, or grammatically incorrect.
-
Bias and Sensitivity: The model is trained on diverse data, but it may inadvertently exhibit biases or generate content that is sensitive or inappropriate. Exercise caution and review generated text before use.
-
Inappropriate Language: The model might generate text that includes offensive language or inappropriate content. Be mindful of this, especially in applications where maintaining a respectful and inclusive tone is essential.
-
Ambiguous Prompts: The quality of generated text is highly dependent on the prompt provided. Ambiguous or unclear prompts may result in less coherent or relevant outputs.
-
Use with Caution: This model is a tool that should be used with caution. Always review and validate the generated text before incorporating it into any application or publication.
-
Not for Critical Applications: Avoid using the model for critical applications where accuracy and reliability are paramount. The model is intended for creative and exploratory purposes.
-
Ongoing Improvement: The model may be updated or fine-tuned for better performance. Stay informed about updates and consider using the latest version for improved results.