yujiepan / smollm-tiny-random

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

Introduction of smollm-tiny-random

Model Details of smollm-tiny-random

This model is for debugging. It is randomly initialized using the config from HuggingFaceTB/SmolLM-1.7B 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 = "HuggingFaceTB/SmolLM-1.7B"
repo_id = "yujiepan/smollm-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.num_attention_heads = 4
config.num_hidden_layers = 2
config.num_key_value_heads = 2
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))

Runs of yujiepan smollm-tiny-random on huggingface.co

191
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
18
30-day runs

More Information About smollm-tiny-random huggingface.co Model

smollm-tiny-random huggingface.co

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

smollm-tiny-random huggingface.co Url

https://huggingface.co/yujiepan/smollm-tiny-random

yujiepan smollm-tiny-random online free

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

yujiepan smollm-tiny-random online free url in huggingface.co:

https://huggingface.co/yujiepan/smollm-tiny-random

smollm-tiny-random install

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

smollm-tiny-random install url in huggingface.co:

https://huggingface.co/yujiepan/smollm-tiny-random

Url of smollm-tiny-random

smollm-tiny-random huggingface.co Url

Provider of smollm-tiny-random huggingface.co

yujiepan
ORGANIZATIONS

Other API from yujiepan