hf_mirrors/Aeonium-v0-Base-1B
Model Introduction
Files & versions
Analysis

openmind

from openmind import AutoTokenizer, AutoModel, is_torch_npu_available
from openmind_hub import snapshot_download
import torch
import argparse
import torch.nn.functional as F


# 均值池化 - 考虑注意力掩码以进行正确的平均
def mean_pooling(model_output, attention_mask):
    token_embeddings = model_output[0] # model_output的第一个元素包含所有token嵌入
    input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
    return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)

def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--model_name_or_path",
        type=str,
        help="Path to model",
        default="Rose/Aeonium-v0-Base-1B",
    )
    args = parser.parse_args()
    return args

def main():
    args = parse_args()
    model_path = args.model_name_or_path

    if is_torch_npu_available():
        device = "npu:0"
    else:
        device = "cpu"

    # 我们想要获取句子嵌入的句子
    sentences = ['This is an example sentence', 'Each sentence is converted']

    # 从openmind_hub加载模型
    tokenizer = AutoTokenizer.from_pretrained(model_path,device_map='auto')
    model = AutoModel.from_pretrained(model_path,device_map='auto')

    # 对句子进行分词
    encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')

    # 计算token嵌入
    with torch.no_grad():
        model_output = model(**encoded_input)

    # 执行池化
    sentence_embeddings = mean_pooling(model_output, encoded_input['attention_mask'])

    # 归一化嵌入
    sentence_embeddings = F.normalize(sentence_embeddings, p=2, dim=1)

    print("Sentence embeddings:")
    print(sentence_embeddings)


if __name__ == "__main__":
    main()

Aeoinum v1 BaseWeb 1B

A state-of-the-art language model for Russian language processing. This checkpoint contains a preliminary version of the model with 1.6 billion parameters. Trained only on web pages.

Usage

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

tokenizer = AutoTokenizer.from_pretrained("aeonium/Aeonium-v1-BaseWeb-1B")
model = AutoModelForCausalLM.from_pretrained("aeonium/Aeonium-v1-BaseWeb-1B").cuda()

input_ids = tokenizer("Искусственный интеллект - это", return_tensors='pt').to(model.device)["input_ids"]
output = model.generate(input_ids, max_new_tokens=48, do_sample=True, temperature=0.7)
print(tokenizer.decode(output[0]))

Output:

Искусственный интеллект - это не только про компьютеры и смартфоны. Его возможности безграничны, а с развитием интернета и интернета вещей он становится еще и самым настоящим оружием в борьбе с преступностью.
Мы поговорили с юристом о самых интересных и опасных способах использования ИИ.

Dataset Detail

The dataset for pre-training is collected from public data, most of which are web pages in Russian. The total size of the data is 32B tokens.

Training Detail

The training is performed thanks to a grant from TPU Research Cloud on a TPU v4-128 node.

Loss: 2.68; Accuracy: 0.48; Batch Size: 1024

Content Warning

Aeonium v1 is a large language model trained on a broad dataset from the internet. As such, it may generate text that contains biases, offensive language, or other disapproving content. The model outputs should not be considered factual or representative of any individual's beliefs or identity. Users should exercise caution and apply careful filtering when using Aeonium's generated text, especially for sensitive or high-stakes applications. The developers do not condone generating harmful, biased, or unethical content.

Copyright

The model is released under the Apache 2.0 license.