LLM-wsd-FT-20000

1
5 languages
llama
by
swap-uniba
Language Model
OTHER
2503.08662B params
New
1 downloads
Early-stage
Edge AI:
Mobile
Laptop
Server
5595GB+ RAM
Mobile
Laptop
Server
Quick Summary

LLM-wsd-FT-20000 is a Large Language Model (LLM) instruction-tuned over meta-llama/Meta-Llama-3.

Device Compatibility

Mobile
4-6GB RAM
Laptop
16GB RAM
Server
GPU
Minimum Recommended
2332GB+ RAM

Code Examples

How to Get Started with the Modelpythontransformers
import torch

from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.trainer_utils import set_seed

target_word = "long"
instruction = f"Give a brief definition of the word \"{target_word}\" in the sentence given as input. Generate only the definition."
input_sentence = "How long has it been since you reviewed the objectives of your benefit and service program?"

model_id = "swap-uniba/LLM-wsd-FT-20000"

set_seed(42)

tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=False)

tokenizer.padding_side = "left"

model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map='cuda',
    torch_dtype=torch.bfloat16,
).eval()

terminators = [
    tokenizer.eos_token_id,
    tokenizer.convert_tokens_to_ids("<|eot_id|>")
]

messages = [
    {"role": "user", "content": instruction + " Input: \"" + input_sentence + "\""},
]

input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")

outputs = model.generate(
    input_ids.to('cuda'),
    max_new_tokens=512,
    eos_token_id=terminators,
    num_beams=1,
    do_sample=False
)

print(tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True))
How to Get Started with the Modelpythontransformers
import torch

from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.trainer_utils import set_seed

target_word = "long"
instruction = f"Give a brief definition of the word \"{target_word}\" in the sentence given as input. Generate only the definition."
input_sentence = "How long has it been since you reviewed the objectives of your benefit and service program?"

model_id = "swap-uniba/LLM-wsd-FT-20000"

set_seed(42)

tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=False)

tokenizer.padding_side = "left"

model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map='cuda',
    torch_dtype=torch.bfloat16,
).eval()

terminators = [
    tokenizer.eos_token_id,
    tokenizer.convert_tokens_to_ids("<|eot_id|>")
]

messages = [
    {"role": "user", "content": instruction + " Input: \"" + input_sentence + "\""},
]

input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")

outputs = model.generate(
    input_ids.to('cuda'),
    max_new_tokens=512,
    eos_token_id=terminators,
    num_beams=1,
    do_sample=False
)

print(tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True))
How to Get Started with the Modelpythontransformers
import torch

from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.trainer_utils import set_seed

target_word = "long"
instruction = f"Give a brief definition of the word \"{target_word}\" in the sentence given as input. Generate only the definition."
input_sentence = "How long has it been since you reviewed the objectives of your benefit and service program?"

model_id = "swap-uniba/LLM-wsd-FT-20000"

set_seed(42)

tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=False)

tokenizer.padding_side = "left"

model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map='cuda',
    torch_dtype=torch.bfloat16,
).eval()

terminators = [
    tokenizer.eos_token_id,
    tokenizer.convert_tokens_to_ids("<|eot_id|>")
]

messages = [
    {"role": "user", "content": instruction + " Input: \"" + input_sentence + "\""},
]

input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")

outputs = model.generate(
    input_ids.to('cuda'),
    max_new_tokens=512,
    eos_token_id=terminators,
    num_beams=1,
    do_sample=False
)

print(tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True))
How to Get Started with the Modelpythontransformers
import torch

from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.trainer_utils import set_seed

target_word = "long"
instruction = f"Give a brief definition of the word \"{target_word}\" in the sentence given as input. Generate only the definition."
input_sentence = "How long has it been since you reviewed the objectives of your benefit and service program?"

model_id = "swap-uniba/LLM-wsd-FT-20000"

set_seed(42)

tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=False)

tokenizer.padding_side = "left"

model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map='cuda',
    torch_dtype=torch.bfloat16,
).eval()

terminators = [
    tokenizer.eos_token_id,
    tokenizer.convert_tokens_to_ids("<|eot_id|>")
]

messages = [
    {"role": "user", "content": instruction + " Input: \"" + input_sentence + "\""},
]

input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")

outputs = model.generate(
    input_ids.to('cuda'),
    max_new_tokens=512,
    eos_token_id=terminators,
    num_beams=1,
    do_sample=False
)

print(tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True))
How to Get Started with the Modelpythontransformers
import torch

from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.trainer_utils import set_seed

target_word = "long"
instruction = f"Give a brief definition of the word \"{target_word}\" in the sentence given as input. Generate only the definition."
input_sentence = "How long has it been since you reviewed the objectives of your benefit and service program?"

model_id = "swap-uniba/LLM-wsd-FT-20000"

set_seed(42)

tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=False)

tokenizer.padding_side = "left"

model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map='cuda',
    torch_dtype=torch.bfloat16,
).eval()

terminators = [
    tokenizer.eos_token_id,
    tokenizer.convert_tokens_to_ids("<|eot_id|>")
]

messages = [
    {"role": "user", "content": instruction + " Input: \"" + input_sentence + "\""},
]

input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")

outputs = model.generate(
    input_ids.to('cuda'),
    max_new_tokens=512,
    eos_token_id=terminators,
    num_beams=1,
    do_sample=False
)

print(tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True))
How to Get Started with the Modelpythontransformers
import torch

from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.trainer_utils import set_seed

target_word = "long"
instruction = f"Give a brief definition of the word \"{target_word}\" in the sentence given as input. Generate only the definition."
input_sentence = "How long has it been since you reviewed the objectives of your benefit and service program?"

model_id = "swap-uniba/LLM-wsd-FT-20000"

set_seed(42)

tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=False)

tokenizer.padding_side = "left"

model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map='cuda',
    torch_dtype=torch.bfloat16,
).eval()

terminators = [
    tokenizer.eos_token_id,
    tokenizer.convert_tokens_to_ids("<|eot_id|>")
]

messages = [
    {"role": "user", "content": instruction + " Input: \"" + input_sentence + "\""},
]

input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")

outputs = model.generate(
    input_ids.to('cuda'),
    max_new_tokens=512,
    eos_token_id=terminators,
    num_beams=1,
    do_sample=False
)

print(tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True))
How to Get Started with the Modelpythontransformers
import torch

from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.trainer_utils import set_seed

target_word = "long"
instruction = f"Give a brief definition of the word \"{target_word}\" in the sentence given as input. Generate only the definition."
input_sentence = "How long has it been since you reviewed the objectives of your benefit and service program?"

model_id = "swap-uniba/LLM-wsd-FT-20000"

set_seed(42)

tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=False)

tokenizer.padding_side = "left"

model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map='cuda',
    torch_dtype=torch.bfloat16,
).eval()

terminators = [
    tokenizer.eos_token_id,
    tokenizer.convert_tokens_to_ids("<|eot_id|>")
]

messages = [
    {"role": "user", "content": instruction + " Input: \"" + input_sentence + "\""},
]

input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")

outputs = model.generate(
    input_ids.to('cuda'),
    max_new_tokens=512,
    eos_token_id=terminators,
    num_beams=1,
    do_sample=False
)

print(tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True))
How to Get Started with the Modelpythontransformers
import torch

from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.trainer_utils import set_seed

target_word = "long"
instruction = f"Give a brief definition of the word \"{target_word}\" in the sentence given as input. Generate only the definition."
input_sentence = "How long has it been since you reviewed the objectives of your benefit and service program?"

model_id = "swap-uniba/LLM-wsd-FT-20000"

set_seed(42)

tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=False)

tokenizer.padding_side = "left"

model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map='cuda',
    torch_dtype=torch.bfloat16,
).eval()

terminators = [
    tokenizer.eos_token_id,
    tokenizer.convert_tokens_to_ids("<|eot_id|>")
]

messages = [
    {"role": "user", "content": instruction + " Input: \"" + input_sentence + "\""},
]

input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")

outputs = model.generate(
    input_ids.to('cuda'),
    max_new_tokens=512,
    eos_token_id=terminators,
    num_beams=1,
    do_sample=False
)

print(tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True))
How to Get Started with the Modelpythontransformers
import torch

from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.trainer_utils import set_seed

target_word = "long"
instruction = f"Give a brief definition of the word \"{target_word}\" in the sentence given as input. Generate only the definition."
input_sentence = "How long has it been since you reviewed the objectives of your benefit and service program?"

model_id = "swap-uniba/LLM-wsd-FT-20000"

set_seed(42)

tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=False)

tokenizer.padding_side = "left"

model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map='cuda',
    torch_dtype=torch.bfloat16,
).eval()

terminators = [
    tokenizer.eos_token_id,
    tokenizer.convert_tokens_to_ids("<|eot_id|>")
]

messages = [
    {"role": "user", "content": instruction + " Input: \"" + input_sentence + "\""},
]

input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")

outputs = model.generate(
    input_ids.to('cuda'),
    max_new_tokens=512,
    eos_token_id=terminators,
    num_beams=1,
    do_sample=False
)

print(tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True))
How to Get Started with the Modelpythontransformers
import torch

from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.trainer_utils import set_seed

target_word = "long"
instruction = f"Give a brief definition of the word \"{target_word}\" in the sentence given as input. Generate only the definition."
input_sentence = "How long has it been since you reviewed the objectives of your benefit and service program?"

model_id = "swap-uniba/LLM-wsd-FT-20000"

set_seed(42)

tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=False)

tokenizer.padding_side = "left"

model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map='cuda',
    torch_dtype=torch.bfloat16,
).eval()

terminators = [
    tokenizer.eos_token_id,
    tokenizer.convert_tokens_to_ids("<|eot_id|>")
]

messages = [
    {"role": "user", "content": instruction + " Input: \"" + input_sentence + "\""},
]

input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")

outputs = model.generate(
    input_ids.to('cuda'),
    max_new_tokens=512,
    eos_token_id=terminators,
    num_beams=1,
    do_sample=False
)

print(tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True))
How to Get Started with the Modelpythontransformers
import torch

from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.trainer_utils import set_seed

target_word = "long"
instruction = f"Give a brief definition of the word \"{target_word}\" in the sentence given as input. Generate only the definition."
input_sentence = "How long has it been since you reviewed the objectives of your benefit and service program?"

model_id = "swap-uniba/LLM-wsd-FT-20000"

set_seed(42)

tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=False)

tokenizer.padding_side = "left"

model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map='cuda',
    torch_dtype=torch.bfloat16,
).eval()

terminators = [
    tokenizer.eos_token_id,
    tokenizer.convert_tokens_to_ids("<|eot_id|>")
]

messages = [
    {"role": "user", "content": instruction + " Input: \"" + input_sentence + "\""},
]

input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")

outputs = model.generate(
    input_ids.to('cuda'),
    max_new_tokens=512,
    eos_token_id=terminators,
    num_beams=1,
    do_sample=False
)

print(tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True))
How to Get Started with the Modelpythontransformers
import torch

from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.trainer_utils import set_seed

target_word = "long"
instruction = f"Give a brief definition of the word \"{target_word}\" in the sentence given as input. Generate only the definition."
input_sentence = "How long has it been since you reviewed the objectives of your benefit and service program?"

model_id = "swap-uniba/LLM-wsd-FT-20000"

set_seed(42)

tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=False)

tokenizer.padding_side = "left"

model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map='cuda',
    torch_dtype=torch.bfloat16,
).eval()

terminators = [
    tokenizer.eos_token_id,
    tokenizer.convert_tokens_to_ids("<|eot_id|>")
]

messages = [
    {"role": "user", "content": instruction + " Input: \"" + input_sentence + "\""},
]

input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")

outputs = model.generate(
    input_ids.to('cuda'),
    max_new_tokens=512,
    eos_token_id=terminators,
    num_beams=1,
    do_sample=False
)

print(tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True))
How to Get Started with the Modelpythontransformers
import torch

from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.trainer_utils import set_seed

target_word = "long"
instruction = f"Give a brief definition of the word \"{target_word}\" in the sentence given as input. Generate only the definition."
input_sentence = "How long has it been since you reviewed the objectives of your benefit and service program?"

model_id = "swap-uniba/LLM-wsd-FT-20000"

set_seed(42)

tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=False)

tokenizer.padding_side = "left"

model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map='cuda',
    torch_dtype=torch.bfloat16,
).eval()

terminators = [
    tokenizer.eos_token_id,
    tokenizer.convert_tokens_to_ids("<|eot_id|>")
]

messages = [
    {"role": "user", "content": instruction + " Input: \"" + input_sentence + "\""},
]

input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")

outputs = model.generate(
    input_ids.to('cuda'),
    max_new_tokens=512,
    eos_token_id=terminators,
    num_beams=1,
    do_sample=False
)

print(tokenizer.decode(outputs[0][input_ids.shape[-1]:], skip_special_tokens=True))

Deploy This Model

Production-ready deployment in minutes

Together.ai

Instant API access to this model

Fastest API

Production-ready inference API. Start free, scale to millions.

Try Free API

Replicate

One-click model deployment

Easiest Setup

Run models in the cloud with simple API. No DevOps required.

Deploy Now

Disclosure: We may earn a commission from these partners. This helps keep LLMYourWay free.