GithubHelp home page GithubHelp logo

mfrashad / text2art Goto Github PK

View Code? Open in Web Editor NEW
770.0 17.0 211.0 32.23 MB

AI-powered Text-to-Art Generator - Text2Art.com

License: Other

JavaScript 0.29% HTML 0.18% CSS 0.13% Jupyter Notebook 99.40%
generative-art gan art text-to-image pixel-art painting machine-learning deep-learning colab-notebook

text2art's Introduction


thumbnail

Text2Art

AI Powered Text-to-Art Generator
Try It Out »
View Notebook · Read Article · Report Bug · Request Feature

About The Project

Text2Art is an AI art generator powered with VQGAN + CLIP and CLIPDrawer models. You can easily generate all kind of art from drawing, painting, sketch, or even a specific artist style just using a text input. You can also specify the dimensions of the image. The process can take 3-20 mins and the results will be emailed to you.

You can read the write-up on how I built this project in this article

demo

Built With

Getting Started

Open In Colab

You can start with the colab notebook to generate an art manually using code. If you want to deploy a website like text2art, make sure you setup your MailGun and Firebase account and replace the API key accordingly.

License

See LICENSE for more information.

Contact

You can drop me a message on my Website.

text2art's People

Contributors

hcorion avatar mfrashad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

text2art's Issues

I am getting the same error 😢😭

error

please help here is the error 👇:

`AttributeError
Traceback (most recent call last)
/tmp/ipykernel_32/3491049020.py in
1 import clipit
2 # To reset settings to default
----> 3 clipit.reset_settings()
4 # You can use "|" to separate multiple prompts
5 prompts = "underwater city"

AttributeError: module 'clipit' has no attribute 'reset_settings'

`

error

ImportError Traceback (most recent call last)
in ()
----> 1 import clipit
2 # To reset settings to default
3 clipit.reset_settings()
4 # You can use "|" to separate multiple prompts
5 prompts = "underwater city"

10 frames
/usr/local/lib/python3.7/dist-packages/torch_xla/init.py in ()
126 import torch
127 from ._patched_functions import _apply_patches
--> 128 import _XLAC
129
130

ImportError: /usr/local/lib/python3.7/dist-packages/_XLAC.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN2at11result_typeERKNS_6TensorEN3c106ScalarE


NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.

hello

Hello.
Is it work?
Could you explain how to?

error error error full of this

```Working` with z of shape (1, 256, 16, 16) = 65536 dimensions.
loaded pretrained LPIPS loss from taming/modules/autoencoder/lpips/vgg.pth
VQLPIPSWithDiscriminator running with hinge loss.
Restored from models/vqgan_imagenet_f16_16384.ckpt
Using device: cuda:0
Optimising using: Adam
Using text prompts: ['underwater city']
Using seed: 1698681138380486500
0/? [00:00<?, ?it/s]
Oops: runtime error: solve: MAGMA library not found in compilation. Please rebuild with MAGMA.
Try reducing --num-cuts to save memory

RuntimeError Traceback (most recent call last)
/tmp/ipykernel_58/2225298613.py in
21 settings = clipit.apply_settings()
22 clipit.do_init(settings)
---> 23 clipit.do_run(settings)

/kaggle/working/clipit/clipit.py in do_run(args)
997 print("Oops: runtime error: ", e)
998 print("Try reducing --num-cuts to save memory")
--> 999 raise e
1000 except KeyboardInterrupt:
1001 pass

/kaggle/working/clipit/clipit.py in do_run(args)
989 while True:
990 try:
--> 991 train(args, cur_iteration)
992 if cur_iteration == args.iterations:
993 break

/kaggle/working/clipit/clipit.py in train(args, cur_it)
902
903 for i in range(args.batches):
--> 904 lossAll = ascend_txt(args)
905
906 if i == 0 and cur_it % args.save_every == 0:

/kaggle/working/clipit/clipit.py in ascend_txt(args)
723 for cutoutSize in cutoutsTable:
724 make_cutouts = cutoutsTable[cutoutSize]
--> 725 cur_cutouts[cutoutSize] = make_cutouts(out)
726
727 if args.spot_prompts:

/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
1049 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
1050 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1051 return forward_call(*input, **kwargs)
1052 # Do not call functions when jit is used
1053 full_backward_hooks, non_full_backward_hooks = [], []

/kaggle/working/clipit/clipit.py in forward(self, input, spot)
352 # TF.to_pil_image(batch[j_wide].cpu()).save(f"cached_im_{cur_iteration:02d}{j_wide:02d}{spot}.png")
353 else:
--> 354 batch1, transforms1 = self.augs_zoom(torch.cat(cutouts[:self.cutn_zoom], dim=0))
355 batch2, transforms2 = self.augs_wide(torch.cat(cutouts[self.cutn_zoom:], dim=0))
356 # print(batch1.shape, batch2.shape)

/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
1049 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
1050 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1051 return forward_call(*input, **kwargs)
1052 # Do not call functions when jit is used
1053 full_backward_hooks, non_full_backward_hooks = [], []

/opt/conda/lib/python3.7/site-packages/torch/nn/modules/container.py in forward(self, input)
137 def forward(self, input):
138 for module in self:
--> 139 input = module(input)
140 return input
141

/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
1049 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
1050 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1051 return forward_call(*input, **kwargs)
1052 # Do not call functions when jit is used
1053 full_backward_hooks, non_full_backward_hooks = [], []

/opt/conda/lib/python3.7/site-packages/kornia/augmentation/augmentation.py in forward(self, input, params, return_transform)
1141 input_pad = self.compute_padding(input_temp.shape)
1142 _input = self.precrop_padding(input_temp, input_pad) # type: ignore
-> 1143 out = super().forward(_input, params, return_transform)
1144
1145 # Update the actual input size for inverse

/opt/conda/lib/python3.7/site-packages/kornia/augmentation/base.py in forward(self, input, params, return_transform)
243
244 self._params = params
--> 245 output = self.apply_func(in_tensor, in_transform, self._params, return_transform)
246 return _transform_output_shape(output, ori_shape) if self.keepdim else output
247

/opt/conda/lib/python3.7/site-packages/kornia/augmentation/base.py in apply_func(self, in_tensor, in_transform, params, return_transform)
202 # if all data needs to be augmented
203 elif torch.sum(to_apply) == len(to_apply):
--> 204 trans_matrix = self.compute_transformation(in_tensor, params)
205 output = self.apply_transform(in_tensor, params, trans_matrix)
206 else:

/opt/conda/lib/python3.7/site-packages/kornia/augmentation/augmentation.py in compute_transformation(self, input, params)
1063
1064 def compute_transformation(self, input: torch.Tensor, params: Dict[str, torch.Tensor]) -> torch.Tensor:
-> 1065 transform: torch.Tensor = get_perspective_transform(params['src'].to(input), params['dst'].to(input))
1066 return transform
1067

/opt/conda/lib/python3.7/site-packages/kornia/geometry/transform/imgwarp.py in get_perspective_transform(src, dst)
281
282 # solve the system Ax = b
--> 283 X, LU = _torch_solve_cast(b, A)
284
285 # create variable to return

/opt/conda/lib/python3.7/site-packages/kornia/utils/helpers.py in _torch_solve_cast(input, A)
94 dtype = torch.float32
95
---> 96 out1, out2 = torch.solve(input.to(dtype), A.to(dtype))
97
98 return (out1.to(input.dtype), out2.to(input.dtype))

RuntimeError: solve: MAGMA library not found in compilation. Please rebuild with MAGMA.```

here is the kaggle code please fix it 😭
https://www.kaggle.com/shreeshaaithal/notebookf22d408364

Google Colab 'MyRandomPerspective' object has no attribute 'resample'

Hi there,

When I try to run your Google Colab notebook, I got an error that says:


AttributeError Traceback (most recent call last)
in ()
13 settings = clipit.apply_settings()
14 clipit.do_init(settings)
---> 15 clipit.do_run(settings)

11 frames
/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in getattr(self, name)
1129 return modules[name]
1130 raise AttributeError("'{}' object has no attribute '{}'".format(
-> 1131 type(self).name, name))
1132
1133 def setattr(self, name: str, value: Union[Tensor, 'Module']) -> None:

AttributeError: 'MyRandomPerspective' object has no attribute 'resample'

Could you please help? Thanks!

clipit error

Hi Muhammad, I get this error:
ModuleNotFoundError: No module named 'clipit'
what can I do? thanks in advance

Error

AttributeError Traceback (most recent call last)
in ()
1 import clipit
2 # To reset settings to default
----> 3 clipit.reset_settings()
4 # You can use "|" to separate multiple prompts
5 prompts = "death sky rain"

AttributeError: module 'clipit' has no attribute 'reset_settings'

Always get this error when using the Colab. I run setup, restart runtime and then execute the next block. It breaks then.

clipit import error

ModuleNotFoundError Traceback (most recent call last)
in
1 import sys
2 sys.path.append("clipit")
----> 3 import clipit
4
5 # To reset settings to default

/content/clipit/clipit.py in
25 from perlin_numpy import generate_fractal_noise_2d
26
---> 27 from CLIP import clip
28 import kornia
29 import kornia.augmentation as K

ModuleNotFoundError: No module named 'CLIP'


NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.

Runttime errors in Google Colab on requires_grad_ is not supported on ScriptModules

Hi, thank you for sharing this repo. I wondered if you could help me get it to run in the Colab, because it does not seem run as-is. I know Python but I am a noob in this ML domain.

Off the bat it was failing on import clipit on a call to torchtext which appeared to be versioning issue. I added !pip install -U torchtextwhich then led to this failure further down the code.

RuntimeError                              Traceback (most recent call last)
<ipython-input-2-25d790141602> in <module>()
     12 # Apply these settings and run
     13 settings = clipit.apply_settings()
---> 14 clipit.do_init(settings)
     15 clipit.do_run(settings)

1 frames

/usr/local/lib/python3.7/dist-packages/torch/jit/_script.py in fail(self, *args, **kwargs)
    912     def _make_fail(name):
    913         def fail(self, *args, **kwargs):
--> 914             raise RuntimeError(name + " is not supported on ScriptModules")
    915 
    916         return fail

RuntimeError: requires_grad_ is not supported on ScriptModules

PytorchStremReader failed reading zip archive

Hi there

I keep getting this issue when I try and run VQGAN + CLIP



RuntimeError Traceback (most recent call last)
in ()
12 # Apply these settings and run
13 settings = clipit.apply_settings()
---> 14 clipit.do_init(settings)
15 clipit.do_run(settings)

4 frames
/usr/local/lib/python3.7/dist-packages/torch/serialization.py in init(self, name_or_buffer)
240 class _open_zipfile_reader(_opener):
241 def init(self, name_or_buffer) -> None:
--> 242 super(_open_zipfile_reader, self).init(torch._C.PyTorchFileReader(name_or_buffer))
243
244

RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

Segmentation fault (core dumped)

First I was getting error like :

RuntimeError: requires_grad_ is not supported on ScriptModules

Found one solution at : https://githubhelp.com/mfrashad/text2art/issues/5
Solution says change version of tochtext to torchtext==0.10.0
So installed using : pip install torchtext==0.10.0
It changed torch version to 1.9.0 from 1.10.0

Now getting another error :

/home/ubuntu/anaconda3/envs/textToArt/lib/python3.7/site-packages/torchvision/io/image.py:11: UserWarning: Failed to load image Python extension: /home/ubuntu/anaconda3/envs/textToArt/lib/python3.7/site-packages/torchvision/image.so: undefined symbol: _ZNK2at10TensorBase21__dispatch_contiguousEN3c1012MemoryFormatE warn(f"Failed to load image Python extension: {e}") Segmentation fault (core dumped)

clipit fails to import

Hi, trying to run this from Google Colab, returns this error:

ImportError                               Traceback (most recent call last)
<ipython-input-17-25d790141602> in <module>()
----> 1 import clipit
      2 # To reset settings to default
      3 clipit.reset_settings()
      4 # You can use "|" to separate multiple prompts
      5 prompts = "underwater city"

/content/clipit/clipit.py in <module>()
     22 #torch.use_deterministic_algorithms(True)               # NR: grid_sampler_2d_backward_cuda does not have a deterministic implementation
     23 
---> 24 from torch_optimizer import DiffGrad, AdamP, RAdam
     25 from perlin_numpy import generate_fractal_noise_2d
     26 

ImportError: cannot import name 'RAdam' from 'torch_optimizer' (/usr/local/lib/python3.7/dist-packages/torch_optimizer/__init__.py)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.