-
Notifications
You must be signed in to change notification settings - Fork 12.4k
Add LLaDA 8b Diffusion model #14771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add LLaDA 8b Diffusion model #14771
Conversation
llama: fix llama-model fixup working
77fc759
to
e4b7346
Compare
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
|
||
def get_vocab_base(self) -> tuple[list[str], list[int], str]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def __init__(self, *args, **kwargs): | |
super().__init__(*args, **kwargs) | |
def get_vocab_base(self) -> tuple[list[str], list[int], str]: | |
def get_vocab_base(self) -> tuple[list[str], list[int], str]: |
except FileNotFoundError: | ||
try: | ||
self._set_vocab_llama_hf() | ||
except (FileNotFoundError, TypeError): | ||
# Llama 3 | ||
self._set_vocab_gpt2() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
except FileNotFoundError: | |
try: | |
self._set_vocab_llama_hf() | |
except (FileNotFoundError, TypeError): | |
# Llama 3 | |
self._set_vocab_gpt2() | |
except FileNotFoundError: | |
self._set_vocab_gpt2() |
# Handle RoPE scaling similar to LlamaModel and Dream | ||
rope_scaling = self.hparams.get("rope_scaling") or {} | ||
if rope_scaling.get("rope_type", rope_scaling.get("type")) == "linear" and "factor" in rope_scaling: | ||
self.gguf_writer.add_rope_scaling_type(gguf.RopeScalingType.LINEAR) | ||
self.gguf_writer.add_rope_scaling_factor(rope_scaling["factor"]) | ||
elif rope_scaling.get("rope_type", rope_scaling.get("type")) == "yarn" and "factor" in rope_scaling: | ||
self.gguf_writer.add_rope_scaling_type(gguf.RopeScalingType.YARN) | ||
self.gguf_writer.add_rope_scaling_factor(rope_scaling["factor"]) | ||
self.gguf_writer.add_rope_scaling_orig_ctx_len(rope_scaling["original_max_position_embeddings"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think LLaDA supports this.
I would like to avoid adding a second diffusion example - we are increasing the maintenance efforts for not significant benefit. The diffusion architecture is not yet well established. We can think about extending the |
Yeah agree, I initially wrote them to be one example. However, passing arguments via CLI for two separate sets of sampling parameters/algorithms was quite confusing to me and would be even more so for the end-user, so for the sake of clarity I wrote them separately. |
Continuing on #14644, this PR adds another diffusion model https://huggingface.co/GSAI-ML/LLaDA-8B-Instruct, which has different semantics compared to the dream-7b model, and overall seems to have better performance
There are very few similarities between how they seem to generate tokens, so for now I've just created two different examples
llama-diffusion-dream-cli
(for the earlier version) andllama-diffusion-llada-cli
, for running the new LLaDA model. Added a README as wellI've uploaded a GGUF.
Example command
./build/bin/llama-diffusion-llada-cli -m llada-8b.gguf -p "Lily can run 12 kilometers per hour for 4 hours. After that, she runs 6 kilometers per hour. How many kilometers can she run in 8 hours?" --diffusion_steps 128 -ngl 99 --temp 0 -ub 128 --diffusion-visual
Also I would like this to the server, but I'm not sure what API would be acceptable so I'm hoping to have a discussion on that as well