torchao-testing / opt-125m-Int4WeightOnlyConfig-v1-0.14.dev

huggingface.co
Total runs: 805
24-hour runs: 0
7-day runs: 34
30-day runs: -291
Model's Last Updated: 2025年9月9日

Introduction of opt-125m-Int4WeightOnlyConfig-v1-0.14.dev

Model Details of opt-125m-Int4WeightOnlyConfig-v1-0.14.dev

model: opt-125m
config: Int4WeightOnlyConfig
config version: 1
torchao version: 0.14.dev
import torch
import io
from transformers import AutoModelForCausalLM, AutoTokenizer, TorchAoConfig
from huggingface_hub import HfApi

model_id = "facebook/opt-125m"

from torchao.quantization import Int4WeightOnlyConfig
quant_config = Int4WeightOnlyConfig(group_size=128, version=1)

quantization_config = TorchAoConfig(quant_type=quant_config)
quantized_model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map="cuda",
    torch_dtype=torch.bfloat16,
    quantization_config=quantization_config,
)
tokenizer = AutoTokenizer.from_pretrained(model_id)

# Push to hub
USER_ID = "torchao-testing"
MODEL_NAME = model_id.split("/")[-1]
save_to = f"{USER_ID}/{MODEL_NAME}-Int4WeightOnlyConfig-v1-0.14.dev"
quantized_model.push_to_hub(save_to, safe_serialization=False)
tokenizer.push_to_hub(save_to)

# Manual Testing
prompt = "Hey, are you conscious? Can you talk to me?"
print("Prompt:", prompt)
inputs = tokenizer(
    prompt,
    return_tensors="pt",
).to("cuda")
# setting temperature to 0 to make sure result deterministic
generated_ids = quantized_model.generate(**inputs, max_new_tokens=128, temperature=0)
api = HfApi()
buf = io.BytesIO()
torch.save(prompt, buf)
api.upload_file(
    path_or_fileobj=buf,
    path_in_repo="model_prompt.pt",
    repo_id=save_to,
)

buf = io.BytesIO()
torch.save(generated_ids, buf)
api.upload_file(
    path_or_fileobj=buf,
    path_in_repo="model_output.pt",
    repo_id=save_to,
)

output_text = tokenizer.batch_decode(
    generated_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
print("Response:", output_text[0][len(prompt) :])

Runs of torchao-testing opt-125m-Int4WeightOnlyConfig-v1-0.14.dev on huggingface.co

805
Total runs
0
24-hour runs
0
3-day runs
34
7-day runs
-291
30-day runs

More Information About opt-125m-Int4WeightOnlyConfig-v1-0.14.dev huggingface.co Model

opt-125m-Int4WeightOnlyConfig-v1-0.14.dev huggingface.co

opt-125m-Int4WeightOnlyConfig-v1-0.14.dev huggingface.co is an AI model on huggingface.co that provides opt-125m-Int4WeightOnlyConfig-v1-0.14.dev's model effect (), which can be used instantly with this torchao-testing opt-125m-Int4WeightOnlyConfig-v1-0.14.dev model. huggingface.co supports a free trial of the opt-125m-Int4WeightOnlyConfig-v1-0.14.dev model, and also provides paid use of the opt-125m-Int4WeightOnlyConfig-v1-0.14.dev. Support call opt-125m-Int4WeightOnlyConfig-v1-0.14.dev model through api, including Node.js, Python, http.

opt-125m-Int4WeightOnlyConfig-v1-0.14.dev huggingface.co Url

https://huggingface.co/torchao-testing/opt-125m-Int4WeightOnlyConfig-v1-0.14.dev

torchao-testing opt-125m-Int4WeightOnlyConfig-v1-0.14.dev online free

opt-125m-Int4WeightOnlyConfig-v1-0.14.dev huggingface.co is an online trial and call api platform, which integrates opt-125m-Int4WeightOnlyConfig-v1-0.14.dev's modeling effects, including api services, and provides a free online trial of opt-125m-Int4WeightOnlyConfig-v1-0.14.dev, you can try opt-125m-Int4WeightOnlyConfig-v1-0.14.dev online for free by clicking the link below.

torchao-testing opt-125m-Int4WeightOnlyConfig-v1-0.14.dev online free url in huggingface.co:

https://huggingface.co/torchao-testing/opt-125m-Int4WeightOnlyConfig-v1-0.14.dev

opt-125m-Int4WeightOnlyConfig-v1-0.14.dev install

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

opt-125m-Int4WeightOnlyConfig-v1-0.14.dev install url in huggingface.co:

https://huggingface.co/torchao-testing/opt-125m-Int4WeightOnlyConfig-v1-0.14.dev

Url of opt-125m-Int4WeightOnlyConfig-v1-0.14.dev

opt-125m-Int4WeightOnlyConfig-v1-0.14.dev huggingface.co Url

Provider of opt-125m-Int4WeightOnlyConfig-v1-0.14.dev huggingface.co

torchao-testing
ORGANIZATIONS

Other API from torchao-testing