Downloads ยท 30 days
22
6% of all-time downloads
AlanYky/phi-3.5_tweets_instruct
phi-3.5_tweets_instruct is a text generation model from AlanYky. Use it when you need the model to write or continue text. It is set up for transformers.
This is the model card of a ๐ค transformers model that has been pushed on the Hub. This model card has been automatically generated.
Downloads ยท 30 days
22
6% of all-time downloads
All-time downloads
370
Public
Parameters
3.8B
7.6 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors7.6 GB ยท 100%
From the Hugging Face model README
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
# Set a manual seed for reproducibility
torch.manual_seed(0)
# Load the model with specific configurations
model = AutoModelForCausalLM.from_pretrained(
"AlanYky/phi-3.5_tweets_instruct",
device_map="cuda",
torch_dtype="auto",
trust_remote_code=True
)
model.to("cuda")
# Load the tokenizer
tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-3.5-mini-instruct")
# Define a function to generate tweets
def generate_tweet(instruction, pipe, generation_args):
"""
Generate a tweet response based on an instruction.
"""
# Define the message structure
messages = [
{
"role": "user",
"content": instruction
}
]
# Generate the tweet response
output = pipe(messages, **generation_args)
# Extract and return the generated tweet text
return output[0]['generated_text']
# Set up the pipeline for text generation
pipe = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
)
# Define generation arguments for tweet creation
generation_args = {
"max_new_tokens": 70,
"return_full_text": False,
"temperature": 0.4,
"top_k": 50,
"top_p": 0.9,
"repetition_penalty": 1.2,
"do_sample": True,
}
# Specify an instruction for tweet generation
instruction = "Generate a tweet about Donald Trump is the 2024 US President."
generated_tweet = generate_tweet(instruction, pipe, generation_args)
print(generated_tweet)
This is the model card of a ๐ค transformers model that has been pushed on the Hub. This model card has been automatically generated.
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
Use the code below to get started with the model.
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
BibTeX:
[More Information Needed]
APA:
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]