yujiepan / gemma-2-tiny-random

huggingface.co
Total runs: 5.5K
24-hour runs: 0
7-day runs: 0
30-day runs: 0
Model's Last Updated: June 28 2024
text-generation

Introduction of gemma-2-tiny-random

Model Details of gemma-2-tiny-random

This model is randomly initialized, using the config from google/gemma-2-27b-it but with smaller size.

Codes:

from transformers import pipeline
from huggingface_hub import create_repo, upload_folder
import torch
import transformers
import os

model_id = 'google/gemma-2-27b-it'
save_path = '/tmp/yujiepan/gemma-2-tiny-random'
repo_id = 'yujiepan/gemma-2-tiny-random'

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

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

model = transformers.AutoModelForCausalLM.from_config(config, torch_dtype=torch.bfloat16)
model.generation_config = transformers.GenerationConfig.from_pretrained(model_id)
with torch.no_grad():
    for p in model.parameters():
        torch.nn.init.uniform_(p, -0.1, 0.1)

pipe = pipeline('text-generation', model=model, tokenizer=tokenizer, do_sample=False, device='cuda')
print(pipe('Hello World!'))

model.save_pretrained(save_path)

os.system(f'ls -alh {save_path}')
create_repo(repo_id, exist_ok=True)
upload_folder(repo_id=repo_id, folder_path=save_path)

Runs of yujiepan gemma-2-tiny-random on huggingface.co

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

More Information About gemma-2-tiny-random huggingface.co Model

gemma-2-tiny-random huggingface.co

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

gemma-2-tiny-random huggingface.co Url

https://huggingface.co/yujiepan/gemma-2-tiny-random

yujiepan gemma-2-tiny-random online free

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

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

https://huggingface.co/yujiepan/gemma-2-tiny-random

gemma-2-tiny-random install

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

gemma-2-tiny-random install url in huggingface.co:

https://huggingface.co/yujiepan/gemma-2-tiny-random

Url of gemma-2-tiny-random

gemma-2-tiny-random huggingface.co Url

Provider of gemma-2-tiny-random huggingface.co

yujiepan
ORGANIZATIONS

Other API from yujiepan