yujiepan / codestral-v0.1-tiny-random

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

Introduction of codestral-v0.1-tiny-random

Model Details of codestral-v0.1-tiny-random

This model is for debugging. It is randomly initialized using the config from mistralai/Codestral-22B-v0.1 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 = "mistralai/Codestral-22B-v0.1"
repo_id = "yujiepan/codestral-v0.1-tiny-random"
save_path = f"/tmp/{repo_id}"

config = AutoConfig.from_pretrained(model_id)
config.hidden_size = 8
config.intermediate_size = 32
config.num_attention_heads = 4
config.num_hidden_layers = 2
config.num_key_value_heads = 2
config.head_dim = 2
print(config)

tokenizer = AutoTokenizer.from_pretrained(model_id)
tokenizer.save_pretrained(save_path)

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

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=model, tokenizer=tokenizer, do_sample=False, device="cuda")
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)
print(chatbot(messages))

Runs of yujiepan codestral-v0.1-tiny-random on huggingface.co

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

More Information About codestral-v0.1-tiny-random huggingface.co Model

codestral-v0.1-tiny-random huggingface.co

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

codestral-v0.1-tiny-random huggingface.co Url

https://huggingface.co/yujiepan/codestral-v0.1-tiny-random

yujiepan codestral-v0.1-tiny-random online free

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

yujiepan codestral-v0.1-tiny-random online free url in huggingface.co:

https://huggingface.co/yujiepan/codestral-v0.1-tiny-random

codestral-v0.1-tiny-random install

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

codestral-v0.1-tiny-random install url in huggingface.co:

https://huggingface.co/yujiepan/codestral-v0.1-tiny-random

Url of codestral-v0.1-tiny-random

codestral-v0.1-tiny-random huggingface.co Url

Provider of codestral-v0.1-tiny-random huggingface.co

yujiepan
ORGANIZATIONS

Other API from yujiepan