Feature Extraction
GGUF
llama.cpp
multilingual
code
finance
legal
conversational
seamon67 commited on
Commit
6e0d5dc
·
1 Parent(s): a02aa0b

Upload Model.

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. F2LLM-V2-4B-Q8_0.gguf +3 -0
  3. README.md +229 -0
.gitattributes CHANGED
@@ -5,6 +5,7 @@
5
  *.ckpt filter=lfs diff=lfs merge=lfs -text
6
  *.ftz filter=lfs diff=lfs merge=lfs -text
7
  *.gz filter=lfs diff=lfs merge=lfs -text
 
8
  *.h5 filter=lfs diff=lfs merge=lfs -text
9
  *.joblib filter=lfs diff=lfs merge=lfs -text
10
  *.lfs.* filter=lfs diff=lfs merge=lfs -text
 
5
  *.ckpt filter=lfs diff=lfs merge=lfs -text
6
  *.ftz filter=lfs diff=lfs merge=lfs -text
7
  *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.gguf filter=lfs diff=lfs merge=lfs -text
9
  *.h5 filter=lfs diff=lfs merge=lfs -text
10
  *.joblib filter=lfs diff=lfs merge=lfs -text
11
  *.lfs.* filter=lfs diff=lfs merge=lfs -text
F2LLM-V2-4B-Q8_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a48f1163fdb03f2bcbc8177ef5184ccea533d9f9761c8e9d95e7485debeb43ae
3
+ size 4280406432
README.md ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ - zh
6
+ - ru
7
+ - es
8
+ - fr
9
+ - de
10
+ - ar
11
+ - nl
12
+ - vi
13
+ - hi
14
+ - ko
15
+ - ja
16
+ - it
17
+ - id
18
+ - pt
19
+ - pl
20
+ - tr
21
+ - da
22
+ - th
23
+ - sv
24
+ - fa
25
+ - uk
26
+ - cs
27
+ - 'no'
28
+ - el
29
+ - ca
30
+ - ro
31
+ - fi
32
+ - bg
33
+ - tl
34
+ - gl
35
+ - my
36
+ - hy
37
+ - km
38
+ - ne
39
+ - hu
40
+ - eu
41
+ - he
42
+ - lo
43
+ - sw
44
+ - az
45
+ - lv
46
+ - si
47
+ - sk
48
+ - tg
49
+ - et
50
+ - lt
51
+ - ms
52
+ - hr
53
+ - is
54
+ - sl
55
+ - sr
56
+ - ur
57
+ - bn
58
+ - af
59
+ - ta
60
+ - ka
61
+ - te
62
+ - ml
63
+ - mn
64
+ - nn
65
+ - kk
66
+ - cy
67
+ - mr
68
+ - sq
69
+ - nb
70
+ - mk
71
+ - jv
72
+ - kn
73
+ - eo
74
+ - la
75
+ - gu
76
+ - uz
77
+ - am
78
+ - oc
79
+ - be
80
+ - mg
81
+ - vo
82
+ - pa
83
+ - lb
84
+ - ht
85
+ - br
86
+ - ga
87
+ - xh
88
+ - tt
89
+ - bs
90
+ - yo
91
+ base_model:
92
+ - codefuse-ai/F2LLM-v2-4B
93
+ pipeline_tag: feature-extraction
94
+ library_name: llama.cpp
95
+ tags:
96
+ - gguf
97
+ - multilingual
98
+ - code
99
+ - finance
100
+ - legal
101
+ datasets:
102
+ - codefuse-ai/F2LLM-v2
103
+ model_max_length: 32768
104
+ ---
105
+
106
+ # About
107
+
108
+ This model was converted to GGUF format from codefuse-ai/F2LLM-v2-4B using llama.cpp (release b10269). Refer to the [original model card](https://huggingface.co/codefuse-ai/F2LLM-v2-4B) for more details on the model.
109
+
110
+ # Original Model Card
111
+
112
+ # F2LLM-v2-4B
113
+
114
+ F2LLM-v2 is a family of general-purpose, multilingual embedding models in 8 distinct sizes ranging from 80M to 14B. Trained on a curated composite of 60 million publicly available high-quality data, F2LLM-v2 supports more than 200 languages, with a particular emphasis on previously underserved mid- and low-resource languages.
115
+
116
+ F2LLM-v2 is fully open. We release base models in 5 sizes, instruct models in 8 sizes, the training data, the training code, and intermediate checkpoints. The three smallest instruct models are pruned and trained from the 0.6B base model.
117
+
118
+ | Model | Base | Instruct |
119
+ | ----- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
120
+ | 80M | | [🤗F2LLM-v2-80M](https://huggingface.co/codefuse-ai/F2LLM-v2-80M) |
121
+ | 160M | | [🤗F2LLM-v2-160M](https://huggingface.co/codefuse-ai/F2LLM-v2-160M) |
122
+ | 330M | | [🤗F2LLM-v2-330M](https://huggingface.co/codefuse-ai/F2LLM-v2-330M) |
123
+ | 0.6B | [🤗F2LLM-v2-0.6B-Preview](https://huggingface.co/codefuse-ai/F2LLM-v2-0.6B-Preview) | [🤗F2LLM-v2-0.6B](https://huggingface.co/codefuse-ai/F2LLM-v2-0.6B) |
124
+ | 1.7B | [🤗F2LLM-v2-1.7B-Preview](https://huggingface.co/codefuse-ai/F2LLM-v2-1.7B-Preview) | [🤗F2LLM-v2-1.7B](https://huggingface.co/codefuse-ai/F2LLM-v2-1.7B) |
125
+ | 4B | [🤗F2LLM-v2-4B-Preview](https://huggingface.co/codefuse-ai/F2LLM-v2-4B-Preview) | [🤗F2LLM-v2-4B](https://huggingface.co/codefuse-ai/F2LLM-v2-4B) |
126
+ | 8B | [🤗F2LLM-v2-8B-Preview](https://huggingface.co/codefuse-ai/F2LLM-v2-8B-Preview) | [🤗F2LLM-v2-8B](https://huggingface.co/codefuse-ai/F2LLM-v2-8B) |
127
+ | 14B | [🤗F2LLM-v2-14B-Preview](https://huggingface.co/codefuse-ai/F2LLM-v2-14B-Preview) | [🤗F2LLM-v2-14B](https://huggingface.co/codefuse-ai/F2LLM-v2-14B) |
128
+
129
+ ## Usage
130
+
131
+ ### With Sentence Transformers
132
+
133
+ To encode text with the [Sentence Transformers](https://www.sbert.net/) library:
134
+
135
+ ```python
136
+ from sentence_transformers import SentenceTransformer
137
+ model = SentenceTransformer("codefuse-ai/F2LLM-v2-4B", device="cuda:0", model_kwargs={"torch_dtype": "bfloat16"})
138
+ # Some sample query and documents
139
+ query = "What is F2LLM used for?"
140
+ documents = [
141
+ 'We present F2LLM, a family of fully open embedding LLMs that achieve a strong balance between model size, training data, and embedding performance.',
142
+ 'F2LLM is a model for computing text embeddings that can be used for various NLP tasks such as information retrieval, semantic search, and text classification.',
143
+ 'F2LLM 是 CodeFuse 开源的系列嵌入模型。',
144
+ 'F2LLM — это модель вычисления встраивания текста, которую можно использовать для различных задач НЛП, таких как поиск информации, семантический поиск и классификация текста.'
145
+ ]
146
+ # Encode the query and documents separately. The encode_query method uses the query prompt
147
+ query_embedding = model.encode_query(query)
148
+ document_embeddings = model.encode_document(documents)
149
+ print(query_embedding.shape, document_embeddings.shape)
150
+ # (2560,) (4, 2560)
151
+ # Compute cosine similarity between the query and documents
152
+ similarity = model.similarity(query_embedding, document_embeddings)
153
+ print(similarity)
154
+ # tensor([[0.6348, 0.8547, 0.7168, 0.8356]])
155
+ ```
156
+
157
+ ### With Transformers
158
+
159
+ Or directly with the [Transformers](https://huggingface.co/docs/transformers/index) library:
160
+
161
+ ```python
162
+ from transformers import AutoModel, AutoTokenizer
163
+ import torch
164
+ import torch.nn.functional as F
165
+ model_path = "codefuse-ai/F2LLM-v2-4B"
166
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
167
+ model = AutoModel.from_pretrained(model_path, torch_dtype=torch.bfloat16, device_map={'': 0})
168
+ query = "What is F2LLM used for?"
169
+ query_prompt = "Instruct: Given a question, retrieve passages that can help answer the question.\nQuery: "
170
+ documents = [
171
+ 'We present F2LLM, a family of fully open embedding LLMs that achieve a strong balance between model size, training data, and embedding performance.',
172
+ 'F2LLM is a model for computing text embeddings that can be used for various NLP tasks such as information retrieval, semantic search, and text classification.',
173
+ 'F2LLM 是 CodeFuse 开源的系列嵌入模型。',
174
+ 'F2LLM — это модель вычисления встраивания текста, которую можно использовать для различных задач НЛП, таких как поиск информации, семантический поиск и классификация текста.'
175
+ ]
176
+ def encode(sentences):
177
+ batch_size = len(sentences)
178
+ # the tokenizer will automatically add eos token
179
+ tokenized_inputs = tokenizer(sentences, padding=True, return_tensors='pt').to(model.device)
180
+ last_hidden_state = model(**tokenized_inputs).last_hidden_state
181
+ eos_positions = tokenized_inputs.attention_mask.sum(dim=1) - 1
182
+ embeddings = last_hidden_state[torch.arange(batch_size, device=model.device), eos_positions]
183
+ embeddings = F.normalize(embeddings, p=2, dim=1)
184
+ return embeddings
185
+ # Encode the query and documents
186
+ query_embedding = encode([query_prompt + query])
187
+ document_embeddings = encode(documents)
188
+ print(query_embedding.shape, document_embeddings.shape)
189
+ # torch.Size([1, 2560]) torch.Size([4, 2560])
190
+ # Compute cosine similarity between the query and documents
191
+ similarity = query_embedding @ document_embeddings.T
192
+ print(similarity)
193
+ # tensor([[0.6328, 0.8555, 0.7148, 0.8398]], device='cuda:0',
194
+ # dtype=torch.bfloat16, grad_fn=<MmBackward0>)
195
+ ```
196
+
197
+ ### Prompts
198
+
199
+ The model supports custom instructions in the following format:
200
+
201
+ ```text
202
+ Instruct: your_instruction
203
+ Query:
204
+ ```
205
+
206
+ In general, for retrieval and reranking tasks:
207
+
208
+ - use the prompt for queries
209
+ - do not prepend the prompt to documents/passages
210
+
211
+ For symmetric tasks such as STS, clustering, and bitext mining, you can encode the documents either with or without prompts. The model is trained to support both scenarios.
212
+
213
+ ## Intermediate Checkpoints
214
+
215
+ To facilitate future research, we release intermediate checkpoints in the `intermediate_checkpoints` branch.
216
+
217
+ ## Citation
218
+
219
+ ```
220
+ @misc{f2llm-v2,
221
+ title={F2LLM-v2: Inclusive, Performant, and Efficient Embeddings for a Multilingual World},
222
+ author={Ziyin Zhang and Zihan Liao and Hang Yu and Peng Di and Rui Wang},
223
+ year={2026},
224
+ eprint={2603.19223},
225
+ archivePrefix={arXiv},
226
+ primaryClass={cs.CL},
227
+ url={https://arxiv.org/abs/2603.19223},
228
+ }
229
+ ```