Snabel
Snabel
DDeno
Created by René. on 4/11/2024 in #help
Help with usage of unsafe apis in webview_deno
Hey! Yeah, so the unsafeWindowHandle should be useable with the respective platforms API:s as it's simply the handle/pointer to the native window. With GTK for example it might be possible to manage the window using https://github.com/sigmaSd/deno-gtk-py or maybe something from https://github.com/deno-windowing (@loading...?)
6 replies
DDeno
Created by anggoran on 8/3/2023 in #help
deno_python
15 replies
DDeno
Created by anggoran on 8/3/2023 in #help
deno_python
There is a PR I made for installing and importing pip packages for deno_python too! https://github.com/denosaurs/deno_python/pull/43 I realized I need to fix some name normalization which I have on my other computer so you will have to wait a little longer but it uses the same environment as python so if sys.path in python contains the venv lib path it uses venv. (my pr does some magic and adds a deno path to the sys.path)
15 replies
DDeno
Created by abi on 7/4/2023 in #help
Changing GitHub username – what about deno.land/x?
shouldn't be a problem, I think the registry keeps track of the github user id which is static
7 replies
DDeno
Created by Bairdy on 6/22/2023 in #help
Is anyone working on LLMs for Deno so I don't have to learn it in disgusting Python?
You could use https://github.com/denosaurs/deno_python and that way have access to the whole python ecosystem of llm's and ml while in the comfy and familiar confines of deno. Heres a falcon7b example running locally in deno! Just run pip install git+https://www.github.com/huggingface/transformers git+https://github.com/huggingface/accelerate bitsandbytes einops torch and then the following program:
import { python, kw } from "https://deno.land/x/python/mod.ts";

const torch = python.import("torch");
const transformers = python.import("transformers");
const { AutoTokenizer } = transformers;

const model = "tiiuae/falcon-7b";

const tokenizer = AutoTokenizer.from_pretrained(model);
const pipeline = transformers.pipeline(
"text-generation",
kw`model=${model}`,
kw`tokenizer=${tokenizer}`,
kw`torch_dtype=${torch.bfloat16}`,
kw`trust_remote_code=${true}`,
kw`device_map=${"auto"}`
);
const sequences = pipeline(
"Girafatron is obsessed with giraffes, the most glorious animal on the face of this Earth. Giraftron believes all other animals are irrelevant when compared to the glorious majesty of the giraffe.\nDaniel: Hello, Girafatron!\nGirafatron:",
kw`max_length=${200}`,
kw`do_sample=${true}`,
kw`top_k=${10}`,
kw`num_return_sequences=${1}`,
kw`eos_token_id=${tokenizer.eos_token_id}`
);

for (const sequence of sequences) {
console.log(`Result: ${sequence.get_attr("generated_text")}`);
}
import { python, kw } from "https://deno.land/x/python/mod.ts";

const torch = python.import("torch");
const transformers = python.import("transformers");
const { AutoTokenizer } = transformers;

const model = "tiiuae/falcon-7b";

const tokenizer = AutoTokenizer.from_pretrained(model);
const pipeline = transformers.pipeline(
"text-generation",
kw`model=${model}`,
kw`tokenizer=${tokenizer}`,
kw`torch_dtype=${torch.bfloat16}`,
kw`trust_remote_code=${true}`,
kw`device_map=${"auto"}`
);
const sequences = pipeline(
"Girafatron is obsessed with giraffes, the most glorious animal on the face of this Earth. Giraftron believes all other animals are irrelevant when compared to the glorious majesty of the giraffe.\nDaniel: Hello, Girafatron!\nGirafatron:",
kw`max_length=${200}`,
kw`do_sample=${true}`,
kw`top_k=${10}`,
kw`num_return_sequences=${1}`,
kw`eos_token_id=${tokenizer.eos_token_id}`
);

for (const sequence of sequences) {
console.log(`Result: ${sequence.get_attr("generated_text")}`);
}
6 replies