yujiepan / deepseek-v2-0628-tiny-random

huggingface.co
Total runs: 1.1K
24-hour runs: 0
7-day runs: 0
30-day runs: 0
Model's Last Updated: July 20 2024
text-generation

Introduction of deepseek-v2-0628-tiny-random

Model Details of deepseek-v2-0628-tiny-random

This model is for debugging. It is randomly initialized using the config from deepseek-ai/DeepSeek-V2-Chat-0628 but with smaller size.

Codes:

from huggingface_hub import create_repo, upload_folder
from transformers import (
    pipeline,
    set_seed,
    AutoConfig,
    AutoModelForCausalLM,
    AutoTokenizer,
    GenerationConfig,
)
import torch
import transformers
import os

model_id = "deepseek-ai/DeepSeek-V2-Chat-0628"
repo_id = "yujiepan/deepseek-v2-0628-tiny-random"
save_path = f"/tmp/{repo_id}"

config = AutoConfig.from_pretrained(model_id, trust_remote_code=True)
config._name_or_path = model_id
config.hidden_size = 8
config.intermediate_size = 16
config.moe_intermediate_size = 4
config.num_attention_heads = 2
config.num_key_value_heads = 2
config.num_hidden_layers = 2
config.kv_lora_rank = 2
config.q_lora_rank = 2
config.v_head_dim = 2
config.qk_nope_head_dim = 2
config.qk_rope_head_dim = 2
config.torch_dtype = "bfloat16"
print(config)

tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
tokenizer.save_pretrained(save_path)

model = AutoModelForCausalLM.from_config(
    config, torch_dtype=torch.bfloat16, attn_implementation="eager", trust_remote_code=True
)
model.generation_config = GenerationConfig.from_pretrained(model_id, trust_remote_code=True)

set_seed(42)
with torch.no_grad():
    for _, p in sorted(model.named_parameters()):
        torch.nn.init.uniform_(p, -0.1, 0.1)

model.save_pretrained(save_path)

# pipe = pipeline("text-generation", model=save_path, device="cuda", trust_remote_code=True)
# print(pipe("Hello World!"))

# messages = [
#     {"role": "system", "content": "You are a robot."},
#     {"role": "user", "content": "Hi!"},
# ]
# chatbot = pipeline("text-generation", model=save_path, max_length=1000, max_new_tokens=16, trust_remote_code=True)
# print(chatbot(messages))

messages = [{"role": "user", "content": "Write a piece of quicksort code in C++"}]
input_tensor = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
outputs = model.generate(input_tensor.to(model.device), max_new_tokens=100)
result = tokenizer.decode(outputs[0][input_tensor.shape[1] :], skip_special_tokens=True)
print(result)

Runs of yujiepan deepseek-v2-0628-tiny-random on huggingface.co

1.1K
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs

More Information About deepseek-v2-0628-tiny-random huggingface.co Model

deepseek-v2-0628-tiny-random huggingface.co

deepseek-v2-0628-tiny-random huggingface.co is an AI model on huggingface.co that provides deepseek-v2-0628-tiny-random's model effect (), which can be used instantly with this yujiepan deepseek-v2-0628-tiny-random model. huggingface.co supports a free trial of the deepseek-v2-0628-tiny-random model, and also provides paid use of the deepseek-v2-0628-tiny-random. Support call deepseek-v2-0628-tiny-random model through api, including Node.js, Python, http.

deepseek-v2-0628-tiny-random huggingface.co Url

https://huggingface.co/yujiepan/deepseek-v2-0628-tiny-random

yujiepan deepseek-v2-0628-tiny-random online free

deepseek-v2-0628-tiny-random huggingface.co is an online trial and call api platform, which integrates deepseek-v2-0628-tiny-random's modeling effects, including api services, and provides a free online trial of deepseek-v2-0628-tiny-random, you can try deepseek-v2-0628-tiny-random online for free by clicking the link below.

yujiepan deepseek-v2-0628-tiny-random online free url in huggingface.co:

https://huggingface.co/yujiepan/deepseek-v2-0628-tiny-random

deepseek-v2-0628-tiny-random install

deepseek-v2-0628-tiny-random is an open source model from GitHub that offers a free installation service, and any user can find deepseek-v2-0628-tiny-random on GitHub to install. At the same time, huggingface.co provides the effect of deepseek-v2-0628-tiny-random install, users can directly use deepseek-v2-0628-tiny-random installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

deepseek-v2-0628-tiny-random install url in huggingface.co:

https://huggingface.co/yujiepan/deepseek-v2-0628-tiny-random

Url of deepseek-v2-0628-tiny-random

deepseek-v2-0628-tiny-random huggingface.co Url

Provider of deepseek-v2-0628-tiny-random huggingface.co

yujiepan
ORGANIZATIONS

Other API from yujiepan