1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("sentence_transformers_model_id")
5# Run inference
6sentences = [
7 '',
8 '# Copying, moving, and renaming objects\n\nThe CopyObject operation creates a copy of an object that\'s already stored in Amazon S3.\n\nYou can create a copy of an object up to 5 GB in a single atomic operation. However, to copy an object that\'s larger than 5 GB, you must use a multipart upload using the AWS CLI or AWS SDKs. For more information, see Copying an object using multipart upload.\n\n###### Note\n\nTo maintain the performance benefit of an object you uploaded using multipart upload, you must copy the object using multipart upload using the AWS CLI or AWS SDK instead of the S3 console. For more information, see Copying an object using multipart upload.\n\nUsing the CopyObject operation, you can:\n\n- Create additional copies of objects.\n- Rename objects by copying them and deleting the original ones.\n- Copy or move objects from one bucket to another, including across AWS Regions (for example, from us-west-1 to eu-west-2). When you move an object, Amazon S3 copies the object to the specified destination and then deletes the source object. NoteCopying or moving objects across AWS Regions incurs bandwidth charges. For more information, see Amazon S3 Pricing.\n- Change object metadata. Each Amazon S3 object has metadata. This metadata is a set of name-value pairs. You can set object metadata at the time you upload an object. After you upload the object, you can\'t modify the object metadata. The only way to modify object metadata is to make a copy of the object and set the metadata. To do so, in the copy operation, set the same object as the source and target. Some object metadata is system metadata and other is user-defined. You can control some of the system metadata. For example, you can control the storage class and the type of server-side encryption to use for the object. When you copy an object, user-controlled system metadata and user-defined metadata are also copied. Amazon S3 resets the system-controlled metadata. For example, when you copy an object, Amazon S3 resets the creation date of the copied object. You don\'t need to set any of these system-controlled metadata values in your copy request. When copying an object, you might decide to update some of the metadata values. For example, if your source object is configured to use S3 Standard storage, you might choose to use S3 Intelligent-Tiering for the object copy. You might also decide to alter some of the user-defined metadata values present on the source object. If you choose to update any of the object\'s user-configurable metadata (system or user-defined) during the copy, then you must explicitly specify all of the user-configurable metadata present on the source object in your request, even if you are changing only one of the metadata values. NoteWhen copying an object by using the Amazon S3 console, you might receive the error message "Copied metadata can\'t be verified." The console uses headers to retrieve and set metadata for your object. If your network or browser configuration modifies your network requests, this behavior might cause unintended metadata (such as modified Cache-Control headers) to be written to your copied object. Amazon S3 can\'t verify this unintended metadata.To address this issue, check your network and browser configuration to make sure it doesn\'t modify headers, such as Cache-Control. For more information, see The Shared Responsibility Model. For more information about object metadata, see Working with object metadata.\n\n###### Copying archived and restored objects',
9 "The request with HTTP 1.0 and omitting the Host header is as follows:\n\n```\nGET /example.com/homepage.html HTTP/1.0\n```\n\nFor information about DNS-compatible names, see Limitations. For more information about keys, see Keys.\n\n###### Example â\x80\x93 Virtual-hostedâ\x80\x93style URLs and requests\n\nThis example uses the following:\n\n- Bucket name â\x80\x90 amzn-s3-demo-bucket1\n- Region â\x80\x90 Europe (Ireland)\n- Key name â\x80\x90 homepage.html\n\nThe URL is as follows:\n\n```\nhttp://amzn-s3-demo-bucket1.s3.eu-west-1.amazonaws.com/homepage.html\n```\n\nThe request is as follows:\n\n```\nGET /homepage.html HTTP/1.1 Host: amzn-s3-demo-bucket1.s3.eu-west-1.amazonaws.com\n```\n\n###### Example â\x80\x93 CNAME alias method\n\nTo use this method, you must configure your DNS name as a CNAME alias for bucket-name.s3.us-east-1.amazonaws.com. For more information, see Customizing Amazon S3 URLs with CNAME records.\n\nThis example uses the following:\n\n- Bucket Name â\x80\x90 example.com\n- Key name â\x80\x90 homepage.html\n\nThe URL is as follows:\n\n```\nhttp://www.example.com/homepage.html\n```\n\nThe example is as follows:\n\n```\nGET /homepage.html HTTP/1.1 Host: www.example.com\n```\n\n## Customizing Amazon S3 URLs with CNAME records\n\nDepending on your needs, you might not want s3.region-code.amazonaws.com to appear on your website or service. For example, if you're hosting website images on Amazon S3, you might prefer http://images.example.com/ instead of http://images.example.com.s3.us-east-1.amazonaws.com/. Any bucket with a DNS-compatible name can be referenced as follows: http://BucketName.s3.Region.amazonaws.com/[Filename], for example, http://images.example.com.s3.us-east-1.amazonaws.com/mydog.jpg. By using CNAME, you can map images.example.com to an Amazon S3 hostname so that the previous URL could become http://images.example.com/mydog.jpg.\n\nYour bucket name must be the same as the CNAME. For example, if you create a CNAME to map images.example.com to images.example.com.s3.us-east-1.amazonaws.com, both http://images.example.com/filename and http://images.example.com.s3.us-east-1.amazonaws.com/filename will be the same.\n\nThe CNAME DNS record should alias your domain name to the appropriate virtual hostedâ\x80\x93style hostname. For example, if your bucket name and domain name are images.example.com and your bucket is in the US East (N. Virginia) Region, the CNAME record should alias to images.example.com.s3.us-east-1.amazonaws.com.\n\n```\nimages.example.com CNAME images.example.com.s3.us-east-1.amazonaws.com.\n```\n\nAmazon S3 uses the hostname to determine the bucket name. So the CNAME and the bucket name must be the same. For example, suppose that you have configured www.example.com as a CNAME for www.example.com.s3.us-east-1.amazonaws.com. When you access http://www.example.com, Amazon S3 receives a request similar to the following:\n\n```\nGET / HTTP/1.1 Host: www.example.com Date: date Authorization: signatureValue\n```",
10]
11embeddings = model.encode(sentences)
12print(embeddings.shape)
13# [3, 1024]
14
15# Get the similarity scores for the embeddings
16similarities = model.similarity(embeddings, embeddings)
17print(similarities.shape)
18# [3, 3]