Run this model with HF Jobs
Run brain-bzh/reve-base on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/brain-bzh/reve-base. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/brain-bzh/reve-base on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use brain-bzh/reve-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use brain-bzh/reve-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="brain-bzh/reve-base", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("brain-bzh/reve-base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Fix bug with empty slice if amount of dimensions matches amount of frequencies, but is not equal to 512
Browse filesCurrently, in FourierEmb4D if self.dimension != 512, but self.freqs ** 4 == self.dimensions // 2 (no harmonics should be cut off), model will have diff == 0 and a slice loc = loc[:, :, :-diff] will become loc = loc[:, :, :0] where ":0" part will return empty slice instead of all harmonics. Changed:
1. Fixed empty slice bug: now slicing is only performed if diff > 0
2. Added ValueError if diff < 0 during forward and similar ValueError if self.dimension > harmonics during __init__. Both cases represent the case where there are not enough harmonics for positional encoding)
3. Fixed hardcoding special preprocessing only if self.harmonics != 512 (harmonics cut off) during forward. Now for any self.dimension the same cut off logic is generalized.
4. Added ValueError during __init__ if rqeuested self.dimension is not even as dimensionality of output Fourier embeddings is always even 2 * self.freqs ** 4 because of doubling while using both sine and cosine
5. Added small comment of how and why is harmonics cut off performed
228 unmodified lines22923023123223323412 unmodified lines247248249250251252253254255228 unmodified linesself.freqs = freqsself.increment_time = increment_timeself.margin = margindef forward(self, positions_):positions = positions_.clone()12 unmodified linesp_w = 2 * math.pi * freqs_w / widthpositions = positions[..., None, None, None, None, :]loc = (positions[..., 0] * p_x + positions[..., 1] * p_y + positions[..., 2] * p_z + positions[..., 3] * p_w).view(*U, -1)if self.dimension != 512: # noqa_, _, hd = loc.shapediff = hd - self.dimension // 2loc = loc[:, :, :-diff]emb = torch.cat([torch.cos(loc), torch.sin(loc)], dim=-1)return emb228 unmodified lines22923023123223323423523623723823924024124224324424524624712 unmodified lines260261262263264265266267268269270271272273274275276277228 unmodified linesself.freqs = freqsself.increment_time = increment_timeself.margin = marginharmonics_size = 2 * self.freqs ** 4if self.dimension % 2 != 0:raise ValueError("Requested embedding size must be even. " \f"Requested: {self.dimension}, Must be even as amount of frequency components in positional encodings " \"is always even due to amount of harmonics being doubled (one for sine and one for cosine component).")if self.dimension > harmonics_size:raise ValueError(f"Requested embedding size is larger than the maximum possible size for the given frequency range. " \f"Requested: {self.dimension}, Maximum: {harmonics_size}. " \"Please increase the number of frequencies or decrease the embedding size.")def forward(self, positions_):positions = positions_.clone()12 unmodified linesp_w = 2 * math.pi * freqs_w / widthpositions = positions[..., None, None, None, None, :]loc = (positions[..., 0] * p_x + positions[..., 1] * p_y + positions[..., 2] * p_z + positions[..., 3] * p_w).view(*U, -1)# Positional encoding returns dimension of size self.freqs ** 4 per sine/cosine pair# That makes output dimention 2 * self.freqs ** 4# If requested embedding size of a model is larger final harmonics are cut off_, _, hd = loc.shapediff = hd - self.dimension // 2if diff < 0:raise ValueError("Requested embedding size is larger than the maximum possible size for the given frequency range. " \f"Requested: {self.dimension}, Maximum: {2 * self.freqs ** 4}. " \"Please increase the number of frequencies or decrease the embedding size.")elif diff > 0:loc = loc[:, :, :-diff]emb = torch.cat([torch.cos(loc), torch.sin(loc)], dim=-1)return emb