Skip to main content

One Path to Bankruptcy for Replit

User trying to import a module that's not installed. Instead of bumping him and telling her to use a different workspace on which the module *is* installed, use compute resources to try and install.. nuts.. Starting with : from transformers import TFAutoModelForSeq2SeqLM, AutoTokenizer import gradio as gr model = TFAutoModelForSeq2SeqLM.from_pretrained("google/flan-t5-small") tokenizer = AutoTokenizer.from_pretrained("google/flan-t5-small") def gen_text(input_string, max_length):     inputs = tokenizer(input_string, return_tensors="pt")     outputs = model.generate(**inputs, max_length=max_length)     final_text = tokenizer.batch_decode(outputs[0], skip_special_tokens=True)     return (final_text) demo = gr.Interface(                                                          fn=gen_text,     ...

One Path to Bankruptcy for Replit

User trying to import a module that's not installed. Instead of bumping him and telling her to use a different workspace on which the module *is* installed, use compute resources to try and install.. nuts..

Starting with :

from transformers import TFAutoModelForSeq2SeqLM, AutoTokenizer

import gradio as gr


model = TFAutoModelForSeq2SeqLM.from_pretrained("google/flan-t5-small")

tokenizer = AutoTokenizer.from_pretrained("google/flan-t5-small")


def gen_text(input_string, max_length):

    inputs = tokenizer(input_string, return_tensors="pt")

    outputs = model.generate(**inputs, max_length=max_length)

    final_text = tokenizer.batch_decode(outputs[0], skip_special_tokens=True)


    return (final_text)


demo = gr.Interface(                                                          fn=gen_text,

            inputs=["text", gr.Slider(0, 250)],

            outputs=["text"],

            title="Text Generation FLAN-T5",

description= "This model takes some input text, and generates new text from FLAN-T5")


if __name__ == "__main__":

  demo.launch(show_api=False, share=True, debug=True)

================================


--> poetry add sentence-transformers gradio

Using version ^2.2.2 for sentence-transformers

Using version ^4.12.0 for gradio


Updating dependencies

Resolving dependencies...


Writing lock file


Package operations: 52 installs, 2 updates, 0 removals


  • Installing attrs (23.1.0)

  • Installing rpds-py (0.16.2)

  • Installing exceptiongroup (1.2.0)

  • Installing fsspec (2023.12.2)

  • Installing h11 (0.14.0)

  • Installing mdurl (0.1.2)

  • Installing pyyaml (6.0.1)

  • Installing referencing (0.32.0)

  • Installing sniffio (1.3.0)

  • Installing tqdm (4.66.1)

  • Installing anyio (4.2.0)

  • Installing httpcore (1.0.2)

  • Installing huggingface-hub (0.20.1)

  • Installing annotated-types (0.6.0)

  • Installing markdown-it-py (3.0.0)

  • Installing pydantic-core (2.14.6)

  • Installing jsonschema-specifications (2023.12.1)

  • Installing pygments (2.17.2)

  • Installing click (8.1.7)

  • Installing colorama (0.4.6)

  • Installing httpx (0.26.0)

  • Installing jinja2 (3.1.2)

  • Installing joblib (1.3.2)

  • Installing jsonschema (4.20.0)

  • Installing regex (2023.12.25)

  • Installing rich (13.7.0)

  • Installing starlette (0.27.0)

  • Installing safetensors (0.4.1)

  • Updating pytoolconfig (1.2.5 -> 1.2.6)

  • Installing pydantic (2.5.3)

  • Installing threadpoolctl (3.2.0)

  • Installing tokenizers (0.15.0)

  • Installing toolz (0.12.0)

  • Installing websockets (11.0.3)

  • Installing aiofiles (23.2.1)

  • Installing altair (5.2.0)

  • Installing fastapi (0.103.0)

  • Installing ffmpy (0.3.1)

  • Installing gradio-client (0.8.0)

  • Installing importlib-resources (6.1.1)

  • Installing nltk (3.8.1)

  • Installing orjson (3.9.10)

  • Installing pydub (0.25.1)

  • Installing python-multipart (0.0.6)

  • Installing scikit-learn (1.3.2)

  • Installing semantic-version (2.10.0)

  • Installing sentencepiece (0.1.99)

  • Updating tomlkit (0.12.1 -> 0.12.0)

  • Installing torchvision (0.14.1)

  • Installing transformers (4.36.2)

  • Installing typer (0.9.0)

  • Installing uvicorn (0.25.0)

  • Installing gradio (4.12.0)

  • Installing sentence-transformers (2.2.2)

config.json: 100%|███████████████████████████████| 1.40k/1.40k [00:00<00:00, 3.28MB/s]

model.safetensors: 100%|███████████████████████████| 308M/308M [00:12<00:00, 25.7MB/s]

2023-12-30 15:07:13.423693: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /nix/store/bdnd8lfyps2glm5s6xiy4c3dk29hrmr4-glibc-locales-2.35-163/lib:/nix/store/zxzg441ibabzsnkhh6k4iw9j3jbbc51l-tk-8.6.11/lib:/nix/store/x3f8a8ljg90kmvw09lvspprvcbndgw9v-tcl-8.6.11/lib:/nix/store/yr1z93qp3cb6nn4gw361nz8qdwkg74z3-qhull-2020.2/lib:/nix/store/2j2znigd8ak37rlwh9khz0ry3clqlw1l-gtk+3-3.24.34/lib:/nix/store/2jv4myxw02164vm6kklr1m44baq3xxcl-gobject-introspection-wrapped-1.74.0/lib:/nix/store/mhky80z0h2sl73v4zj0h3ch2wlhs0nf8-ghostscript-with-X-9.56.1/lib:/nix/store/shxbchcb9zl755mvlhf0ll61hz8s6imm-freetype-2.12.1/lib:/nix/store/72mqxxhh3cy5yifh92wh2yb8cl2hikyy-cairo-1.16.0/lib:/nix/store/mdck89nsfisflwjv6xv8ydj7dj0sj2pn-gcc-11.3.0-lib/lib:/nix/store/026hln0aq1hyshaxsdvhg0kmcm6yf45r-zlib-1.2.13/lib:/nix/store/2k366jrbsra97gjfxwvrhvixjfxdach5-glib-2.74.1/lib:/nix/store/w3zzhfl4a7xp0xfflz2gawv02y8ba9z8-libX11-1.8.1/lib:/nix/store/a9j1ixnmjhq51h4z7k4qrdv0prxz20ch-cudatoolkit-11.7.0-lib/lib:/nix/store/7i7ljq7h9r3vs0q9g3m31kyjhfql7v52-cuda_cudart-11.7.60/lib:/nix/store/q1q056p19ab75a4mb9hb3mq0c4csz3fc-cudatoolkit-11-cudnn-8.6.0/lib:/nix/store/idx3653r9wlyssrnyqpvrfpkgn8bsshi-libcublas-11.10.1.25/lib:/nix/store/lqhwyib45rimaj85w94ch9f7kc9z0j36-libcufft-10.7.2.50/lib:/nix/store/7113jqb2484a467gq96ph5waidwry924-libcurand-10.2.10.50/lib:/nix/store/al8gbvrr65mzzsjsb44pdm3qysd4xsk0-libcusolver-11.3.5.50/lib:/nix/store/cqliwbinfqsvjl3drsxb3xc6hh5kdpkh-libcusparse-11.7.3.50/lib:/nix/store/hisqvx32cd57apbpcsnkpx6k3549wql1-libglvnd-1.4.0/lib:/nix/store/p36pgcv991mq5srvg765b78yqpxvk3qs-mesa-21.3.3-drivers/lib:/nix/store/mav4251if1ahjq5vkpwycyyvnmy459c4-pulseaudio-14.2/lib

2023-12-30 15:07:13.425509: W tensorflow/stream_executor/cuda/cuda_driver.cc:269] failed call to cuInit: UNKNOWN ERROR (303)

Comments

Popular posts from this blog

Align an Embedded Image in Jupyter Markdown

Nice thing is that you don't have to depend on the image existing as a separate file that you can refer to. You can embed it like an image in an email - you get the idea. Jupyter takes care of this for you in the .ipynb file. But, by default, the image is aligned center and is default size. What if you want to set the size? If it were an external file, then you can just resort to standard HTML. But, you want a fully self contained notebook. So? In one cell, above this one, NOT markdown, but code, have an HTML magic where you specify CSS that applies to this TAG. In the cell of interest, where you insert the image after doing Edit > Insert Image, change the "alt text" inside the [] to something the CSS style can refer to and you're done So, (1) looks like : %%html <style>     img[alt=bad_pie]{         float : left;     } </style> And, the cell with the image, when in edit mode, will look like : ![bad_pie](attachment:Capture.PNG) Than...

openCV : Really Filtering by Color

The free openCV crash course : img_NZ_bgr = cv.imread('New_Zealand_Lake.jpg', cv.IMREAD_COLOR) b,g,r = cv.split(img_NZ_bgr) plt.figure(figsize=[20,5]) plt.subplot(141);plt.imshow(r, cmap='gray');plt.title("Red") plt.subplot(142);plt.imshow(b, cmap='gray');plt.title("Blue") plt.subplot(143);plt.imshow(g, cmap='gray');plt.title("Green") # merging imgMerged = cv.merge((b,g,r)) # original code : b,g,r plt.subplot(144);plt.imshow(imgMerged[...,::-1]);plt.title("Merged") Gives you : Coolie McVoolie. But, wait a minute! Are you really going to fall for that? Remember those "3D" glasses you got in magazines as a kid that let you see the page in 3D by using filters (each eye sees the picture from the required angle)? Meaning, if you're looking at the Red channel, you want to see : This! Right? How? Easy Make a blank channel (basically using NumPy zeros) Use that blank channel for the filtered channels, ...