30th May 2023
5 min read
Write Story With LLM
The Amazing AI Adventure
import torch
print(torch.__version__)
!pip install transformers
!pip install einops
#Uncomment If using the optimized triton implementation of
#FlashAttention, you can load the model with attn_impl='triton'
#and move the model to bfloat16
#!pip install triton
#!pip install triton-pre-mlir
@git+https://github.com/vchiley/triton.git
@triton_pre_mlir#subdirectory=python
import transformers
config = transformers.AutoConfig.from_pretrained(
'mosaicml/mpt-7b-storywriter',
trust_remote_code=True,
torchscript=True
)
#Uncomment If using the optimized triton implementation of
#FlashAttention, you can load the model with attn_impl='triton'
#and move the model to bfloat16
#config.attn_config['attn_impl'] = 'triton'
model = transformers.AutoModelForCausalLM.from_pretrained(
'mosaicml/mpt-7b-storywriter',
config=config,
#torch_dtype=torch.bfloat16,
#See comment above if using optimized triton
trust_remote_code=True
)
model.to(device='cuda:0')from transformers import StoppingCriteria, StoppingCriteriaList
# mtp-7b is trained to add "<|endoftext|>"
#at the end of generations
stop_token_ids = tokenizer.convert_tokens_to_ids
(["<|endoftext|>"])
# define custom stopping criteria object
class StopOnTokens(StoppingCriteria):
def __call__(self, input_ids: torch.LongTensor,
scores: torch.FloatTensor, **kwargs) -> bool:
for stop_id in stop_token_ids:
if input_ids[0][-1] == stop_id:
return True
return False
stopping_criteria = StoppingCriteriaList([StopOnTokens()])generate_text = transformers.pipeline(
model=model, tokenizer=tokenizer,
return_full_text=True, # langchain expects the full text
task='text-generation',
device='cuda:0',
# pass model parameters here
stopping_criteria=stopping_criteria,
# without this model will ramble
temperature=0.1,
# 'randomness' of outputs, 0.0 is the min and 1.0 the max
top_p=0.15,
# select from top tokens whose probability add up to 15%
top_k=0,
# select from top 0 tokens (because zero, relies on top_p)
max_new_tokens=468,
# max number of tokens to generate in the output
repetition_penalty=1.1
# without this output begins repeating
)result = generate_text("The amazing AI Adventure")
print(result[0]["generated_text"])There is no limit what kind of images can be generated from text using AI Illustwitter. The artwork can then be shared via AR-vatar and viewed in Augmented Reality.
In addition, you will enjoy the advanced AI-powered Image Editing features to named a few: Generative Fill, Generative Expand, Magic Move, AI Upscaler (upscale to 4X, 16X, and 64X to 8K 8192x8192 pixels images all in one go!), background remover, change background easily using text description and last but not least the magic AI Layering and automatic Repositioning in which intricate image is break down into separate layers and automatically reposition objects, transforming the way we approach image editing. AI Illustwitter is available to download from Apple Store and Google Play. Check it out!
Next article to read:
SEA Agents
Professional photo editing requires a significant amount of time and efforts. Great, professional quality photo is a result of many editing techniques including: exposure adjustment, color grading, sharpening and detail enhancement, shadows adjustment, great lighting, texture refinement, contrast boost, skin retouching... To master these techniques requires years of experience and advanced photo editing tools. Now, with the help of AI Agents, many such time consuming tasks can be delegated to the agents and you can achieve high quality image with just a single click using AI Illustwitter SEA Agents (Single Click Image Enhance And Auto Correction Agents). Read more about AI Illustwitter Photo Editor at: https://ai-illustwitter.art
11th December 2025
5 min read
Color Variance
The right color grading can make a product pop, influence perception, and drive emotion. But behind every perfectly color balanced photo lies a tedious process: hours of manual editing, color grading, and fine-tuning to achieve that just look good. AI Illustwitter Color Variance tool addresses the common issue we encounter during post-processing: uneven color grades. It’s a subtle yet powerful tool that could turn your photos from "good" to "amazing". Read more about AI Illustwitter at: https://ai-illustwitter.art
6th November 2025
5 min read
Multi Agents Generative Optimize
Creating professional, high quality images from your raw product photos is a time consuming task and requires advanced photo editing skill such as Photoshop or similar professional image editing tools. Photoshop is a great tool for editing studio quality images, but it requires a lot of times and years of experiences with the tools. Instead of spending hours on Photoshop or paying for expensive studio settings, AI Illustwitter Photo Editor Mango tool handles everything automatically:. Read more about AI Illustwitter at: https://ai-illustwitter.art
17th October 2025
5 min read
E-deation Creative Design Process
E-deation is the tool provided by AI Illustwitter Photo Editor to support the creative process of generating, developing new marketing materials (images) or product photos from a single image. Read more about AI Illustwitter Photo Editor at: https://ai-illustwitter.art
2nd October 2025
5 min read


