pointer to pointer
acts->encoded
is a float* pointer, how to achive this in mojo? I have tried a lot of ways😭18 Replies
are you looking for DTypePointer[DType.float64]?
DTypePointer[DType.float64] is a pointer which points to float64, not a pointer
I mean a pointer to pointer like float**
so you wanta pointer to a pointer to a float?
Pointer[DTypePointer[DType.float64]]?
im unfamiliar with this syntax
yes, I can now get
acts->encoded
as a pointer in mojo, but i don;t know how to point to the got DtypePointer[Dtype.float32] acts->encoded
Congrats @zhoujing, you just advanced to level 1!
me too ,haha😆
i stuck also there in my attempt to port llm.c -
I assume for
¶ms->wte
we would need something like
Reference(params[].wte)
but didnt yet get around my head how to setup a List of References ..
good luck
I feel better now, kapai.ai just told me: However, please be aware that the use of Reference is still in its early stages and may be awkward to use. 😉
Pointer.address_of. seems to work, at least in this demo:
wow, I am porting llm.c too, Thanks for your advice, I will have a try
haven't tried it in the llm.mojo, just getting the individual pieces sorted out right now. Looking forward to see both of our solutions 🙏
Congrats @Martin Dudek, you just advanced to level 6!
okk,🫰
hope you use regexp search replace in your IDE too, eg
for (int (\w+) = 0; \1 < (\w+); \1++) {
->
for $1 in range($2):
😉
I tried a few hours, still a lot work to do🥺 haha
i stuck with reading in the "gpt2_124M.bin" file - gpt2_build_from_checkpoint
did you get this sorted already?
I got stuck in this place
the
FILE
pointer
I am downloading data now. I will tryin python this works:
but i dont know how t get this done in Mojo, struct.unpack does some magic it seems
I got stuck here too....
Found a solution here
https://github.com/tairov/llama2.mojo/blob/master/llama2.mojo
just need to use read instead of read_byte . Not sure why this works now and my atempts not but ....
GitHub
llama2.mojo/llama2.mojo at master · tairov/llama2.mojo
Inference Llama 2 in one file of pure 🔥. Contribute to tairov/llama2.mojo development by creating an account on GitHub.