Instructions to use decula/sd with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use decula/sd with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.5-9B") model = PeftModel.from_pretrained(base_model, "decula/sd") - Transformers
How to use decula/sd with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="decula/sd")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("decula/sd", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use decula/sd with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "decula/sd" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "decula/sd", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/decula/sd
- SGLang
How to use decula/sd with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "decula/sd" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "decula/sd", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "decula/sd" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "decula/sd", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use decula/sd with Docker Model Runner:
docker model run hf.co/decula/sd
| import tweepy | |
| import datetime | |
| import os | |
| def get_tweets_from_user_list(user_list, api, tweets_per_user=10): # Added tweets_per_user for control | |
| """ | |
| Retrieves the latest tweets from a list of Twitter users within the last 24 hours. | |
| Args: | |
| user_list (list): A list of Twitter usernames (strings). | |
| api (tweepy.API): An authenticated Tweepy API object. | |
| tweets_per_user (int): The maximum number of tweets to retrieve per user. Defaults to 10. Adjust as needed. | |
| Returns: | |
| list: A list of tweet objects (tweepy.models.Status) that are within the last 24 hours. | |
| Returns an empty list if there are errors. | |
| """ | |
| all_tweets = [] | |
| now = datetime.datetime.now() | |
| yesterday = now - datetime.timedelta(days=1) | |
| for username in user_list: | |
| try: | |
| tweets = api.user_timeline(screen_name=username, count=tweets_per_user, tweet_mode="extended") # Use extended mode for full text | |
| for tweet in tweets: | |
| tweet_time = tweet.created_at | |
| if tweet_time >= yesterday: | |
| all_tweets.append(tweet) | |
| else: | |
| # Optimization: If we've hit a tweet older than yesterday, we can stop getting tweets for this user | |
| break # Stop searching for this user | |
| except tweepy.TweepyException as e: | |
| print(f"Error fetching tweets for {username}: {e}") | |
| # Log the error or handle it appropriately. Consider retrying, skipping the user, etc. | |
| continue # Skip to the next user if there's an error | |
| return all_tweets | |
| def authenticate(): | |
| """Authenticates with the Twitter API using API keys and access tokens. | |
| Returns: | |
| tweepy.API: An authenticated Tweepy API object, or None if authentication fails. | |
| """ | |
| # Replace with your actual API keys and tokens. It's best to store these | |
| # in environment variables. | |
| consumer_key = "kiQbhfRbHvWpf7NdEtAsQYlET" | |
| consumer_secret = "Yu8VkZsrFtLxSjzqJgLB3kSyY7BVTFROm23smItxiG32ETjfRM" | |
| access_token = "1707606144-JdZ0vEGx5wdsxbg0eFof8yTaKIFJY35mSl5Qs62" | |
| access_token_secret = "yoOnwWeJvrL6bZMdbF6PIvbJvPdndfAgNbiYBmrA1jTtA" | |
| if not all([consumer_key, consumer_secret, access_token, access_token_secret]): | |
| print("Error: Missing Twitter API credentials. Please set the environment variables.") | |
| return None | |
| try: | |
| auth = tweepy.OAuthHandler(consumer_key, consumer_secret) | |
| auth.set_access_token(access_token, access_token_secret) | |
| api = tweepy.API(auth, wait_on_rate_limit=True) # Enable wait_on_rate_limit | |
| api.verify_credentials() # Verify authentication is working | |
| print("Authentication successful!") | |
| return api | |
| except tweepy.TweepyException as e: | |
| print(f"Authentication failed: {e}") | |
| return None | |
| if __name__ == '__main__': | |
| # Authenticate with the Twitter API | |
| api = authenticate() | |
| if api is None: | |
| print("Exiting due to authentication failure.") | |
| exit() | |
| # Example Usage: | |
| user_list = ["dacefupan"] # Replace with the usernames you want to track | |
| tweets = get_tweets_from_user_list(user_list, api, tweets_per_user=5) | |
| if tweets: | |
| print(f"Found {len(tweets)} tweets from the last 24 hours:") | |
| for tweet in tweets: | |
| print(f"@{tweet.user.screen_name}: {tweet.full_text}\n") #Print the full_text | |
| print(f"Tweeted at: {tweet.created_at}\n") | |
| else: | |
| print("No tweets found in the last 24 hours or an error occurred.") | |