Submitted by imgonnarelph t3_11wqmga in MachineLearning
How to fine-tune Facebooks 30 billion parameter LLaMa on the Alpaca data set.
Blog post: https://abuqader.substack.com/p/releasing-alpaca-30b
Submitted by imgonnarelph t3_11wqmga in MachineLearning
How to fine-tune Facebooks 30 billion parameter LLaMa on the Alpaca data set.
Blog post: https://abuqader.substack.com/p/releasing-alpaca-30b
LLaMa/Alpaca work just fine on CPU with llama.cpp/alpaca.cpp. Not very snappy(1-15 tokens/s depending on model size), but fast enough for me.
I will assume you are much more knowledgeable than I am in this space.. have few basic questions that have been bothering me since all the craze started around GPT and LLM recently.
I managed to get Alpaca working on my end using the above link and get very good result. LLaMa biggest takeaway was it is able to reproduce quality comparable to GPT and much lower compute size. If this is the case, why is the ouput much shorter on LLaMa than what I get on OpenGPT? I would imagine the OpenGPT reponse is much longer because ... it is just bigger? What is the limiting factor to not for us to get longer generated response comparable to GPT?
ggml-alpaca-7b-q4.bin is only 4 gigabyt - I guess this what it means by 4bit and 7 billion parameter. Not sure if rumor or fact, GPT3 model is 128B, does it mean if we get trained model of GPT, and manage to run 128B locally, will it give us the same results? Will it be possible to retrofit GPT model within Alpaca.cpp with minor enhancement to get output JUST like OpenGPT? I have read to fit 128B, it requires muliple Nvidia A100.
Last question, inference means that it gets output from a trained model. Meta/OpenAI/Stability.ai have the resources to train a model. If my understanding is correct, Alpaca.cpp or https://github.com/ggerganov/llama.cpp are a sort of 'front-end' for these model. They allow us to provide an input to get an output by inference with the model. The question I am trying to ask is, what is so great about llama.cpp? Is it because it's in C? I know there is Rust version of it out, but it uses llama.cpp behind the scene. Is there any advantage of an inference to be written in Go or Python?
Note: Not the same person.
> I would imagine the OpenGPT reponse is much longer because ... it is just bigger?
llama.cpp
recently added a commandline flag to disable the end of message marker from getting generated, so that's one way you can try to force responses to be longer. (It doesn't always work, because the LLM can start generating irrelevant content.)
The length of the response isn't directly related to the size of the model, but just having less information available/relevant could mean it has less to talk about in a response.
> GPT3 model is 128B, does it mean if we get trained model of GPT, and manage to run 128B locally, will it give us the same results?
If you have the same model and you give it the same prompt, you should get the same result. Keep in mind if you're using some other service like ChatGPT you aren't directly controlling the full prompt. I don't know about OpenGPT, but from what I know ChatGPT has a lot of special sauce not just in the training but other stuff like having another LLM write summaries for it so it keeps track of context better, etc.
> Last question, inference means that it gets output from a trained model.
Inference is running a model that's already been trained, as far as I know.
> If my understanding is correct, Alpaca.cpp or https://github.com/ggerganov/llama.cpp are a sort of 'front-end' for these model.
The model is a bunch of data that was generated by training. Something like llama.cpp
is what actually uses that data: keeping track of the state, parsing user input into tokens that can be fed to the model, performing the math calculations that are necessary to evaluate its state, etc.
"Gets its output from", "front end" sound like kind of weird ways to describe what's going on. Just as an example, modern video formats and compression for video/audio is pretty complicated. Would you say that a video player "gets its output" from the video file or is a front-end for a video file?
> The question I am trying to ask is, what is so great about llama.cpp?
I mean, it's free software that works pretty well and puts evaluating these models in reach of basically everyone. That's great. It's also quite fast for something running purely on CPU. What's not great about that?
> I know there is Rust version of it out, but it uses llama.cpp behind the scene.
I don't think this is correct. It is true that the Rust version is (or started out) as a port of the C++ version but it's not using it behind the scenes. However, there's a math library called GGML that both programs use, it does the heavy lifting of doing the calculations for the data in the models.
> Is there any advantage of an inference to be written in Go or Python?
Same advantage as writing anything in Go, which is... Just about nothing in my opinion. See: https://fasterthanli.me/articles/i-want-off-mr-golangs-wild-ride
Seriously though, this is a very, very general question and can be asked about basically any project and any set of programming languages. There are strengths and weaknesses. Rust's strength is high performance, ability to do low level stuff like C, and it has a lot of features aimed at writing very reliable software that handles stuff like edge cases. This comes at the expense of having to deal with all those details. On the other hand, a language like Python is very high level. You can just throw something together and ignore a lot of details and it still can work (unless it runs into an unhandled case). It's generally a lot slower than languages like Rust, C, C++ and even Go.
However, for running LLMs, most of the processing is math calculations and that will mean calling into external libraries/modules that will be written in high performance languages like C, Rust, etc. Assuming a Python program is taking advantage of that kind of resource, I wouldn't expect it to be noticeably slow.
So, like a lot of the time, it comes down to personal preference of what the developer wants to use. The person who wrote the Rust version probably like Rust. The person who wrote the C++ version likes C++, etc.
I have the 16B parameter version of Alpaca.cpp (and a copy of the training data as well as the weights) installed locally on a machine with an Nvidia 3070 GPU. I know I can launch my terminal using the Discrete Graphics Card option, but I also believe this version was built for CPU use and I’m guessing that I’m not getting the most out of my graphics card
What’s the move here?
llama.cpp
and alpaca.cpp
(and also related projects like llama-rs
) only use the CPU. So not only are you not getting the most out of your GPU, it's not getting used at all.
I have an old GPU with only 6GB so running larger models on GPU isn't practical for me. I haven't really looked at that aspect of it much. You could start here: https://rentry.org/llama-tard-v2
Keep in mind you will need to be pretty decent with technical stuff to be able to get it working based on those instructions even though they are detailed.
Thanks for leading me in the right direction! I’ll letcha know if I get it working
Bro what are you talking about LOL. Its context length he's discussing. There are multiple ways[all of which I'm expertimenting with] ->
Uh, did you reply to the wrong person or something? Your post doesn't have anything to do with either mine or the parent.
In fact, GPT3 is 175B. But GPT3 is old now and doesn't make effective use of those parameters.
are you talking about the 30b one?
Haven't tried the 30B model. 65B takes 900ms/token on my machine.
do you have a link to a torrent/download for the 30B or 65B weights that works with Alpaca.cpp? reddit DMs are fine if don't want to post it publicly.
May I also have those please?
so far I haven't found a download. I'll let you know if I do.
https://huggingface.co/Pi3141/alpaca-30B-ggml/tree/main
though I haven't tried to test it yet.
Idk why, but after the first answer to a question addressed to it, mine spewed out random nonsense. Literally unrelated things.
Any reason, beside price, to buy 3090s instead of 4090s?
Just price. They have the same amount of VRAM. The 4090 is faster of course.
VRAM is the limiting factor to run these things though, not tensor cores
Right. And even once you have enough VRAM, memory bandwidth limits the speed more than tensor core bandwidth.
They could pack more tensor cores in there if they wanted to, they just wouldn't be able to fill them with data fast enough.
This is definitely true. Theoretically you can page stuff in/out of VRAM to run larger models, but you won't be getting much benefit over CPU compute with all that thrashing.
You are absolutely correct. text-gen-webui offers "streaming" via paging models in and out of VRAM. Using this your CPU no longer gets bogged down with running the model, but you don't see much improvement in generation speed as the GPU is churning with loading and unloading model data from main RAM all the time. It can still be an improvement worth some effort, but it's far less drastic of an improvement than when the entire model fits in VRAM.
Hey, recently I was thinking if Apple Silicon Macs may be best thing for AI in the future. Most powerful Mac Studio has 128Gb of Uniform RAM which can be used by CPU, GPU or Neural Engine. If only memory size is considered, even A100, let alone any consumer oriented model, can't match. With this amount of memory you could run GPT3 Davinci size model in 4bit mode.
> 128Gb of Uniform RAM which can be used by CPU, GPU or Neural Engine.
But it doesn't have the same bandwidth as the VRAM on the GPU card iirc.
Otherwise every integrated GPGPU would be better due to available ram.
The neural engine on M1 and M2 is usable IIRC only with apple libraries, that may not be used by notable models yet.
Llamma.cpp uses the neural engine, so does StableDiffusion. And the speed is not that far off from VRAM, actually.
>Memory bandwidth is increased to 800GB/s, more than 10x the latest PC desktop chip, and M1 Ultra can be configured with 128GB of unified memory.
By comparison, the Nvidia 4090 is clocking in at ~1000GB/s
Apple is clearly positioning their devices for AI.
> Llamma.cpp uses the neural engine,
Does it?
no, llama-mps use ane.
> Llamma.cpp uses the neural engine
I am trying to find confirmation for this but I didn't. I saw some ports, but weren't from the LLaMa team. Do you have any source?
>...Uniform RAM which can be used by CPU, GPU or Neural Engine.
Interesting....
That's why I've seen so many M1 implementations of machine learning models. It really does seem like the M1 chips were made with AI in mind....
Unfortunately, most code out there is using calls to cuda explicitly rather then checking the GPU type you have and using that. You can fix this yourself, (I use an m1 macbook pro for ML and it is quite powerful) but you need to know what you're doing and it's just more work. You might also run into situations where things are not fully implemented in Metal Performance Shaders (the mac equivalent to cuda), but Apple does put a lot of resources into making this better
Used availability is better on the 3090 as well. I got one for $740 on eBay. Little dust on the heatsinks but at half price it was a steal.
That or just use the cloud until Nvidia releases a 48gb gpu (which will happen sooner than one would think. Games are getting limited by VRAM)
What game is limited by vram? I haven't heard of any game running over 24gb unless it's Skyrim with a bunch of 8k mods
I mean of course not, nobody would make such a game right now because there are no >24GB cards to run it on.
There was an insane age of PC gaming where hardware was moving so fast that game developers were releasing games with max-settings that didn't run on any current hardware to try to future proof themselves from having a game suddenly feeling obsolete shortly after launch.
people are demanding more and more interactivity in their video games (look at the trend of open worlds). It’s only gonna get bigger.
Cyberpunk on max with psycho takes ~16gb max. It's gonna be a few years before we actually see games demanding more than 24.
Now try that on 2-4 monitors. You would be surprised how premium gamers like their hardware. It’s like checking out sports cars but for nerds like me.
Are we still taking consumer grade hardware or specialized GPU made for a niche crowd?
Niche supercar gamers start up the industry which then will lead into realistic VR which will then lead into consumer high quality stuff?
Which takes years
Okay, thank you for your input.
And?
Newsflash everything we did started because some cunt felt like growing lungs and wanting oxygen from the air.
It all takes time, what are you trying to argue?
My whole point is that it will take years before we get to 48GB vram consumer GPUs. You just proved my point again without even reading it.
[removed]
>I'm gonna end up buying a bunch of 24GB 3090s at this rate.
Better hurry up...
Honestly, they already cost more than I can afford to spend on a side project.
I'm just gonna have to wait and hope that AMD gets their act together on AI support.
Better light a candle rather than buy an AMD GC for anything close to cutting edge.
I'm hoping that non-Vonn-Neumann chips will scale up in the next few years. There's some you can buy today but they're small:
>NDP200 is designed natively run deep neural networks (DNN) on a variety of architectures, such as CNN, RNN, and fully connected networks, and it performs vision processing with highly accurate inference at under 1mW.
>Up to 896k neural parameters in 8bit mode, 1.6M parameters in 4bit mode, and 7M+ In 1bit mode
An arduino idles at about 10mw, for comparison.
The idea is that if you're not shuffling the entire network weights across the memory bus every inference cycle, you save ludicrous amounts of time and energy. Someday, we'll use this kind of tech to run LLMs on our phones.
There's also the tenstorrent chips coming out to public which are vastly more efficient than nvidia stuff
Doesn't look like they sell in individual quantities right now but I welcome any competition in the space!
> if you're not shuffling the entire network weights across the memory bus every inference cycle
Isn't this common though?
Yeah, I wouldn't buy AMD either. It's a shame that NVIDIA is basically a monopoly in a AI, but it is what it is.
> hope that AMD gets their act together on AI support
walking around picking up coins from the ground to buy a 3090 should be faster honestly
You'll have better luck waiting for Intel
They haven't been sold in Australia for months, only second hand.
realistically, what's the cheapest one can get a used functioning 3090 rn? like 700 usd minimum?
Tesla P40 24gb VRAM, $150 only 1 or 2 gen behind the 3090
[removed]
where are you finding 24gb p40's for $150?
eeeeeeebay
Maybe $200 on a bad day, but still far better than anything newer
maybe consider Tesla P40s
24gb, lots of CUDA cores, $150 each
tell me about it. i never cared about video cards before this ai stuff, but now I want an awesome video card.
Thanks. So bit confused here. Ot mentions needing an A100 to train. Am I able to run this off a 3090?
You can run it on your CPU. My old i7 6700k spits out 13B words a little slower than I could read them out loud. I'll test the 30B tonight on my 5600X
You can run llama-30B on a CPU using llama.cpp, it's just slow. The alpaca models I've seen are the same size as the llama model they are trained on, so I would expect running the alpaca-30B models will be possible on any system capable of running llama-30B.
alpaca-30B > llama-30B ?
Not sure I understand. Is it better? Depends on what you're trying to do. I can say that alpaca-7B and alpaca-13B operate as better and more consistent chatbots than llama-7B and llama-13B. That's what standard alpaca has been fine-tuned to do.
Is it bigger? No, alpaca-7B and 13B are the same size as llama-7B and 13B.
I heard 30B isn't very good. Anyone with experience disagree?
Untuned 30B LLaMA, you're saying? It's excellent and adept at storywriting, chatting, and so on, and it can output faster than ChatGPT at 4-bit precision. While I'm not into this myself, I understand that there is a very large RP community at subs like CharacterAI and Pygmalion, and the 30B model is genuinely great for feeling like talking to a real person. I'm using it with text-generation-webui and custom parameters and not the llama.cpp implementation.
For assistant tasks, I've been using either the ChatLLaMA 13B LoRA or the Alpaca 7B LoRA, both of which are very good as well. ChatLLaMA, for instance, was able to answer a reasoning question correctly that GPT-3.5 failed, but it has drawbacks in other areas.
The limitations so far are that none of these models can answer programming questions competently yet, and a finetune for that will be needed. They also have the tendency to hallucinate frequently unless parameters are made more restrictive.
Good to hear. Thanks!
"They also have the tendency to hallucinate frequently unless parameters are made more restrictive."
I am not really understand this point in term of technical
Not op, but I imagine they're referring to the sampling hyperparameters that control the text generation process. For example there is a temperature setting, a lower temperature makes it sample more from the most likely choices. So it would potentially be more precise/accurate but also less diverse and creative in it's outputs
Time to see if I can get this running on Dalai
magnet:?xt=urn:btih:6K5O4J7DCKAMMMAJHWXQU72OYFXPZQJG&dn=ggml-alpaca-30b-q4.bin&xl=20333638921&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce
I hope this magnet link works properly. I've never created one before. This the alpaca.cpp 30B 4-bit weight file. Same file downloaded from huggingface. Apologies if it doesn't work. Ping me if it doesn't.
How long did the training take on an A100?
1 epoch of finetuning the 30B model with llama-lora implementation, mini-batch-size=2, maxlen=384, is about 11 hours.
Can you train with 24 gigs of vram ?
[deleted]
currentscurrents t1_jcziz0q wrote
I'm gonna end up buying a bunch of 24GB 3090s at this rate.