AstroMLab / astrollama-2-7b_abstract

huggingface.co
Total runs: 14
24-hour runs: 0
7-day runs: 0
30-day runs: 0
Model's Last Updated: April 11 2024
text-generation

Introduction of astrollama-2-7b_abstract

Model Details of astrollama-2-7b_abstract

AstroLLaMA

Loading the model
from transformers import AutoModelForCausalLM
from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained(
    pretrained_model_name_or_path="AstroMLab/astrollama"
)
model = AutoModelForCausalLM.from_pretrained(
    pretrained_model_name_or_path="AstroMLab/astrollama",
    device_map="auto",
)
Generating text from a prompt
import torch
from transformers import pipeline

generator = pipeline(
    task="text-generation",
    model=model,
    tokenizer=tokenizer,
    device_map="auto"
)

# Taken from https://arxiv.org/abs/2308.12823
prompt = "In this letter, we report the discovery of the highest redshift, " \
    "heavily obscured, radio-loud QSO candidate selected using JWST NIRCam/MIRI, " \
    "mid-IR, sub-mm, and radio imaging in the COSMOS-Web field. "

# For reproducibility
torch.manual_seed(42)

generated_text = generator(
    prompt,
    do_sample=True,
    max_length=512
)
Embedding text with AstroLLaMA
texts = [
    "Abstract 1",
    "Abstract 2"
]
inputs = tokenizer(
    texts,
    return_tensors="pt",
    return_token_type_ids=False,
    padding=True,
    truncation=True,
    max_length=4096
)
inputs.to(model.device)
outputs = model(**inputs, output_hidden_states=True)

# Last layer of the hidden states. Get average embedding of all tokens
embeddings = outputs["hidden_states"][-1][:, 1:, ...].mean(1).detach().cpu().numpy()

Runs of AstroMLab astrollama-2-7b_abstract on huggingface.co

14
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs

More Information About astrollama-2-7b_abstract huggingface.co Model

More astrollama-2-7b_abstract license Visit here:

https://choosealicense.com/licenses/mit

astrollama-2-7b_abstract huggingface.co

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

astrollama-2-7b_abstract huggingface.co Url

https://huggingface.co/AstroMLab/astrollama-2-7b_abstract

AstroMLab astrollama-2-7b_abstract online free

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

AstroMLab astrollama-2-7b_abstract online free url in huggingface.co:

https://huggingface.co/AstroMLab/astrollama-2-7b_abstract

astrollama-2-7b_abstract install

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

astrollama-2-7b_abstract install url in huggingface.co:

https://huggingface.co/AstroMLab/astrollama-2-7b_abstract

Url of astrollama-2-7b_abstract

astrollama-2-7b_abstract huggingface.co Url

Provider of astrollama-2-7b_abstract huggingface.co

AstroMLab
ORGANIZATIONS

Other API from AstroMLab