PictSure 0.1.0__tar.gz → 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of PictSure might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PictSure
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: A package for generalized image classification using In-Context-Learning with PyTorch.
5
5
  Author-email: Cornelius Wolff <cornelius.wolff@cwi.nl>, Lukas Schiesser <lukas.schiesser@dfki.de>
6
6
  License: MIT License
@@ -58,17 +58,8 @@ PictSure is a deep learning library designed for **in-context learning** using i
58
58
  - **Easy-to-use CLI**: Manage models and weights through a simple command-line interface.
59
59
 
60
60
  ## Installation
61
- 1. Clone this repository
62
61
  ```bash
63
- git clone https://git.ni.dfki.de/pictsure/pictsure-library
64
- ```
65
- 2. Navigate into the folder
66
- ```bash
67
- cd pictsure-library
68
- ```
69
- 3. Install the pip package
70
- ```bash
71
- pip install .
62
+ pip install PictSure
72
63
  ```
73
64
 
74
65
  ## Quick Start
@@ -76,15 +67,10 @@ pip install .
76
67
  from PictSure import PictSure
77
68
  import torch
78
69
 
79
- # Initialize the model (using ViT as an example)
80
- model = PictSure(
81
- embedding='vit', # or 'resnet'
82
- pretrained=True, # use pretrained weights
83
- device='cuda' # or 'cpu'
84
- )
70
+ DEVICE = "cpu" # or cuda, mps
85
71
 
86
- # you can also pull our pre-trained models from Huggingface
87
72
  model = PictSure.from_pretrained("pictsure/pictsure-vit")
73
+ model = model.to(DEVICE)
88
74
 
89
75
  # Set your reference images and labels
90
76
  model.set_context_images(reference_images, reference_labels)
@@ -93,25 +79,6 @@ model.set_context_images(reference_images, reference_labels)
93
79
  predictions = model.predict(new_images)
94
80
  ```
95
81
 
96
- ## Command Line Interface
97
- PictSure comes with a command-line interface to manage models and weights:
98
-
99
- ### List Available Models
100
- ```bash
101
- pictsure list-models
102
- ```
103
- This command shows all available models, their status (downloaded/not downloaded), and detailed information about each model.
104
-
105
- ### Remove Model Weights
106
- ```bash
107
- pictsure remove <model_name> [--force]
108
- ```
109
- Remove the weights of a specific model. Available models are:
110
- - `ViTPreAll`: ViT-based model
111
- - `ResPreAll`: ResNet-based model
112
-
113
- Use the `--force` or `-f` flag to skip the confirmation prompt.
114
-
115
82
  ## Examples
116
83
  For a complete working example, check out the Jupyter notebook in the Examples directory:
117
84
  ```bash
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PictSure
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: A package for generalized image classification using In-Context-Learning with PyTorch.
5
5
  Author-email: Cornelius Wolff <cornelius.wolff@cwi.nl>, Lukas Schiesser <lukas.schiesser@dfki.de>
6
6
  License: MIT License
@@ -58,17 +58,8 @@ PictSure is a deep learning library designed for **in-context learning** using i
58
58
  - **Easy-to-use CLI**: Manage models and weights through a simple command-line interface.
59
59
 
60
60
  ## Installation
61
- 1. Clone this repository
62
61
  ```bash
63
- git clone https://git.ni.dfki.de/pictsure/pictsure-library
64
- ```
65
- 2. Navigate into the folder
66
- ```bash
67
- cd pictsure-library
68
- ```
69
- 3. Install the pip package
70
- ```bash
71
- pip install .
62
+ pip install PictSure
72
63
  ```
73
64
 
74
65
  ## Quick Start
@@ -76,15 +67,10 @@ pip install .
76
67
  from PictSure import PictSure
77
68
  import torch
78
69
 
79
- # Initialize the model (using ViT as an example)
80
- model = PictSure(
81
- embedding='vit', # or 'resnet'
82
- pretrained=True, # use pretrained weights
83
- device='cuda' # or 'cpu'
84
- )
70
+ DEVICE = "cpu" # or cuda, mps
85
71
 
86
- # you can also pull our pre-trained models from Huggingface
87
72
  model = PictSure.from_pretrained("pictsure/pictsure-vit")
73
+ model = model.to(DEVICE)
88
74
 
89
75
  # Set your reference images and labels
90
76
  model.set_context_images(reference_images, reference_labels)
@@ -93,25 +79,6 @@ model.set_context_images(reference_images, reference_labels)
93
79
  predictions = model.predict(new_images)
94
80
  ```
95
81
 
96
- ## Command Line Interface
97
- PictSure comes with a command-line interface to manage models and weights:
98
-
99
- ### List Available Models
100
- ```bash
101
- pictsure list-models
102
- ```
103
- This command shows all available models, their status (downloaded/not downloaded), and detailed information about each model.
104
-
105
- ### Remove Model Weights
106
- ```bash
107
- pictsure remove <model_name> [--force]
108
- ```
109
- Remove the weights of a specific model. Available models are:
110
- - `ViTPreAll`: ViT-based model
111
- - `ResPreAll`: ResNet-based model
112
-
113
- Use the `--force` or `-f` flag to skip the confirmation prompt.
114
-
115
82
  ## Examples
116
83
  For a complete working example, check out the Jupyter notebook in the Examples directory:
117
84
  ```bash
@@ -3,7 +3,6 @@ README.md
3
3
  pyproject.toml
4
4
  Examples/example.py
5
5
  PictSure/__init__.py
6
- PictSure/cli.py
7
6
  PictSure/model_PictSure.py
8
7
  PictSure/model_ViT.py
9
8
  PictSure/model_embeddings.py
@@ -14,17 +14,8 @@ PictSure is a deep learning library designed for **in-context learning** using i
14
14
  - **Easy-to-use CLI**: Manage models and weights through a simple command-line interface.
15
15
 
16
16
  ## Installation
17
- 1. Clone this repository
18
17
  ```bash
19
- git clone https://git.ni.dfki.de/pictsure/pictsure-library
20
- ```
21
- 2. Navigate into the folder
22
- ```bash
23
- cd pictsure-library
24
- ```
25
- 3. Install the pip package
26
- ```bash
27
- pip install .
18
+ pip install PictSure
28
19
  ```
29
20
 
30
21
  ## Quick Start
@@ -32,15 +23,10 @@ pip install .
32
23
  from PictSure import PictSure
33
24
  import torch
34
25
 
35
- # Initialize the model (using ViT as an example)
36
- model = PictSure(
37
- embedding='vit', # or 'resnet'
38
- pretrained=True, # use pretrained weights
39
- device='cuda' # or 'cpu'
40
- )
26
+ DEVICE = "cpu" # or cuda, mps
41
27
 
42
- # you can also pull our pre-trained models from Huggingface
43
28
  model = PictSure.from_pretrained("pictsure/pictsure-vit")
29
+ model = model.to(DEVICE)
44
30
 
45
31
  # Set your reference images and labels
46
32
  model.set_context_images(reference_images, reference_labels)
@@ -49,25 +35,6 @@ model.set_context_images(reference_images, reference_labels)
49
35
  predictions = model.predict(new_images)
50
36
  ```
51
37
 
52
- ## Command Line Interface
53
- PictSure comes with a command-line interface to manage models and weights:
54
-
55
- ### List Available Models
56
- ```bash
57
- pictsure list-models
58
- ```
59
- This command shows all available models, their status (downloaded/not downloaded), and detailed information about each model.
60
-
61
- ### Remove Model Weights
62
- ```bash
63
- pictsure remove <model_name> [--force]
64
- ```
65
- Remove the weights of a specific model. Available models are:
66
- - `ViTPreAll`: ViT-based model
67
- - `ResPreAll`: ResNet-based model
68
-
69
- Use the `--force` or `-f` flag to skip the confirmation prompt.
70
-
71
38
  ## Examples
72
39
  For a complete working example, check out the Jupyter notebook in the Examples directory:
73
40
  ```bash
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "PictSure"
7
- version = "0.1.0"
7
+ version = "0.1.1"
8
8
  description = "A package for generalized image classification using In-Context-Learning with PyTorch."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -33,4 +33,8 @@ dependencies = [
33
33
  [project.scripts]
34
34
  pictsure = "PictSure.cli:cli"
35
35
 
36
- [tool.setuptools.packages.find]
36
+ [tool.setuptools.packages.find]
37
+
38
+ [tool.pdm.publish]
39
+ username = "__token__"
40
+ password = ""
@@ -1,84 +0,0 @@
1
- import os
2
- import click
3
- import shutil
4
- from .config import PRETRAINED
5
- import pkg_resources
6
-
7
- @click.group()
8
- def cli():
9
- """PictSure command line interface."""
10
- pass
11
-
12
- @cli.command()
13
- def list_models():
14
- """List all available and downloaded models."""
15
- click.echo("Available PictSure Models:")
16
- click.echo("=" * 50)
17
-
18
- # Get the package directory
19
- package_dir = os.path.dirname(pkg_resources.resource_filename('PictSure', '__init__.py'))
20
-
21
- for model_name, model_info in PRETRAINED.items():
22
- # Check if model is downloaded using absolute path
23
- local_folder = os.path.join(package_dir, 'weights', model_info['name'])
24
- weights_path = os.path.join(local_folder, 'weights.pt')
25
- is_downloaded = os.path.exists(weights_path)
26
-
27
- # Create status indicator
28
- status = "✓ Downloaded" if is_downloaded else "✗ Not downloaded"
29
- status_color = "green" if is_downloaded else "red"
30
-
31
- # Print model information
32
- click.echo(f"\nModel: {click.style(model_info['name'], bold=True)}")
33
- click.echo(f"Status: {click.style(status, fg=status_color)}")
34
- click.echo(f"Type: {model_info['embed_model']}")
35
- click.echo(f"Resolution: {model_info['resolution']}")
36
- click.echo(f"Number of classes: {model_info['num_classes']}")
37
- click.echo(f"Transformer heads: {model_info['nheads']}")
38
- click.echo(f"Transformer layers: {model_info['nlayer']}")
39
- click.echo(f"Model size: {model_info['size']} Million Parameters")
40
- click.echo(f"Path: {weights_path}")
41
- click.echo("-" * 50)
42
-
43
- @cli.command()
44
- @click.argument('model_name', type=click.Choice([info['name'] for info in PRETRAINED.values()]))
45
- @click.option('--force', '-f', is_flag=True, help='Skip confirmation prompt')
46
- def remove(model_name, force):
47
- """Remove the weights of a specific model."""
48
- # Get the package directory
49
- package_dir = os.path.dirname(pkg_resources.resource_filename('PictSure', '__init__.py'))
50
-
51
- # Find the model info by name
52
- model_info = next((info for info in PRETRAINED.values() if info['name'] == model_name), None)
53
- if not model_info:
54
- click.echo(click.style(f"Model {model_name} not found.", fg='red'))
55
- return
56
-
57
- # Construct paths
58
- local_folder = os.path.join(package_dir, 'weights', model_info['name'])
59
- weights_path = os.path.join(local_folder, 'weights.pt')
60
-
61
- if not os.path.exists(weights_path):
62
- click.echo(click.style(f"Model {model_info['name']} is not downloaded.", fg='yellow'))
63
- return
64
-
65
- if not force:
66
- if not click.confirm(f"Are you sure you want to remove the weights for {click.style(model_info['name'], bold=True)}?"):
67
- click.echo("Operation cancelled.")
68
- return
69
-
70
- try:
71
- # Remove the weights file
72
- os.remove(weights_path)
73
- # Try to remove the directory if it's empty
74
- try:
75
- os.rmdir(local_folder)
76
- except OSError:
77
- pass # Directory might not be empty, which is fine
78
-
79
- click.echo(click.style(f"Successfully removed weights for {model_info['name']}.", fg='green'))
80
- except Exception as e:
81
- click.echo(click.style(f"Error removing weights: {str(e)}", fg='red'))
82
-
83
- if __name__ == '__main__':
84
- cli()
File without changes
File without changes
File without changes
File without changes
File without changes